2022-03-21 21:53:51 -04:00
|
|
|
#ifndef MarsGameH
|
|
|
|
#define MarsGameH
|
|
|
|
|
|
|
|
#include "raylib.h"
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class OTRGame {
|
|
|
|
public:
|
|
|
|
std::map<std::string, Font> Fonts;
|
|
|
|
std::map<std::string, Model> Models;
|
|
|
|
std::map<std::string, Texture2D> Textures;
|
|
|
|
float ModelRotation = 0.0f;
|
|
|
|
Camera camera;
|
|
|
|
|
|
|
|
void preload();
|
|
|
|
void init();
|
|
|
|
void imgui();
|
|
|
|
void update();
|
|
|
|
void draw();
|
|
|
|
void exit();
|
2022-03-24 14:48:22 -04:00
|
|
|
|
|
|
|
inline bool CloseRequested() { return closeRequested; }
|
2022-03-21 21:53:51 -04:00
|
|
|
protected:
|
|
|
|
void LoadTexture(const std::string& name, const std::string& path) {
|
|
|
|
const Image tmp = LoadImage(path.c_str());
|
|
|
|
Textures[name] = LoadTextureFromImage(tmp);
|
|
|
|
UnloadImage(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoadFont(const std::string& name, const std::string& path) {
|
|
|
|
Font font = LoadFontEx(path.c_str(), 16, nullptr, 0);
|
|
|
|
GenTextureMipmaps(&font.texture);
|
|
|
|
SetTextureFilter(font.texture, TEXTURE_FILTER_POINT);
|
|
|
|
Fonts[name] = font;
|
|
|
|
}
|
2022-03-24 14:48:22 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool closeRequested = false;
|
2022-03-21 21:53:51 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern OTRGame* Game;
|
|
|
|
|
|
|
|
#endif
|