2009-12-01 22:55:38 +01:00
|
|
|
|
2009-12-01 23:02:55 +01:00
|
|
|
#include <stdio.h>
|
2009-12-07 16:57:30 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include "SDL.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "draw.h"
|
2009-12-01 23:02:55 +01:00
|
|
|
|
2009-12-01 22:55:38 +01:00
|
|
|
int main(int argc, char **argv) {
|
2009-12-07 16:57:30 +01:00
|
|
|
// Initialize SDL and open up a screen
|
|
|
|
SDL_Init(SDL_INIT_VIDEO);
|
|
|
|
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
|
|
|
|
|
2009-12-14 00:28:06 +01:00
|
|
|
// Initialize internal game state
|
|
|
|
terrain = generateTerrain(150.0, 180.0);
|
|
|
|
|
2009-12-07 16:57:30 +01:00
|
|
|
// the main game loop
|
|
|
|
while (gameRunning == true) {
|
|
|
|
// Check for events
|
|
|
|
if (SDL_PollEvent(&event)) {
|
|
|
|
// Make it possible to close the game window
|
|
|
|
if (event.type == SDL_QUIT) gameRunning = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the stuff on the screen and "flip" th the next frame
|
2009-12-10 23:23:02 +01:00
|
|
|
SDL_FillRect(screen, NULL, 0x000000);
|
2009-12-07 16:57:30 +01:00
|
|
|
drawScreen();
|
|
|
|
SDL_Flip(screen);
|
|
|
|
}
|
|
|
|
|
2009-12-14 00:28:06 +01:00
|
|
|
// Cleanup and quit
|
|
|
|
free(terrain);
|
|
|
|
|
2009-12-07 16:57:30 +01:00
|
|
|
SDL_Quit();
|
2009-12-01 22:55:38 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|