SDL tutorial 10 - snake game GUI (part 2) - example program 5

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
462 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jun 30, 2011

In this tutorial we'll write a GUI for the snake game, we've written earlier.
SDL is a cross-platform free-source library which allows you to draw to the screen (so make graphical programs), we'll make 2D games with it, but it can make 3D render as well, if you use it with OpenGL.
SDL tutorial:
http://www.lazyfoo.net/SDL_tutorials/index.php
Download && other things:
http://www.libsdl.org/



The ncurses version of the snake game (for Linux only, this is the original source, I started the work):
http://pastebin.com/p5NPZD5f
http://pastebin.com/AZzHSifV
http://pastebin.com/apdXFugL
Compile: g++ snake.cpp main.cpp -lncurses


The SDL version (this can be compiled almost any platform, included Linux, MacOS, Windows...):
http://pastebin.com/SJw08DHR
http://pastebin.com/BeqDAVFU
http://pastebin.com/ch9CPT10
If you download the SDL version VERY IMPORTANT to put a air.ttf (true type font) beside the runnable (binary file), else the program just collapse (RTE).
Compile:
On Windows the compile works the same way as I showed you in the SDL tutorial 0, in the project/properties-project settings-project's build option-linker settings you have to add -lSDL_ttf
Linux:
g++ snake.cpp main.cpp -lSDL -lSDL_ttf

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more