57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
/* ================================================================
|
|
Core
|
|
----------------
|
|
Core is somewhat like a service locator, but with larger engine capabilities - in essence, it is a lot of glue that would normally exist in a global scope. An instance of Core, "core," is provided in the global scope and is the instance that is referenced from other contexts.
|
|
================================================================ */
|
|
#ifndef CORE_HPP
|
|
#define CORE_HPP
|
|
#include "common.hpp"
|
|
#include "RenderScene.hpp"
|
|
#include "AssetManager.hpp"
|
|
#include "Gui.hpp"
|
|
#include "State.hpp"
|
|
#include <vector>
|
|
class Core {
|
|
public:
|
|
Core();
|
|
~Core();
|
|
int initSystem();
|
|
int closeSystem();
|
|
void doProcess();
|
|
void doRender();
|
|
enum Flags { IS_RUNNING = (1 << 1) };
|
|
//
|
|
SDL_Window* getWindow();
|
|
RenderScene *getScene();
|
|
AssetManager *getAssetManager();
|
|
Gui* getGui();
|
|
// Audio* getAudio();
|
|
// Net* getNet();
|
|
int pushState(State *state);
|
|
int popState();
|
|
int getWidth();
|
|
int getHeight();
|
|
unsigned int flags; // Core state flags
|
|
private:
|
|
SDL_Window *v_window; // Our window
|
|
SDL_GLContext v_context; // OpenGL context
|
|
GLint v_fbo; // window framebuffer object
|
|
int v_width; // width of our display
|
|
int v_height; // height of our display
|
|
int v_flags; // video flags
|
|
RenderScene *scene; // our current render scene
|
|
AssetManager *asset_manager; // our asset manager service
|
|
Gui *gui; // our GUI service
|
|
std::vector<State*> states; // our record of states
|
|
// Audio *audio_service;
|
|
// Net *net_service;
|
|
//
|
|
unsigned int tick_rate; // our tickrate
|
|
unsigned int tick_accumulator;// our tickrate accumulator
|
|
unsigned int tick_last; // our last tickstamp
|
|
unsigned int tick_current; // our current tickstamp
|
|
unsigned int tick_delta; // delta between current and last
|
|
};
|
|
extern Core core;
|
|
#endif
|