Skip to content

Commit

Permalink
Fixed splash screen flashing, improved visuals (#367)
Browse files Browse the repository at this point in the history
Fixed splash screen flashing, improved visuals
  • Loading branch information
johnnywycliffe authored Jan 1, 2025
1 parent 0b7ad5e commit b2ae361
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 18 deletions.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_middle_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_middle_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_middle_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cGrove/Sprites/UI/Splash/cg_title_middle_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions main/modes/games/cGrove/cg_Typedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,10 @@ typedef struct
bool unload; ///< if the state is ready to unload

// title screen
bool titleActive; ///< If title screen is active
int64_t timer; ///< Timer for animations
vec_t cloudPos; ///< Position of the cloud
int8_t animFrame; ///< Current frame of the animation;
int8_t titleFrame; ///< Frame of title animation
bool titleActive; ///< If title screen is active
int64_t timer; ///< Timer for animations
int16_t cloudPos; ///< Position of the cloud
int8_t animFrame; ///< Current frame of the animation;

// Menu
menu_t* menu; ///< Main menu
Expand Down
50 changes: 37 additions & 13 deletions main/modes/games/cGrove/mode_cGrove.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,21 +499,45 @@ static void cg_titleScreen(int64_t elapsedUs)
{
// Update
cg->timer += elapsedUs;
if (cg->timer >= SECOND)
if (cg->timer >= (SECOND >> 4))
{
cg->timer = 0;
cg->cloudPos.x += 1;
if (cg->cloudPos.x >= TFT_WIDTH)
// Animation frame
cg->animFrame += 1;
if (cg->animFrame >= 16)
{
cg->cloudPos.x = -cg->title[0].h;
cg->animFrame = 0;
}

// Cloud (1/16)
cg->cloudPos += 1;
if (cg->cloudPos >= TFT_WIDTH)
{
cg->cloudPos = -(cg->title[0].h * 7);
}

// Reset timer
cg->timer -= SECOND >> 4;
}

// Draw bg
drawWsgSimpleScaled(&cg->title[1], 0, 0, 3, 5);

// Draw cloud
drawWsgSimpleScaled(&cg->title[0], cg->cloudPos, 64, 5, 5);

// Chowa
// 4 frames, loop every 1 second
// 1 frame = 4 animFrames; bitshift by two (divide by four)
drawWsgSimple(&cg->title[4 + (cg->animFrame >> 2)], 0, 84);

// Title
drawWsgSimpleHalf(&cg->title[2], 16, 16);

// Blinky Arrow
// 2 frames, loop every 1 second
// 1 frame - 8 animFrames; bitshift by three (divide by eight)
if (cg->animFrame >> 3 == 1)
{
drawWsgSimpleHalf(&cg->title[3], 125, 20);
}
cg->animFrame = (cg->animFrame + 1) % 32;
cg->titleFrame = (cg->titleFrame + 1) % 64;

// Draw
drawWsgSimple(&cg->title[1], 0, 0);
drawWsgSimpleHalf(&cg->title[0], cg->cloudPos.x, -30);
drawWsgSimpleHalf(&cg->title[4 + (cg->animFrame >> 3)], 0, 84);
drawWsgSimpleHalf(&cg->title[2 + (cg->titleFrame >> 5)], 0, 0);
}

0 comments on commit b2ae361

Please sign in to comment.