From b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 12 Aug 2012 10:45:04 +0200 Subject: Fixes & testing in CEngine - fixed bugs in settings modes, etc. - some additions and minor refactoring --- src/app/app.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/app/app.cpp') diff --git a/src/app/app.cpp b/src/app/app.cpp index 4f7120d..a0518db 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -215,8 +215,7 @@ bool CApplication::Create() if (! m_device->Create() ) { SystemDialog( SDT_ERROR, "COLOBT - Fatal Error", - std::string("Error in CDevice::Create() :\n") + - std::string(m_device->GetError()) ); + std::string("Error in CDevice::Create()") ); m_exitCode = 1; return false; } @@ -229,8 +228,7 @@ bool CApplication::Create() if (! m_engine->Create() ) { SystemDialog( SDT_ERROR, "COLOBT - Fatal Error", - std::string("Error in CEngine::Init() :\n") + - std::string(m_engine->GetError()) ); + std::string("Error in CEngine::Init()") ); m_exitCode = 1; return false; } @@ -498,6 +496,14 @@ void CApplication::UpdateJoystick() } } +void CApplication::UpdateMouse() +{ + Math::IntPoint pos; + SDL_GetMouseState(&pos.x, &pos.y); + m_systemMousePos = m_engine->WindowToInterfaceCoords(pos); + m_engine->SetMousePos(m_systemMousePos); +} + int CApplication::Run() { m_active = true; @@ -572,6 +578,10 @@ int CApplication::Run() m_robotMain->ProcessEvent(event); */ } + /* Update mouse position explicitly right before rendering + * because mouse events are usually way behind */ + UpdateMouse(); + // Update game and render a frame during idle time (no messages are waiting) Render(); } @@ -857,7 +867,6 @@ bool CApplication::GetSystemMouseVisibile() return result == SDL_ENABLE; } - void CApplication::SetSystemMousePos(Math::Point pos) { Math::IntPoint windowPos = m_engine->InterfaceToWindowCoords(pos); -- cgit v1.2.3-1-g7c22