summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerihel <erihel@gmail.com>2012-08-17 23:03:52 +0200
committererihel <erihel@gmail.com>2012-08-17 23:03:52 +0200
commitea6269c4110282a3e7c05bec9c7f17ffd1bd5191 (patch)
tree712508692172671a06e6453908704b1c8f7ace94
parent6ff8706d041d0b204734eabcfc4f6acf39cfbbf2 (diff)
downloadcolobot-ea6269c4110282a3e7c05bec9c7f17ffd1bd5191.tar.gz
colobot-ea6269c4110282a3e7c05bec9c7f17ffd1bd5191.tar.bz2
colobot-ea6269c4110282a3e7c05bec9c7f17ffd1bd5191.zip
* ui/key.cpp compiles
* csoundinterface to ccontrol
-rw-r--r--src/common/key.h1
-rw-r--r--src/ui/control.cpp2
-rw-r--r--src/ui/control.h2
-rw-r--r--src/ui/interface.cpp4
-rw-r--r--src/ui/interface.h2
-rw-r--r--src/ui/key.cpp11
-rw-r--r--src/ui/key.h4
7 files changed, 18 insertions, 8 deletions
diff --git a/src/common/key.h b/src/common/key.h
index de31c09..1d03a47 100644
--- a/src/common/key.h
+++ b/src/common/key.h
@@ -29,6 +29,7 @@
// If need arises, it can be changed to custom function or anything else
#define KEY(x) SDLK_ ## x
+
// Key modifier defined as concatenation to KMOD_...
// If need arises, it can be changed to custom function or anything else
#define KEY_MOD(x) KMOD_ ## x
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 867958c..61fd6dd 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -51,7 +51,7 @@ CControl::CControl(CInstanceManager* iMan)
m_event = static_cast< CEventQueue* > ( m_iMan->SearchInstance(CLASS_EVENT) );
m_main = static_cast< CRobotMain* > ( m_iMan->SearchInstance(CLASS_MAIN) );
m_particle = static_cast< Gfx::CParticle* > (m_iMan->SearchInstance(CLASS_PARTICULE));
- m_sound = static_cast< CSound* > (m_iMan->SearchInstance(CLASS_SOUND));
+ m_sound = static_cast< CSoundInterface* > (m_iMan->SearchInstance(CLASS_SOUND));
m_eventType = EVENT_NULL;
m_state = STATE_ENABLE|STATE_VISIBLE|STATE_GLINT;
m_fontSize = Gfx::FONT_SIZE_SMALL;
diff --git a/src/ui/control.h b/src/ui/control.h
index ef49b65..d336ede 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -116,7 +116,7 @@ protected:
CEventQueue* m_event;
CRobotMain* m_main;
Gfx::CParticle* m_particle;
- CSound* m_sound;
+ CSoundInterface* m_sound;
Math::Point m_pos; // corner upper / left
Math::Point m_dim; // dimensions
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index afedfc9..0398e7f 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -20,6 +20,8 @@
#include <ui/interface.h>
+namespace Ui {
+
CInterface::CInterface()
{
@@ -337,3 +339,5 @@ void CInterface::Draw()
m_table[i]->Draw();
}
}
+
+}
diff --git a/src/ui/interface.h b/src/ui/interface.h
index d8f4d62..43f2698 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -49,6 +49,7 @@
#include <ui/map.h>
#include <ui/window.h>
+namespace Ui {
const int MAXCONTROL = 100;
@@ -100,3 +101,4 @@ class CInterface
};
+}
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index 0d73ed0..de668bc 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -20,6 +20,7 @@
#include <ui/key.h>
+namespace Ui {
void GetKeyName(char *name, int key)
{
@@ -90,12 +91,9 @@ bool CKey::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_BUTTON_DOWN && m_bCatch) {
m_bCatch = false;
- if ( TestKey(event.param) ) // impossible ?
- {
+ if ( TestKey(event.param) ) { // impossible ?
m_sound->Play(SOUND_TZOING);
- }
- else
- {
+ } else {
if ( event.param == m_key[0] || event.param == m_key[1] ) {
m_key[0] = event.param;
m_key[1] = 0;
@@ -120,7 +118,7 @@ bool CKey::EventProcess(const Event &event)
bool CKey::TestKey(int key)
{
- if ( key == VK_PAUSE || key == VK_SNAPSHOT ) return true; // blocked key
+ if ( key == KEY(PAUSE) || key == KEY(PRINT) ) return true; // blocked key
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 2; j++) {
@@ -237,3 +235,4 @@ int CKey::GetKey(int option)
return m_key[option];
}
+}
diff --git a/src/ui/key.h b/src/ui/key.h
index db7d856..5ca71b0 100644
--- a/src/ui/key.h
+++ b/src/ui/key.h
@@ -27,9 +27,11 @@
#include <common/iman.h>
#include <common/event.h>
#include <common/restext.h>
+#include <common/key.h>
#include <app/app.h>
+namespace Ui {
class CKey : public CControl
{
@@ -55,3 +57,5 @@ class CKey : public CControl
};
+}
+