Various graphics fixes.

This commit is contained in:
Steve 2018-12-11 08:24:25 +00:00
parent f015f83425
commit 21bb032a05
11 changed files with 33 additions and 30 deletions

View File

@ -273,23 +273,26 @@ static void draw(void)
static void drawMenu(void) static void drawMenu(void)
{ {
SDL_Rect r; SDL_Rect r;
if (app.modalDialog.type == MD_NONE)
{
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, NULL);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); r.w = 400;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); r.h = 400;
SDL_RenderFillRect(app.renderer, NULL); r.x = (SCREEN_WIDTH / 2) - r.w / 2;
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
r.w = 400; SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
r.h = 400; SDL_RenderFillRect(app.renderer, &r);
r.x = (SCREEN_WIDTH / 2) - r.w / 2; SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; SDL_RenderDrawRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); drawWidgets("inBattle");
SDL_RenderFillRect(app.renderer, &r); }
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, SDL_ALPHA_OPAQUE);
SDL_RenderDrawRect(app.renderer, &r);
drawWidgets("inBattle");
} }
static void handleKeyboard(void) static void handleKeyboard(void)

View File

@ -90,7 +90,7 @@ void drawRope(Entity *e)
{ {
if (e->towing) if (e->towing)
{ {
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawLine(app.renderer, e->x - battle.camera.x, e->y - battle.camera.y, e->towing->x - battle.camera.x, e->towing->y - battle.camera.y); SDL_RenderDrawLine(app.renderer, e->x - battle.camera.x, e->y - battle.camera.y, e->towing->x - battle.camera.x, e->towing->y - battle.camera.y);
} }

View File

@ -405,7 +405,7 @@ static void drawChallenges(void)
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);
r.y = 240; r.y = 240;
@ -453,7 +453,7 @@ static void drawMenu(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -812,7 +812,7 @@ static void drawMenu(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -110,7 +110,7 @@ void drawFighterDatabase(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -141,7 +141,7 @@ void drawStats(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -143,7 +143,7 @@ void drawTrophies(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);
@ -307,10 +307,10 @@ void drawTrophyAlert(void)
if (alertTrophy) if (alertTrophy)
{ {
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &alertRect); SDL_RenderFillRect(app.renderer, &alertRect);
SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, 255);
SDL_RenderDrawRect(app.renderer, &alertRect); SDL_RenderDrawRect(app.renderer, &alertRect);
drawText(alertRect.x + 15, alertRect.y + 5, 30, TA_LEFT, colors.white, alertTrophy->title); drawText(alertRect.x + 15, alertRect.y + 5, 30, TA_LEFT, colors.white, alertTrophy->title);

View File

@ -162,7 +162,7 @@ void drawControls(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -63,7 +63,7 @@ static void initColor(SDL_Color *c, int r, int g, int b)
void prepareScene(void) void prepareScene(void)
{ {
SDL_SetRenderTarget(app.renderer, app.backBuffer); SDL_SetRenderTarget(app.renderer, app.backBuffer);
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderClear(app.renderer); SDL_RenderClear(app.renderer);
} }

View File

@ -101,7 +101,7 @@ static void drawMain(void)
r.x = (SCREEN_WIDTH / 2) - r.w / 2; r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2; r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &r); SDL_RenderFillRect(app.renderer, &r);
SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255);
SDL_RenderDrawRect(app.renderer, &r); SDL_RenderDrawRect(app.renderer, &r);

View File

@ -150,19 +150,19 @@ void drawWidgets(const char *group)
} }
else else
{ {
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 255);
SDL_RenderFillRect(app.renderer, &w->rect); SDL_RenderFillRect(app.renderer, &w->rect);
if (w == selectedWidget) if (w == selectedWidget)
{ {
SDL_SetRenderDrawColor(app.renderer, 64, 128, 200, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 64, 128, 200, 255);
SDL_RenderFillRect(app.renderer, &w->rect); SDL_RenderFillRect(app.renderer, &w->rect);
SDL_SetRenderDrawColor(app.renderer, 128, 192, 255, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 128, 192, 255, 255);
SDL_RenderDrawRect(app.renderer, &w->rect); SDL_RenderDrawRect(app.renderer, &w->rect);
} }
else else
{ {
SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, SDL_ALPHA_OPAQUE); SDL_SetRenderDrawColor(app.renderer, 64, 64, 64, 255);
SDL_RenderDrawRect(app.renderer, &w->rect); SDL_RenderDrawRect(app.renderer, &w->rect);
} }
} }