From 7c5a3514dd6e907866bddcbb09b4d9cbd958dd8e Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 29 Jul 2012 15:09:53 +0200 Subject: Video mode changing - added video mode querying & changing - added joystick querying & changing - cleaned up CApplication interface --- src/graphics/engine/engine.cpp | 20 +++++++++++++++++--- src/graphics/engine/engine.h | 21 +++++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) (limited to 'src/graphics/engine') diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 0914f9e..e544ee3 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -62,9 +62,6 @@ Gfx::CEngine::CEngine(CInstanceManager *iMan, CApplication *app) m_sound = NULL; m_terrain = NULL; - m_dim.x = 640; - m_dim.y = 480; - m_lastDim = m_dim; m_focus = 0.75f; m_baseTime = 0; m_lastTime = 0; @@ -272,6 +269,12 @@ bool Gfx::CEngine::AfterDeviceSetInit() return true; } +void Gfx::CEngine::ResetAfterDeviceChanged() +{ + // TODO +} + + Gfx::Texture Gfx::CEngine::CreateTexture(const std::string &texName, const Gfx::TextureCreateParams ¶ms) { CImage img; @@ -727,3 +730,14 @@ void Gfx::CEngine::AddStatisticTriangle(int count) { m_statisticTriangle += count; } + +void Gfx::CEngine::SetShowStat(bool show) +{ + m_showStats = show; +} + +bool Gfx::CEngine::GetShowStat() +{ + return m_showStats; +} + diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index 1348cdd..25c5e5d 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -26,6 +26,7 @@ #include "graphics/core/texture.h" #include "graphics/core/vertex.h" #include "math/intpoint.h" +#include "math/intsize.h" #include "math/matrix.h" #include "math/point.h" #include "math/vector.h" @@ -513,21 +514,33 @@ public: CEngine(CInstanceManager *iMan, CApplication *app); ~CEngine(); + //! Returns whether the device was initialized bool GetWasInit(); + //! Returns the last error encountered std::string GetError(); + //! Performs the first initialization, before a device was set bool Create(); + //! Frees all resources before exit void Destroy(); + //! Sets the device to be used void SetDevice(Gfx::CDevice *device); + //! Returns the current device Gfx::CDevice* GetDevice(); + //! Performs initialization after a device was created and set bool AfterDeviceSetInit(); + //! Resets some states and flushes textures after device was changed (e.g. resoulution changed) + void ResetAfterDeviceChanged(); + void SetTerrain(Gfx::CTerrain* terrain); + //! Processes incoming event bool ProcessEvent(const Event &event); + //! Renders a single frame bool Render(); @@ -859,6 +872,9 @@ protected: bool m_wasInit; std::string m_error; + //! Whether to show stats (FPS, etc) + bool m_showStats; + int m_blackSrcBlend[2]; int m_blackDestBlend[2]; int m_whiteSrcBlend[2]; @@ -887,8 +903,9 @@ protected: bool m_render; bool m_movieLock; - Math::IntPoint m_dim; - Math::IntPoint m_lastDim; + //! Current size of window + Math::IntSize m_size; + Math::IntSize m_lastSize; std::vector m_objectTree; std::vector m_objects; -- cgit v1.2.3-1-g7c22