|
@@ -1,43 +1,40 @@
|
|
|
+// Author : Jovian HERSEMEULE
|
|
|
#include <iostream>
|
|
|
-#include <SDL.h>
|
|
|
+#include <SDL/SDL.h>
|
|
|
|
|
|
-int main ( int argc, char** argv )
|
|
|
+int main()
|
|
|
{
|
|
|
- /// [1] Démarrage
|
|
|
- // [1.1] Démarrages SDL
|
|
|
+ /// [1] Start
|
|
|
+ // [1.1] Start SDL
|
|
|
if ( SDL_Init( SDL_INIT_VIDEO ) < 0)
|
|
|
{
|
|
|
- std::cout << "Impossible d'initialiser la SDL: " << SDL_GetError() << std::endl;
|
|
|
+ std::cout << "Can't initialize SDL: " << SDL_GetError() << std::endl;
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- // [1.2] Préparation de fermeture
|
|
|
+ // [1.2] Anticipate quit
|
|
|
atexit(SDL_Quit);
|
|
|
|
|
|
- // [1.3] Para-fenêtre
|
|
|
+ // [1.3] Set title
|
|
|
SDL_WM_SetCaption("Application SDL", 0);
|
|
|
|
|
|
- /// [2] Préparation des composants
|
|
|
- // [2.1] Préparation de la fenêtre
|
|
|
- SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16,
|
|
|
- SDL_HWSURFACE|SDL_DOUBLEBUF);
|
|
|
+ /// [2] Create components
|
|
|
+ // [2.1] Create window
|
|
|
+ SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
|
|
|
if ( !screen )
|
|
|
{
|
|
|
std::cout << "Unable to set 640x480 video: " << SDL_GetError() << std::endl;
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- // [2.2] Préparation
|
|
|
+ // [2.2] Other components
|
|
|
+ // Nothing for now
|
|
|
|
|
|
-
|
|
|
- // [2.3] Préparation des ...
|
|
|
-
|
|
|
-
|
|
|
- /// [3] Boucle principale
|
|
|
- bool done = false;
|
|
|
+ /// [3] Main loop
|
|
|
+ bool done(false);
|
|
|
while (!done)
|
|
|
{
|
|
|
- // [3.1] Gestion évènements
|
|
|
+ // [3.1] Events
|
|
|
SDL_Event event;
|
|
|
while (SDL_PollEvent(&event))
|
|
|
{
|
|
@@ -53,20 +50,20 @@ int main ( int argc, char** argv )
|
|
|
} // end switch event type
|
|
|
} // end of message processing
|
|
|
|
|
|
- // [3.2] Calculs
|
|
|
+ // [3.2] Compute
|
|
|
+ // Nothing for now
|
|
|
|
|
|
- // [3.3] Dessin des composants
|
|
|
+ // [3.3] Draw phase
|
|
|
SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 255, 255));
|
|
|
|
|
|
- //
|
|
|
+ // other draws
|
|
|
|
|
|
SDL_Flip(screen);
|
|
|
- } //fin bcl principale
|
|
|
+ } // end of main loop
|
|
|
|
|
|
- ///[4] Destruction des composants
|
|
|
+ ///[4] Free components
|
|
|
SDL_FreeSurface(screen);
|
|
|
|
|
|
-
|
|
|
- std::cout << "Aucune erreur détectée." << std::endl;
|
|
|
+ std::cout << "No error caught." << std::endl;
|
|
|
return 0;
|
|
|
}
|