Added Drawable, rewrote changing states, and organized class definitions and macros
This commit is contained in:
1 parent
1f6bb4630c
commit
2f4e0ebfac
12 files changed
+141
-109
No files matched your search
@@ -17,11 +17,11 @@ namespace nf {
|
||||
|
||||
void setWindowIcon(HANDLE hIcon);
|
||||
void setWindowCursor(HCURSOR hCursor);
|
||||
void addState(IGamestate* state, const char* stateName);
|
||||
void addDefaultState(const char* stateName);
|
||||
void addState(IGamestate* state, const std::string& stateName);
|
||||
void addDefaultState(const std::string& stateName);
|
||||
void run();
|
||||
void changeState(const std::string& stateName);
|
||||
void showWindow(bool show);
|
||||
void changeState(const char* stateName);
|
||||
const HWND& getWindow();
|
||||
void changeConfig(const Config& in);
|
||||
const Config& getConfig() const;
|
||||
@@ -30,12 +30,13 @@ namespace nf {
|
||||
|
||||
~Application();
|
||||
private:
|
||||
void startIntroState();
|
||||
void runMainGameThread();
|
||||
void registerWindowClass();
|
||||
void toggleFullscreen();
|
||||
RECT getWindowRect() const;
|
||||
void calculateNewWindowPos(int& x, int& y);
|
||||
void toggleFullscreen();
|
||||
void runMainGameThread();
|
||||
void startIntroState();
|
||||
void doStateChange();
|
||||
|
||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@@ -56,13 +57,15 @@ namespace nf {
|
||||
const double m_minFrametime = 1.0 / m_targetFPS;
|
||||
int m_FPS;
|
||||
|
||||
//Inactive states states to potentially be active during the Application's lifetime
|
||||
//Inactive states to potentially be active during the Application's lifetime
|
||||
//Mapped to const char* to be referenced later in the frontend
|
||||
std::unordered_map<const char*, IGamestate*> m_states;
|
||||
std::unordered_map<std::string, IGamestate*> m_states;
|
||||
IntroGamestate* m_sIntro;
|
||||
IGamestate* m_DefaultState;
|
||||
bool m_defaultStateAdded = false;
|
||||
bool m_defaultStateAdded;
|
||||
IGamestate* m_currentState;
|
||||
bool m_stateChange;
|
||||
std::string m_nextState;
|
||||
|
||||
//Array of booleans that represent keyboard and mouse input minus the scrollwheel
|
||||
bool m_input[164];
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace nf {
|
||||
class Drawable {
|
||||
public:
|
||||
Drawable();
|
||||
|
||||
~Drawable();
|
||||
private:
|
||||
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <Windows.h>
|
||||
|
||||
#include "Drawable.h"
|
||||
|
||||
namespace nf {
|
||||
class Application;
|
||||
|
||||
@@ -16,5 +19,8 @@ namespace nf {
|
||||
|
||||
HDC m_hdc;
|
||||
HGLRC m_hglrc;
|
||||
|
||||
std::vector<Drawable*> m_lGame;
|
||||
std::vector<Drawable*> m_lUI;
|
||||
};
|
||||
}
|
||||
@@ -16,8 +16,8 @@ namespace nf {
|
||||
//Prints a nicely-formatted message complete with a timestamp
|
||||
#define Log(x) nf::Debug::LogImp(x)
|
||||
//Prints error message and breaks the debugger
|
||||
#define Error(x) nf::Debug::ErrorImp(x,__FILENAME__, __LINE__);\
|
||||
__debugbreak();
|
||||
#define Error(x) {nf::Debug::ErrorImp(x,__FILENAME__, __LINE__);\
|
||||
__debugbreak();}
|
||||
|
||||
class Debug {
|
||||
private:
|
||||
@@ -34,8 +34,8 @@ __debugbreak();
|
||||
#else
|
||||
#define DEBUGINIT
|
||||
#define Log(x)
|
||||
#define Error(x) MessageBox(FindWindow(L"NFClass", NULL), toWide(x), L"NF Engine Error", MB_OK | MB_ICONERROR);\
|
||||
std::exit(-1)
|
||||
#define Error(x) {MessageBox(FindWindow(L"NFClass", NULL), toWide(x), L"NF Engine Error", MB_OK | MB_ICONERROR);\
|
||||
std::exit(-1);}
|
||||
#endif
|
||||
|
||||
const wchar_t* toWide(const char* in);
|
||||
|
||||
Reference in new issue
Block a user