48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
|
#include "main.h"
|
||
|
|
||
|
// On cree un sdl-toplevel statique
|
||
|
static sdltl *mgr;
|
||
|
|
||
|
|
||
|
|
||
|
int main(int argc, char* argv[]) {
|
||
|
|
||
|
/* [0] Initialisation de SDL
|
||
|
=========================================================*/
|
||
|
mgr = new sdltl("Ma fenetre SDL", WIN_WIDTH, WIN_HEIGHT);
|
||
|
|
||
|
/* [1] Creation de la fenetre
|
||
|
=========================================================*/
|
||
|
if( !mgr->status() )
|
||
|
cout << "Erreur: " << SDL_GetError() << endl;
|
||
|
|
||
|
|
||
|
/* [3] On definit le background color
|
||
|
=========================================================*/
|
||
|
// mgr->setBackground(255, 0, 255);
|
||
|
mgr->setBackground(255, 0, 0);
|
||
|
bool imageLoaded = mgr->setImage( "src/1.bmp" );
|
||
|
mgr->update();
|
||
|
|
||
|
|
||
|
|
||
|
/* [n-1] Boucle infinie
|
||
|
=========================================================*/
|
||
|
// while(1){
|
||
|
mgr->waitEvent(SDL_QUIT, &eventHandler);
|
||
|
// }
|
||
|
// SDL_Delay(5000);
|
||
|
|
||
|
|
||
|
|
||
|
/* [n] Fin d'execution
|
||
|
=========================================================*/
|
||
|
delete mgr;
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
void eventHandler(SDL_Event *e){
|
||
|
cout << "Ferme" << endl;
|
||
|
delete mgr;
|
||
|
}
|