aboutsummaryrefslogtreecommitdiff
#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