Skip to main content

Getting Started

  • Chapter
  • First Online:
C++ for Lazy Programmers
  • 4658 Accesses

Abstract

Most programs in the first half of this book use the SDL and SSDL libraries, on the theory that watching colorful shapes move across the screen and shoot each other is more interesting than printing text. Don't worry; when you're done, you'll be able to write programs both with and without this library – and if I have anything to say about it, you'll have had fun doing it. Let's see how it goes.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    SDL provides graphics, sound, and friendly interaction including mouse input. SSDL, standing for Simple SDL, is a “wrapper” library that wraps SDL’s functions in easier-to-use versions. Both libraries are described in more detail in the Introduction. Don’t worry; I don’t read introductions either.

  2. 2.

    From here on, I’ll be putting the title of the text, rather than name and date, because that’s more useful for textbook examples. Ordinarily name of programmer and date are better for keeping track of what was done and who to track down if it doesn’t work.

  3. 3.

    “Evil and rude” is a technical term meaning, essentially, “maliciously awful.” See The New Hacker’s Dictionary, currently online at www.catb.org/jargon, for other terms in programmers’ slang.

  4. 4.

    Good Thing: hacker slang for something that’s completely wonderful and everybody knows it (or should).

  5. 5.

    If you get a dialog box asking if you want to “Retarget Projects,” just accept the defaults and press OK. This happens if your machine and my machine have slightly different versions of a Windows library.

  6. 6.

    If g++ isn’t installed or isn’t working, see Appendix A: Setting up SDL and SSDL – problems.

  7. 7.

    For a quick start with emacs, you might try A Guided Tour of Emacs currently at www.gnu.org/software/emacs/tour/ . For an even quicker start, go to “Basic editing commands” and skip over the first table.

  8. 8.

    I recommend UNIX Tutorial for Beginners currently at www.ee.surrey.ac.uk/Teaching/Unix/ . Up through Tutorial 4 should be fine for now. Or search for your own.

  9. 9.

    You can also give an optional fourth argument, “alpha,” that can make the color transparent:

    SSDL_Color SSDL_CreateColor (int r, int g, int b, int alpha);

    Alpha ranges from 0 (completely transparent) to 255 (completely opaque). For example,

    const SSDL_Color GHOSTLY_GREY =SSDL_CreateColor (100, 100, 100, 128);

    gives us a color that is about halfway transparent.

    We won’t use this, since we rarely want transparent geometric shapes, and the PNG format we’ll use for images allows transparency without any special handling. But it’s there if you want to experiment.

  10. 10.

    Some of these functions have their descriptions simplified to be understandable based on what we’ve covered so far. The correct versions are in Appendix H – but simplified is fine for now.

  11. 11.

    If you can’t, there’s a function TTF_SetFontStyle , which can generate the new style (though it may look a little ragged), and which is called thus: TTF_SetFontStyle (myFont, TTF_STYLE_BOLD); //boldor TTF_SetFontStyle (myFont, TTF_STYLE_BOLD | TTF_STYLE_ITALIC); //bold italic

    The available styles are TTF_STYLE_BOLD, TTF_STYLE_ITALIC, TTF_STYLE_UNDERLINE, TTF_STYLE_STRIKETHROUGH, and the default, TTF_STYLE_NORMAL.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Will Briggs

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Briggs, W. (2019). Getting Started. In: C++ for Lazy Programmers. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5187-4_1

Download citation

Publish with us

Policies and ethics