Added state changing
This commit is contained in:
1 parent
c63fd0ec88
commit
e8bc0903e6
11 files changed
+99
-24
No files matched your search
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
#include "Config.h"
|
||||
#include "Utility.h"
|
||||
#include "IntroGamestate.h"
|
||||
#include <Windows.h>
|
||||
#include <chrono>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace nf {
|
||||
@@ -14,8 +16,9 @@ namespace nf {
|
||||
|
||||
void setWindowIcon(HANDLE hIcon);
|
||||
void setWindowCursor(HCURSOR hCursor);
|
||||
void addState(IGamestate* in);
|
||||
void addDefaultState(IGamestate* in);
|
||||
void addState(const char* stateName, IGamestate* state);
|
||||
void addDefaultState(const char* stateName);
|
||||
void changeState(const char* stateName);
|
||||
void run();
|
||||
void showWindow(bool show);
|
||||
const Config& getConfig() const;
|
||||
@@ -23,6 +26,7 @@ namespace nf {
|
||||
|
||||
~Application();
|
||||
private:
|
||||
void addIntroState();
|
||||
void registerWindowClass();
|
||||
void toggleFullscreen();
|
||||
RECT getWindowRect() const;
|
||||
@@ -52,10 +56,12 @@ namespace nf {
|
||||
int m_FPS;
|
||||
|
||||
//Inactive states states to potentially be loaded during the Application's lifetime
|
||||
std::vector<IGamestate*> m_states;
|
||||
std::unordered_map<const char*, IGamestate*> m_states;
|
||||
//The currently active and loaded states where the top-most is the current one
|
||||
std::vector<IGamestate*> m_activeStates;
|
||||
IntroGamestate* m_sIntro;
|
||||
IGamestate* m_DefaultState;
|
||||
bool m_defaultStateAdded = false;
|
||||
IGamestate* m_currentState;
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "IGamestate.h"
|
||||
#include "Utility.h"
|
||||
|
||||
namespace nf {
|
||||
class IntroGamestate : public IGamestate {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//Master engine include (Is this even useful?)
|
||||
|
||||
#include "Application.h"
|
||||
#include "Config.h"
|
||||
#include "Utility.h"
|
||||
#include "Application.h"
|
||||
@@ -10,8 +10,8 @@ namespace nf {
|
||||
#define DEBUGINIT std::chrono::steady_clock::time_point Debug::m_initTime = std::chrono::high_resolution_clock::now();
|
||||
#define SleepS(x) std::this_thread::sleep_for(std::chrono::seconds(x))
|
||||
#define SleepMS(x) std::this_thread::sleep_for(std::chrono::milliseconds(x))
|
||||
#define Log(x) Debug::LogImp(x)
|
||||
#define Error(x) Debug::ErrorImp(x,__FILENAME__, __LINE__);\
|
||||
#define Log(x) nf::Debug::LogImp(x)
|
||||
#define Error(x) nf::Debug::ErrorImp(x,__FILENAME__, __LINE__);\
|
||||
DebugBreak();
|
||||
|
||||
class Debug {
|
||||
|
||||
Reference in new issue
Block a user