-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.h
More file actions
199 lines (181 loc) · 5.81 KB
/
types.h
File metadata and controls
199 lines (181 loc) · 5.81 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#ifndef TYPES_H
#define TYPES_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_mixer.h"
#include "config.h"
/**
* @enum PlayerDirection
* @brief Player movement directions
*/
typedef enum {
DIR_IDLE_RIGHT = 0,
DIR_MOVING_RIGHT = 1,
DIR_IDLE_LEFT = 2,
DIR_MOVING_LEFT = 3,
DIR_JUMP_RIGHT = 4,
DIR_JUMP_LEFT = 5
} PlayerDirection;
/**
* @enum EnemyAIState
* @brief Enemy AI states
*/
typedef enum {
ENEMY_WAITING = 0,
ENEMY_FOLLOWING = 1
} EnemyAIState;
/**
* @struct Player
* @brief Player character structure
*/
typedef struct {
SDL_Rect position; /*!< Position on screen */
SDL_Rect relativePosition; /*!< Position relative to jump arc */
SDL_Surface *sprites[NUM_DIRECTIONS][NUM_FRAMES_PER_DIRECTION]; /*!< Sprite sheets */
float velocityX; /*!< Horizontal velocity */
PlayerDirection direction; /*!< Current direction state */
int currentFrame; /*!< Current animation frame */
int lastDirection; /*!< Last direction pressed (0=right, 1=left) */
int isJumping; /*!< Jump state */
} Player;
/**
* @struct Enemy
* @brief Enemy character structure
*/
typedef struct {
int direction; /*!< Direction: 0=right, 1=left */
SDL_Rect screenPosition; /*!< Position on screen */
SDL_Rect spritePosition; /*!< Position on sprite sheet */
SDL_Surface *spriteSheet; /*!< Enemy sprite sheet */
EnemyAIState state; /*!< AI state */
} Enemy;
/**
* @struct TextDisplay
* @brief Text rendering structure
*/
typedef struct {
SDL_Surface *textSurface; /*!< Rendered text surface */
SDL_Rect textPosition; /*!< Position on screen */
char textBuffer[20]; /*!< Text content */
SDL_Color textColor; /*!< Text color */
TTF_Font *font; /*!< Font for rendering */
} TextDisplay;
/**
* @struct GameTimer
* @brief Game timer structure
*/
typedef struct {
int startTime; /*!< Start time in ms */
int minutes; /*!< Minutes elapsed */
int seconds; /*!< Seconds elapsed */
TextDisplay display; /*!< Display info */
} GameTimer;
/**
* @struct Background
* @brief Background and world structure
*/
typedef struct {
SDL_Surface *backgroundImage; /*!< Background image */
SDL_Rect displayPosition; /*!< Position on screen */
SDL_Rect camera; /*!< Camera viewport */
SDL_Rect cloudPosition; /*!< Cloud animation position */
SDL_Surface *cloudImage; /*!< Cloud image */
} Background;
/**
* @struct Minimap
* @brief Minimap display structure
*/
typedef struct {
SDL_Surface *minimapImage; /*!< Minimap image */
SDL_Rect minimapPosition; /*!< Position on screen */
SDL_Surface *playerIndicator; /*!< Player marker */
SDL_Rect playerMapPosition; /*!< Position on minimap */
} Minimap;
/**
* @struct Puzzle
* @brief Quiz puzzle structure
*/
typedef struct {
char questionText[100]; /*!< Question text */
char answer1[100]; /*!< Answer 1 */
char answer2[100]; /*!< Answer 2 */
char answer3[100]; /*!< Answer 3 */
int correctAnswer; /*!< Correct answer number (1-3) */
SDL_Surface *questionSurface; /*!< Rendered question */
SDL_Surface *answer1Surface; /*!< Rendered answer 1 */
SDL_Surface *answer2Surface; /*!< Rendered answer 2 */
SDL_Surface *answer3Surface; /*!< Rendered answer 3 */
SDL_Rect questionPosition; /*!< Position on screen */
SDL_Rect answer1Position; /*!< Answer 1 position */
SDL_Rect answer2Position; /*!< Answer 2 position */
SDL_Rect answer3Position; /*!< Answer 3 position */
} Puzzle;
/**
* @struct GameCell
* @brief Connect-4 game cell
*/
typedef struct {
int column;
int row;
} GameCell;
/**
* @struct MenuButton
* @brief Menu button structure
*/
typedef struct {
SDL_Surface *sprites[2]; /*!< Normal and hovered sprites */
SDL_Rect position; /*!< Button position */
int isHighlighted; /*!< Highlight state */
} MenuButton;
/**
* @struct MenuBackground
* @brief Menu background animation
*/
typedef struct {
SDL_Surface *sprites[3]; /*!< Animation frames */
SDL_Rect position; /*!< Position on screen */
int currentFrame; /*!< Current animation frame */
} MenuBackground;
/**
* @struct MenuLogo
* @brief Menu logo animation
*/
typedef struct {
SDL_Surface *sprites[11]; /*!< Animation frames */
SDL_Rect position; /*!< Position on screen */
int currentFrame; /*!< Current animation frame */
} MenuLogo;
/**
* @struct MenuText
* @brief Menu text display
*/
typedef struct {
SDL_Rect position; /*!< Position on screen */
TTF_Font *font; /*!< Font for rendering */
SDL_Surface *textSurface; /*!< Rendered text */
SDL_Color textColor; /*!< Text color */
char text[50]; /*!< Text content */
} MenuText;
/**
* @struct GameImage
* @brief Simple image structure
*/
typedef struct {
SDL_Surface *image; /*!< Image surface */
SDL_Rect position; /*!< Position on screen */
} GameImage;
/**
* @struct BackgroundMusic
* @brief Background music structure
*/
typedef struct {
Mix_Music *music; /*!< Music data */
SDL_Rect position; /*!< Display position */
SDL_Surface *albumArt; /*!< Album art image */
int trackNumber; /*!< Track number */
} BackgroundMusic;
#endif /* TYPES_H */