Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SDL Game Development

You're reading from   SDL Game Development If you're good with C++ and object oriented programming, this book utilizes your skills to create 2D games using the Simple DirectMedia Layer API. Practical tutorials include the development of two wickedly good games.

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781849696821
Length 256 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Shaun Mitchell Shaun Mitchell
Author Profile Icon Shaun Mitchell
Shaun Mitchell
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Why use SDL?


Each platform has its own way of creating and displaying windows and graphics, handling user input, and accessing any low-level hardware; each one with its own intricacies and syntax. SDL provides a uniform way of accessing these platform-specific features. This uniformity leads to more time spent tweaking your game rather than worrying about how a specific platform allows you to render or get user input, and so on. Game programming can be quite difficult, and having a library such as SDL can get your game up and running relatively quickly.

The ability to write a game on Windows and then go on to compile it on OSX or Linux with little to no changes in the code is extremely powerful and perfect for developers who want to target as many platforms as possible; SDL makes this kind of cross-platform development a breeze. While SDL is extremely effective for cross-platform development, it is also an excellent choice for creating a game with just one platform in mind, due to its ease of use and abundance of features.

SDL has a large user base and is being actively updated and maintained. There is also a responsive community along with a helpful mailing list. Documentation for SDL 2.0 is up-to-date and constantly maintained. Visiting the SDL website, libsdl.org, offers up lots of articles and information with links to the documentation, mailing list, and forums.

Overall, SDL offers a great place to start with game development, allowing you to focus on the game itself and ignore which platform you are developing for, until it is completely necessary. Now, with SDL 2.0 and the new features it brings to the table, SDL has become an even more capable library for game development using C++.

Note

The best way to find out what you can do with SDL and its various functions is to use the documentation found at http://wiki.libsdl.org/moin.cgi/CategoryAPI. There you can see a list of all of SDL 2.0's functions along with various code examples.

What is new in SDL 2.0?

The latest version of SDL and SDL 2.0, which we will be covering in this book, is still in development. It adds many new features to the existing SDL 1.2 framework. The SDL 2.0 Roadmap (wiki.libsdl.org/moin.cgi/Roadmap) lists these features as:

  • A 3D accelerated, texture-based rendering API

  • Hardware-accelerated 2D graphics

  • Support for render targets

  • Multiple window support

  • API support for clipboard access

  • Multiple input device support

  • Support for 7.1 audio

  • Multiple audio device support

  • Force-feedback API for joysticks

  • Horizontal mouse wheel support

  • Multitouch input API support

  • Audio capture support

  • Improvements to multithreading

While not all of these will be used in our game-programming adventures, some of them are invaluable and make SDL an even better framework to use to develop games. We will be taking advantage of the new hardware-accelerated 2D graphics to make sure our games have excellent performance.

Migrating SDL 1.2 extensions

SDL has separate extensions that can be used to add new capabilities to the library. The reason these extensions are not included in the first place is to keep SDL as lightweight as possible, with the extensions serving to add functionality only when necessary. The next table shows some useful extensions along with their purpose. These extensions have been updated from their SDL1.2/3 Versions to support SDL 2.0, and this book will cover cloning and building them from their respective repositories as and when they are needed.

Name

Description

SDL_image

This is an image file loading library with support for BMP, GIF, PNG, TGA, PCX, and among others.

SDL_net

This is a cross-platform networking library.

SDL_mixer

This is an audio mixer library. It has support for MP3, MIDI, and OGG.

SDL_ttf

This is a library supporting the use of TrueType fonts in SDL applications.

SDL_rtf

This is a library to support the rendering of the Rich Text Format (RTF).

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime