summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 18:32:18 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 18:32:18 +0200
commit51884cef8e015bccbe1fa96dc56dc2f32439ccc5 (patch)
tree53974a01650d52101c96dd11da5e2235c61a02d6 /src/ui
parent4a639cf543c15d45a37674d7eadaf09c23c2203d (diff)
downloadcolobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.gz
colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.bz2
colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.zip
Input bindings rewrite
- moved input bindings to CRobotMain - added virtual keymod and joystick button key presses - fixed putenv error; other minor fixes
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/edit.cpp12
-rw-r--r--src/ui/edit.h3
-rw-r--r--src/ui/maindialog.cpp68
-rw-r--r--src/ui/studio.cpp4
4 files changed, 41 insertions, 46 deletions
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 4c558f4..123f985 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -82,7 +82,6 @@ CEdit::CEdit () : CControl ()
m_text = new char[m_maxChar+1];
memset(m_text, 0, m_maxChar+1);
m_len = 0;
- m_app = CApplication::GetInstancePointer();
memset(m_lineOffset, 0, sizeof(int) * EDITLINEMAX);
@@ -1465,7 +1464,7 @@ bool CEdit::ReadText(const char *filename, int addSize)
char iName[50];
char text[50];
float iWidth;
- KeyRank key;
+ InputSlot slot;
bool bInSoluce, bBOL;
if ( filename[0] == 0 ) return false;
@@ -1795,10 +1794,10 @@ bool CEdit::ReadText(const char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- if ( SearchKey(buffer+i+5, key) )
+ if ( SearchKey(buffer+i+5, slot) )
{
- res = 0;
- //res = m_app->GetInputBinding(key).key; // TODO input bindings
+ CRobotMain* main = CRobotMain::GetInstancePointer();
+ res = main->GetInputBinding(slot).key;
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1817,8 +1816,7 @@ bool CEdit::ReadText(const char *filename, int addSize)
m_format[j] = font;
j ++;
- // res = m_app->GetInputBinding(key).joy; // TODO input bindings
- res = 0;
+ res = main->GetInputBinding(slot).joy;
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
diff --git a/src/ui/edit.h b/src/ui/edit.h
index b6766f8..c5c6cf6 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -35,8 +35,6 @@
#include "common/iman.h"
#include "common/restext.h"
-#include "app/app.h"
-
#include <vector>
@@ -246,7 +244,6 @@ protected:
int m_len; // length used in m_text
int m_cursor1; // offset cursor
int m_cursor2; // offset cursor
- CApplication *m_app;
bool m_bMulti; // true -> multi-line
bool m_bEdit; // true -> editable
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index a2fc733..a40cc27 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -5956,41 +5956,41 @@ void CMainDialog::ChangeSetupQuality(int quality)
static int key_table[KEY_TOTAL] =
{
/* TODO: #if _SCHOOL & _TEEN
- KEYRANK_LEFT,
- KEYRANK_RIGHT,
- KEYRANK_UP,
- KEYRANK_DOWN,
- KEYRANK_CAMERA,
- KEYRANK_NEAR,
- KEYRANK_AWAY,
- KEYRANK_HELP,
- KEYRANK_PROG,
- KEYRANK_SPEED10,
- KEYRANK_SPEED15,
- KEYRANK_SPEED20,
- KEYRANK_QUIT,
+ INPUT_SLOT_LEFT,
+ INPUT_SLOT_RIGHT,
+ INPUT_SLOT_UP,
+ INPUT_SLOT_DOWN,
+ INPUT_SLOT_CAMERA,
+ INPUT_SLOT_NEAR,
+ INPUT_SLOT_AWAY,
+ INPUT_SLOT_HELP,
+ INPUT_SLOT_PROG,
+ INPUT_SLOT_SPEED10,
+ INPUT_SLOT_SPEED15,
+ INPUT_SLOT_SPEED20,
+ INPUT_SLOT_QUIT,
#else */
- KEYRANK_LEFT,
- KEYRANK_RIGHT,
- KEYRANK_UP,
- KEYRANK_DOWN,
- KEYRANK_GUP,
- KEYRANK_GDOWN,
- KEYRANK_ACTION,
- KEYRANK_CAMERA,
- KEYRANK_VISIT,
- KEYRANK_NEXT,
- KEYRANK_HUMAN,
- KEYRANK_DESEL,
- KEYRANK_NEAR,
- KEYRANK_AWAY,
- KEYRANK_HELP,
- KEYRANK_PROG,
- KEYRANK_CBOT,
- KEYRANK_SPEED10,
- KEYRANK_SPEED15,
- KEYRANK_SPEED20,
- KEYRANK_QUIT,
+ INPUT_SLOT_LEFT,
+ INPUT_SLOT_RIGHT,
+ INPUT_SLOT_UP,
+ INPUT_SLOT_DOWN,
+ INPUT_SLOT_GUP,
+ INPUT_SLOT_GDOWN,
+ INPUT_SLOT_ACTION,
+ INPUT_SLOT_CAMERA,
+ INPUT_SLOT_VISIT,
+ INPUT_SLOT_NEXT,
+ INPUT_SLOT_HUMAN,
+ INPUT_SLOT_DESEL,
+ INPUT_SLOT_NEAR,
+ INPUT_SLOT_AWAY,
+ INPUT_SLOT_HELP,
+ INPUT_SLOT_PROG,
+ INPUT_SLOT_CBOT,
+ INPUT_SLOT_SPEED10,
+ INPUT_SLOT_SPEED15,
+ INPUT_SLOT_SPEED20,
+ INPUT_SLOT_QUIT,
// #endif
};
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 809ed0c..c546c57 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -241,8 +241,8 @@ bool CStudio::EventProcess(const Event &event)
if ( event.type == EVENT_KEY_DOWN )
{
- if ( event.key.key == m_app->GetInputBinding(INPUT_SLOT_CBOT).key // ||
- /*TODO event.param == m_app->GetKey(KEYRANK_CBOT, 1)*/ )
+ if ( event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).key ||
+ event.param == m_main->GetInputBinding(INPUT_SLOT_CBOT).joy )
{
if ( m_helpFilename.length() > 0 )
{