88 lines
2.2 KiB
C++
88 lines
2.2 KiB
C++
/*
|
|
* Game.hpp
|
|
*
|
|
* Created on: Feb 9, 2020
|
|
* Author: ayoungblood
|
|
*/
|
|
|
|
#ifndef GAME_HPP_
|
|
#define GAME_HPP_
|
|
#include <SDL.h>
|
|
#include <SDL_image.h>
|
|
#include <SDL_mixer.h>
|
|
#include <stdio.h>
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include "Vector2D.h"
|
|
#include "../assetmgr/AssetManager.h"
|
|
#include "GameStateManager.h"
|
|
//#include "../../libtmx-parser/src/tmxparser.h"
|
|
//#include "libtmx-parser/src/tmxparser.h"
|
|
//#include <tmxparser.h>
|
|
|
|
class ColliderComponent;
|
|
class AssetManager;
|
|
|
|
class Game {
|
|
public:
|
|
Game();
|
|
virtual ~Game();
|
|
void init(const char* title, int width, int height, bool fullscreen, int globalScale);
|
|
void handleEvents();
|
|
void update();
|
|
void render();
|
|
void clean();
|
|
// void printDebug(std::string debugInfo);
|
|
static void drawLine(Vector2D srcpt, Vector2D destpt, int red, int green, int blue);
|
|
static int * predictCollisions();
|
|
bool running() { return isRunning; }
|
|
// static void AddTile(int srcX, int srcY, int xpos, int ypos);
|
|
static SDL_Renderer *renderer;
|
|
static SDL_Event event;
|
|
// static std::vector<ColliderComponent*> colliders;
|
|
// static tmxparser::TmxMap map;
|
|
// gameScene;
|
|
|
|
static bool debugMenu;
|
|
static bool isRunning;
|
|
static bool debugCollisionBoxes;
|
|
static bool gravityOnPlayer;
|
|
static bool playerIsGrounded;
|
|
static bool playerIsJumping;
|
|
static Vector2D playerPosition;
|
|
static Vector2D pVel;
|
|
static Vector2D fontSize;
|
|
static Vector2D nineSliceSize;
|
|
static int nineSliceX0;
|
|
static int nineSliceX1;
|
|
static int nineSliceY0;
|
|
static int nineSliceY1;
|
|
static SDL_Rect camera;
|
|
static SDL_Rect levelMap;
|
|
static AssetManager* assets;
|
|
static GameStateManager* gsm;
|
|
static int pTileX;
|
|
static int pTileY;
|
|
std::string BoolToString(bool b);
|
|
enum groupLabels : std::size_t
|
|
{
|
|
groupMap,
|
|
groupPlayers,
|
|
groupEnemies,
|
|
groupColliders,
|
|
groupProjectiles,
|
|
groupObjects,
|
|
groupBackground,
|
|
groupUI_Layer0,
|
|
groupUI_Layer1,
|
|
groupUI_Layer2,
|
|
groupUI_Layer3
|
|
};
|
|
private:
|
|
int counter = 0;
|
|
// bool isRunning = false;
|
|
SDL_Window *window;
|
|
// SDL_Renderer *renderer;
|
|
};
|
|
#endif /* GAME_HPP_ */
|