1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#include "game.h"
void initGame(Game* game)
{
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Penguin Yippies!");
SetWindowState(FLAG_WINDOW_RESIZABLE);
// Assets.
initAssets(&game->assets);
// Screens.
game->currentScreen = MAIN_MENU_SCREEN;
initMainMenu(&game->mainMenu, game);
initGameScreen(&game->gameScreen, game);
// Clickies lol.
initClickies(&game->clickies);
// Test clickies.
Clicky testClicky = createPenguinLolClicky(game);
addClickyToClickies(&game->clickies, testClicky);
game->screenTexture = LoadRenderTexture(WINDOW_WIDTH, WINDOW_HEIGHT);
game->stones = 0;
game->madeWithUnity = createAnimation(&game->assets.animations[MADE_WITH_UNITY_ANIMATION], 0.2);
game->madeWithUnity.repeat = false;
playAnimation(&game->madeWithUnity);
}
void updateGame(Game* game)
{
if (game->madeWithUnity.playing)
{
runAnimation(&game->madeWithUnity);
BeginDrawing();
DrawTexturePro(
game->madeWithUnity.texture,
(Rectangle){0.0, 0.0, game->madeWithUnity.width, game->madeWithUnity.height},
(Rectangle){0.0, 0.0, GetScreenWidth(), GetScreenHeight()},
Vector2Zero(),
0.0,
WHITE
);
EndDrawing();
return;
}
// Draw screen.
BeginTextureMode(game->screenTexture);
switch (game->currentScreen)
{
case MAIN_MENU_SCREEN:
updateMainMenu(&game->mainMenu, game);
break;
case GAME_SCREEN:
updateGameScreen(&game->gameScreen, game);
break;
default:
break;
}
EndTextureMode();
// Draw the silly silly render texture.
BeginDrawing();
DrawTexturePro(
game->screenTexture.texture,
(Rectangle){0.0, 0.0, game->screenTexture.texture.width, -game->screenTexture.texture.height},
(Rectangle){0.0, 0.0, GetScreenWidth(), GetScreenHeight()},
Vector2Zero(),
0.0,
WHITE
);
EndDrawing();
}
void closeGame(Game* game)
{
closeAssets(&game->assets);
closeMainMenu(&game->mainMenu);
closeGameScreen(&game->gameScreen);
closeClickies(&game->clickies);
UnloadRenderTexture(game->screenTexture);
closeAnimation(&game->madeWithUnity);
CloseWindow();
}
|