mirror of
https://github.com/thepigeongenerator/tetris_clone.git
synced 2025-12-17 14:05:45 +01:00
use tabs over spaces
This commit is contained in:
64
src/main.c
64
src/main.c
@@ -14,49 +14,49 @@ static renderdata rdat;
|
||||
|
||||
// initialize the game
|
||||
static void init(void) {
|
||||
// initialize SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) fatal(ERROR_SDL_INIT, "SDL could not initialize! SDL Error: %s", SDL_GetError());
|
||||
if (TTF_Init() != 0) fatal(ERROR_SDL_FONT_INIT, "the TTF module of SDL could not initialize! TTF Error: %s", TTF_GetError());
|
||||
// initialize SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) fatal(ERROR_SDL_INIT, "SDL could not initialize! SDL Error: %s", SDL_GetError());
|
||||
if (TTF_Init() != 0) fatal(ERROR_SDL_FONT_INIT, "the TTF module of SDL could not initialize! TTF Error: %s", TTF_GetError());
|
||||
|
||||
// initialize other game components
|
||||
paths_init();
|
||||
game_init(&gdat);
|
||||
render_init(&rdat, &gdat);
|
||||
// initialize other game components
|
||||
paths_init();
|
||||
game_init(&gdat);
|
||||
render_init(&rdat, &gdat);
|
||||
}
|
||||
|
||||
// perform the updates to the game
|
||||
static void update(void) {
|
||||
// update the input
|
||||
{
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
switch (e.type) {
|
||||
case SDL_QUIT:
|
||||
gdat.run = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// update the input
|
||||
{
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
switch (e.type) {
|
||||
case SDL_QUIT:
|
||||
gdat.run = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// perform updates
|
||||
game_update(&gdat);
|
||||
render_update(&rdat);
|
||||
// perform updates
|
||||
game_update(&gdat);
|
||||
render_update(&rdat);
|
||||
}
|
||||
|
||||
// entry-point of the application
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc, (void)argv;
|
||||
(void)argc, (void)argv;
|
||||
|
||||
init();
|
||||
debug("successfully initialized!", );
|
||||
init();
|
||||
debug("successfully initialized!", );
|
||||
|
||||
while (gdat.run == true)
|
||||
update();
|
||||
while (gdat.run == true)
|
||||
update();
|
||||
|
||||
debug("done! starting to free resources...", );
|
||||
game_free(&gdat);
|
||||
render_free(&rdat);
|
||||
paths_free();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
debug("done! starting to free resources...", );
|
||||
game_free(&gdat);
|
||||
render_free(&rdat);
|
||||
paths_free();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user