init
This commit is contained in:
commit
2f372ede93
212 changed files with 50289 additions and 0 deletions
12
include/assets.hpp
Normal file
12
include/assets.hpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include "texture.hpp"
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct PhoenixAssets {
|
||||
std::vector<PhoenixTexture> textures;
|
||||
};
|
||||
|
||||
void PLoadTextureAsset(std::string filePath);
|
||||
PhoenixTexture *PGetTextureById(int id);
|
13
include/config.hpp
Normal file
13
include/config.hpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#define SCREEN_WIDTH 1000
|
||||
#define SCREEN_HEIGHT 1000
|
||||
#define MAX_AMMO 400
|
||||
|
||||
// 32x32 textures
|
||||
#define TEXTURE_WIDTH 32
|
||||
#define TEXTURE_HEIGHT 32
|
||||
|
||||
// Texture IDs
|
||||
#define BRICK_WALL_TEXTURE_ID 0
|
||||
#define FLOOR_TEXTURE_ID 1
|
24
include/map.hpp
Normal file
24
include/map.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct MapData {
|
||||
std::vector<std::string> mapTiles;
|
||||
std::vector<std::string> mapEnemys;
|
||||
};
|
||||
|
||||
struct Map {
|
||||
std::string mapName;
|
||||
std::string mapVersion;
|
||||
std::string mapAuthor;
|
||||
int mapWidth; // Width of the map in tiles
|
||||
int mapHeight;
|
||||
int mapScaleX; // Rendering scale
|
||||
int mapScaleY; // Rendering scale
|
||||
|
||||
MapData data;
|
||||
};
|
||||
|
||||
Map PLoadMapFromFile(std::string filepath);
|
||||
void PSaveMapToFile(Map *map, std::string filepath);
|
||||
void PRenderMap(Map *map);
|
22
include/phoenix.hpp
Normal file
22
include/phoenix.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "map.hpp"
|
||||
#include "texture.hpp"
|
||||
|
||||
void PRunBoostrap();
|
||||
|
||||
class PhoenixGame {
|
||||
public:
|
||||
PhoenixGame();
|
||||
|
||||
void present();
|
||||
|
||||
void run();
|
||||
|
||||
void render();
|
||||
|
||||
private:
|
||||
bool mb_isOpen = false;
|
||||
Map m_currentMap;
|
||||
SDL_Rect m_viewport;
|
||||
};
|
13
include/state.hpp
Normal file
13
include/state.hpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
#include "assets.hpp"
|
||||
#include "config.hpp"
|
||||
#include <SDL.h>
|
||||
|
||||
struct GlobalState {
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
PhoenixAssets assets;
|
||||
int scale = 20;
|
||||
};
|
||||
|
||||
extern GlobalState state;
|
15
include/texture.hpp
Normal file
15
include/texture.hpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "config.hpp"
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct PhoenixTexture {
|
||||
SDL_Texture *texture;
|
||||
};
|
||||
|
||||
PhoenixTexture PLoadTexture(std::string filePath);
|
||||
|
||||
void PRenderTexture(PhoenixTexture *texture, int x, int y);
|
||||
|
||||
void PDestroyTexture(PhoenixTexture *texture);
|
Loading…
Add table
Add a link
Reference in a new issue