Skip to content

Commit

Permalink
Merge branch 'error-texture-display-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
padawin committed Sep 12, 2017
2 parents 7144c28 + c36d395 commit 8c59633
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions multiplayer_setup_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void multiplayer_setup_state_render(s_Game* game) {
0, 0, 0
);

if (errorTexture != 0) {
if (errorTexture != NULL) {
SDL_QueryTexture(errorTexture, NULL, NULL, &textWidth, &textHeight);
SDL_Rect errorRect = {50, 60, textWidth, textHeight};
SDL_RenderCopy(game->renderer, errorTexture, NULL, &errorRect);
Expand Down Expand Up @@ -281,7 +281,7 @@ void multiplayer_setup_state_render(s_Game* game) {
);
}

if (errorTexture != 0) {
if (errorTexture != NULL) {
SDL_QueryTexture(errorTexture, NULL, NULL, &textWidth, &textHeight);
SDL_Rect errorRect = {50, 210, textWidth, textHeight};
SDL_RenderCopy(game->renderer, errorTexture, NULL, &errorRect);
Expand Down Expand Up @@ -339,6 +339,7 @@ void multiplayer_setup_state_handleEvent(s_Game* game, int key) {
if (key == SDLK_ESCAPE) {
g_localState = STATE_HOST_JOIN;
SDL_DestroyTexture(errorTexture);
errorTexture = NULL;
}
else if (IS_GCW) {
_handleIPSelectionEventGCW(game, key);
Expand All @@ -351,12 +352,17 @@ void multiplayer_setup_state_handleEvent(s_Game* game, int key) {
if (key == SDLK_ESCAPE) {
g_localState = STATE_JOIN_SETUP;
SDL_DestroyTexture(errorTexture);
errorTexture = NULL;
}
}
}

void _setSetupError(s_Game *game, const char *errorMessage) {
SDL_DestroyTexture(errorTexture);
if (errorTexture != NULL) {
SDL_DestroyTexture(errorTexture);
errorTexture = NULL;
}

utils_createTextTexture(
game->renderer,
game->menuFont,
Expand Down

0 comments on commit 8c59633

Please sign in to comment.