summaryrefslogtreecommitdiffstats
path: root/src/ui/check.cpp
diff options
context:
space:
mode:
authorMichał Konopacki <konopacki.m@gmail.com>2012-08-15 01:48:49 +0200
committerMichał Konopacki <konopacki.m@gmail.com>2012-08-15 01:48:49 +0200
commit10b2c562fb7635f9850f1441f08ba8b1a71e31e1 (patch)
tree34d2b49911923481a41ba8b24edf630bae27d314 /src/ui/check.cpp
parente942400c8bb9b6836bdfe705111f7ec63ef19e28 (diff)
downloadcolobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.tar.gz
colobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.tar.bz2
colobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.zip
First approach to port 2D UI Interface
- changes in src/ui ; be CAREFUL, not every file is changed in a proper way -> bugs - necessary changes in object/robotmain.h and common/misc.h/.cpp in order to compile
Diffstat (limited to 'src/ui/check.cpp')
-rw-r--r--src/ui/check.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 18c7633..424e4fc 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -15,18 +15,19 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
+//#include <windows.h>
#include <stdio.h>
-#include <d3d.h>
+//#include <d3d.h>
#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/text.h"
+//#include "old/text.h"
#include "ui/check.h"
@@ -47,16 +48,16 @@ CCheck::~CCheck()
// Creates a new button.
-bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
char name[100];
char* p;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -73,14 +74,15 @@ bool CCheck::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN &&
- (m_state & STATE_VISIBLE) &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
+ (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -109,7 +111,7 @@ void CCheck::Draw()
}
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
zoomExt = 1.00f;
zoomInt = 0.95f;
@@ -143,7 +145,7 @@ void CCheck::Draw()
if ( (m_state & STATE_DEAD) == 0 )
{
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
if ( m_state & STATE_CHECK )
{
@@ -159,8 +161,8 @@ void CCheck::Draw()
// Draw the name.
pos.x = m_pos.x+m_dim.y/0.9f;
pos.y = m_pos.y+m_dim.y*0.50f;
- pos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ pos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize)/2.0f;
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}