State manager generic data
Read:
Code:
/*
* GameSystem.h
*
* Manages system states.
* Copyright (C) 2006 The Elements of Form
*/
#pragma once
#include "Singleton.h"
/* FIXME: I don't really like the way this works. I have considered using 'Dators' in a similar
* way to matey who wrote the "Enginuity" series @ GameDev. I need to be able to represent generic
* data that the GameSystem can hold on to. unions can suck my ass.
*
* It's not *that* important, but it makes me feel all dirty :-(
*/
// See I could have an array and use some neat const's like STATE_WINDOW_HANDLE which is
// an index into said array.
//const int STATE_WINDOW_HANDLE = 0;
//const int STATE_GAME_INSTANCE = 1;
class GameSystem :public Singleton<GameSystem>
{
public:
GameSystem();
~GameSystem();
inline void SetWindowHandle(HWND hWnd) { m_hGameWindowHandle = hWnd; }
inline void SetGameInstance(HINSTANCE hInst) { m_hGameInstance = hInst; }
inline HWND GetWindowHandle() { return m_hGameWindowHandle; }
inline HINSTANCE GetGameInstance() { return m_hGameInstance; }
private:
HWND m_hGameWindowHandle;
HINSTANCE m_hGameInstance;
};
Feedback for poor, tired me?
Mentioned this: http://www.gamedev.net/reference/art...rticle1959.asp
Any other suggestions?
EDIT: In case you were wondering, "The Elements of Form" is me and my brother. We've decided to go into hobbyist game developement together :)
EDIT2: Why? It makes the most sense to me to have a globally accessible singleton which keeps track of what otherwise would be global data. Horrible, global data.