aboutsummaryrefslogtreecommitdiff
path: root/progress/src/main.h
blob: 19bd3ca5d8b9d3895aae4e9fdec13056883139e9 (plain)
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
#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED
#include "SDL2/SDL.h"
#include <stdio.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>

#define GRAVEDAD 1
#define CUADRO 0
#define MAX_BULLETS 6
#define ENTIDADES 2


typedef struct
{
    int x, y, w, h;
    int dy, dx;
    int facing_left, walking;
    int camara_x[3], camara_y[3];
    int camara;
    int salto;
    int shooting;
    int cargador;
    int muerto;
} Player1;

typedef struct
{
    int x, y, w, h;
    int dy, dx;
    int facing_left, walking;
    int camara_x[3], camara_y[3];
    int camara;
    int salto;
    int shooting;
    int cargador;
    int muerto;
} Player2;

typedef struct
{
    int x, y, w, h;
    int camara_x[3], camara_y;
    int camara;
} Menu;

typedef struct
{
    int x, y, dx, owner;
} Bala_player_1;

typedef struct
{
    int x, y, w, h;
} Entidades[ENTIDADES];
typedef struct
{
    Player1 player1;
    Player2 player2;
    Menu menu;
    Entidades entidades;
    Bala_player_1 *bala_1[MAX_BULLETS];
    SDL_Texture *balaTexture;
    SDL_Texture *player1Texture;
    SDL_Texture *player2Texture;
    SDL_Texture *ladrilloTexture;
    SDL_Texture *vidaTexture;
    SDL_Texture *menuTexture;
    SDL_Texture *gameOver;
    SDL_Texture *backGround;
    SDL_Renderer *renderer;
    Mix_Chunk *disparo;
    TTF_Font *font;
    int done;
    int maxE;
} GameState;

int processEvents(SDL_Window *window, GameState *gameState);
void doRender(SDL_Renderer *renderer, GameState *gameState);
int menu_events(SDL_Window *window,GameState *gameState);
void menu_render(SDL_Renderer *renderer, GameState *gameState);
void loadScreen(GameState *gameState, SDL_Renderer *renderer);
void collisionDetect(GameState *gameState);
int addBullet(int x, int y, int dx, GameState *gameState, int player);
void processBullet(GameState *gameState);
void removeBullet(int i, GameState *gameState);
void declaraciones(GameState *gameState);
void spriteUpdate(GameState *gameState);
void bulletCollision(GameState *gameState);
void loadGame(GameState *gameState);
#endif // MAIN_H_INCLUDED