From e37019943cb77d8c0735b330339a139430202fd8 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 30 Jun 2012 00:12:04 +0200 Subject: Event handling, CApplication and switch to c++-11 - added/changed event structs and event queue in common/event.h - added event handling and some minor functions in CApplication - switched to --std=c++11 because of union in Event struct --- src/app/app.h | 80 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 30 deletions(-) (limited to 'src/app/app.h') diff --git a/src/app/app.h b/src/app/app.h index e83652c..9d689e2 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -60,44 +60,55 @@ public: //! Main event loop int Run(); -protected: - //! Cleans up before exit - void Destroy(); - //! Processes an SDL event to Event struct - void ParseEvent(); - //! Handles some incoming events - void ProcessEvent(Event event); - //! Renders the image in window - bool Render(); - -public: + //! Enters the pause mode void Pause(bool pause); - void StepSimulation(float rTime); - void SetMousePos(Math::Point pos); + //! Updates the simulation state + void StepSimulation(float rTime); void SetShowStat(bool show); bool RetShowStat(); + void SetDebugMode(bool mode); bool RetDebugMode(); + bool RetSetupMode(); + void SetJoystickEnabled(bool enable); + bool RetJoystickEnabled(); + void FlushPressKey(); void ResetKey(); void SetKey(int keyRank, int option, int key); int RetKey(int keyRank, int option); - void SetJoystick(bool enable); - bool RetJoystick(); - void SetMouseType(Gfx::MouseType type); - void SetNiceMouse(bool nice); - bool RetNiceMouse(); - bool RetNiceMouseCap(); + void SetMousePos(Math::Point pos); + + //? void SetNiceMouse(bool nice); + //? bool RetNiceMouse(); + //? bool RetNiceMouseCap(); bool WriteScreenShot(char *filename, int width, int height); protected: + //! Cleans up before exit + void Destroy(); + //! Processes an SDL event to Event struct + void ParseEvent(); + //! Handles some incoming events + void ProcessEvent(Event event); + //! Renders the image in window + bool Render(); + + //! Opens the joystick device + bool OpenJoystick(); + //! Closes the joystick device + void CloseJoystick(); + + //! Converts window coords to interface coords + Math::Point WindowToInterfaceCoords(int x, int y); + //HRESULT ConfirmDevice( DDCAPS* pddDriverCaps, D3DDEVICEDESC7* pd3dDeviceDesc ); //HRESULT Initialize3DEnvironment(); //HRESULT Change3DEnvironment(); @@ -113,14 +124,20 @@ protected: void OutputText(long x, long y, char* str); protected: + CInstanceManager* m_iMan; //! Private (SDL-dependent data) ApplicationPrivate* m_private; - CInstanceManager* m_iMan; + //! Global event queue + CEventQueue* m_eventQueue; + //! Current configuration of display device Gfx::DeviceConfig m_deviceConfig; + //! Graphics engine Gfx::CEngine* m_engine; - CEvent* m_event; - CRobotMain* m_robotMain; + //! Sound subsystem CSound* m_sound; + //! Main class of the proper game engine + CRobotMain* m_robotMain; + //! Code to return at exit int m_exitCode; @@ -128,19 +145,22 @@ protected: bool m_active; bool m_activateApp; bool m_ready; - bool m_joystick; - std::string m_windowTitle; - long m_vidMemTotal; - bool m_appUseZBuffer; - bool m_appUseStereo; bool m_showStats; bool m_debugMode; - bool m_audioState; - bool m_audioTrack; - bool m_niceMouse; bool m_setupMode; + bool m_joystickEnabled; + + std::string m_windowTitle; + + //? long m_vidMemTotal; + //? bool m_appUseZBuffer; + //? bool m_appUseStereo; + //? bool m_audioState; + //? bool m_audioTrack; + //? bool m_niceMouse; + int m_keyState; Math::Vector m_axeKey; Math::Vector m_axeJoy; -- cgit v1.2.3-1-g7c22