forked from mswlandi/megamania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.h
82 lines (72 loc) · 1.74 KB
/
structs.h
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
#ifndef STRUCTS_H_INCLUDED
#define STRUCTS_H_INCLUDED
#include <SFML/Graphics.h>
/// Structs
// Struct for button
typedef struct str_button
{
sfText* text;
sfRectangleShape* base;
} TYPE_BUTTON;
// Struct for menu
typedef struct str_menu
{
sfFont* font;
sfText* megamaniaLogo;
TYPE_BUTTON buttons[3]; // 0 - PLAY / 1 - OPTIONS / 2 - CREDITS
} TYPE_MENU;
// Struct for fire
typedef struct str_fire
{
int flag; // If it's 1, this fire is enabled. Else, it's 0.
float posX;
float posY;
}TYPE_FIRE;
// Struct for enemy
typedef struct str_enemy
{
float posX;
float posY;
sfVector2f initialPos;
int color;
int flag; // If this enemy is alive, it's 1.
TYPE_FIRE fire;
} TYPE_ENEMIES;
// Struct for player ship
typedef struct str_playership
{
sfSprite* shipSprite;
float posX;
float posY;
} TYPE_PLAYERSHIP;
// Struct that holds all of the game's sprites
typedef struct str_sprites
{
TYPE_PLAYERSHIP ship;
sfSprite* fire;
sfSprite* enemyFire;
sfSprite* menuBackground;
sfSprite* background;
sfSprite* life;
sfSprite* lifebar;
sfSprite* gameover;
sfSprite* enemyBlack;
sfSprite* enemyRed;
sfSprite* enemyBlue;
sfSprite* enemyGreen;
sfRectangleShape* fillLifeBar;
sfRectangleShape* fillLifeBar2;
sfRectangleShape* base;
TYPE_ENEMIES enemies[];
} TYPE_ALLSPRITES;
// Struct which holds all about the logic of level
typedef struct str_level
{
char* mapName;
int levelSpeed;
char direction; // Can be 'R', to right, 'L', to left, or 'B', to both synchronously.
int numberEnemies;
int paused;
float lastShot;
} TYPE_LEVEL;
#endif // STRUCTS_H_INCLUDED