Uploaded by thecplusplusguy 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
Category:
Tags:
- C++
- tutorial
- Linux
- Windows
- computer
- programming
- standard
- basic
- write
- out
- software
- functions
- thecplusplusguy
- development
- SDL
- simple
- directmedia
- layer
- 2d
- 3d
- game
- free-source
- cross-platform
- graphics
- GUI
- graphical
- user
- interface
- ttf
- SDL_ttf
- true
- type
- font
- example
- program
- complex
- snake
License:
Standard YouTube License
-
3 likes, 0 dislikes
15:03
SDL tutorial 10 - snake game GUI (part 3) - example program 5by thecplusplusguy624 views
15:02
SDL tutorial 10 - snake game GUI (part 1) - example program 5by thecplusplusguy1,717 views
12:48
SDL tutorial 15 - simple pong game (part 5) - example program 6by thecplusplusguy454 views
9:19
SDL tutorial 9 - SDL_ttfby thecplusplusguy726 views
13:29
SDL tutorial 0 - install SDLby thecplusplusguy2,208 views
15:01
SDL tutorial 15 - simple pong game (part 1) - example program 6by thecplusplusguy1,006 views
15:01
SDL tutorial 20 - Sidescroller game (part 3) - example program 7by thecplusplusguy430 views
14:23
SDL tutorial 1 - Hello worldby thecplusplusguy1,838 views
15:02
SDL tutorial 20 - Sidescroller game (part 10) - example program 7by thecplusplusguy467 views
14:14
OpenGL (SDL,C++) tutorial 14 - simple 3D FPS camera (part 3).aviby thecplusplusguy1,699 views
15:00
SDL tutorial 20 - Sidescroller game (part 5) - example program 7by thecplusplusguy521 views
9:06
OpenGL (SDL,C++) tutorial 11 - Alpha blending (transparency)by thecplusplusguy662 views
14:59
SDL tutorial 20 - Sidescroller game (part 8) - example program 7by thecplusplusguy289 views
14:44
C++ tutorial 36 - sudoku solver (part 1) - example programby thecplusplusguy3,214 views
14:58
SDL tutorial 20 - Sidescroller game (part 11) - example program 7by thecplusplusguy297 views
10:21
SDL tutorial 21 - particle engine (part 3)by thecplusplusguy711 views
15:00
SDL tutorial 20 - Sidescroller game (part 17) - example program 7by thecplusplusguy227 views
7:44
SDL tutorial 13 - mouse eventsby thecplusplusguy463 views
25:09
OpenGL (SDL,C++) tutorial 15 - skyboxby thecplusplusguy1,147 views
10:48
SDL tutorial 12 - sound with SDL_mixerby thecplusplusguy446 views
- Loading more suggestions...
Link to this comment:
All Comments (0)