|
|
@ -43,8 +43,7 @@ static int leftSideRecHeight = 0; |
|
|
|
static int bottomSideRecWidth = 0; |
|
|
|
static int bottomSideRecWidth = 0; |
|
|
|
static int rightSideRecHeight = 0; |
|
|
|
static int rightSideRecHeight = 0; |
|
|
|
|
|
|
|
|
|
|
|
static char raylib[8] = { 0 }; // raylib text array, max 8 letters
|
|
|
|
static int state = 0; // Logo animation states
|
|
|
|
static int state = 0; // Tracking animation states (State Machine)
|
|
|
|
|
|
|
|
static float alpha = 1.0f; // Useful for fading
|
|
|
|
static float alpha = 1.0f; // Useful for fading
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
@ -54,7 +53,6 @@ static float alpha = 1.0f; // Useful for fading |
|
|
|
// Logo Screen Initialization logic
|
|
|
|
// Logo Screen Initialization logic
|
|
|
|
void InitLogoScreen(void) |
|
|
|
void InitLogoScreen(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Initialize LOGO screen variables here!
|
|
|
|
|
|
|
|
finishScreen = 0; |
|
|
|
finishScreen = 0; |
|
|
|
framesCounter = 0; |
|
|
|
framesCounter = 0; |
|
|
|
lettersCount = 0; |
|
|
|
lettersCount = 0; |
|
|
@ -62,7 +60,10 @@ void InitLogoScreen(void) |
|
|
|
logoPositionX = GetScreenWidth()/2 - 128; |
|
|
|
logoPositionX = GetScreenWidth()/2 - 128; |
|
|
|
logoPositionY = GetScreenHeight()/2 - 128; |
|
|
|
logoPositionY = GetScreenHeight()/2 - 128; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; i++) raylib[i] = '\0'; |
|
|
|
topSideRecWidth = 16; |
|
|
|
|
|
|
|
leftSideRecHeight = 16; |
|
|
|
|
|
|
|
bottomSideRecWidth = 16; |
|
|
|
|
|
|
|
rightSideRecHeight = 16; |
|
|
|
|
|
|
|
|
|
|
|
state = 0; |
|
|
|
state = 0; |
|
|
|
alpha = 1.0f; |
|
|
|
alpha = 1.0f; |
|
|
@ -71,8 +72,7 @@ void InitLogoScreen(void) |
|
|
|
// Logo Screen Update logic
|
|
|
|
// Logo Screen Update logic
|
|
|
|
void UpdateLogoScreen(void) |
|
|
|
void UpdateLogoScreen(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Update LOGO screen variables here!
|
|
|
|
if (state == 0) // State 0: Top-left square corner blink logic
|
|
|
|
if (state == 0) // State 0: Small box blinking
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
framesCounter++; |
|
|
|
framesCounter++; |
|
|
|
|
|
|
|
|
|
|
@ -82,60 +82,43 @@ void UpdateLogoScreen(void) |
|
|
|
framesCounter = 0; // Reset counter... will be used later...
|
|
|
|
framesCounter = 0; // Reset counter... will be used later...
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 1) // State 1: Top and left bars growing
|
|
|
|
else if (state == 1) // State 1: Bars animation logic: top and left
|
|
|
|
{ |
|
|
|
{ |
|
|
|
topSideRecWidth += 8; |
|
|
|
topSideRecWidth += 8; |
|
|
|
leftSideRecHeight += 8; |
|
|
|
leftSideRecHeight += 8; |
|
|
|
|
|
|
|
|
|
|
|
if (topSideRecWidth == 256) state = 2; |
|
|
|
if (topSideRecWidth == 256) state = 2; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 2) // State 2: Bottom and right bars growing
|
|
|
|
else if (state == 2) // State 2: Bars animation logic: bottom and right
|
|
|
|
{ |
|
|
|
{ |
|
|
|
bottomSideRecWidth += 8; |
|
|
|
bottomSideRecWidth += 8; |
|
|
|
rightSideRecHeight += 8; |
|
|
|
rightSideRecHeight += 8; |
|
|
|
|
|
|
|
|
|
|
|
if (bottomSideRecWidth == 256) state = 3; |
|
|
|
if (bottomSideRecWidth == 256) state = 3; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 3) // State 3: Letters appearing (one by one)
|
|
|
|
else if (state == 3) // State 3: "raylib" text-write animation logic
|
|
|
|
{ |
|
|
|
{ |
|
|
|
framesCounter++; |
|
|
|
framesCounter++; |
|
|
|
|
|
|
|
|
|
|
|
if (framesCounter/10) // Every 12 frames, one more letter!
|
|
|
|
if (lettersCount < 10) |
|
|
|
{ |
|
|
|
{ |
|
|
|
lettersCount++; |
|
|
|
if (framesCounter/12) // Every 12 frames, one more letter!
|
|
|
|
framesCounter = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (lettersCount) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
case 1: raylib[0] = 'r'; break; |
|
|
|
lettersCount++; |
|
|
|
case 2: raylib[1] = 'a'; break; |
|
|
|
|
|
|
|
case 3: raylib[2] = 'y'; break; |
|
|
|
|
|
|
|
case 4: raylib[3] = 'l'; break; |
|
|
|
|
|
|
|
case 5: raylib[4] = 'i'; break; |
|
|
|
|
|
|
|
case 6: raylib[5] = 'b'; break; |
|
|
|
|
|
|
|
default: break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// When all letters have appeared...
|
|
|
|
|
|
|
|
if (lettersCount >= 10) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
state = 4; |
|
|
|
|
|
|
|
framesCounter = 0; |
|
|
|
framesCounter = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 4) |
|
|
|
else // When all letters have appeared, just fade out everything
|
|
|
|
{ |
|
|
|
{ |
|
|
|
framesCounter++; |
|
|
|
if (framesCounter > 200) |
|
|
|
|
|
|
|
|
|
|
|
if (framesCounter > 100) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
alpha -= 0.02f; |
|
|
|
alpha -= 0.02f; |
|
|
|
|
|
|
|
|
|
|
|
if (alpha <= 0.0f) |
|
|
|
if (alpha <= 0.0f) |
|
|
|
{ |
|
|
|
{ |
|
|
|
alpha = 0.0f; |
|
|
|
alpha = 0.0f; |
|
|
|
finishScreen = 1; |
|
|
|
finishScreen = 1; // Jump to next screen
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -144,16 +127,16 @@ void UpdateLogoScreen(void) |
|
|
|
// Logo Screen Draw logic
|
|
|
|
// Logo Screen Draw logic
|
|
|
|
void DrawLogoScreen(void) |
|
|
|
void DrawLogoScreen(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (state == 0) |
|
|
|
if (state == 0) // Draw blinking top-left square corner
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK); |
|
|
|
if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 1) |
|
|
|
else if (state == 1) // Draw bars animation: top and left
|
|
|
|
{ |
|
|
|
{ |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 2) |
|
|
|
else if (state == 2) // Draw bars animation: bottom and right
|
|
|
|
{ |
|
|
|
{ |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); |
|
|
@ -161,19 +144,7 @@ void DrawLogoScreen(void) |
|
|
|
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK); |
|
|
|
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (state == 3) |
|
|
|
else if (state == 3) // Draw "raylib" text-write animation + "powered by"
|
|
|
|
{ |
|
|
|
|
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (state == 4) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha)); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha)); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha)); |
|
|
|
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha)); |
|
|
@ -183,7 +154,7 @@ void DrawLogoScreen(void) |
|
|
|
|
|
|
|
|
|
|
|
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha)); |
|
|
|
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha)); |
|
|
|
|
|
|
|
|
|
|
|
DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha)); |
|
|
|
DrawText(TextSubtext("raylib", 0, lettersCount), GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha)); |
|
|
|
|
|
|
|
|
|
|
|
if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha)); |
|
|
|
if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha)); |
|
|
|
} |
|
|
|
} |
|
|
|