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

Pubblicato il: 30 giugno 2011
sul canale di: thecplusplusguy
4,916
15

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/...
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


In questa pagina del sito puoi guardare il video online SDL tutorial 10 - snake game GUI (part 2) - example program 5 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato thecplusplusguy 30 giugno 2011, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 4,916 volte e gli è piaciuto 15 spettatori. Buona visione!