main.c (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
#include "SDL/SDL.h" #include "SDL/SDL_image.h" #include "SDL/SDL_ttf.h" #include "SDL/SDL_mixer.h" #include <stdio.h> #include "enum.h" #include "Engine.h" #include "Timer.h" #include "Player.h" #include "Room.h" #include "TextBox.h" #include "Kaos.h" #include "HyperKaos.h" #include "WorldData.h" /*const int SCREEN_WIDTH = 320; const int SCREEN_HEIGHT = 180; const int SCREEN_BPP = 32; const int FRAMES_PER_SECOND = 30;*/ int fullscreen = 0; int playing = 0; int quit = 0; int actionbutton = 0; int captive = 0; int hasMusic = 0; Timer fps = { 0 }; SDL_Event event; SDL_Surface* screen = NULL; Room* rightHere = NULL; SDL_Surface* saveMenu = NULL; SDL_Surface* textBoxBG = NULL; SDL_Surface* choiceBox = NULL; SDL_Surface* nextArrow = NULL; SDL_Surface* selectArrow = NULL; SDL_Surface* loadingTxt = NULL; TTF_Font* font = NULL; SDL_Color textColor = {255, 255, 255}; Player* hero = NULL; Room* menuBG = NULL; Mix_Music* menuBGM = NULL; long long int savestate = 2; Room** mapData = NULL; Room** mapBuffer = NULL; TextBox** dialogueData = NULL; Mix_Music** bgmData = NULL; Mix_Chunk** sfxData = NULL; Kaos** kaosData = NULL; int kaosFlag = -1; enum dataChunks thisChunk; enum dataChunks nextChunk; int main (int argc, char* args[]) { if (!init(argc, args)) { printf("Init failed\n"); return 1; } // main game loop while (!quit) { mainmenu(); while (playing) { timeStart(fps); interact(); movePlayer(hero, rightHere); renderBackground(); renderForeground(); SDL_Flip(screen); kListen(&kaosFlag); pager(); timeDilation(); } } cleanup(); return 0; } |