Skip to content

Commit

Permalink
It is more than just GameState, so let's not make the name confusing.
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan McQuen <rpcm@linux.com>
  • Loading branch information
ryanpcmcquen committed Aug 20, 2020
1 parent 35acd65 commit 591187d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion source/basque.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(int argc, char* argv[])
}

memset(&app, 0, sizeof(App));
memset(&game, 0, sizeof(GameState));
memset(&game, 0, sizeof(Game));

init();

Expand Down
4 changes: 2 additions & 2 deletions source/initialization.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "mechanics.h"

GameState game;
Game game;
App app;

void cleanup(void)
Expand Down Expand Up @@ -41,7 +41,7 @@ void cleanup(void)
SDL_Quit();
}

void create_outlined_font(GameState* game, char* map_tile_str)
void create_outlined_font(Game* game, char* map_tile_str)
{
game->font.outline_surface = TTF_RenderText_Blended(game->font.outline, map_tile_str, game->font.outline_color);
game->font.surface = TTF_RenderText_Blended(game->font.face, map_tile_str, game->font.color);
Expand Down
8 changes: 4 additions & 4 deletions source/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bool map_char_is_not_tile_info(char char_to_check)
return char_to_check == ' ' || char_to_check == '\0' || char_to_check == '\n' || char_to_check == ',';
}

void read_map_layout(GameState* game)
void read_map_layout(Game* game)
{
game->map.layout_string = read_file(game->map.layout_file);
// TODO: Return string length when file is read.
Expand Down Expand Up @@ -59,7 +59,7 @@ void read_map_layout(GameState* game)
} \
}

void read_map_attributes(GameState* game)
void read_map_attributes(Game* game)
{
game->map.attributes_string = read_file(game->map.attributes_file);
game->map.attributes_string_length = strlen(game->map.attributes_string);
Expand Down Expand Up @@ -182,7 +182,7 @@ void read_map_attributes(GameState* game)
}
}

void draw_edit_grid(App* app, GameState* game, Axes background, int map_tile)
void draw_edit_grid(App* app, Game* game, Axes background, int map_tile)
{
if (DEBUG_MODE && game->EDIT_MODE) {
SDL_Rect text_clip;
Expand Down Expand Up @@ -217,7 +217,7 @@ void draw_edit_grid(App* app, GameState* game, Axes background, int map_tile)
} \
}

void generate_map(App* app, GameState* game)
void generate_map(App* app, Game* game)
{
Axes background;

Expand Down
10 changes: 5 additions & 5 deletions source/mechanics.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SDL_Texture* load_texture(App* app, char* file)
return texture;
}

void load_music(GameState* game)
void load_music(Game* game)
{
int flags = MIX_INIT_OGG;
int initted = Mix_Init(flags);
Expand All @@ -31,7 +31,7 @@ void load_music(GameState* game)
}
}

void prepare_scene(App* app, GameState* game)
void prepare_scene(App* app, Game* game)
{
game->player_image = load_texture(app, PLAYER_IMAGE);
game->background_image = load_texture(app, BACKGROUND_IMAGE);
Expand Down Expand Up @@ -109,7 +109,7 @@ int is_above_bound(int coordinate, int sprite_dimension, int bound)
} \
}

void handle_collisions(GameState* game)
void handle_collisions(Game* game)
{
if (DEBUG_MODE && game->EDIT_MODE) {

Expand All @@ -123,7 +123,7 @@ void handle_collisions(GameState* game)
}
}

int write_map_layout(GameState* game)
int write_map_layout(Game* game)
{
if (file_exists(MAP_LOCK_FILE)) {
// Do not write if there is a lock file, to avoid obliterating the map.
Expand Down Expand Up @@ -237,7 +237,7 @@ int write_map_layout(GameState* game)
} \
}

void handle_input(App* app, GameState* game)
void handle_input(App* app, Game* game)
{
game->done = SDL_FALSE;

Expand Down
2 changes: 1 addition & 1 deletion source/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ typedef struct {
bool EDIT_MODE;

Editor editor;
} GameState;
} Game;

0 comments on commit 591187d

Please sign in to comment.