| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // main.c
- // Mario Sokoban
- //
- // Created by Benoit Sida on 2014-02-15.
- // Copyright (c) 2014 Benoit Sida. All rights reserved.
- //
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <SDL2/SDL.h>
- #include <SDL2_image/SDL_image.h>
- #include "constantes.h"
- #include "menu.h"
- #include "game.h"
- #include "level.h"
- #include "editor.h"
- #include "difficulty.h"
-
-
-
- int main(int argc, const char * argv[])
- {
- if (SDL_Init(SDL_INIT_VIDEO) == -1) {
- printf("Erreur lors de l'initialisation du module SDL. Erreur : %s", SDL_GetError());
- exit(EXIT_FAILURE);
- }
- int choice = 0, diff = 1;
- SDL_Window *ecran;
- SDL_Surface *screen, *icon;
- ecran = SDL_CreateWindow("MARIO SOKOBAN", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, LARGEUR_ECRAN, HAUTEUR_ECRAN, SDL_WINDOW_SHOWN);
- screen = SDL_GetWindowSurface(ecran);
- icon = IMG_Load("sprites/mario_bas.gif");
- SDL_SetWindowIcon(ecran, icon);
- while (choice == 0) {
- choice = menu(ecran, screen);
- switch (choice) {
- case 1:
- diff = difficulty(ecran, screen);
- game(diff, ecran, screen);
- choice = 0;
- break;
- case 2:
- editor(ecran, screen);
- choice = 0;
- break;
- }
- }
- SDL_Quit();
- return EXIT_SUCCESS;
- }
|