summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-08-12 10:45:04 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-08-12 10:45:04 +0200
commitb4b74c30e9aa93ae736db73df5cb0c5d508ec6ed (patch)
treee22269066699afbd3e3464f0b69db08a610f57ef /src/app
parent1996507fd3d4d9de90de99845b71a6bf3fbe62da (diff)
downloadcolobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.tar.gz
colobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.tar.bz2
colobot-b4b74c30e9aa93ae736db73df5cb0c5d508ec6ed.zip
Fixes & testing in CEngine
- fixed bugs in settings modes, etc. - some additions and minor refactoring
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.cpp19
-rw-r--r--src/app/app.h3
2 files changed, 17 insertions, 5 deletions
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);
diff --git a/src/app/app.h b/src/app/app.h
index bfa8c25..0cfaad2 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -164,6 +164,9 @@ public:
//! Polls the state of joystick axes and buttons
void UpdateJoystick();
+ //! Updates the mouse position explicitly
+ void UpdateMouse();
+
void FlushPressKey();
void ResetKey();
void SetKey(int keyRank, int option, int key);