Review game code (something broken)

This commit is contained in:
raysan5 2017-04-23 12:05:47 +02:00
parent 9b072dc346
commit 3a1e6ab0b6
5 changed files with 34 additions and 34 deletions

View File

@ -68,7 +68,7 @@ int main(void)
font = LoadSpriteFont("resources/graphics/mainfont.png");
atlas01 = LoadTexture("resources/graphics/atlas01.png");
atlas02 = LoadTexture("resources/graphics/atlas02.pvr");
atlas02 = LoadTexture("resources/graphics/atlas02.png");
#if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 KiB

After

Width:  |  Height:  |  Size: 899 KiB

View File

@ -465,11 +465,11 @@ void DrawEndingScreen(void)
DrawTexturePro(atlas01, ending_button_trophy, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.513, ending_button_trophy.width, ending_button_trophy.height}, (Vector2){ 0, 0}, 0, buttonTrophyColor);
DrawTexturePro(atlas01, ending_button_share, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.719, ending_button_share.width, ending_button_share.height}, (Vector2){ 0, 0}, 0, buttonShareColor);
DrawTextEx(font, FormatText("%03i", seasonsCounter), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.14f }, font.size, 1, WHITE);
DrawTextEx(font, FormatText("%03i", currentLeavesEnding), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.29f }, font.size, 1, WHITE);
DrawTextEx(font, FormatText("%04i", currentScore), (Vector2){ GetScreenWidth()*0.715f, GetScreenHeight()*0.426f }, font.size, 1, WHITE);
DrawTextEx(font, FormatText("%03i", seasonsCounter), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.14f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%03i", currentLeavesEnding), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.29f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%04i", currentScore), (Vector2){ GetScreenWidth()*0.715f, GetScreenHeight()*0.426f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%s %i - %s %i", initMonthText, initYears, finalMonthText, finalYears), (Vector2){ GetScreenWidth()*0.1f, GetScreenHeight()*0.7f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, FormatText("%s %i - %s %i", initMonthText, initYears, finalMonthText, finalYears), (Vector2){ GetScreenWidth()*0.1f, GetScreenHeight()*0.7f }, font.baseSize/2.0f, 1, WHITE);
for (int i = 0; i < MAX_KILLS; i++)
{
@ -495,26 +495,26 @@ void DrawEndingScreen(void)
//DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, 0.5));
*/
//DrawTextEx(font, FormatText("%02s", killer), (Vector2){ GetScreenWidth()*0.08, GetScreenHeight()*0.78 }, font.size/2, 1, WHITE);
if (killer == 0) DrawTextEx(font, textFire01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
else if (killer == 2) DrawTextEx(font, textDingo01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
//DrawTextEx(font, FormatText("%02s", killer), (Vector2){ GetScreenWidth()*0.08, GetScreenHeight()*0.78 }, font.baseSize/2, 1, WHITE);
if (killer == 0) DrawTextEx(font, textFire01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 2) DrawTextEx(font, textDingo01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 1)
{
DrawTextEx(font, textSnake01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textSnake02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textSnake01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textSnake02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
}
else if (killer == 3)
{
DrawTextEx(font, textOwl01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textOwl02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textOwl01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textOwl02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
}
else if (killer == 4) DrawTextEx(font, textNaturalDeath01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
else if (killer == 4) DrawTextEx(font, textNaturalDeath01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 5)
{
DrawTextEx(font, textBee01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textBee02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE);
DrawTextEx(font, textBee01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textBee02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
}
else if (killer == 6) DrawTextEx(font, textEagle, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE);
else if (killer == 6) DrawTextEx(font, textEagle, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
}
// Ending Screen Unload logic

View File

@ -475,7 +475,7 @@ void UpdateGameplayScreen(void)
if (numberAlpha <= 0) numberAlpha = 1;
if (numberScale <= 0) numberScale = 2.5f;
textSize = MeasureTextEx(font, FormatText("%01i", startNum), font.size*numberScale, 2);
textSize = MeasureTextEx(font, FormatText("%01i", startNum), font.baseSize*numberScale, 2);
}
if (playerActive) finishScreen = 0;
@ -2914,42 +2914,42 @@ void DrawGameplayScreen(void)
{
if (popupScore[i].active)
{
DrawTextEx(font, FormatText("%i", popupScore[i].score), popupScore[i].position, font.size/4*popupScore[i].scale, -5, Fade((Color){255, 73, 73, 255}, popupScore[i].alpha));
DrawTextEx(font, FormatText("%i", popupScore[i].score), popupScore[i].position, font.baseSize/4*popupScore[i].scale, -5, Fade((Color){255, 73, 73, 255}, popupScore[i].alpha));
}
}
if (popupBee.active) DrawTextEx(font, FormatText("%i", popupBee.score), popupBee.position, font.size/4*popupBee.scale, -5, Fade((Color){255, 73, 73, 255}, popupBee.alpha));
if (popupEagle.active) DrawTextEx(font, FormatText("%i", popupEagle.score), popupEagle.position, font.size/4*popupEagle.scale, -5, Fade((Color){255, 73, 73, 255}, popupEagle.alpha));
if (popupBee.active) DrawTextEx(font, FormatText("%i", popupBee.score), popupBee.position, font.baseSize/4*popupBee.scale, -5, Fade((Color){255, 73, 73, 255}, popupBee.alpha));
if (popupEagle.active) DrawTextEx(font, FormatText("%i", popupEagle.score), popupEagle.position, font.baseSize/4*popupEagle.scale, -5, Fade((Color){255, 73, 73, 255}, popupEagle.alpha));
for (int i = 0; i < MAX_LEAVES; i++)
{
if (popupLeaves[i].active) DrawTextEx(font, FormatText("+ %i", popupLeaves[i].score), popupLeaves[i].position, font.size/4*popupLeaves[i].scale, -5, Fade((Color){139, 179, 0, 255}, popupLeaves[i].alpha));
if (popupLeaves[i].active) DrawTextEx(font, FormatText("+ %i", popupLeaves[i].score), popupLeaves[i].position, font.baseSize/4*popupLeaves[i].scale, -5, Fade((Color){139, 179, 0, 255}, popupLeaves[i].alpha));
}
DrawTextEx(font, FormatText("%03i", currentLeaves), (Vector2){ 47, 50 }, font.size, -8, counterColor);
DrawTextEx(font, FormatText("%03i", currentLeaves), (Vector2){ 47, 50 }, font.baseSize, -8, counterColor);
if (transforming) DrawTextEx(font, textFinalForm, (Vector2){ GetScreenWidth()/2 - MeasureText(textFinalForm, 40)/2, GetScreenHeight()/4}, font.size, -5, (Color){246, 133, 133, 255});
if (transforming) DrawTextEx(font, textFinalForm, (Vector2){ GetScreenWidth()/2 - MeasureText(textFinalForm, 40)/2, GetScreenHeight()/4}, font.baseSize, -5, (Color){246, 133, 133, 255});
if ((currentMonth == 7) && (transitionFramesCounter >= SEASONTRANSITION/2))
{
if (randomMessage <= 4) DrawTextEx(font, textSpring1, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255});
else DrawTextEx(font, textSpring2, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255});
if (randomMessage <= 4) DrawTextEx(font, textSpring1, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){185, 222, 105, 255});
else DrawTextEx(font, textSpring2, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){185, 222, 105, 255});
}
else if ((currentMonth == 10) && (transitionFramesCounter >= SEASONTRANSITION/2))
{
if (randomMessage <= 4) DrawTextEx(font, textSummer1, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255});
else DrawTextEx(font, textSummer2, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255});
if (randomMessage <= 4) DrawTextEx(font, textSummer1, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){253, 200, 108, 255});
else DrawTextEx(font, textSummer2, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){253, 200, 108, 255});
}
else if ((currentMonth == 1) && (transitionFramesCounter >= SEASONTRANSITION/2))
{
if (randomMessage <= 4) DrawTextEx(font, textFall1, (Vector2){GetScreenWidth()/2 - MeasureText(textFall1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255});
else DrawTextEx(font, textFall2, (Vector2){GetScreenWidth()/2 - MeasureText(textFall2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255});
if (randomMessage <= 4) DrawTextEx(font, textFall1, (Vector2){GetScreenWidth()/2 - MeasureText(textFall1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){255, 149, 107, 255});
else DrawTextEx(font, textFall2, (Vector2){GetScreenWidth()/2 - MeasureText(textFall2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){255, 149, 107, 255});
}
else if (currentMonth == 4 && transitionFramesCounter >= SEASONTRANSITION/2)
{
if (randomMessage <= 4) DrawTextEx(font, textWinter1, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255});
else DrawTextEx(font, textWinter2, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255});
if (randomMessage <= 4) DrawTextEx(font, textWinter1, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){133, 249, 253, 255});
else DrawTextEx(font, textWinter2, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){133, 249, 253, 255});
}
#if defined(DEBUG)
@ -3933,5 +3933,5 @@ static void Reset(void)
firePos.x = -200;
firePos.y = 0;
textSize = MeasureTextEx(font, "3", font.size*5, 2);
textSize = MeasureTextEx(font, "3", font.baseSize*5, 2);
}

View File

@ -326,7 +326,7 @@ void InitTitleScreen(void)
koalaMenu.width = gameplay_koala_menu.width/2;
koalaMenu.height = gameplay_koala_menu.height;
fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.size, 2);
fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.baseSize, 2);
}
// Title Screen Update logic
@ -918,7 +918,7 @@ void DrawTitleScreen(void)
DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y, title_titletext.width, 230}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue1, title_titletext.width, 235}, (Vector2){0, 0}, 0, WHITE);
DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y + 232, title_titletext.width, 116}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue2, title_titletext.width, 116}, (Vector2){0, 0}, 0, WHITE);
if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.size, 2, (Color){247, 239, 209, 255});
if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.baseSize, 2, (Color){247, 239, 209, 255});
for (int i = 0; i < MAX_particle; i++)
{