summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ui/button.cpp44
-rw-r--r--src/ui/button.h11
-rw-r--r--src/ui/check.cpp18
-rw-r--r--src/ui/check.h10
-rw-r--r--src/ui/color.cpp57
-rw-r--r--src/ui/color.h26
-rw-r--r--src/ui/compass.cpp63
-rw-r--r--src/ui/compass.h13
-rw-r--r--src/ui/control.cpp187
-rw-r--r--src/ui/control.h27
-rw-r--r--src/ui/displayinfo.cpp413
-rw-r--r--src/ui/displayinfo.h33
-rw-r--r--src/ui/displaytext.cpp174
-rw-r--r--src/ui/displaytext.h32
-rw-r--r--src/ui/edit.cpp470
-rw-r--r--src/ui/edit.h124
-rw-r--r--src/ui/editvalue.cpp94
-rw-r--r--src/ui/editvalue.h30
-rw-r--r--src/ui/gauge.cpp46
-rw-r--r--src/ui/gauge.h10
-rw-r--r--src/ui/group.cpp334
-rw-r--r--src/ui/group.h9
-rw-r--r--src/ui/image.cpp56
-rw-r--r--src/ui/image.h18
-rw-r--r--src/ui/scroll.cpp74
-rw-r--r--src/ui/scroll.h6
-rw-r--r--src/ui/shortcut.cpp66
-rw-r--r--src/ui/shortcut.h5
-rw-r--r--src/ui/slider.cpp85
-rw-r--r--src/ui/slider.h7
-rw-r--r--src/ui/target.cpp68
-rw-r--r--src/ui/target.h2
-rw-r--r--src/ui/window.cpp257
-rw-r--r--src/ui/window.h31
34 files changed, 1542 insertions, 1358 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index ab2c644..1f11a0c 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -24,22 +25,22 @@
#include "graphics/engine/engine.h"
//#include "common/language.h"
//#include "old/math3d.h"
-//#include "common/event.h"
+#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
#include "ui/button.h"
+namespace Ui {
const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f;
-
// Object's constructor.
-CButton::CButton(CInstanceManager* iMan) : CControl(iMan)
+CButton::CButton() : CControl()
{
m_bCapture = false;
m_bImmediat = false;
@@ -162,10 +163,10 @@ void CButton::Draw()
if ( m_state & STATE_WARNING ) // shading yellow-black?
{
- pos.x = m_pos.x-( 8.0f/640.0f);
- pos.y = m_pos.y-( 4.0f/480.0f);
- dim.x = m_dim.x+(16.0f/640.0f);
- dim.y = m_dim.y+( 8.0f/480.0f);
+ pos.x = m_pos.x - ( 8.0f / 640.0f);
+ pos.y = m_pos.y - ( 4.0f / 480.0f);
+ dim.x = m_dim.x + (16.0f / 640.0f);
+ dim.y = m_dim.y + ( 8.0f / 480.0f);
if ( m_state & STATE_SHADOW )
{
DrawShadow(pos, dim);
@@ -188,17 +189,17 @@ void CButton::Draw()
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
- uv1.x = 128.0f/256.0f;
- uv1.y = 96.0f/256.0f;
- uv2.x = 136.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ uv1.x = 128.0f / 256.0f;
+ uv1.y = 96.0f / 256.0f;
+ uv2.x = 136.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
if ( (m_state & STATE_ENABLE) == 0 )
{
- uv1.x += 16.0f/256.0f;
- uv2.x += 16.0f/256.0f;
+ uv1.x += 16.0f / 256.0f;
+ uv2.x += 16.0f / 256.0f;
}
uv1.x += dp;
@@ -206,15 +207,15 @@ void CButton::Draw()
uv2.x -= dp;
uv2.y -= dp;
- pos.y = m_pos.y+5.0f/480.0f;
- dim.y = m_dim.y-10.0f/480.0f;
- pos.x = m_pos.x+5.0f/640.0f;
- dim.x = 3.0f/640.0f;
+ pos.y = m_pos.y + 5.0f / 480.0f;
+ dim.y = m_dim.y - 10.0f / 480.0f;
+ pos.x = m_pos.x + 5.0f / 640.0f;
+ dim.x = 3.0f / 640.0f;
DrawIcon(pos, dim, uv1, uv2, 0.0f);
- uv1.x += 8.0f/256.0f;
- uv2.x += 8.0f/256.0f;
- pos.x = m_pos.x+m_dim.x-5.0f/640.0f-3.0f/640.0f;
+ uv1.x += 8.0f / 256.0f;
+ uv2.x += 8.0f / 256.0f;
+ pos.x = m_pos.x + m_dim.x - 5.0f / 640.0f - 3.0f / 640.0f;
DrawIcon(pos, dim, uv1, uv2, 0.0f);
}
#endif
@@ -248,3 +249,4 @@ bool CButton::GetRepeat()
return m_bRepeat;
}
+}
diff --git a/src/ui/button.h b/src/ui/button.h
index 4f1740d..924a4d8 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,11 +22,11 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+}
-//class CD3DEngine;
-
-
-
+namespace Ui {
class CButton : public CControl
{
public:
@@ -53,4 +54,4 @@ protected:
float m_repeat;
};
-
+}
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 424e4fc..b4ddf4a 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -16,10 +17,10 @@
//#include <windows.h>
-#include <stdio.h>
+//#include <stdio.h>
//#include <d3d.h>
-#include "common/struct.h"
+//#include "common/struct.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
//#include "old/math3d.h"
@@ -28,14 +29,15 @@
#include "common/iman.h"
#include "common/restext.h"
//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/check.h"
-
+namespace Ui {
// Object's constructor.
-CCheck::CCheck(CInstanceManager* iMan) : CControl(iMan)
+CCheck::CCheck() : CControl()
{
}
@@ -103,7 +105,7 @@ void CCheck::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
iDim = m_dim;
- m_dim.x = m_dim.y*0.75f; // square
+ m_dim.x = m_dim.y * 0.75f; // square
if ( m_state & STATE_SHADOW )
{
@@ -159,10 +161,10 @@ void CCheck::Draw()
if ( m_state & STATE_DEAD ) return;
// Draw the name.
- pos.x = m_pos.x+m_dim.y/0.9f;
- pos.y = m_pos.y+m_dim.y*0.50f;
+ pos.x = m_pos.x + m_dim.y / 0.9f;
+ pos.y = m_pos.y + m_dim.y * 0.50f;
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);
}
-
+}
diff --git a/src/ui/check.h b/src/ui/check.h
index 66375c0..0b6a1f2 100644
--- a/src/ui/check.h
+++ b/src/ui/check.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,11 +22,11 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+}
-class CD3DEngine;
-
-
-
+namespace Ui {
class CCheck : public CControl
{
public:
@@ -43,4 +44,5 @@ protected:
protected:
};
+}
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 3ba68b3..2d463b5 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -16,7 +17,7 @@
//#include <windows.h>
-#include <stdio.h>
+//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
@@ -32,7 +33,7 @@
#include "ui/color.h"
-
+namespace Ui {
const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f;
@@ -40,7 +41,8 @@ const float DELAY2 = 0.1f;
// Object's constructor.
-CColor::CColor(CInstanceManager* iMan) : CControl(iMan)
+//CColor::CColor(CInstanceManager* iMan) : CControl(iMan)
+CColor::CColor() : CControl()
{
m_bRepeat = false;
m_repeat = 0.0f;
@@ -160,42 +162,42 @@ void CColor::Draw()
device = m_engine->GetDevice();
- p1.x = m_pos.x+(4.0f/640.0f);
- p1.y = m_pos.y+(4.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(4.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(4.0f/480.0f);
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
+ p1.x = m_pos.x + (4.0f / 640.0f);
+ p1.y = m_pos.y + (4.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (4.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (4.0f / 480.0f);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
- p1.x = m_pos.x+(5.0f/640.0f);
- p1.y = m_pos.y+(5.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(5.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(5.0f/480.0f);
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
+ p1.x = m_pos.x + (5.0f / 640.0f);
+ p1.y = m_pos.y + (5.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (5.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (5.0f / 480.0f);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(4);
#else
- p1.x = m_pos.x+(3.0f/640.0f);
- p1.y = m_pos.y+(3.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(3.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(3.0f/480.0f);
+ p1.x = m_pos.x + (3.0f / 640.0f);
+ p1.y = m_pos.y + (3.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (3.0f / 480.0f);
color = GetColor();
m_engine->SetTexture("xxx.tga"); // no texture
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- vertex[0] = Gfx::VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f,0.0f));
- vertex[1] = Gfx::VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f,0.0f));
- vertex[2] = Gfx::VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point(0.0f,0.0f));
- vertex[3] = Gfx::VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f,0.0f));
+ vertex[0] = Gfx::VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[1] = Gfx::VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[2] = Gfx::VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[3] = Gfx::VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
device = m_engine->GetDevice();
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
@@ -226,3 +228,4 @@ Gfx::Color CColor::GetColor()
}
+}
diff --git a/src/ui/color.h b/src/ui/color.h
index 740b7e9..2666f94 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -22,27 +23,29 @@
#include "ui/control.h"
//#include "graphics/engine/engine.h"
+namespace Gfx{
+class CEngine;
+struct Color;
+}
-//class CEngine;
-
-
-
+namespace Ui {
class CColor : public CControl
{
public:
+// CColor(CInstanceManager* iMan);
CColor();
- virtual ~CColor();
+ virtual ~CColor();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetRepeat(bool bRepeat);
- bool GetRepeat();
+ void SetRepeat(bool bRepeat);
+ bool GetRepeat();
- void SetColor(Gfx::Color color);
+ void SetColor(Gfx::Color color);
Gfx::Color GetColor();
protected:
@@ -54,3 +57,4 @@ protected:
};
+}
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index d4a15a8..95e75b3 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -16,7 +17,7 @@
//#include <windows.h>
-#include <stdio.h>
+//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
@@ -32,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan)
+//CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan)
+CCompass::CCompass() : CControl()
{
m_dir = 0.0f;
}
@@ -102,15 +104,15 @@ void CCompass::Draw()
p2.x = m_pos.x + m_dim.x;
p2.y = m_pos.y + m_dim.y;
- c.x = (p1.x+p2.x)/2.0f;
- c.y = (p1.y+p2.y)/2.0f; // center
+ c.x = (p1.x + p2.x) / 2.0f;
+ c.y = (p1.y + p2.y) / 2.0f; // center
- uv1.x = 64.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -118,10 +120,10 @@ void CCompass::Draw()
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point( uv1.x,uv2.y));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point( uv1.x,uv1.y));
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point( uv2.x,uv2.y));
- vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point( uv2.x,uv1.y));
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
@@ -129,33 +131,33 @@ void CCompass::Draw()
if ( m_state & STATE_ENABLE )
{
p1.x = c.x;
- p1.y = c.y+m_dim.x*0.40f;
+ p1.y = c.y + m_dim.x * 0.40f;
p1 = Math::RotatePoint(c, m_dir, p1);
- p1.x = c.x+(p1.x-c.x)*(m_dim.x/m_dim.y);
+ p1.x = c.x + (p1.x - c.x) * (m_dim.x / m_dim.y);
- p2.x = c.x+m_dim.x*0.20f;
- p2.y = c.y-m_dim.x*0.40f;
+ p2.x = c.x + m_dim.x * 0.20f;
+ p2.y = c.y - m_dim.x * 0.40f;
p2 = Math::RotatePoint(c, m_dir, p2);
- p2.x = c.x+(p2.x-c.x)*(m_dim.x/m_dim.y);
+ p2.x = c.x + (p2.x - c.x) * (m_dim.x / m_dim.y);
- p3.x = c.x-m_dim.x*0.20f;
- p3.y = c.y-m_dim.x*0.40f;
+ p3.x = c.x - m_dim.x * 0.20f;
+ p3.y = c.y - m_dim.x * 0.40f;
p3 = Math::RotatePoint(c, m_dir, p3);
- p3.x = c.x+(p3.x-c.x)*(m_dim.x/m_dim.y);
+ p3.x = c.x + (p3.x - c.x) * (m_dim.x / m_dim.y);
- uv1.x = 96.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 104.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 96.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 104.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point( uv1.x,uv1.y));
- vertex[1] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point( uv1.x,uv2.y));
- vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point( uv2.x,uv2.y));
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
m_engine->AddStatisticTriangle(1);
@@ -170,9 +172,10 @@ void CCompass::SetDirection(float dir)
m_dir = dir;
}
-float CCompass::RetDirection()
+float CCompass::GetDirection()
{
return m_dir;
}
+}
diff --git a/src/ui/compass.h b/src/ui/compass.h
index fcbf860..1d48907 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,14 +22,15 @@
#include "ui/control.h"
+namespace Gfx {
+class CEngine;
+}
-//class CEngine;
-
-
-
+namespace Ui {
class CCompass : public CControl
{
public:
+// CCompass(CInstanceManager* iMan);
CCompass();
virtual ~CCompass();
@@ -39,7 +41,7 @@ public:
void Draw();
void SetDirection(float dir);
- float RetDirection();
+ float GetDirection();
protected:
@@ -48,3 +50,4 @@ protected:
};
+}
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 9893fc8..37392d7 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -21,7 +21,7 @@
//#include <d3d.h>
#include "graphics/core/device.h"
-#include "common/struct.h"
+//#include "common/struct.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
#include "common/language.h"
@@ -36,11 +36,12 @@
//#include "old/text.h"
#include "graphics/engine/text.h"
//#include "old/sound.h"
+#include "sound/sound.h"
#include "ui/control.h"
-
+namespace Ui {
// Object's constructor.
CControl::CControl()
@@ -94,7 +95,7 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even
m_eventType = eventType;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
GetResource(RES_EVENT, m_eventType, text);
@@ -120,7 +121,7 @@ void CControl::SetPos(Math::Point pos)
m_pos = pos;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
}
@@ -136,7 +137,7 @@ void CControl::SetDim(Math::Point dim)
m_dim = dim;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
}
@@ -411,8 +412,8 @@ void CControl::GlintCreate(Math::Point ref, bool bLeft, bool bUp)
{
float offset;
- offset = 8.0f/640.0f;
- if ( offset > m_dim.x/4.0f) offset = m_dim.x/4.0f;
+ offset = 8.0f / 640.0f;
+ if ( offset > m_dim.x / 4.0f) offset = m_dim.x / 4.0f;
if ( bLeft )
{
@@ -426,17 +427,17 @@ void CControl::GlintCreate(Math::Point ref, bool bLeft, bool bUp)
}
offset = 8.0f/480.0f;
- if ( offset > m_dim.y/4.0f) offset = m_dim.y/4.0f;
+ if ( offset > m_dim.y / 4.0f) offset = m_dim.y / 4.0f;
if ( bUp )
{
- m_glintCorner1.y = ref.y-offset;
+ m_glintCorner1.y = ref.y - offset;
m_glintCorner2.y = ref.y;
}
else
{
m_glintCorner1.y = ref.y;
- m_glintCorner2.y = ref.y+offset;
+ m_glintCorner2.y = ref.y + offset;
}
m_bGlint = true;
@@ -459,12 +460,12 @@ void CControl::GlintFrame(const Event &event)
if ( m_glintProgress >= 2.0f && Detect(m_glintMouse) )
{
- pos.x = m_glintCorner1.x + (m_glintCorner2.x-m_glintCorner1.x)*Math::Rand();
- pos.y = m_glintCorner1.y + (m_glintCorner2.y-m_glintCorner1.y)*Math::Rand();
+ pos.x = m_glintCorner1.x + (m_glintCorner2.x - m_glintCorner1.x) * Math::Rand();
+ pos.y = m_glintCorner1.y + (m_glintCorner2.y - m_glintCorner1.y) * Math::Rand();
pos.z = 0.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
- dim.x = ((15.0f+Math::Rand()*15.0f)/640.0f);
- dim.y = dim.x/0.75f;
+ dim.x = ((15.0f + Math::Rand() * 15.0f) / 640.0f);
+ dim.y = dim.x / 0.75f;
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICONTROL,
1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE );
@@ -544,7 +545,7 @@ void CControl::Draw()
if ( m_name[0] == 0 ) // button without name?
{
//? DrawPart(icon, zoomExt, 0.0f);
- DrawPart(icon, zoomExt, 8.0f/256.0f);
+ DrawPart(icon, zoomExt, 8.0f / 256.0f);
if ( m_state & STATE_DEAD ) return;
@@ -589,23 +590,23 @@ void CControl::Draw()
// if ( m_justif < 0 )
if ( m_textAlign == Gfx::TEXT_ALIGN_LEFT )
{
- pos.x = m_pos.x+m_dim.x-m_dim.y*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + m_dim.x - m_dim.y * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
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);
}
else if ( m_textAlign == Gfx::TEXT_ALIGN_RIGHT )
// else if ( m_justif > 0 )
{
- pos.x = m_pos.x+m_dim.y*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + m_dim.y * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
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);
}
else
{
- pos.x = m_pos.x+m_dim.x*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + m_dim.x * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
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);
}
@@ -627,26 +628,26 @@ void CControl::DrawPart(int icon, float zoom, float ex)
if ( (m_state & STATE_CARD ) &&
(m_state & STATE_CHECK) )
{
- p2.y += (2.0f/480.0f); // a bit above
+ p2.y += (2.0f / 480.0f); // a bit above
}
- c.x = (p1.x+p2.x)/2.0f;
- c.y = (p1.y+p2.y)/2.0f; // center
+ c.x = (p1.x + p2.x)/2.0f;
+ c.y = (p1.y + p2.y)/2.0f; // center
- p1.x = (p1.x-c.x)*zoom + c.x;
- p1.y = (p1.y-c.y)*zoom + c.y;
- p2.x = (p2.x-c.x)*zoom + c.x;
- p2.y = (p2.y-c.y)*zoom + c.y;
+ p1.x = (p1.x - c.x) * zoom + c.x;
+ p1.y = (p1.y - c.y) * zoom + c.y;
+ p2.x = (p2.x - c.x) * zoom + c.x;
+ p2.y = (p2.y - c.y) * zoom + c.y;
p2.x -= p1.x;
p2.y -= p1.y;
- uv1.x = (32.0f/256.0f)*(icon%8);
- uv1.y = (32.0f/256.0f)*(icon/8); // uv texture
- uv2.x = (32.0f/256.0f)+uv1.x;
- uv2.y = (32.0f/256.0f)+uv1.y;
+ uv1.x = (32.0f / 256.0f) * (icon%8);
+ uv1.y = (32.0f / 256.0f) * (icon/8); // uv texture
+ uv2.x = (32.0f / 256.0f) + uv1.x;
+ uv2.y = (32.0f / 256.0f) + uv1.y;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -689,8 +690,8 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
{
if ( dim.x >= dim.y )
{
- p3.x = p1.x + ex*dim.y/(uv2.y-uv1.y);
- p4.x = p2.x - ex*dim.y/(uv2.y-uv1.y);
+ p3.x = p1.x + ex*dim.y / (uv2.y - uv1.y);
+ p4.x = p2.x - ex*dim.y / (uv2.y - uv1.y);
vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
@@ -706,17 +707,17 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
}
else
{
- p3.y = p1.y + ex*dim.x/(uv2.x-uv1.x);
- p4.y = p2.y - ex*dim.x/(uv2.x-uv1.x);
-
- vertex[0] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x,uv2.y ));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv2.y ));
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x,uv2.y-ex));
- vertex[3] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x,uv2.y-ex));
- vertex[4] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x,uv1.y+ex));
- vertex[5] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x,uv1.y+ex));
- vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x,uv1.y ));
- vertex[7] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv1.y ));
+ p3.y = p1.y + ex*dim.x / (uv2.x - uv1.x);
+ p4.y = p2.y - ex*dim.x / (uv2.x - uv1.x);
+
+ vertex[0] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y ));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y ));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y ));
+ vertex[7] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y ));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
@@ -743,8 +744,8 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- if ( corner.x > dim.x/2.0f ) corner.x = dim.x/2.0f;
- if ( corner.y > dim.y/2.0f ) corner.y = dim.y/2.0f;
+ if ( corner.x > dim.x / 2.0f ) corner.x = dim.x / 2.0f;
+ if ( corner.y > dim.y / 2.0f ) corner.y = dim.y / 2.0f;
p1.x = pos.x;
p1.y = pos.y;
@@ -756,38 +757,38 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
p4.y = p2.y - corner.y;
// Bottom horizontal band.
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y ));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y-ex));
- vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p1.y, 0.0f), n, Math::Point(uv1.x+ex,uv2.y ));
- vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x+ex,uv2.y-ex));
- vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p1.y, 0.0f), n, Math::Point(uv2.x-ex,uv2.y ));
- vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x-ex,uv2.y-ex));
- vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y ));
- vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y-ex));
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y ));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p1.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y ));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y - ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p1.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y ));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y - ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y ));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
// Central horizontal band.
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y-ex));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y+ex));
- vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x+ex,uv2.y-ex));
- vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x+ex,uv1.y+ex));
- vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x-ex,uv2.y-ex));
- vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x-ex,uv1.y+ex));
- vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y-ex));
- vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y+ex));
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y - ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y + ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y - ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y + ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
// Top horizontal band.
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y+ex));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y ));
- vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x+ex,uv1.y+ex));
- vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p2.y, 0.0f), n, Math::Point(uv1.x+ex,uv1.y ));
- vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x-ex,uv1.y+ex));
- vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p2.y, 0.0f), n, Math::Point(uv2.x-ex,uv1.y ));
- vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y+ex));
- vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y ));
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y ));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y + ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p2.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y ));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y + ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p2.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y ));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y ));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
}
@@ -799,15 +800,15 @@ void CControl::DrawWarning(Math::Point pos, Math::Point dim)
Math::Point uv1, uv2;
float dp;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f;
- uv1.y = 208.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
@@ -848,25 +849,25 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep)
m_engine->SetTexture("button2.tga");
m_engine->SetState( Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- pos.x += deep*0.010f*0.75f;
- pos.y -= deep*0.015f;
- dim.x += deep*0.005f*0.75f;
- dim.y += deep*0.005f;
+ pos.x += deep * 0.010f * 0.75f;
+ pos.y -= deep * 0.015f;
+ dim.x += deep * 0.005f * 0.75f;
+ dim.y += deep * 0.005f;
- uv1.x = 192.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 224.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 192.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 224.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
- DrawIcon(pos, dim, uv1, uv2, corner, 6.0f/256.0f);
+ DrawIcon(pos, dim, uv1, uv2, corner, 6.0f / 256.0f);
}
@@ -874,10 +875,10 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep)
bool CControl::Detect(Math::Point pos)
{
- return ( pos.x >= m_pos.x &&
- pos.x <= m_pos.x+m_dim.x &&
- pos.y >= m_pos.y &&
- pos.y <= m_pos.y+m_dim.y );
+ return ( pos.x >= m_pos.x &&
+ pos.x <= m_pos.x + m_dim.x &&
+ pos.y >= m_pos.y &&
+ pos.y <= m_pos.y + m_dim.y );
}
-
+}
diff --git a/src/ui/control.h b/src/ui/control.h
index ca57207..13cf998 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -20,22 +20,23 @@
//#include "old/text.h"
-#include <common/struct.h>
-#include <common/event.h>
+#include "graphics/engine/text.h"
+//#include "common/struct.h"
+#include "common/event.h"
-#include <graphics/engine/engine.h>
-#include <graphics/engine/text.h>
-#include <graphics/engine/particle.h>
-
-#include <sound/sound.h>
+namespace Gfx {
+class CEngine;
+class CParticle;
+};
-// class CEvent;
+class CInstanceManager;
+class CEvent;
//class Gfx::CEngine;
-// class CRobotMain;
+class CRobotMain;
//class Gfx::CParticle;
-//class CSound;
-
+class CSoundInterface;
+namespace Ui {
enum ControlState
{
STATE_ENABLE = (1<<0), // active
@@ -62,7 +63,8 @@ enum ControlState
class CControl
{
public:
- CControl();
+// CControl(CInstanceManager* iMan);
+ CControl ();
virtual ~CControl();
virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@@ -141,3 +143,4 @@ protected:
};
+}
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 39a4a14..bbd3740 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,21 +18,22 @@
// displayinfo.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/d3dmath.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "object/robotmain.h"
-#include "old/camera.h"
+//#include "old/camera.h"
#include "object/object.h"
#include "object/motion/motion.h"
#include "object/motion/motiontoto.h"
@@ -41,29 +43,31 @@
#include "ui/edit.h"
#include "ui/group.h"
#include "ui/window.h"
-#include "old/particule.h"
-#include "old/light.h"
-#include "old/text.h"
+//#include "old/particule.h"
+#include "graphics/engine/particle.h"
+//#include "old/light.h"
+//#include "old/text.h"
#include "script/cbottoken.h"
#include "ui/displayinfo.h"
-
+namespace Ui {
// Object's constructor.
-CDisplayInfo::CDisplayInfo(CInstanceManager* iMan)
+//CDisplayInfo::CDisplayInfo(CInstanceManager* iMan)
+CDisplayInfo::CDisplayInfo()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_STUDIO, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
+ m_engine = static_cast <Gfx::CEngine*> (m_iMan->SearchInstance(CLASS_ENGINE));
+ m_event = static_cast <CEventQueue*> (m_iMan->SearchInstance(CLASS_EVENT));
+ m_interface = static_cast <CInterface*> (m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN));
+ m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA));
+ m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_light = static_cast <Gfx::CLight*> (m_iMan->SearchInstance(CLASS_LIGHT));
m_bInfoMaximized = true;
m_bInfoMinimized = false;
@@ -87,22 +91,22 @@ CDisplayInfo::~CDisplayInfo()
bool CDisplayInfo::EventProcess(const Event &event)
{
- CWindow* pw;
- CEdit* edit;
- CSlider* slider;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CSlider* slider;
CMotionToto* toto;
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
EventFrame(event);
HyperUpdate();
}
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( m_toto != 0 )
{
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
toto->SetMousePos(event.pos);
@@ -110,21 +114,21 @@ bool CDisplayInfo::EventProcess(const Event &event)
}
}
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
- if ( event.event == pw->RetEventMsgClose() )
+ if ( event.type == pw->GetEventTypeClose() )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_INFOOK;
+ newEvent.type = EVENT_OBJECT_INFOOK;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_SATCOM_HUSTON )
+ if ( event.type == EVENT_SATCOM_HUSTON )
{
ChangeIndexButton(SATCOM_HUSTON);
}
- if ( event.event == EVENT_SATCOM_SAT )
+ if ( event.type == EVENT_SATCOM_SAT )
{
ChangeIndexButton(SATCOM_SAT);
}
@@ -132,90 +136,90 @@ bool CDisplayInfo::EventProcess(const Event &event)
//? {
//? ChangeIndexButton(SATCOM_OBJECT);
//? }
- if ( event.event == EVENT_SATCOM_LOADING )
+ if ( event.type == EVENT_SATCOM_LOADING )
{
ChangeIndexButton(SATCOM_LOADING);
}
- if ( event.event == EVENT_SATCOM_PROG )
+ if ( event.type == EVENT_SATCOM_PROG )
{
ChangeIndexButton(SATCOM_PROG);
}
- if ( event.event == EVENT_SATCOM_SOLUCE )
+ if ( event.type == EVENT_SATCOM_SOLUCE )
{
ChangeIndexButton(SATCOM_SOLUCE);
}
- if ( event.event == EVENT_HYPER_HOME ||
- event.event == EVENT_HYPER_PREV ||
- event.event == EVENT_HYPER_NEXT )
+ if ( event.type == EVENT_HYPER_HOME ||
+ event.type == EVENT_HYPER_PREV ||
+ event.type == EVENT_HYPER_NEXT )
{
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
- edit->HyperGo(event.event);
+ edit->HyperGo(event.type);
HyperUpdate();
}
}
- if ( event.event == EVENT_HYPER_SIZE1 ) // size 1?
+ if ( event.type == EVENT_HYPER_SIZE1 ) // size 1?
{
m_main->SetFontSize(9.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE2 ) // size 2?
+ if ( event.type == EVENT_HYPER_SIZE2 ) // size 2?
{
m_main->SetFontSize(10.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE3 ) // size 3?
+ if ( event.type == EVENT_HYPER_SIZE3 ) // size 3?
{
m_main->SetFontSize(12.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE4 ) // size 4?
+ if ( event.type == EVENT_HYPER_SIZE4 ) // size 4?
{
m_main->SetFontSize(15.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_STUDIO_SIZE ) // size?
+ if ( event.type == EVENT_STUDIO_SIZE ) // size?
{
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == 0 ) return false;
- m_main->SetFontSize(9.0f+slider->RetVisibleValue()*6.0f);
+ m_main->SetFontSize(9.0f+slider->GetVisibleValue()*6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_COPY ) // copy ?
+ if ( event.type == EVENT_HYPER_COPY ) // copy ?
{
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
edit->Copy();
}
}
- if ( event.event == EVENT_LBUTTONDOWN ||
- event.event == EVENT_LBUTTONUP )
+ if ( ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 )||
+ ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 ))
{
UpdateCopyButton();
}
- if ( event.event == EVENT_WINDOW4 ) // window moved?
+ if ( event.type == EVENT_WINDOW4 ) // window moved?
{
- m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->RetPos();
- m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->RetDim();
+ m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->GetPos();
+ m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->GetDim();
AdjustDisplayInfo(m_infoActualPos, m_infoActualDim);
}
- if ( event.event == pw->RetEventMsgReduce() )
+ if ( event.type == pw->GetEventTypeReduce() )
{
if ( m_bInfoMinimized )
{
@@ -241,7 +245,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
pw->SetMinimized(m_bInfoMinimized);
}
}
- if ( event.event == pw->RetEventMsgFull() )
+ if ( event.type == pw->GetEventTypeFull() )
{
if ( m_bInfoMaximized )
{
@@ -260,7 +264,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
m_bInfoMaximized = true;
}
//? m_main->SetEditFull(m_bInfoMaximized);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
pw->SetMaximized(m_bInfoMaximized);
@@ -299,31 +303,31 @@ bool CDisplayInfo::EventFrame(const Event &event)
void CDisplayInfo::HyperUpdate()
{
- CWindow* pw;
- CEdit* edit;
- CButton* button;
- bool bEnable;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CButton* button;
+ bool bEnable;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_HOME);
button->SetState(STATE_ENABLE, bEnable);
}
- button = (CButton*)pw->SearchControl(EVENT_HYPER_PREV);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_PREV));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_PREV);
button->SetState(STATE_ENABLE, bEnable);
}
- button = (CButton*)pw->SearchControl(EVENT_HYPER_NEXT);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_NEXT));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_NEXT);
@@ -336,12 +340,12 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
{
- D3DLIGHT7 light;
+ Gfx::CLight light;
Math::Point pos, dim;
- CWindow* pw;
- CEdit* edit;
- CButton* button;
- CSlider* slider;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CButton* button;
+ Ui::CSlider* slider;
CMotionToto* toto;
m_index = index;
@@ -349,10 +353,10 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
//? CreateObjectsFile();
- m_bEditLock = m_main->RetEditLock();
+ m_bEditLock = m_main->GetEditLock();
if ( m_bEditLock ) // edition running program?
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw != 0 )
{
pw->ClearState(STATE_ENABLE); // CStudio inactive
@@ -361,10 +365,10 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
m_main->SetEditLock(true, false);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->RetPause();
+ m_bInitPause = m_engine->GetPause();
m_engine->SetPause(true);
- m_infoCamera = m_camera->RetType();
- m_camera->SetType(CAMERA_INFO);
+ m_infoCamera = m_camera->GetType();
+ m_camera->SetType(Gfx::CAM_TYPE_INFO);
pos = m_infoActualPos = m_infoFinalPos;
dim = m_infoActualDim = m_infoFinalDim;
@@ -383,7 +387,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
edit->SetState(STATE_SHADOW);
edit->SetMultiFont(true);
edit->SetMaxChar(10000);
- edit->SetFontType(FONT_COLOBOT);
+ edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce);
edit->ReadText(filename);
edit->HyperHome(filename);
@@ -447,20 +451,20 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
m_engine->SetDrawWorld(false); // doesn't draw anything in the interface
m_engine->SetDrawFront(true); // toto draws on the interface
- m_particule->SetFrameUpdate(SH_WORLD, false); // particles break into world
+ m_particle->SetFrameUpdate(Gfx::SH_WORLD, false); // particles break into world
m_toto = SearchToto();
if ( m_toto != 0 )
{
m_toto->SetDrawFront(true);
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
toto->StartDisplayInfo();
}
}
-
+// TODO
ZeroMemory(&light, sizeof(light));
light.dltType = D3DLIGHT_DIRECTIONAL;
light.dcvDiffuse.r = 1.0f;
@@ -483,31 +487,31 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
CGroup* group;
Math::Point pos, dim;
- wpos.x = 50.0f/640.0f;
- wpos.y = 30.0f/480.0f;
- wdim.x = 540.0f/640.0f;
- wdim.y = 420.0f/480.0f;
+ wpos.x = 50.0f / 640.0f;
+ wpos.y = 30.0f / 480.0f;
+ wdim.x = 540.0f / 640.0f;
+ wdim.y = 420.0f / 480.0f;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
pw->SetPos(wpos);
pw->SetDim(wdim);
- wdim = pw->RetDim();
+ wdim = pw->GetDim();
}
- pos.x = (50.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+24.0f+10.0f+324.0f-48.0f)/480.0f;
- dim.x = 48.0f/640.0f;
- dim.y = 48.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON);
+ pos.x = (50.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f - 48.0f) / 480.0f;
+ dim.x = 48.0f / 640.0f;
+ dim.y = 48.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SAT);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SAT));
if ( button != 0 )
{
button->SetPos(pos);
@@ -520,136 +524,136 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
//? button->SetPos(pos);
//? button->SetDim(dim);
//? }
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_PROG);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_PROG));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SOLUCE);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SOLUCE));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f+5.0f)/640.0f;
- pos.y = (30.0f+10.0f+4.0f)/480.0f;
- dim.x = (48.0f-10.0f)/640.0f;
- dim.y = 24.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_OBJECT_INFOOK);
+ pos.x = (50.0f + 10.0f + 5.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 4.0f) / 480.0f;
+ dim.x = (48.0f - 10.0f) / 640.0f;
+ dim.y = 24.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_OBJECT_INFOOK));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f+48.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f)/480.0f;
- dim.x = 462.0f/640.0f;
- dim.y = 358.0f/480.0f;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ pos.x = (50.0f + 10.0f + 48.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f) / 480.0f;
+ dim.x = 462.0f / 640.0f;
+ dim.y = 358.0f / 480.0f;
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
edit->SetPos(pos);
edit->SetDim(dim);
}
- pos.x = (50.0f+10.0f+48.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+358.0f+10.0f)/480.0f;
- dim.x = 32.0f/640.0f;
- dim.y = 32.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_PREV);
+ pos.x = (50.0f + 10.0f + 48.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 358.0f + 10.0f) / 480.0f;
+ dim.x = 32.0f / 640.0f;
+ dim.y = 32.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_PREV));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_NEXT);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_NEXT));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 50.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE1);
+ pos.x += 50.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE1));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE2);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE2));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE3);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE3));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE4);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE4));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- dim.x = 18.0f/640.0f;
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
+ pos.x += 35.0f / 640.0f;
+ dim.x = 18.0f / 640.0f;
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 )
{
slider->SetPos(pos);
slider->SetDim(dim);
}
- pos.x += 50.0f/640.0f;
- dim.x = 32.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY);
+ pos.x += 50.0f / 640.0f;
+ dim.x = 32.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_COPY));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+24.0f+10.0f+324.0f+6.0f)/480.0f;
- dim.x = 48.0f/640.0f;
- dim.y = 40.0f/480.0f;
- group = (CGroup*)pw->SearchControl(EVENT_LABEL2); // symbol SatCom
+ pos.x = (50.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f + 6.0f) / 480.0f;
+ dim.x = 48.0f / 640.0f;
+ dim.y = 40.0f / 480.0f;
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL2)); // symbol SatCom
if ( group != 0 )
{
group->SetPos(pos);
group->SetDim(dim);
}
- pos.x = (50.0f+10.0f+14.0f)/640.0f;
- pos.y = (30.0f+10.0f+6.0f)/480.0f;
- dim.x = 20.0f/640.0f;
- dim.y = 20.0f/480.0f;
- group = (CGroup*)pw->SearchControl(EVENT_LABEL3); // symbol stand-by
+ pos.x = (50.0f + 10.0f + 14.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 6.0f) / 480.0f;
+ dim.x = 20.0f / 640.0f;
+ dim.y = 20.0f / 480.0f;
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL3)); // symbol stand-by
if ( group != 0 )
{
group->SetPos(pos);
@@ -661,26 +665,26 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
void CDisplayInfo::ChangeIndexButton(int index)
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
char* filename;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
if ( m_index != -1 )
{
- m_main->SetDisplayInfoPosition(m_index, RetPosition());
+ m_main->SetDisplayInfoPosition(m_index, GetPosition());
}
m_index = index;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
- filename = m_main->RetDisplayInfoName(m_index);
+ filename = m_main->GetDisplayInfoName(m_index);
edit->ReadText(filename);
edit->HyperHome(filename);
- SetPosition(m_main->RetDisplayInfoPosition(m_index));
+ SetPosition(m_main->GetDisplayInfoPosition(m_index));
}
UpdateIndexButton();
@@ -690,10 +694,10 @@ void CDisplayInfo::ChangeIndexButton(int index)
void CDisplayInfo::UpdateIndexButton()
{
- CWindow* pw;
- CButton* button;
- CGroup* group;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CGroup* group;
+ Ui::CEdit* edit;
Math::Point pos, dim;
char* filename;
char* loading;
@@ -708,10 +712,10 @@ void CDisplayInfo::UpdateIndexButton()
4, // SATCOM_SOLUCE
};
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON);
@@ -719,7 +723,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0);
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SAT);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SAT));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SAT);
@@ -736,7 +740,7 @@ void CDisplayInfo::UpdateIndexButton()
//? }
loading = 0;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_LOADING);
@@ -744,7 +748,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, loading[0]!=0);
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_PROG);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_PROG));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_PROG);
@@ -752,7 +756,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0 && (m_index==SATCOM_LOADING||m_index==SATCOM_PROG||(loading!=0&&loading[0]==0)));
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SOLUCE);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SOLUCE));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE);
@@ -760,7 +764,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce);
}
- group = (CGroup*)pw->SearchControl(EVENT_LABEL1);
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL1));
if ( group != 0 )
{
if ( m_index == -1 )
@@ -789,7 +793,7 @@ void CDisplayInfo::UpdateIndexButton()
}
#endif
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
//? edit->SetHiliteCap(m_index==SATCOM_LOADING);
@@ -803,20 +807,20 @@ void CDisplayInfo::UpdateIndexButton()
void CDisplayInfo::UpdateCopyButton()
{
- CWindow* pw;
- CButton* button;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CEdit* edit;
int c1, c2;
//? if ( m_index != SATCOM_LOADING ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_COPY));
if ( button == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
edit->GetCursor(c1, c2);
@@ -828,10 +832,10 @@ void CDisplayInfo::UpdateCopyButton()
void CDisplayInfo::StopDisplayInfo()
{
- CWindow* pw;
+ Ui::CWindow* pw;
CMotionToto* toto;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
m_interface->DeleteControl(EVENT_WINDOW4);
@@ -853,13 +857,13 @@ void CDisplayInfo::StopDisplayInfo()
m_engine->SetDrawWorld(true); // draws all on the interface
m_engine->SetDrawFront(false); // draws nothing on the interface
- m_particule->SetFrameUpdate(SH_WORLD, true);
- m_particule->FlushParticule(SH_FRONT);
- m_particule->FlushParticule(SH_INTERFACE);
+ m_particle->SetFrameUpdate(Gfx::SH_WORLD, true);
+ m_particle->FlushParticule(Gfx::SH_FRONT);
+ m_particle->FlushParticule(Gfx::SH_INTERFACE);
if ( m_toto != 0 )
{
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = (CMotionToto*)m_toto->GetMotion();
if ( toto != 0 )
{
toto->StopDisplayInfo();
@@ -875,13 +879,13 @@ void CDisplayInfo::StopDisplayInfo()
void CDisplayInfo::SetPosition(int pos)
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
edit->SetFirstLine(pos);
@@ -889,18 +893,18 @@ void CDisplayInfo::SetPosition(int pos)
// Returns the position.
-int CDisplayInfo::RetPosition()
+int CDisplayInfo::GetPosition()
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return 0;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return 0;
- return edit->RetFirstLine();
+ return edit->GetFirstLine();
}
@@ -909,18 +913,18 @@ int CDisplayInfo::RetPosition()
void CDisplayInfo::ViewDisplayInfo()
{
- CWindow* pw;
- CEdit* edit;
- POINT dim;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Math::Point dim;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
- dim = m_engine->RetDim();
- edit->SetFontSize(m_main->RetFontSize()/(dim.x/640.0f));
+ dim = m_engine->GetDim();
+ edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f));
}
// Returns the object human.
@@ -936,7 +940,7 @@ CObject* CDisplayInfo::SearchToto()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
return pObj;
@@ -995,7 +999,7 @@ void ObjectWrite(FILE* file, ObjectList list[], int i)
strcat(line, res);
strcat(line, "\\u ");
- p = RetHelpFilename(list[i].type);
+ p = GetHelpFilename(list[i].type);
if ( p[0] == 0 ) return;
strcat(line, p+5); // skip "help\"
p = strstr(line, ".txt");
@@ -1026,11 +1030,11 @@ void CDisplayInfo::CreateObjectsFile()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( !pObj->RetSelectable() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( !pObj->GetSelectable() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_NULL ) continue;
if ( type == OBJECT_FIX ) continue;
@@ -1217,3 +1221,4 @@ void CDisplayInfo::CreateObjectsFile()
}
+}
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index dbc9bed..1eaa39b 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -24,19 +25,28 @@
class CInstanceManager;
-class CD3DEngine;
+//class CD3DEngine;
class CEvent;
class CRobotMain;
-class CCamera;
-class CInterface;
+//class CCamera;
+
class CObject;
-class CParticule;
+//class CLight;
+
+namespace Gfx {
+class CEngine;
+class Camera;
+class Particle;
class CLight;
+}
+namespace Ui {
+class CInterface;
class CDisplayInfo
{
public:
+// CDisplayInfo(CInstanceManager* iMan);
CDisplayInfo();
~CDisplayInfo();
@@ -46,7 +56,7 @@ public:
void StopDisplayInfo();
void SetPosition(int pos);
- int RetPosition();
+ int GetPosition();
protected:
bool EventFrame(const Event &event);
@@ -61,19 +71,19 @@ protected:
protected:
CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CEvent* m_event;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
CRobotMain* m_main;
- CCamera* m_camera;
+ Gfx::CCamera* m_camera;
CInterface* m_interface;
- CParticule* m_particule;
- CLight* m_light;
+ Gfx::CParticle* m_particle;
+ Gfx::CLight* m_light;
bool m_bInfoMaximized;
bool m_bInfoMinimized;
int m_index;
- CameraType m_infoCamera;
+ Gfx::CameraType m_infoCamera;
Math::Point m_infoNormalPos;
Math::Point m_infoNormalDim;
Math::Point m_infoActualPos;
@@ -88,3 +98,4 @@ protected:
};
+}
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index 9be81f4..1e26f7f 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,12 +18,13 @@
// displaytext.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -35,28 +37,31 @@
#include "ui/label.h"
#include "ui/window.h"
#include "ui/group.h"
-#include "old/text.h"
-#include "old/sound.h"
+//#include "old/text.h"
+//#include "old/sound.h"
+//#include "sound/sound.h"
#include "ui/displaytext.h"
-
+namespace Ui {
const float FONTSIZE = 12.0f;
// Object's constructor.
-CDisplayText::CDisplayText(CInstanceManager* iMan)
+//CDisplayText::CDisplayText(CInstanceManager* iMan)
+CDisplayText::CDisplayText()
{
int i;
- m_iMan = iMan;
+// m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_DISPLAYTEXT, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
+ m_engine = (Gfx::CEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_sound = (CSoundInterface*)m_iMan->SearchInstance(CLASS_SOUND);
for ( i=0 ; i<MAXDTLINE ; i++ )
{
@@ -94,9 +99,9 @@ bool CDisplayText::EventProcess(const Event &event)
{
int i;
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
for ( i=0 ; i<MAXDTLINE ; i++ )
{
@@ -124,9 +129,9 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time)
if ( pObj == 0 ) return;
- pos = pObj->RetPosition(0);
- h = RetIdealHeight(pObj);
- d = RetIdealDist(pObj);
+ pos = pObj->GetPosition(0);
+ h = GetIdealHeight(pObj);
+ d = GetIdealDist(pObj);
DisplayError(err, pos, h, d, time);
}
@@ -186,9 +191,9 @@ void CDisplayText::DisplayText(char *text, CObject* pObj,
if ( pObj == 0 ) return;
- pos = pObj->RetPosition(0);
- h = RetIdealHeight(pObj);
- d = RetIdealDist(pObj);
+ pos = pObj->GetPosition(0);
+ h = GetIdealHeight(pObj);
+ d = GetIdealDist(pObj);
DisplayText(text, pos, h, d, time, type);
}
@@ -199,10 +204,10 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
{
CObject* toto;
CMotion* motion;
- CWindow* pw;
- CButton* button;
- CGroup* group;
- CLabel* label;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CGroup* group;
+ Ui::CLabel* label;
Math::Point pos, ppos, dim;
Sound sound;
float hLine, hBox;
@@ -210,7 +215,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
if ( !m_bEnable ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 )
{
pos.x = 0.0f;
@@ -221,12 +226,12 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
}
hBox = 0.045f;
- hLine = m_engine->RetText()->RetHeight(FONTSIZE, FONT_COLOBOT);
+ hLine = m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, FONTSIZE);
nLine = 0;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- group = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i));
+ group = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i)));
if ( group == 0 ) break;
nLine ++;
}
@@ -247,13 +252,13 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
if ( type == TT_WARNING ) icon = 10; // blue
if ( type == TT_INFO ) icon = 8; // green
if ( type == TT_MESSAGE ) icon = 11; // yellow
- pw->CreateGroup(pos, dim, icon, EventMsg(EVENT_DT_GROUP0+nLine));
+ pw->CreateGroup(pos, dim, icon, EventType(EVENT_DT_GROUP0+nLine));
pw->SetTrashEvent(false);
ppos = pos;
ppos.y -= hLine/2.0f;
- label = pw->CreateLabel(ppos, dim, -1, EventMsg(EVENT_DT_LABEL0+nLine), text);
+ label = pw->CreateLabel(ppos, dim, -1, EventType(EVENT_DT_LABEL0+nLine), text);
if ( label != 0 )
{
label->SetFontSize(FONTSIZE);
@@ -261,7 +266,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
dim.x = dim.y*0.75f;
pos.x -= dim.x;
- button = pw->CreateButton(pos, dim, 14, EventMsg(EVENT_DT_VISIT0+nLine));
+ button = pw->CreateButton(pos, dim, 14, EventType(EVENT_DT_VISIT0+nLine));
if ( goal.x == 0.0f &&
goal.y == 0.0f &&
@@ -279,7 +284,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
toto = SearchToto();
if ( toto != 0 )
{
- motion = toto->RetMotion();
+ motion = toto->GetMotion();
if ( motion != 0 )
{
if ( type == TT_ERROR )
@@ -324,18 +329,18 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
void CDisplayText::ClearText()
{
- CWindow* pw;
+ Ui::CWindow* pw;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
for ( i=0 ; i<MAXDTLINE ; i++ )
{
if ( pw != 0 )
{
- pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i));
+ pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
+ pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
+ pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
}
m_bExist[i] = false;
m_visitGoal[i] = Math::Vector(0.0f, 0.0f, 0.0f);
@@ -349,32 +354,32 @@ void CDisplayText::ClearText()
void CDisplayText::HideText(bool bHide)
{
- CWindow* pw;
- CGroup* pg;
- CLabel* pl;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CGroup* pg;
+ Ui::CLabel* pl;
+ Ui::CButton* pb;
int i;
m_bHide = bHide;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- pg = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i));
+ pg = static_cast<Ui::CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i)));
if ( pg != 0 )
{
pg->SetState(STATE_VISIBLE, !bHide);
}
- pl = (CLabel* )pw->SearchControl(EventMsg(EVENT_DT_LABEL0+i));
+ pl = static_cast<Ui::CLabel*>(pw->SearchControl(EventType(EVENT_DT_LABEL0+i)));
if ( pl != 0 )
{
pl->SetState(STATE_VISIBLE, !bHide);
}
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb != 0 )
{
pb->SetState(STATE_VISIBLE, !bHide);
@@ -386,20 +391,20 @@ void CDisplayText::HideText(bool bHide)
bool CDisplayText::ClearLastText()
{
- CWindow *pw;
- CButton *pb1, *pb2;
- CGroup *pg1, *pg2;
- CLabel *pl1, *pl2;
+ Ui::CWindow *pw;
+ Ui::CButton *pb1, *pb2;
+ Ui::CGroup *pg1, *pg2;
+ Ui::CLabel *pl1, *pl2;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return false;
- pb2 = (CButton*)pw->SearchControl(EVENT_DT_VISIT0);
+ pb2 = static_cast<CButton*>(pw->SearchControl(EVENT_DT_VISIT0));
if ( pb2 == 0 ) return false; // same not of first-line
- pg2 = (CGroup*)pw->SearchControl(EVENT_DT_GROUP0);
+ pg2 = static_cast<CGroup*>(pw->SearchControl(EVENT_DT_GROUP0));
if ( pg2 == 0 ) return false;
- pl2 = (CLabel*)pw->SearchControl(EVENT_DT_LABEL0);
+ pl2 = static_cast<CLabel*>(pw->SearchControl(EVENT_DT_LABEL0));
if ( pl2 == 0 ) return false;
for ( i=0 ; i<MAXDTLINE-1 ; i++ )
@@ -408,18 +413,18 @@ bool CDisplayText::ClearLastText()
pg1 = pg2;
pl1 = pl2;
- pb2 = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i+1));
+ pb2 = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i+1)));
if ( pb2 == 0 ) break;
- pg2 = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i+1));
+ pg2 = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i+1)));
if ( pg2 == 0 ) break;
- pl2 = (CLabel*)pw->SearchControl(EventMsg(EVENT_DT_LABEL0+i+1));
+ pl2 = static_cast<CLabel*>(pw->SearchControl(EventType(EVENT_DT_LABEL0+i+1)));
if ( pl2 == 0 ) break;
pb1->SetState(STATE_ENABLE, pb2->TestState(STATE_ENABLE));
- pg1->SetIcon(pg2->RetIcon());
- pl1->SetName(pl2->RetName());
+ pg1->SetIcon(pg2->GetIcon());
+ pl1->SetName(pl2->GetName());
m_time[i] = m_time[i+1];
m_visitGoal[i] = m_visitGoal[i+1];
@@ -427,9 +432,9 @@ bool CDisplayText::ClearLastText()
m_visitHeight[i] = m_visitHeight[i+1]; // shift
}
- pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i));
+ pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
+ pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
+ pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
m_bExist[i] = false;
return true;
}
@@ -453,7 +458,7 @@ void CDisplayText::SetEnable(bool bEnable)
// Returns the goal during a visit.
-Math::Vector CDisplayText::RetVisitGoal(EventMsg event)
+Math::Vector CDisplayText::GetVisitGoal(EventType event)
{
int i;
@@ -464,7 +469,7 @@ Math::Vector CDisplayText::RetVisitGoal(EventMsg event)
// Returns the distance during a visit.
-float CDisplayText::RetVisitDist(EventMsg event)
+float CDisplayText::GetVisitDist(EventType event)
{
int i;
@@ -475,7 +480,7 @@ float CDisplayText::RetVisitDist(EventMsg event)
// Returns the height on a visit.
-float CDisplayText::RetVisitHeight(EventMsg event)
+float CDisplayText::GetVisitHeight(EventType event)
{
int i;
@@ -487,13 +492,13 @@ float CDisplayText::RetVisitHeight(EventMsg event)
// Ranges from ideal visit for a given object.
-float CDisplayText::RetIdealDist(CObject* pObj)
+float CDisplayText::GetIdealDist(CObject* pObj)
{
ObjectType type;
if ( pObj == 0 ) return 40.0f;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_PORTICO ) return 200.0f;
if ( type == OBJECT_BASE ) return 200.0f;
if ( type == OBJECT_NUCLEAR ) return 100.0f;
@@ -506,13 +511,13 @@ float CDisplayText::RetIdealDist(CObject* pObj)
// Returns the height of ideal visit for a given object.
-float CDisplayText::RetIdealHeight(CObject* pObj)
+float CDisplayText::GetIdealHeight(CObject* pObj)
{
ObjectType type;
if ( pObj == 0 ) return 5.0f;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ) return 35.0f;
if ( type == OBJECT_FACTORY ) return 22.0f;
if ( type == OBJECT_REPAIR ) return 30.0f;
@@ -537,16 +542,16 @@ float CDisplayText::RetIdealHeight(CObject* pObj)
void CDisplayText::ClearVisit()
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) break;
pb->SetIcon(14); // eyes
}
@@ -554,38 +559,38 @@ void CDisplayText::ClearVisit()
// Puts a button in "visit".
-void CDisplayText::SetVisit(EventMsg event)
+void CDisplayText::SetVisit(EventType event)
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) return;
pb->SetIcon(48); // >
}
// Indicates whether a button is set to "visit".
-bool CDisplayText::IsVisit(EventMsg event)
+bool CDisplayText::IsVisit(EventType event)
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return false;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return false;
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) return false;
- return (pb->RetIcon() == 48); // > ?
+ return (pb->GetIcon() == 48); // > ?
}
@@ -599,10 +604,10 @@ CObject* CDisplayText::SearchToto()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
return pObj;
@@ -611,3 +616,4 @@ CObject* CDisplayText::SearchToto()
return 0;
}
+}
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index 93a3c8b..d560433 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,15 +22,18 @@
#include "common/event.h"
#include "common/misc.h"
-#include "old/d3dengine.h"
+#include "sound/sound.h"
+//#include "old/d3dengine.h"
class CInstanceManager;
-class CD3DEngine;
-class CInterface;
+//class CD3DEngine
class CObject;
class CSound;
+namespace Ui {;
+
+class CInterface;
enum TextType
{
@@ -45,6 +49,7 @@ const int MAXDTLINE = 4;
class CDisplayText
{
public:
+// CDisplayText(CInstanceManager* iMan);
CDisplayText();
~CDisplayText();
@@ -62,25 +67,25 @@ public:
void SetDelay(float factor);
void SetEnable(bool bEnable);
- Math::Vector RetVisitGoal(EventMsg event);
- float RetVisitDist(EventMsg event);
- float RetVisitHeight(EventMsg event);
+ Math::Vector GetVisitGoal(EventType event);
+ float GetVisitDist(EventType event);
+ float GetVisitHeight(EventType event);
- float RetIdealDist(CObject* pObj);
- float RetIdealHeight(CObject* pObj);
+ float GetIdealDist(CObject* pObj);
+ float GetIdealHeight(CObject* pObj);
void ClearVisit();
- void SetVisit(EventMsg event);
- bool IsVisit(EventMsg event);
+ void SetVisit(EventType event);
+ bool IsVisit(EventType event);
protected:
CObject* SearchToto();
protected:
CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CSound* m_sound;
+ Gfx::CEngine* m_engine;
+ Ui::CInterface* m_interface;
+ CSoundInterface* m_sound;
bool m_bExist[MAXDTLINE];
float m_time[MAXDTLINE];
@@ -94,3 +99,4 @@ protected:
};
+}
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 58a8b7d..86f0011 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -20,34 +21,41 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
-#include <windows.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
#include "ui/scroll.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
+//#include "graphics/engine/color.h"
#include "ui/edit.h"
+namespace Ui {
const float MARGX = (5.0f/640.0f);
const float MARGY = (5.0f/480.0f);
const float MARGYS = (4.0f/480.0f);
const float MARGY1 = (1.0f/480.0f);
-const float DELAY_DBCLICK = 0.3f; // time limit for double-click
-const float DELAY_SCROLL = 0.1f; // time limit for scroll
-const float BIG_FONT = 1.6f; // expansion for \b;
+//! time limit for double-click
+const float DELAY_DBCLICK = 0.3f;
+//! time limit for scroll
+const float DELAY_SCROLL = 0.1f;
+//! expansion for \b;
+const float BIG_FONT = 1.6f;
-// Indicates whether a character is a space.
+//! Indicates whether a character is a space.
bool IsSpace(int character)
{
@@ -56,20 +64,20 @@ bool IsSpace(int character)
character == '\n' );
}
-// Indicates whether a character is part of a word.
+//! Indicates whether a character is part of a word.
bool IsWord(int character)
{
char c;
- c = tolower(RetNoAccent(character));
+ c = tolower(GetNoAccent(character));
return ( (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_' );
}
-// Indicates whether a character is a word separator.
+//! Indicates whether a character is a word separator.
bool IsSep(int character)
{
@@ -79,19 +87,20 @@ bool IsSep(int character)
-// Object's constructor.
+//! Object's constructor.
-CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan)
+//CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan)
+CEdit::CEdit () : CControl ()
{
Math::Point pos;
int i;
m_maxChar = 100;
- m_text = (char*)malloc(sizeof(char)*(m_maxChar+1));
+ m_text = new char* [sizeof(char)*(m_maxChar+1)]; // TODO
m_format = 0;
m_len = 0;
- m_fontType = FONT_COURIER;
+ m_fontType = Gfx::FONT_COURIER;
m_scroll = 0;
m_bEdit = true;
m_bHilite = true;
@@ -137,13 +146,13 @@ CEdit::~CEdit()
// Creates a new editable line.
-bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
CScroll* pc;
Math::Point start, end;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
m_len = 0;
m_lineFirst = 0;
@@ -162,8 +171,8 @@ bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg
{
m_bMulti = true;
MoveAdjust(); // readjusts multi-line mode
- m_scroll = new CScroll(m_iMan);
- pc = (CScroll*)m_scroll;
+ m_scroll = new Ui::CScroll();
+ pc = static_cast<CScroll*>(m_scroll);
pc->Create(pos, dim, -1, EVENT_NULL);
MoveAdjust();
}
@@ -189,25 +198,25 @@ void CEdit::MoveAdjust()
Math::Point pos, dim;
float height;
- m_lineDescent = m_engine->RetText()->RetDescent(m_fontSize, m_fontType);
- m_lineAscent = m_engine->RetText()->RetAscent(m_fontSize, m_fontType);
- m_lineHeight = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ m_lineDescent = m_engine->GetText()->GetDescent(m_fontType, m_fontSize);
+ m_lineAscent = m_engine->GetText()->GetAscent(m_fontType, m_fontSize);
+ m_lineHeight = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
height = m_dim.y-(m_bMulti?MARGY*2.0f:MARGY1);
- m_lineVisible = (int)(height/m_lineHeight);
+ m_lineVisible = static_cast<int>((height/m_lineHeight));
if ( m_scroll != 0 )
{
if ( m_bInsideScroll )
{
- pos.x = m_pos.x+m_dim.x-MARGX-SCROLL_WIDTH;
- pos.y = m_pos.y+MARGYS;
+ pos.x = m_pos.x + m_dim.x - MARGX-SCROLL_WIDTH;
+ pos.y = m_pos.y + MARGYS;
dim.x = SCROLL_WIDTH;
- dim.y = m_dim.y-MARGYS*2.0f;
+ dim.y = m_dim.y - MARGYS*2.0f;
}
else
{
- pos.x = m_pos.x+m_dim.x-SCROLL_WIDTH;
+ pos.x = m_pos.x + m_dim.x - SCROLL_WIDTH;
pos.y = m_pos.y;
dim.x = SCROLL_WIDTH;
dim.y = m_dim.y;
@@ -238,15 +247,15 @@ bool CEdit::EventProcess(const Event &event)
if ( (m_state & STATE_VISIBLE) == 0 ) return true;
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) )
{
Scroll(m_lineFirst-3, true);
return true;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 && // TODO
Detect(event.pos) )
{
Scroll(m_lineFirst+3, true);
@@ -255,30 +264,30 @@ bool CEdit::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
m_time += event.rTime;
m_timeBlink += event.rTime;
}
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( Detect(event.pos) &&
event.pos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
if ( m_bEdit )
{
- m_engine->SetMouseType(D3DMOUSEEDIT);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_EDIT);
}
else
{
if ( IsLinkPos(event.pos) )
{
- m_engine->SetMouseType(D3DMOUSEHAND);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
else
{
- m_engine->SetMouseType(D3DMOUSENORM);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
}
}
}
@@ -288,32 +297,32 @@ bool CEdit::EventProcess(const Event &event)
{
m_scroll->EventProcess(event);
- if ( event.event == m_scroll->RetEventMsg() )
+ if ( event.type == m_scroll->GetEventType() )
{
Scroll();
return true;
}
}
- if ( event.event == EVENT_KEYDOWN && m_bFocus )
+ if ( event.type == EVENT_KEY_DOWN && m_bFocus )
{
bShift = (event.keyState&KS_SHIFT);
bControl = (event.keyState&KS_CONTROL);
if ( (event.param == 'X' && !bShift && bControl) ||
- (event.param == VK_DELETE && bShift && !bControl) )
+ (event.param == KEY(DELETE) && bShift && !bControl) )
{
Cut();
return true;
}
if ( (event.param == 'C' && !bShift && bControl) ||
- (event.param == VK_INSERT && !bShift && bControl) )
+ (event.param == KEY(INSERT) && !bShift && bControl) )
{
Copy();
return true;
}
if ( (event.param == 'V' && !bShift && bControl) ||
- (event.param == VK_INSERT && bShift && !bControl) )
+ (event.param == KEY(INSERT) && bShift && !bControl) )
{
Paste();
return true;
@@ -327,14 +336,14 @@ bool CEdit::EventProcess(const Event &event)
if ( event.param == 'O' && !bShift && bControl )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_STUDIO_OPEN);
+ Event newEvent(EVENT_STUDIO_OPEN);
+// m_event->NewEvent(newEvent, EVENT_STUDIO_OPEN);
m_event->AddEvent(newEvent);
}
if ( event.param == 'S' && !bShift && bControl )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_STUDIO_SAVE);
+ Event newEvent( EVENT_STUDIO_SAVE );
+// m_event->MakeEvent(newEvent, EVENT_STUDIO_SAVE);
m_event->AddEvent(newEvent);
}
@@ -353,44 +362,44 @@ bool CEdit::EventProcess(const Event &event)
if ( MinMaj(true) ) return true;
}
- if ( event.param == VK_TAB && !bShift && !bControl && !m_bAutoIndent )
+ if ( event.param == KEY(TAB) && !bShift && !bControl && !m_bAutoIndent )
{
if ( Shift(false) ) return true;
}
- if ( event.param == VK_TAB && bShift && !bControl && !m_bAutoIndent )
+ if ( event.param == KEY(TAB) && bShift && !bControl && !m_bAutoIndent )
{
if ( Shift(true) ) return true;
}
if ( m_bEdit )
{
- if ( event.param == VK_LEFT )
+ if ( event.param == KEY(LEFT) )
{
MoveChar(-1, bControl, bShift);
return true;
}
- if ( event.param == VK_RIGHT )
+ if ( event.param == KEY(RIGHT) )
{
MoveChar(1, bControl, bShift);
return true;
}
- if ( event.param == VK_UP )
+ if ( event.param == KEY(UP) )
{
MoveLine(-1, bControl, bShift);
return true;
}
- if ( event.param == VK_DOWN )
+ if ( event.param == KEY(DOWN) )
{
MoveLine(1, bControl, bShift);
return true;
}
- if ( event.param == VK_PRIOR ) // PageUp ?
+ if ( event.param == KEY(PAGEUP) ) // PageUp ?
{
MoveLine(-(m_lineVisible-1), bControl, bShift);
return true;
}
- if ( event.param == VK_NEXT ) // PageDown ?
+ if ( event.param == KEY(PAGEDOWN) ) // PageDown ?
{
MoveLine(m_lineVisible-1, bControl, bShift);
return true;
@@ -398,62 +407,62 @@ bool CEdit::EventProcess(const Event &event)
}
else
{
- if ( event.param == VK_LEFT ||
- event.param == VK_UP )
+ if ( event.param == KEY(LEFT) ||
+ event.param == KEY(UP) )
{
Scroll(m_lineFirst-1, true);
return true;
}
- if ( event.param == VK_RIGHT ||
- event.param == VK_DOWN )
+ if ( event.param == KEY(RIGHT) ||
+ event.param == KEY(DOWN) )
{
Scroll(m_lineFirst+1, true);
return true;
}
- if ( event.param == VK_PRIOR ) // PageUp ?
+ if ( event.param == KEY(PAGEUP) ) // PageUp ?
{
Scroll(m_lineFirst-(m_lineVisible-1), true);
return true;
}
- if ( event.param == VK_NEXT ) // PageDown ?
+ if ( event.param == KEY(PAGEDOWN) ) // PageDown ?
{
Scroll(m_lineFirst+(m_lineVisible-1), true);
return true;
}
}
- if ( event.param == VK_HOME )
+ if ( event.param == KEY(HOME) )
{
MoveHome(bControl, bShift);
return true;
}
- if ( event.param == VK_END )
+ if ( event.param == KEY(END) )
{
MoveEnd(bControl, bShift);
return true;
}
- if ( event.param == VK_BACK ) // backspace ( <- ) ?
+ if ( event.param == KEY(BACKSPACE) ) // backspace ( <- ) ?
{
Delete(-1);
SendModifEvent();
return true;
}
- if ( event.param == VK_DELETE )
+ if ( event.param == KEY(DELETE) )
{
Delete(1);
SendModifEvent();
return true;
}
- if ( event.param == VK_RETURN )
+ if ( event.param == KEY(RETURN) )
{
Insert('\n');
SendModifEvent();
return true;
}
- if ( event.param == VK_TAB )
+ if ( event.param == KEY(TAB) )
{
Insert('\t');
SendModifEvent();
@@ -461,7 +470,7 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_CHAR && m_bFocus )
+ if ( event.type == EVENT_ACTIVE && m_bFocus )
{
if ( event.param >= ' ' && event.param <= 255 )
{
@@ -471,9 +480,9 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_FOCUS )
+ if ( event.type == EVENT_ACTIVE )
{
- if ( event.param == m_eventMsg )
+ if ( event.param == m_eventType )
{
m_bFocus = true;
}
@@ -483,7 +492,8 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
m_mouseFirstPos = event.pos;
m_mouseLastPos = event.pos;
@@ -502,18 +512,19 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
m_mouseLastPos = event.pos;
MouseMove(event.pos);
}
- if ( event.event == EVENT_FRAME && m_bCapture )
+ if ( event.type == EVENT_FRAME && m_bCapture )
{
MouseMove(m_mouseLastPos);
}
- if ( event.event == EVENT_LBUTTONUP )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton.button == 1)
{
if ( Detect(event.pos) )
{
@@ -541,9 +552,9 @@ bool CEdit::EventProcess(const Event &event)
void CEdit::SendModifEvent()
{
- Event newEvent;
+ Event newEvent (m_eventType);
- m_event->MakeEvent(newEvent, m_eventMsg);
+// m_event->MakeEvent(newEvent, m_eventType);
m_event->AddEvent(newEvent);
}
@@ -560,7 +571,7 @@ bool CEdit::IsLinkPos(Math::Point pos)
if ( i == -1 ) return false;
if ( i >= m_len ) return false;
- if ( (m_format[i]&COLOR_MASK) == COLOR_LINK ) return true;
+ if ( (m_format[i]& Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) return true; // TODO
return false;
}
@@ -635,13 +646,13 @@ void CEdit::MouseRelease(Math::Point mouse)
if ( !m_bEdit )
{
if ( m_format != 0 && i < m_len && m_cursor1 == m_cursor2 &&
- (m_format[i]&COLOR_MASK) == COLOR_LINK )
+ (m_format[i]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) //TODO
{
rank = -1;
for ( j=0 ; j<=i ; j++ )
{
- if ( (j == 0 || (m_format[j-1]&COLOR_MASK) != COLOR_LINK) &&
- (m_format[j+0]&COLOR_MASK) == COLOR_LINK )
+ if ( (j == 0 || (m_format[j-1]&Gfx::FONT_MASK_HIGHLIGHT) != Gfx::FONT_HIGHLIGHT_LINK) && // TODO check if good
+ (m_format[j+0]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) // TODO
{
rank ++;
}
@@ -694,14 +705,14 @@ int CEdit::MouseDetect(Math::Point mouse)
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1);
for ( i=m_lineFirst ; i<m_lineTotal ; i++ )
{
- bTitle = ( m_format != 0 && (m_format[m_lineOffset[i]]&TITLE_MASK) == TITLE_BIG );
+ bTitle = ( m_format != 0 && (m_format[m_lineOffset[i]]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG );
if ( i >= m_lineFirst+m_lineVisible ) break;
@@ -720,19 +731,21 @@ int CEdit::MouseDetect(Math::Point mouse)
if ( m_format == 0 )
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[i],
- len, offset, m_fontSize,
- m_fontStretch, m_fontType);
+// c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],
+// len, offset, m_fontSize,
+// m_fontStretch, m_fontType);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[i], m_fontType, m_fontSize, offset); // TODO check if good
}
else
{
size = m_fontSize;
- if ( bTitle ) size *= BIG_FONT;
+ if ( bTitle ) size *= Gfx::FONT_SIZE_BIG;
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[i],
- m_format+m_lineOffset[i],
- len, offset, size,
- m_fontStretch);
+// c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],
+// m_format+m_lineOffset[i],
+// len, offset, size,
+// m_fontStretch);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],m_format+m_lineOffset[i], size, offset); // TODO check if good
}
return m_lineOffset[i]+c;
}
@@ -827,7 +840,7 @@ bool CEdit::HyperAdd(char *filename, int firstLine)
// Indicates whether a button EVENT_HYPER_ * is active or not.
-bool CEdit::HyperTest(EventMsg event)
+bool CEdit::HyperTest(EventType event)
{
if ( event == EVENT_HYPER_HOME )
{
@@ -849,7 +862,7 @@ bool CEdit::HyperTest(EventMsg event)
// Performs the action corresponding to a button EVENT_HYPER_ *.
-bool CEdit::HyperGo(EventMsg event)
+bool CEdit::HyperGo(EventType event)
{
if ( !HyperTest(event) ) return false;
@@ -911,8 +924,8 @@ void CEdit::Draw()
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1);
@@ -933,7 +946,7 @@ void CEdit::Draw()
for ( j=0 ; j<m_lineIndent[i] ; j++ )
{
char s = '\t'; // line | dotted
- m_engine->RetText()->DrawText(&s, 1, pos, 1.0f, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_RIGHT, 0);
pos.x += indentLength;
}
}
@@ -946,7 +959,7 @@ void CEdit::Draw()
// Headline \b;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_BIG )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -960,7 +973,7 @@ void CEdit::Draw()
// As \t;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_NORM )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_NORM )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -971,7 +984,7 @@ void CEdit::Draw()
// Subtitle \s;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_LITTLE )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_LITTLE )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -982,7 +995,7 @@ void CEdit::Draw()
// Table \tab;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&COLOR_MASK) == COLOR_TABLE )
+ (m_format[beg]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_TABLE )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -993,21 +1006,21 @@ void CEdit::Draw()
// Image \image; ?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&IMAGE_MASK) != 0 )
+ (m_format[beg]&Gfx::FONT_MASK_IMAGE) != 0 )
{
line = 1;
while ( true ) // includes the image slices
{
if ( i+line >= m_lineTotal ||
i+line >= m_lineFirst+m_lineVisible ||
- (m_format[beg+line]&IMAGE_MASK) == 0 ) break;
+ (m_format[beg+line]&Gfx::FONT_MASK_IMAGE) == 0 ) break;
line ++;
}
iIndex = m_text[beg]; // character = index in m_image
pos.y -= m_lineHeight*(line-1);
DrawImage(pos, m_image[iIndex].name,
- m_image[iIndex].width*(m_fontSize/SMALLFONT),
+ m_image[iIndex].width*(m_fontSize/Gfx::FONT_SIZE_SMALL),
m_image[iIndex].offset, m_image[iIndex].height*line, line);
pos.y -= m_lineHeight;
i += line-1;
@@ -1023,18 +1036,18 @@ void CEdit::Draw()
if ( m_format == 0 )
{
- start.x = ppos.x+m_engine->RetText()->RetStringWidth(m_text+beg, o1-beg, size, m_fontStretch, m_fontType);
- end.x = m_engine->RetText()->RetStringWidth(m_text+o1, o2-o1, size, m_fontStretch, m_fontType);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_fontType, size);
+ end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_fontType, size);
}
else
{
- start.x = ppos.x+m_engine->RetText()->RetStringWidth(m_text+beg, m_format+beg, o1-beg, size, m_fontStretch);
- end.x = m_engine->RetText()->RetStringWidth(m_text+o1, m_format+o1, o2-o1, size, m_fontStretch);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_format+beg, size);
+ end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_format+o1, size);
}
start.y = ppos.y-(m_bMulti?0.0f:MARGY1);
end.y = m_lineHeight;
- if ( m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_BIG ) end.y *= BIG_FONT;
+ if ( m_format != 0 && (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG) end.y *= BIG_FONT;
DrawPart(start, end, 1); // plain yellow background
}
@@ -1051,11 +1064,11 @@ void CEdit::Draw()
if ( !m_bMulti || !m_bDisplaySpec ) eol = 0;
if ( m_format == 0 )
{
- m_engine->RetText()->DrawText(m_text+beg, len, ppos, m_dim.x, 1, size, m_fontStretch, m_fontType, eol);
+ m_engine->GetText()->DrawText(m_text+beg, m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
}
else
{
- m_engine->RetText()->DrawText(m_text+beg, m_format+beg, len, ppos, m_dim.x, 1, size, m_fontStretch, eol);
+ m_engine->GetText()->DrawText(m_text+beg, m_format+beg, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
}
pos.y -= m_lineHeight;
@@ -1085,17 +1098,15 @@ void CEdit::Draw()
if ( m_format == 0 )
{
- m_engine->RetText()->DimText(m_text+m_lineOffset[i], len,
- pos, 1, size,
- m_fontStretch, m_fontType,
+ m_engine->GetText()->SizeText(m_text+m_lineOffset[i], m_fontType,
+ size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
else
{
- m_engine->RetText()->DimText(m_text+m_lineOffset[i],
+ m_engine->GetText()->SizeText(m_text+m_lineOffset[i],
m_format+m_lineOffset[i],
- len, pos, 1, size,
- m_fontStretch,
+ size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
@@ -1104,8 +1115,8 @@ void CEdit::Draw()
}
pos.y -= m_lineHeight;
}
- pos.x -= 1.0f/640.0f;
- dim.x = 2.0f/640.0f;
+ pos.x -= 1.0f / 640.0f;
+ dim.x = 2.0f / 640.0f;
dim.y = m_lineHeight;
DrawPart(pos, dim, 0); // red
}
@@ -1130,7 +1141,7 @@ void CEdit::DrawImage(Math::Point pos, char *name, float width,
strcat(filename, ".bmp");
m_engine->SetTexture(filename);
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f;
uv2.x = 1.0f;
@@ -1158,7 +1169,7 @@ void CEdit::DrawBack(Math::Point pos, Math::Point dim)
if ( m_bGeneric ) return;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( m_bMulti )
{
@@ -1212,7 +1223,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
#else
m_engine->SetTexture("text.tga");
#endif
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = (16.0f/256.0f)*(icon%16);
uv1.y = (240.0f/256.0f);
@@ -1291,32 +1302,32 @@ void CEdit::SetText(char *text, bool bNew)
{
if ( text[i+1] == 'n' ) // normal ?
{
- font &= ~FONT_MASK;
- font |= FONT_COLOBOT;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COLOBOT;
i += 2;
}
else if ( text[i+1] == 'c' ) // cbot ?
{
- font &= ~FONT_MASK;
- font |= FONT_COURIER;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COURIER;
i += 2;
}
else if ( text[i+1] == 'b' ) // big title ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_BIG;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_BIG;
i += 2;
}
else if ( text[i+1] == 't' ) // title ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_NORM;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_NORM;
i += 2;
}
else if ( text[i+1] == 's' ) // subtitle ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_LITTLE;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_LITTLE;
i += 2;
}
}
@@ -1326,7 +1337,7 @@ void CEdit::SetText(char *text, bool bNew)
m_format[j] = font;
j ++;
- font &= ~TITLE_MASK; // reset title
+ font &= ~Gfx::FONT_MASK_TITLE; // reset title
}
}
m_len = j;
@@ -1342,7 +1353,7 @@ void CEdit::SetText(char *text, bool bNew)
// Returns a pointer to the edited text.
-char* CEdit::RetText()
+char* CEdit::GetText()
{
m_text[m_len] = 0;
return m_text;
@@ -1361,7 +1372,7 @@ void CEdit::GetText(char *buffer, int max)
// Returns the length of the text.
-int CEdit::RetTextLength()
+int CEdit::GetTextLength()
{
return m_len;
}
@@ -1394,7 +1405,7 @@ void GetNameParam(char *cmd, int rank, char *buffer)
// Returns a number of a command.
// \x nom n1 n2;
-int RetValueParam(char *cmd, int rank)
+int GetValueParam(char *cmd, int rank)
{
int n, i;
@@ -1423,7 +1434,7 @@ void CEdit::FreeImage()
//? sprintf(filename, "diagram\\%s.bmp", m_image[i].name);
UserDir(filename, m_image[i].name, "diagram");
strcat(filename, ".bmp");
- m_engine->FreeTexture(filename);
+ m_engine->DeleteTexture(filename);
}
}
@@ -1467,14 +1478,14 @@ bool CEdit::ReadText(char *filename, int addSize)
FreeImage();
delete m_text;
- m_text = (char*)malloc(sizeof(char)*(m_maxChar+1));
- buffer = (char*)malloc(sizeof(char)*(m_maxChar+1));
+ m_text = new char[sizeof(char)*(m_maxChar+1)];
+ buffer = new char[sizeof(char)*(m_maxChar+1)];
fread(buffer, 1, len, file);
if ( m_format != 0 )
{
delete m_format;
- m_format = (char*)malloc(sizeof(char)*m_maxChar);
+ m_format = new char[sizeof(char)*m_maxChar];
}
fclose(file);
@@ -1515,8 +1526,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~FONT_MASK;
- font |= FONT_COLOBOT;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COLOBOT;
}
i += 3;
}
@@ -1524,8 +1535,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~FONT_MASK;
- font |= FONT_COURIER;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COURIER;
}
i += 3;
}
@@ -1533,8 +1544,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_BIG;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_BIG;
}
i += 3;
}
@@ -1542,8 +1553,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_NORM;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_NORM;
}
i += 3;
}
@@ -1551,8 +1562,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_LITTLE;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_LITTLE;
}
i += 3;
}
@@ -1560,8 +1571,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_LINK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_LINK;
}
i += 3;
}
@@ -1583,7 +1594,7 @@ bool CEdit::ReadText(char *filename, int addSize)
GetNameParam(buffer+i+3, 1, m_link[iLink].marker);
iLink ++;
}
- font &= ~COLOR_MASK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
@@ -1620,9 +1631,9 @@ bool CEdit::ReadText(char *filename, int addSize)
GetNameParam(buffer+i+7, 0, iName);
#endif
//? iWidth = m_lineHeight*RetValueParam(buffer+i+7, 1);
- iWidth = (float)RetValueParam(buffer+i+7, 1);
- iWidth *= m_engine->RetText()->RetHeight(SMALLFONT, FONT_COLOBOT);
- iLines = RetValueParam(buffer+i+7, 2);
+ iWidth = static_cast<float>(GetValueParam(buffer+i+7, 1));
+ iWidth *= m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, Gfx::FONT_SIZE_SMALL);
+ iLines = GetValueParam(buffer+i+7, 2);
LoadImage(iName);
// A part of image per line of text.
@@ -1634,7 +1645,7 @@ bool CEdit::ReadText(char *filename, int addSize)
m_image[iIndex].width = iWidth*0.75f;
m_text[j] = (char)(iIndex++); // as an index into m_image
- m_format[j] = (unsigned char)IMAGE_MASK;
+ m_format[j] = (unsigned char)Gfx::FONT_MASK_IMAGE;
j ++;
}
}
@@ -1652,8 +1663,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- m_text[j] = RetValueParam(buffer+i+8, 0);
- m_format[j] = font|FONT_BUTTON;
+ m_text[j] = GetValueParam(buffer+i+8, 0);
+ m_format[j] = font|Gfx::FONT_BUTTON;
j ++;
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
@@ -1669,8 +1680,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_TOKEN;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_TOKEN;
}
i += 7;
}
@@ -1684,8 +1695,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_TYPE;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_TYPE;
}
i += 6;
}
@@ -1700,8 +1711,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_CONST;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_CONST;
}
i += 7;
}
@@ -1714,8 +1725,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_KEY;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_KEY;
}
i += 5;
}
@@ -1728,7 +1739,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font |= COLOR_TABLE;
+ font |= Gfx::FONT_HIGHLIGHT_TABLE;
}
i += 5;
}
@@ -1742,7 +1753,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
}
i += 6;
}
@@ -1775,7 +1786,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( SearchKey(buffer+i+5, key) )
{
- res = m_engine->RetKey(key, 0);
+ res = m_engine->GetKey(key, 0); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1794,7 +1805,7 @@ bool CEdit::ReadText(char *filename, int addSize)
m_format[j] = font;
j ++;
- res = m_engine->RetKey(key, 1);
+ res = m_engine->GetKey(key, 1); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1804,7 +1815,7 @@ bool CEdit::ReadText(char *filename, int addSize)
while ( text[n] != 0 )
{
m_text[j] = text[n++];
- m_format[j] = font&~COLOR_MASK;
+ m_format[j] = font&~Gfx::FONT_MASK_HIGHLIGHT;
j ++;
}
n = 0;
@@ -1840,11 +1851,11 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i ++;
- font &= ~TITLE_MASK; // reset title
+ font &= ~Gfx::FONT_MASK_TITLE; // reset title
- if ( (font&COLOR_MASK) == COLOR_TABLE )
+ if ( (font&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_TABLE )
{
- font &= ~COLOR_TABLE;
+ font &= ~Gfx::FONT_HIGHLIGHT_TABLE;
}
}
}
@@ -1945,7 +1956,7 @@ void CEdit::SetMaxChar(int max)
UndoFlush();
}
-int CEdit::RetMaxChar()
+int CEdit::GetMaxChar()
{
return m_maxChar;
}
@@ -1958,7 +1969,7 @@ void CEdit::SetEditCap(bool bMode)
m_bEdit = bMode;
}
-bool CEdit::RetEditCap()
+bool CEdit::GetEditCap()
{
return m_bEdit;
}
@@ -1970,7 +1981,7 @@ void CEdit::SetHiliteCap(bool bEnable)
m_bHilite = bEnable;
}
-bool CEdit::RetHiliteCap()
+bool CEdit::GetHiliteCap()
{
return m_bHilite;
}
@@ -1982,7 +1993,7 @@ void CEdit::SetInsideScroll(bool bInside)
m_bInsideScroll = bInside;
}
-bool CEdit::RetInsideScroll()
+bool CEdit::GetInsideScroll()
{
return m_bInsideScroll;
}
@@ -1994,7 +2005,7 @@ void CEdit::SetSoluceMode(bool bSoluce)
m_bSoluce = bSoluce;
}
-bool CEdit::RetSoluceMode()
+bool CEdit::GetSoluceMode()
{
return m_bSoluce;
}
@@ -2006,7 +2017,7 @@ void CEdit::SetGenericMode(bool bGeneric)
m_bGeneric = bGeneric;
}
-bool CEdit::RetGenericMode()
+bool CEdit::GetGenericMode()
{
return m_bGeneric;
}
@@ -2019,7 +2030,7 @@ void CEdit::SetAutoIndent(bool bMode)
m_bAutoIndent = bMode;
}
-bool CEdit::RetAutoIndent()
+bool CEdit::GetAutoIndent()
{
return m_bAutoIndent;
}
@@ -2057,7 +2068,7 @@ void CEdit::SetFirstLine(int rank)
// Returns the first displayed line.
-int CEdit::RetFirstLine()
+int CEdit::GetFirstLine()
{
if ( m_historyTotal > 0 )
{
@@ -2091,7 +2102,7 @@ void CEdit::ShowSelect()
cursor2 = m_cursor1;
}
- line = RetCursorLine(cursor2);
+ line = GetCursorLine(cursor2);
if ( line >= m_lineFirst+m_lineVisible )
{
line -= m_lineVisible-1;
@@ -2099,7 +2110,7 @@ void CEdit::ShowSelect()
Scroll(line, false);
}
- line = RetCursorLine(cursor1);
+ line = GetCursorLine(cursor1);
if ( line < m_lineFirst )
{
Scroll(line, false);
@@ -2114,7 +2125,7 @@ void CEdit::SetDisplaySpec(bool bDisplay)
m_bDisplaySpec = bDisplay;
}
-bool CEdit::RetDisplaySpec()
+bool CEdit::GetDisplaySpec()
{
return m_bDisplaySpec;
}
@@ -2137,7 +2148,7 @@ void CEdit::SetMultiFont(bool bMulti)
}
}
-bool CEdit::RetMultiFont()
+bool CEdit::GetMultiFont()
{
return ( m_format != 0 );
}
@@ -2161,7 +2172,7 @@ void CEdit::Scroll()
if ( m_scroll != 0 )
{
- value = m_scroll->RetVisibleValue();
+ value = m_scroll->GetVisibleValue();
value *= m_lineTotal-m_lineVisible;
Scroll((int)(value+0.5f), true);
}
@@ -2181,7 +2192,7 @@ void CEdit::Scroll(int pos, bool bAdjustCursor)
if ( max < 0 ) max = 0;
if ( m_lineFirst > max ) m_lineFirst = max;
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( bAdjustCursor && m_bEdit )
{
@@ -2418,29 +2429,28 @@ void CEdit::MoveLine(int move, bool bWord, bool bSelect)
}
}
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
column = m_column;
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
column -= indentLength*m_lineIndent[line];
}
if ( m_format == 0 )
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[line],
- m_lineOffset[line+1]-m_lineOffset[line],
- column, m_fontSize,
- m_fontStretch, m_fontType);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
+ m_fontType, m_fontSize,
+ m_lineOffset[line+1]-m_lineOffset[line]);
}
else
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[line],
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
m_format+m_lineOffset[line],
- m_lineOffset[line+1]-m_lineOffset[line],
- column, m_fontSize, m_fontStretch);
+ m_fontSize,
+ m_lineOffset[line+1]-m_lineOffset[line]);
}
m_cursor1 = m_lineOffset[line]+c;
@@ -2457,32 +2467,27 @@ void CEdit::ColumnFix()
float indentLength;
int line;
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( m_format == 0 )
{
- m_column = m_engine->RetText()->RetStringWidth
- (
+ m_column = m_engine->GetText()->GetStringWidth(
m_text+m_lineOffset[line],
- m_cursor1-m_lineOffset[line],
- m_fontSize, m_fontStretch, m_fontType
- );
+ m_fontType, m_fontSize);
}
else
{
- m_column = m_engine->RetText()->RetStringWidth
- (
+ m_column = m_engine->GetText()->GetStringWidth(
m_text+m_lineOffset[line],
m_format+m_lineOffset[line],
- m_cursor1-m_lineOffset[line],
- m_fontSize, m_fontStretch
+ m_fontSize
);
}
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
m_column += indentLength*m_lineIndent[line];
}
}
@@ -2490,7 +2495,7 @@ void CEdit::ColumnFix()
// Cut the selected characters or entire line.
-bool CEdit::Cut()
+bool CEdit::Cut() // TODO MS Windows allocations
{
HGLOBAL hg;
char* text;
@@ -2571,7 +2576,7 @@ bool CEdit::Cut()
// Copy the selected characters or entire line.
-bool CEdit::Copy()
+bool CEdit::Copy() // TODO
{
HGLOBAL hg;
char* text;
@@ -2643,7 +2648,7 @@ bool CEdit::Copy()
// Paste the contents of the notebook.
-bool CEdit::Paste()
+bool CEdit::Paste() // TODO
{
HANDLE h;
char c;
@@ -2777,7 +2782,7 @@ void CEdit::Insert(char character)
#endif
else if ( character == '\t' )
{
- for ( i=0 ; i<m_engine->RetEditIndentValue() ; i++ )
+ for ( i=0 ; i<m_engine->GetEditIndentValue() ; i++ )
{
InsertOne(' ');
}
@@ -3025,8 +3030,8 @@ bool CEdit::MinMaj(bool bMaj)
for ( i=c1 ; i<c2 ; i++ )
{
character = (unsigned char)m_text[i];
- if ( bMaj ) character = RetToUpper(character);
- else character = RetToLower(character);
+ if ( bMaj ) character = GetToUpper(character);
+ else character = GetToLower(character);
m_text[i] = character;
}
@@ -3053,8 +3058,8 @@ void CEdit::Justif()
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
bString = bRem = false;
@@ -3071,29 +3076,29 @@ void CEdit::Justif()
if ( m_format == 0 )
{
- i += m_engine->RetText()->Justif(m_text+i, m_len-i, width,
- m_fontSize, m_fontStretch,
- m_fontType);
+ // TODO check if good
+ i += m_engine->GetText()->Justify(m_text+i, m_fontType,
+ m_fontSize, width);
}
else
{
size = m_fontSize;
- if ( (m_format[i]&TITLE_MASK) == TITLE_BIG ) // headline?
+ if ( (m_format[i]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG ) // headline?
{
size *= BIG_FONT;
bDual = true;
}
- if ( (m_format[i]&IMAGE_MASK) != 0 ) // image part?
+ if ( (m_format[i]&Gfx::FONT_MASK_IMAGE) != 0 ) // image part?
{
i ++; // jumps just a character (index in m_image)
}
else
{
- i += m_engine->RetText()->Justif(m_text+i, m_format+i,
- m_len-i, width,
- size, m_fontStretch);
+ // TODO check if good
+ i += m_engine->GetText()->Justify(m_text+i, m_format+i,
+ size, width);
}
}
@@ -3149,7 +3154,7 @@ void CEdit::Justif()
{
if ( m_bEdit )
{
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( line < m_lineFirst )
{
m_lineFirst = line;
@@ -3175,13 +3180,13 @@ void CEdit::Justif()
}
else
{
- value = (float)m_lineVisible/m_lineTotal;
+ value = static_cast<float>(m_lineVisible/m_lineTotal);
m_scroll->SetVisibleRatio(value);
- value = (float)m_lineFirst/(m_lineTotal-m_lineVisible);
+ value = static_cast<float>(m_lineFirst/(m_lineTotal-m_lineVisible));
m_scroll->SetVisibleValue(value);
- value = (float)1.0f/(m_lineTotal-m_lineVisible);
+ value = static_cast<float>(1.0f/(m_lineTotal-m_lineVisible));
m_scroll->SetArrowStep(value);
}
}
@@ -3191,7 +3196,7 @@ void CEdit::Justif()
// Returns the rank of the line where the cursor is located.
-int CEdit::RetCursorLine(int cursor)
+int CEdit::GetCursorLine(int cursor)
{
int line, i;
@@ -3314,3 +3319,4 @@ bool CEdit::SetFormat(int cursor1, int cursor2, int format)
}
+}
diff --git a/src/ui/edit.h b/src/ui/edit.h
index 73bd062..99ec693 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -14,66 +15,99 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-// edit.h
+
+/**
+ * \file ui/edit.h
+ * \brief CEdit class
+ */
#pragma once
-#include <common/struct.h>
-#include <common/event.h>
+//#include "common/struct.h"
+#include "ui/control.h"
+
+namespace Gfx{
+class CEngine;
+};
+
+namespace Ui {
+class CScroll;
-#include <ui/control.h>
-#include <ui/scroll.h>
-const int EDITSTUDIOMAX = 20000; // maximum number of characters in CBOT edit
-const int EDITLINEMAX = 1000; // maximum total number of lines
-const int EDITIMAGEMAX = 50; // maximum total number of lines with images
-const int EDITLINKMAX = 100; // maximum number of links
-const int EDITHISTORYMAX = 50; // max number of levels preserves
+//! maximum number of characters in CBOT edit
+const int EDITSTUDIOMAX = 20000;
+//! maximum total number of lines
+const int EDITLINEMAX = 1000;
+//! maximum total number of lines with images
+const int EDITIMAGEMAX = 50;
+//! maximum number of links
+const int EDITLINKMAX = 100;
+//! max number of levels preserves
+const int EDITHISTORYMAX = 50;
-const int EDITUNDOMAX = 20; // max number of successive undo
+//! max number of successive undo
+const int EDITUNDOMAX = 20;
struct EditUndo
{
- char* text; // original text
- int len; // length of the text
- int cursor1; // offset cursor
- int cursor2; // offset cursor
- int lineFirst; // the first line displayed.
+ //! original text
+ char* text;
+ //! length of the text
+ int len;
+ //! offset cursor
+ int cursor1;
+ //! offset cursor
+ int cursor2;
+ //! the first line displayed.
+ int lineFirst;
};
enum OperUndo
{
- OPERUNDO_SPEC = 0, // special operation
- OPERUNDO_INSERT = 1, // inserting characters
- OPERUNDO_DELETE = 2, // deleting characters
+ //! special operation
+ OPERUNDO_SPEC = 0,
+ //! inserting characters
+ OPERUNDO_INSERT = 1,
+ //! deleting characters
+ OPERUNDO_DELETE = 2,
};
struct ImageLine
{
- char name[40]; // name of the image (without diagram \)
- float offset; // vertical offset (v texture)
- float height; // height of the part (dv texture)
- float width; // width
+ //! name of the image (without diagram \)
+ char name[40];
+ //! vertical offset (v texture)
+ float offset;
+ //! height of the part (dv texture)
+ float height;
+ //! width
+ float width;
};
struct HyperLink
{
- char name[40]; // text file name (without help \)
- char marker[20]; // name of the marker
+ //! text file name (without help \)
+ char name[40];
+ //! name of the marker
+ char marker[20];
};
struct HyperMarker
{
- char name[20]; // name of the marker
- int pos; // position in the text
+ //! name of the marker
+ char name[20];
+ //! position in the text
+ int pos;
};
struct HyperHistory
{
- char filename[50]; // full file name text
- int firstLine; // rank of the first displayed line
+ //! full file name text
+ char filename[50];
+ //! rank of the first displayed line
+ int firstLine;
};
@@ -82,10 +116,11 @@ struct HyperHistory
class CEdit : public CControl
{
public:
- CEdit();
+// CEdit(CInstanceManager* iMan);
+ CEdit ();
virtual ~CEdit();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
@@ -95,45 +130,45 @@ public:
void SetText(char *text, bool bNew=true);
void GetText(char *buffer, int max);
- char* RetText();
- int RetTextLength();
+ char* GetText();
+ int GetTextLength();
bool ReadText(char *filename, int addSize=0);
bool WriteText(char *filename);
void SetMaxChar(int max);
- int RetMaxChar();
+ int GetMaxChar();
void SetEditCap(bool bMode);
- bool RetEditCap();
+ bool GetEditCap();
void SetHiliteCap(bool bEnable);
- bool RetHiliteCap();
+ bool GetHiliteCap();
void SetInsideScroll(bool bInside);
- bool RetInsideScroll();
+ bool GetInsideScroll();
void SetSoluceMode(bool bSoluce);
- bool RetSoluceMode();
+ bool GetSoluceMode();
void SetGenericMode(bool bGeneric);
- bool RetGenericMode();
+ bool GetGenericMode();
void SetAutoIndent(bool bMode);
- bool RetAutoIndent();
+ bool GetAutoIndent();
void SetCursor(int cursor1, int cursor2);
void GetCursor(int &cursor1, int &cursor2);
void SetFirstLine(int rank);
- int RetFirstLine();
+ int GetFirstLine();
void ShowSelect();
void SetDisplaySpec(bool bDisplay);
- bool RetDisplaySpec();
+ bool GetDisplaySpec();
void SetMultiFont(bool bMulti);
- bool RetMultiFont();
+ bool GetMultiFont();
bool Cut();
bool Copy();
@@ -186,7 +221,7 @@ protected:
bool Shift(bool bLeft);
bool MinMaj(bool bMaj);
void Justif();
- int RetCursorLine(int cursor);
+ int GetCursorLine(int cursor);
void UndoFlush();
void UndoMemorize(OperUndo oper);
@@ -243,3 +278,4 @@ protected:
};
+}
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 71e06f2..f747c94 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,13 @@
// editvalue.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -33,10 +34,11 @@
-
+namespace Ui {
// Object's constructor.
-CEditValue::CEditValue(CInstanceManager* iMan) : CControl(iMan)
+//CEditValue::CEditValue(CInstanceManager* iMan) : CControl(iMan)
+CEditValue::CEditValue() : CControl ()
{
m_edit = 0;
m_buttonUp = 0;
@@ -60,28 +62,28 @@ CEditValue::~CEditValue()
// Creates a new button.
-bool CEditValue::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CEditValue::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- CEdit* pe;
- CButton* pc;
+ Ui::CEdit* pe;
+ Ui::CButton* pc;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
GlintDelete();
- m_edit = new CEdit(m_iMan);
- pe = (CEdit*)m_edit;
+ m_edit = new Ui::CEdit();
+ pe = static_cast<Ui::CEdit*>(m_edit);
pe->Create(pos, dim, 0, EVENT_NULL);
pe->SetMaxChar(4);
- m_buttonUp = new CButton(m_iMan);
- pc = (CButton*)m_buttonUp;
+ m_buttonUp = new Ui::CButton();
+ pc = static_cast<Ui::CButton*>(m_buttonUp);
pc->Create(pos, dim, 49, EVENT_NULL); // ^
pc->SetRepeat(true);
- m_buttonDown = new CButton(m_iMan);
- pc = (CButton*)m_buttonDown;
+ m_buttonDown = new Ui::CButton();
+ pc = static_cast<Ui::CButton*>(m_buttonDown);
pc->Create(pos, dim, 50, EVENT_NULL); // v
pc->SetRepeat(true);
@@ -151,11 +153,11 @@ bool CEditValue::EventProcess(const Event &event)
if ( m_edit != 0 )
{
- if ( m_edit->RetFocus() &&
- event.event == EVENT_KEYDOWN &&
- event.param == VK_RETURN )
+ if ( m_edit->GetFocus() &&
+ event.type == EVENT_KEY_DOWN &&
+ event.param == KEY(RETURN) )
{
- value = RetValue();
+ value = GetValue();
if ( value > m_maxValue ) value = m_maxValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
@@ -163,19 +165,18 @@ bool CEditValue::EventProcess(const Event &event)
}
if ( !m_edit->EventProcess(event) ) return false;
- if ( event.event == m_edit->RetEventMsg() )
+ if ( event.type == m_edit->GetEventType() )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, m_eventMsg);
+ Event newEvent(m_eventType);
m_event->AddEvent(newEvent);
}
}
if ( m_buttonUp != 0 )
{
- if ( event.event == m_buttonUp->RetEventMsg() )
+ if ( event.type == m_buttonUp->GetEventType() )
{
- value = RetValue()+m_stepValue;
+ value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
SetValue(value, true);
HiliteValue(event);
@@ -185,9 +186,9 @@ bool CEditValue::EventProcess(const Event &event)
if ( m_buttonDown != 0 )
{
- if ( event.event == m_buttonDown->RetEventMsg() )
+ if ( event.type == m_buttonDown->GetEventType() )
{
- value = RetValue()-m_stepValue;
+ value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
HiliteValue(event);
@@ -195,20 +196,20 @@ bool CEditValue::EventProcess(const Event &event)
if ( !m_buttonDown->EventProcess(event) ) return false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
Detect(event.pos) )
{
- value = RetValue()+m_stepValue;
+ value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
SetValue(value, true);
HiliteValue(event);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) )
{
- value = RetValue()-m_stepValue;
+ value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
HiliteValue(event);
@@ -226,7 +227,7 @@ void CEditValue::HiliteValue(const Event &event)
if ( m_edit == 0 ) return;
- pos = m_edit->RetTextLength();
+ pos = m_edit->GetTextLength();
if ( m_type == EVT_100 && pos > 0 )
{
pos --; // not only selects the "%"
@@ -236,8 +237,9 @@ void CEditValue::HiliteValue(const Event &event)
m_edit->SetFocus(true);
Event newEvent = event;
- newEvent.event = EVENT_FOCUS;
- newEvent.param = m_edit->RetEventMsg();
+ newEvent.type = EVENT_ACTIVE;
+ newEvent.active.gain = true; // TODO not much pretty sure about it
+ newEvent.param = m_edit->GetEventType();
m_event->AddEvent(newEvent); // defocus the other objects
}
@@ -275,7 +277,7 @@ void CEditValue::SetType(EditValueType type)
m_type = type;
}
-EditValueType CEditValue::RetType()
+EditValueType CEditValue::GetType()
{
return m_type;
}
@@ -310,15 +312,14 @@ void CEditValue::SetValue(float value, bool bSendMessage)
if ( bSendMessage )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, m_eventMsg);
+ Event newEvent(m_eventType);
m_event->AddEvent(newEvent);
}
}
// Return the edited value.
-float CEditValue::RetValue()
+float CEditValue::GetValue()
{
char text[100];
float value;
@@ -345,7 +346,7 @@ void CEditValue::SetStepValue(float value)
m_stepValue = value;
}
-float CEditValue::RetStepValue()
+float CEditValue::GetStepValue()
{
return m_stepValue;
}
@@ -358,7 +359,7 @@ void CEditValue::SetMinValue(float value)
m_minValue = value;
}
-float CEditValue::RetMinValue()
+float CEditValue::GetMinValue()
{
return m_minValue;
}
@@ -371,8 +372,9 @@ void CEditValue::SetMaxValue(float value)
m_maxValue = value;
}
-float CEditValue::RetMaxValue()
+float CEditValue::GetMaxValue()
{
return m_maxValue;
}
+}
diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h
index 758450a..c5c857c 100644
--- a/src/ui/editvalue.h
+++ b/src/ui/editvalue.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,7 +22,12 @@
#include "ui/control.h"
-#include "common/event.h"
+
+namespace Gfx{
+class CEngine;
+}
+
+namespace Ui {
enum EditValueType
{
@@ -30,8 +36,6 @@ enum EditValueType
EVT_100 = 3, // percent (0 .. 1)
};
-
-class CD3DEngine;
class CEdit;
class CButton;
@@ -40,10 +44,11 @@ class CButton;
class CEditValue : public CControl
{
public:
+// CEditValue(CInstanceManager* iMan);
CEditValue();
virtual ~CEditValue();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
@@ -52,28 +57,28 @@ public:
void Draw();
void SetType(EditValueType type);
- EditValueType RetType();
+ EditValueType GetType();
void SetValue(float value, bool bSendMessage=false);
- float RetValue();
+ float GetValue();
void SetStepValue(float value);
- float RetStepValue();
+ float GetStepValue();
void SetMinValue(float value);
- float RetMinValue();
+ float GetMinValue();
void SetMaxValue(float value);
- float RetMaxValue();
+ float GetMaxValue();
protected:
void MoveAdjust();
void HiliteValue(const Event &event);
protected:
- CEdit* m_edit;
- CButton* m_buttonUp;
- CButton* m_buttonDown;
+ Ui::CEdit* m_edit;
+ Ui::CButton* m_buttonUp;
+ Ui::CButton* m_buttonDown;
EditValueType m_type;
float m_stepValue;
@@ -82,3 +87,4 @@ protected:
};
+}
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index a4571da..cc4eca0 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -18,11 +19,12 @@
//#include <windows.h>
-#include <stdio.h>
+//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
@@ -31,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan)
+//CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan)
+CGauge::CGauge() : CControl()
{
m_level = 0.0f;
}
@@ -95,40 +98,40 @@ void CGauge::Draw()
pos = m_pos;
dim = m_dim;
- uv1.x = 32.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
DrawIcon(pos, dim, uv1, uv2, corner, 8.0f/256.0f);
- pos.x += 3.0f/640.0f;
- pos.y += 3.0f/480.0f;
- dim.x -= 6.0f/640.0f;
- dim.y -= 6.0f/480.0f;
+ pos.x += 3.0f / 640.0f;
+ pos.y += 3.0f / 480.0f;
+ dim.x -= 6.0f / 640.0f;
+ dim.y -= 6.0f / 480.0f;
if ( m_dim.x < m_dim.y ) // vertical gauge?
{
- uv1.x = (0.0f+m_icon*16.0f)/256.0f;
- uv2.x = uv1.x+16.0f/256.0f;
- uv1.y = 128.0f/256.0f+m_level*(64.0f/256.0f);
- uv2.y = uv1.y+64.0f/256.0f;
+ uv1.x = (0.0f + m_icon * 16.0f) / 256.0f;
+ uv2.x = uv1.x + 16.0f / 256.0f;
+ uv1.y = 128.0f/256.0f + m_level * (64.0f/256.0f);
+ uv2.y = uv1.y + 64.0f/256.0f;
}
else // horizontal gauge?
{
- uv1.x = 64.0f/256.0f+(1.0f-m_level)*(64.0f/256.0f);
- uv2.x = uv1.x+64.0f/256.0f;
- uv1.y = (128.0f+m_icon*16.0f)/256.0f;
- uv2.y = uv1.y+16.0f/256.0f;
+ uv1.x = 64.0f/256.0f + (1.0f - m_level) * (64.0f/256.0f);
+ uv2.x = uv1.x + 64.0f/256.0f;
+ uv1.y = (128.0f + m_icon*16.0f) / 256.0f;
+ uv2.y = uv1.y + 16.0f/256.0f;
}
uv1.x += dp;
@@ -155,3 +158,4 @@ float CGauge::GetLevel()
}
+}
diff --git a/src/ui/gauge.h b/src/ui/gauge.h
index 26ce8e9..b745834 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,14 +22,16 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+};
-//class CD3DEngine;
-
-
+namespace Ui {
class CGauge : public CControl
{
public:
+// CGauge(CInstanceManager* iMan);
CGauge();
virtual ~CGauge();
@@ -48,3 +51,4 @@ protected:
};
+}
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index d2cd192..da0aa37 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -33,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan)
+//CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan)
+CGroup::CGroup() : CControl()
{
}
@@ -93,16 +94,16 @@ void CGroup::Draw()
DrawShadow(m_pos, m_dim);
}
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
if ( m_icon == 0 ) // hollow frame?
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 160.0f/256.0f;
- uv1.y = 192.0f/256.0f; // u-v texture
- uv2.x = 192.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 192.0f / 256.0f; // u-v texture
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -115,10 +116,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 104.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 112.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 104.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 112.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -129,10 +130,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 112.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 120.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 112.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 120.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -143,10 +144,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 120.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 128.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 120.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 128.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -157,10 +158,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 192.0f/256.0f;
- uv1.y = 128.0f/256.0f;
- uv2.x = 224.0f/256.0f;
- uv2.y = 160.0f/256.0f;
+ uv1.x = 192.0f / 256.0f;
+ uv1.y = 128.0f / 256.0f;
+ uv2.x = 224.0f / 256.0f;
+ uv2.y = 160.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -171,10 +172,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 224.0f/256.0f;
- uv1.y = 128.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 160.0f/256.0f;
+ uv1.x = 224.0f / 256.0f;
+ uv1.y = 128.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 160.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -185,26 +186,26 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- uv1.x = 0.0f/256.0f; // brown transparent
- uv1.y = 75.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ uv1.x = 0.0f / 256.0f; // brown transparent
+ uv1.y = 75.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
}
if ( m_icon == 7 )
{
m_engine->SetTexture("button1.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f;
- uv1.y = 0.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 32.0f/256.0f;
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 32.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -215,10 +216,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- uv1.x = 64.0f/256.0f; // green transparent
- uv1.y = 160.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 176.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // green transparent
+ uv1.y = 160.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 176.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -229,7 +230,7 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- uv1.x = 64.0f/256.0f; // red transparent
+ uv1.x = 64.0f / 256.0f; // red transparent
uv1.y = 176.0f/256.0f;
uv2.x = 160.0f/256.0f;
uv2.y = 192.0f/256.0f;
@@ -243,10 +244,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- uv1.x = 64.0f/256.0f; // blue transparent
- uv1.y = 192.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // blue transparent
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -257,10 +258,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- uv1.x = 64.0f/256.0f; // yellow transparent
- uv1.y = 224.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 240.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // yellow transparent
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 240.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -269,17 +270,17 @@ void CGroup::Draw()
}
if ( m_icon == 12 ) // viewfinder cross?
{
- dim.x = m_dim.x/2.0f;
- dim.y = m_dim.y/2.0f;
+ dim.x = m_dim.x / 2.0f;
+ dim.y = m_dim.y / 2.0f;
m_engine->SetTexture("mouse.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/300.0f;
pos.y = m_pos.y+m_dim.y/300.0f+dim.y;
- uv1.x = 0.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 63.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 0.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 63.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, dim, uv1, uv2); // ul
pos.x += dim.x;
Math::Swap(uv1.x, uv2.x);
@@ -294,10 +295,10 @@ void CGroup::Draw()
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/300.0f;
pos.y = m_pos.y-m_dim.y/300.0f+dim.y;
- uv1.x = 64.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 127.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 64.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 127.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, dim, uv1, uv2); // ul
pos.x += dim.x;
Math::Swap(uv1.x, uv2.x);
@@ -315,19 +316,19 @@ void CGroup::Draw()
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv1.x = 128.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 191.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 128.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 191.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv1.x = 192.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 255.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 192.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 255.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 14 ) // corner upper / right?
@@ -336,19 +337,19 @@ void CGroup::Draw()
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv2.x = 128.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv1.x = 191.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv2.x = 128.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv1.x = 191.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv2.x = 192.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv1.x = 255.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv2.x = 192.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv1.x = 255.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 15 ) // corner lower / left?
@@ -357,19 +358,19 @@ void CGroup::Draw()
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv1.x = 128.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv2.x = 191.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv1.x = 128.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv2.x = 191.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv1.x = 192.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv2.x = 255.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv1.x = 192.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv2.x = 255.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 16 ) // corner lower / left?
@@ -378,45 +379,45 @@ void CGroup::Draw()
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv2.x = 128.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv1.x = 191.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv2.x = 128.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv1.x = 191.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv2.x = 192.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv1.x = 255.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv2.x = 192.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv1.x = 255.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 17 )
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 0.0f/256.0f; // blue frame
- uv1.y = 75.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ uv1.x = 0.0f / 256.0f; // blue frame
+ uv1.y = 75.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 6.0f/640.0f;
- corner.y = 6.0f/480.0f;
+ corner.x = 6.0f / 640.0f;
+ corner.y = 6.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 18 ) // arrow> for SatCom?
{
m_engine->SetTexture("button1.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 0.0f/256.0f; // >
- uv1.y = 192.0f/256.0f;
- uv2.x = 32.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 0.0f / 256.0f; // >
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 32.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -427,10 +428,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button1.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 224.0f/256.0f; // SatCom symbol
- uv1.y = 224.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 256.0f/256.0f;
+ uv1.x = 224.0f / 256.0f; // SatCom symbol
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 256.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -441,10 +442,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button1.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 224.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 224.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -455,10 +456,10 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- uv1.x = 160.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 192.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -469,16 +470,16 @@ void CGroup::Draw()
{
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f; // opaque yellow
- uv1.y = 224.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 240.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // opaque yellow
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 240.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 5.0f/640.0f;
- corner.y = 5.0f/480.0f;
+ corner.x = 5.0f / 640.0f;
+ corner.y = 5.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 3.0f/256.0f);
}
@@ -486,74 +487,74 @@ void CGroup::Draw()
{
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f; // yellow
- uv1.y = 192.0f/256.0f;
- uv2.x = 80.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // yellow
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 80.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 24 )
{
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 80.0f/256.0f; // orange
- uv1.y = 192.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ uv1.x = 80.0f / 256.0f; // orange
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 25 )
{
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f; // orange
- uv1.y = 208.0f/256.0f;
- uv2.x = 80.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 64.0f / 256.0f; // orange
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 80.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 26 )
{
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 80.0f/256.0f; // red
- uv1.y = 208.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 80.0f / 256.0f; // red
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 27 )
{
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 32.0f/256.0f;
- uv1.y = 0.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 32.0f/256.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 32.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -568,8 +569,8 @@ void CGroup::Draw()
m_engine->SetTexture("button2.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 32.0f/256.0f;
- uv1.y = 32.0f/256.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -580,12 +581,12 @@ void CGroup::Draw()
m_engine->SetTexture("button3.tga");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- pos.x += 8.0f/640.0f;
- pos.y += 8.0f/480.0f;
- dim.x -= 16.0f/640.0f;
- dim.y -= 16.0f/480.0f;
- uv1.x = 32.0f/256.0f;
- uv1.y = 0.0f/256.0f;
+ pos.x += 8.0f / 640.0f;
+ pos.y += 8.0f / 480.0f;
+ dim.x -= 16.0f / 640.0f;
+ dim.y -= 16.0f / 480.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -595,12 +596,12 @@ void CGroup::Draw()
DrawIcon(pos, dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- pos.x += 2.0f/640.0f;
- pos.y += 2.0f/480.0f;
- dim.x -= 4.0f/640.0f;
- dim.y -= 4.0f/480.0f;
- uv1.x = 0.0f/256.0f;
- uv1.y = 0.0f/256.0f;
+ pos.x += 2.0f / 640.0f;
+ pos.y += 2.0f / 480.0f;
+ dim.x -= 4.0f / 640.0f;
+ dim.y -= 4.0f / 480.0f;
+ uv1.x = 0.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -610,10 +611,10 @@ void CGroup::Draw()
DrawIcon(pos, dim, uv1, uv2);
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
- pos.x += 8.0f/640.0f;
- pos.y += 8.0f/480.0f;
- dim.x -= 16.0f/640.0f;
- dim.y -= 16.0f/480.0f;
+ pos.x += 8.0f / 640.0f;
+ pos.y += 8.0f / 480.0f;
+ dim.x -= 16.0f / 640.0f;
+ dim.y -= 16.0f / 480.0f;
if ( m_icon == 100 ) icon = 43; // base ?
if ( m_icon == 101 ) icon = 32; // factory ?
if ( m_icon == 102 ) icon = 35; // research ?
@@ -643,3 +644,4 @@ void CGroup::Draw()
}
+}
diff --git a/src/ui/group.h b/src/ui/group.h
index 12c4003..bfeef74 100644
--- a/src/ui/group.h
+++ b/src/ui/group.h
@@ -21,14 +21,16 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+};
-class CD3DEngine;
-
-
+namespace Ui {
class CGroup : public CControl
{
public:
+// CGroup(CInstanceManager* iMan);
CGroup();
virtual ~CGroup();
@@ -44,3 +46,4 @@ protected:
};
+}
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index 8bf46fb..5bf6e45 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,14 @@
// image.cpp
-#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 "common/struct.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"
@@ -32,10 +34,11 @@
-
+namespace Ui {
// Object's constructor.
-CImage::CImage(CInstanceManager* iMan) : CControl(iMan)
+//CImage::CImage(CInstanceManager* iMan) : CControl(iMan)
+CImage::CImage() : CControl()
{
m_filename[0] = 0;
}
@@ -46,25 +49,25 @@ CImage::~CImage()
{
if ( m_filename[0] != 0 )
{
- m_engine->FreeTexture(m_filename);
+ m_engine->DeleteTexture(m_filename);
}
}
// Creates a new button.
-bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
if ( icon == -1 )
{
char name[100];
char* p;
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -80,13 +83,13 @@ void CImage::SetFilenameImage(char *name)
{
if ( m_filename[0] != 0 )
{
- m_engine->FreeTexture(m_filename);
+ m_engine->DeleteTexture(m_filename);
}
strcpy(m_filename, name);
}
-char* CImage::RetFilenameImage()
+char* CImage::GetFilenameImage()
{
return m_filename;
}
@@ -119,17 +122,17 @@ void CImage::Draw()
if ( m_icon == 0 ) // hollow frame?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 160.0f/256.0f;
- uv1.y = 192.0f/256.0f; // u-v texture
- uv2.x = 192.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 192.0f / 256.0f; // u-v texture
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
}
@@ -137,13 +140,13 @@ void CImage::Draw()
{
m_engine->LoadTexture(m_filename);
m_engine->SetTexture(m_filename);
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos;
dim = m_dim;
- pos.x += 5.0f/640.0f;
- pos.y += 5.0f/480.0f;
- dim.x -= 10.0f/640.0f;
- dim.y -= 10.0f/480.0f;
+ pos.x += 5.0f / 640.0f;
+ pos.y += 5.0f / 480.0f;
+ dim.x -= 10.0f / 640.0f;
+ dim.y -= 10.0f / 480.0f;
uv1.x = 0.0f;
uv1.y = 0.0f;
uv2.x = 1.0f;
@@ -153,3 +156,4 @@ void CImage::Draw()
}
+}
diff --git a/src/ui/image.h b/src/ui/image.h
index b6b88c3..f24684a 100644
--- a/src/ui/image.h
+++ b/src/ui/image.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,28 +20,30 @@
#pragma once
-#include <ui/control.h>
+#include "ui/control.h"
-#include <common/event.h>
-
-class CD3DEngine;
+namespace Gfx{
+class CEngine;
+};
+namespace Ui {
class CImage : public CControl
{
public:
- CImage();
+// CImage(CInstanceManager* iMan);
+ CImage ();
virtual ~CImage();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetFilenameImage(char *name);
- char* RetFilenameImage();
+ char* GetFilenameImage();
protected:
@@ -49,3 +52,4 @@ protected:
};
+}
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index 5526c80..b54c868 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,14 @@
// scroll.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -31,7 +33,7 @@
#include "ui/scroll.h"
-
+namespace Ui {
// Object's constructor.
@@ -61,9 +63,9 @@ CScroll::~CScroll()
// Creates a new button.
-bool CScroll::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CScroll::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
MoveAdjust();
@@ -102,20 +104,20 @@ void CScroll::MoveAdjust()
{
if ( m_buttonUp == 0 )
{
- m_buttonUp = new CButton(m_iMan);
+ m_buttonUp = new CButton();
pc = (CButton*)m_buttonUp;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 49, EVENT_NULL);
pc->SetRepeat(true);
- m_eventUp = pc->GetEventMsg();
+ m_eventUp = pc->GetEventType();
}
if ( m_buttonDown == 0 )
{
- m_buttonDown = new CButton(m_iMan);
+ m_buttonDown = new CButton();
pc = (CButton*)m_buttonDown;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 50, EVENT_NULL);
pc->SetRepeat(true);
- m_eventDown = pc->GetEventMsg();
+ m_eventDown = pc->GetEventType();
}
}
@@ -213,31 +215,32 @@ bool CScroll::EventProcess(const Event &event)
if ( !m_buttonDown->EventProcess(event) ) return false;
}
- if ( event.event == m_eventUp && m_step > 0.0f )
+ if ( event.type == m_eventUp && m_step > 0.0f )
{
m_visibleValue -= m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == m_eventDown && m_step > 0.0f )
+ if ( event.type == m_eventDown && m_step > 0.0f )
{
m_visibleValue += m_step;
if ( m_visibleValue > 1.0f ) m_visibleValue = 1.0f;
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
hButton = m_buttonUp?m_dim.x/0.75f:0.0f;
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -258,7 +261,7 @@ bool CScroll::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
m_bCapture = true;
@@ -267,7 +270,7 @@ bool CScroll::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
if ( h != 0 )
@@ -282,33 +285,35 @@ bool CScroll::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
}
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton.button == 1 &&
+ m_bCapture )
{
m_bCapture = false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
- Detect(event.pos) &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
+ Detect(event.pos) &&
m_buttonUp != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonUp->GetEventMsg();
+ newEvent.type = m_buttonUp->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
- Detect(event.pos) &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
+ Detect(event.pos) &&
m_buttonDown != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonDown->GetEventMsg();
+ newEvent.type = m_buttonDown->GetEventType();
m_event->AddEvent(newEvent);
}
@@ -381,7 +386,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -391,7 +396,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -401,7 +406,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 2 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // blue rectangle
uv1.y = 0.0f/256.0f;
uv2.x = 96.0f/256.0f;
@@ -411,7 +416,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 104.0f/256.0f; // blue line -
uv1.y = 32.0f/256.0f;
uv2.x = 128.0f/256.0f;
@@ -467,3 +472,4 @@ float CScroll::GetArrowStep()
return m_step;
}
+}
diff --git a/src/ui/scroll.h b/src/ui/scroll.h
index 289d309..9dbd8a4 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -23,6 +24,10 @@
#include <common/event.h>
+namespace Ui {
+
+class CButton;
+
const float SCROLL_WIDTH = (15.0f/640.0f);
@@ -76,3 +81,4 @@ class CScroll : public CControl
};
+}
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index fe9ca9b..05e5d2d 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,24 +18,27 @@
// shortcut.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
+#include <math.h>
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
+#include "graphics/core/device.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "ui/shortcut.h"
-
+namespace Ui {
// Object's constructor.
-CShortcut::CShortcut(CInstanceManager* iMan) : CControl(iMan)
+//CShortcut::CShortcut(CInstanceManager* iMan) : CControl(iMan)
+CShortcut::CShortcut() : CControl()
{
m_time = 0.0f;
}
@@ -48,11 +52,11 @@ CShortcut::~CShortcut()
// Creates a new button.
-bool CShortcut::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CShortcut::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -63,17 +67,18 @@ bool CShortcut::EventProcess(const Event &event)
{
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
m_time += event.rTime;
}
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -92,24 +97,24 @@ void CShortcut::Draw()
icon = 0;
zoom = 0.8f;
- mode = D3DSTATETTw;
+ mode = Gfx::ENG_RSTATE_TTEXTURE_WHITE;
if ( m_state & STATE_HILIGHT )
{
icon = 4;
zoom = 0.9f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_state & STATE_CHECK )
{
icon = 1;
zoom = 0.8f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_state & STATE_PRESS )
{
icon = 1;
zoom = 1.0f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_icon == 6 || m_icon == 7 ) // pause or film?
{
@@ -125,7 +130,7 @@ void CShortcut::Draw()
DrawVertex(icon, 0.95f);
}
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
DrawVertex(m_icon, zoom);
if ( m_state & STATE_FRAME )
@@ -134,7 +139,7 @@ void CShortcut::Draw()
float zoom, dp;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
zoom = 0.9f+sinf(m_time*8.0f)*0.1f;
@@ -174,7 +179,7 @@ void CShortcut::Draw()
float dp;
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 160.0f/256.0f;
uv1.y = 0.0f/256.0f;
@@ -195,13 +200,13 @@ void CShortcut::Draw()
void CShortcut::DrawVertex(int icon, float zoom)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[4]; // 2 triangles
+ Gfx::CDevice* device;
+ Gfx::Vertex vertex[4]; // 2 triangles
Math::Point p1, p2, c;
Math::Vector n;
float u1, u2, v1, v2, dp;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
p1.x = m_pos.x;
p1.y = m_pos.y;
@@ -230,12 +235,13 @@ void CShortcut::DrawVertex(int icon, float zoom)
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, u1,v2);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, u1,v1);
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, u2,v2);
- vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, u2,v1);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
}
+}
diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h
index d819bf2..9ee97e0 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,7 @@
#include <common/event.h>
+namespace Ui {
class CShortcut : public CControl
{
@@ -29,7 +31,7 @@ class CShortcut : public CControl
CShortcut();
~CShortcut();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
@@ -43,3 +45,4 @@ class CShortcut : public CControl
};
+}
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index be8af18..27bcfbb 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,21 +18,24 @@
// slider.cpp
-#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 "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/button.h"
#include "ui/slider.h"
+namespace Ui {
const float CURSOR_WIDTH = (10.0f/640.0f);
const float HOLE_WIDTH = (5.0f/480.0f);
@@ -41,7 +45,7 @@ const float HOLE_WIDTH = (5.0f/480.0f);
// Object's constructor.
-CSlider::CSlider(CInstanceManager* iMan) : CControl(iMan)
+CSlider::CSlider() : CControl()
{
m_buttonLeft = 0;
m_buttonRight = 0;
@@ -71,10 +75,10 @@ CSlider::~CSlider()
// Creates a new button.
-bool CSlider::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CSlider::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
MoveAdjust();
return true;
@@ -115,20 +119,20 @@ void CSlider::MoveAdjust()
#if 1
if ( m_buttonLeft == 0 )
{
- m_buttonLeft = new CButton(m_iMan);
+ m_buttonLeft = new CButton();
m_buttonLeft->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?55:49, EVENT_NULL); // </^
m_buttonLeft->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW);
- m_eventUp = m_buttonLeft->RetEventMsg();
+ m_eventUp = m_buttonLeft->GetEventType();
}
if ( m_buttonRight == 0 )
{
- m_buttonRight = new CButton(m_iMan);
+ m_buttonRight = new CButton();
m_buttonRight->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?48:50, EVENT_NULL); // >/v
m_buttonRight->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonRight->SetState(STATE_SHADOW);
- m_eventDown = m_buttonRight->RetEventMsg();
+ m_eventDown = m_buttonRight->GetEventType();
}
m_marginButton = m_bHoriz?(m_dim.y*0.75f):(m_dim.x/0.75f);
@@ -261,7 +265,7 @@ bool CSlider::EventProcess(const Event &event)
if ( !m_buttonRight->EventProcess(event) ) return false;
}
- if ( event.event == m_eventUp && m_step > 0.0f )
+ if ( event.type == m_eventUp && m_step > 0.0f )
{
m_visibleValue -= m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@@ -269,11 +273,11 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == m_eventDown && m_step > 0.0f )
+ if ( event.type == m_eventDown && m_step > 0.0f )
{
m_visibleValue += m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@@ -281,12 +285,13 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- 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) )
@@ -311,7 +316,7 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
m_bCapture = true;
@@ -320,7 +325,7 @@ bool CSlider::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
if ( m_bHoriz )
{
@@ -345,32 +350,35 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( ( event.type == EVENT_MOUSE_BUTTON_UP ) &&
+ ( event.mouseButton.button == 1 ) &&
+ m_bCapture )
{
m_bCapture = false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
Detect(event.pos) &&
m_buttonLeft != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonLeft->RetEventMsg();
+ newEvent.type = m_buttonLeft->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) &&
m_buttonRight != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonRight->RetEventMsg();
+ newEvent.type = m_buttonRight->GetEventType();
m_event->AddEvent(newEvent);
}
@@ -466,10 +474,10 @@ void CSlider::Draw()
if ( m_bHoriz )
{
sprintf(text, "%d", (int)(m_min+m_visibleValue*(m_max-m_min)));
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
pos.x = m_pos.x+m_dim.x+(10.0f/640.0f);
pos.y = m_pos.y+(m_dim.y-h)/2.0f;
- m_engine->RetText()->DrawText(text, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
else
{
@@ -482,7 +490,7 @@ void CSlider::Draw()
dim.x = 50.0f/640.0f;
dim.y = 16.0f/480.0f;
sprintf(text, "%d", (int)(m_min+(m_visibleValue*(m_max-m_min))));
- m_engine->RetText()->DrawText(text, pos, dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
}
}
@@ -497,7 +505,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -509,7 +517,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -521,7 +529,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 224.0f/256.0f; // cursor
uv1.y = 32.0f/256.0f;
uv2.x = 256.0f/256.0f;
@@ -561,7 +569,7 @@ void CSlider::SetVisibleValue(float value)
AdjustGlint();
}
-float CSlider::RetVisibleValue()
+float CSlider::GetVisibleValue()
{
return m_min+m_visibleValue*(m_max-m_min);
}
@@ -572,9 +580,10 @@ void CSlider::SetArrowStep(float step)
m_step = step/(m_max-m_min);
}
-float CSlider::RetArrowStep()
+float CSlider::GetArrowStep()
{
return m_step*(m_max-m_min);
}
+}
diff --git a/src/ui/slider.h b/src/ui/slider.h
index e79b348..0de9b3c 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
#include <common/event.h>
+namespace Ui {
class CSlider : public CControl
{
@@ -45,10 +47,10 @@ class CSlider : public CControl
void SetLimit(float min, float max);
void SetVisibleValue(float value);
- float RetVisibleValue();
+ float GetVisibleValue();
void SetArrowStep(float step);
- float RetArrowStep();
+ float GetArrowStep();
protected:
void MoveAdjust();
@@ -76,3 +78,4 @@ class CSlider : public CControl
};
+}
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index f94ae02..db478fe 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -17,13 +17,14 @@
// target.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
+
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -34,10 +35,10 @@
-
+namespace Ui {
// Object's constructor.
-CTarget::CTarget(CInstanceManager* iMan) : CControl(iMan)
+CTarget::CTarget() : CControl()
{
}
@@ -50,11 +51,11 @@ CTarget::~CTarget()
// Creates a new button.
-bool CTarget::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CTarget::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -70,26 +71,27 @@ bool CTarget::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( CControl::Detect(event.pos) )
{
- m_engine->SetMouseType(D3DMOUSETARGET);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ 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 = EVENT_OBJECT_FIRE;
+ newEvent.type = EVENT_OBJECT_FIRE;
m_event->AddEvent(newEvent);
return false;
}
@@ -104,7 +106,7 @@ bool CTarget::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
m_main->SetFriendAim(false);
@@ -113,22 +115,23 @@ bool CTarget::EventProcess(const Event &event)
pObj = DetectFriendObject(event.pos);
if ( pObj == 0 )
{
- m_engine->SetMouseType(D3DMOUSETARGET);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
else
{
m_main->SetFriendAim(true);
- m_engine->SetMouseType(D3DMOUSENORM);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
}
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -137,7 +140,7 @@ bool CTarget::EventProcess(const Event &event)
if ( !m_main->RetFriendAim() )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_FIRE;
+ newEvent.type = EVENT_OBJECT_FIRE;
m_event->AddEvent(newEvent);
return false;
}
@@ -202,15 +205,15 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
- if ( pObj->RetSelect() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
+ if ( pObj->GetSelect() ) continue;
pTarget = 0;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ||
type == OBJECT_FACTORY ||
type == OBJECT_REPAIR ||
@@ -261,10 +264,10 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
}
else if ( (type == OBJECT_POWER ||
type == OBJECT_ATOMIC ) &&
- pObj->RetTruck() != 0 ) // battery used?
+ pObj->GetTruck() != 0 ) // battery used?
{
- pTarget = pObj->RetTruck();
- if ( pTarget->RetType() == OBJECT_MOBILEtg )
+ pTarget = pObj->GetTruck();
+ if ( pTarget->GetType() == OBJECT_MOBILEtg )
{
pTarget = 0;
}
@@ -272,7 +275,7 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
for ( j=0 ; j<OBJECTMAXPART ; j++ )
{
- rank = pObj->RetObjectRank(j);
+ rank = pObj->GetObjectRank(j);
if ( rank == -1 ) continue;
if ( rank != objRank ) continue;
return pTarget;
@@ -281,3 +284,4 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
return 0;
}
+}
diff --git a/src/ui/target.h b/src/ui/target.h
index a2615b4..0b5b67d 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -23,6 +23,7 @@
#include <common/event.h>
+namespace Ui {
class CTarget : public CControl
{
@@ -41,3 +42,4 @@ class CTarget : public CControl
};
+}
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 8866643..fabd9c4 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,14 +18,14 @@
// window.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
#include "common/language.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -46,15 +47,17 @@
#include "ui/gauge.h"
#include "ui/compass.h"
#include "ui/target.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/window.h"
-
+namespace Ui {
// Object's constructor.
-CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
+//CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
+CWindow::CWindow() : CControl()
{
int i;
@@ -80,7 +83,7 @@ CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
m_bClosable = false;
m_bCapture = false;
- m_fontStretch = NORMSTRETCH*1.2f;
+// m_fontStretch = NORMSTRETCH*1.2f;
}
// Object's destructor.
@@ -128,9 +131,9 @@ void CWindow::Flush()
// Creates a new window.
-bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
return true;
@@ -139,18 +142,19 @@ bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventM
// Creates a new button.
-CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CButton* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CButton(m_iMan);
+// m_table[i] = new CButton(m_iMan);
+ m_table[i] = new CButton();
pc = (CButton*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -161,18 +165,19 @@ CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new button.
-CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CColor* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CColor(m_iMan);
+// m_table[i] = new CColor(m_iMan);
+ m_table[i] = new CColor();
pc = (CColor*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -183,18 +188,19 @@ CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CCheck* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CCheck(m_iMan);
+// m_table[i] = new CCheck(m_iMan);
+ m_table[i] = new CCheck();
pc = (CCheck*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -205,18 +211,19 @@ CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CKey* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CKey(m_iMan);
+// m_table[i] = new CKey(m_iMan);
+ m_table[i] = new CKey();
pc = (CKey*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -227,18 +234,19 @@ CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg ev
// Creates a new button.
-CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CGroup* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CGroup(m_iMan);
+// m_table[i] = new CGroup(m_iMan);
+ m_table[i] = new CGroup();
pc = (CGroup*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -249,18 +257,19 @@ CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CImage* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CImage(m_iMan);
+// m_table[i] = new CImage(m_iMan);
+ m_table[i] = new CImage();
pc = (CImage*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -271,20 +280,21 @@ CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new label.
-CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
+CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg,
char *name)
{
CLabel* pc;
char* p;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CLabel(m_iMan);
+// m_table[i] = new CLabel(m_iMan);
+ m_table[i] = new CLabel();
pc = (CLabel*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
@@ -312,18 +322,19 @@ CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new editable pave.
-CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CEdit* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CEdit(m_iMan);
+// m_table[i] = new CEdit(m_iMan);
+ m_table[i] = new CEdit();
pc = (CEdit*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -334,18 +345,19 @@ CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg
// Creates a new editable pave.
-CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CEditValue* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CEditValue(m_iMan);
+// m_table[i] = new CEditValue(m_iMan);
+ m_table[i] = new CEditValue();
pc = (CEditValue*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -356,18 +368,19 @@ CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon,
// Creates a new elevator.
-CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CScroll* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CScroll(m_iMan);
+// m_table[i] = new CScroll(m_iMan);
+ m_table[i] = new CScroll();
pc = (CScroll*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -378,18 +391,19 @@ CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new cursor.
-CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CSlider* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CSlider(m_iMan);
+// m_table[i] = new CSlider(m_iMan);
+ m_table[i] = new CSlider();
pc = (CSlider*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -400,19 +414,20 @@ CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new list.
-CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
+CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg,
float expand)
{
CList* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CList(m_iMan);
+// m_table[i] = new CList(m_iMan);
+ m_table[i] = new CList();
pc = (CList*)m_table[i];
pc->Create(pos, dim, icon, eventMsg, expand);
return pc;
@@ -423,18 +438,18 @@ CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg
// Creates a new shortcut.
-CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CShortcut* ps;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CShortcut(m_iMan);
+ m_table[i] = new CShortcut();
ps = (CShortcut*)m_table[i];
ps->Create(pos, dim, icon, eventMsg);
return ps;
@@ -445,18 +460,18 @@ CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, E
// Creates a new card.
-CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CMap* pm;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CMap(m_iMan);
+ m_table[i] = new CMap();
pm = (CMap*)m_table[i];
pm->Create(pos, dim, icon, eventMsg);
return pm;
@@ -467,18 +482,18 @@ CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg ev
// Creates a new gauge.
-CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CGauge* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CGauge(m_iMan);
+ m_table[i] = new CGauge();
pc = (CGauge*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -489,18 +504,18 @@ CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new compass.
-CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CCompass* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CCompass(m_iMan);
+ m_table[i] = new CCompass();
pc = (CCompass*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -511,18 +526,18 @@ CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, Eve
// Creates a new target.
-CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CTarget* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CTarget(m_iMan);
+ m_table[i] = new CTarget();
pc = (CTarget*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -533,7 +548,7 @@ CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, Event
// Removes a control.
-bool CWindow::DeleteControl(EventMsg eventMsg)
+bool CWindow::DeleteControl(EventType eventMsg)
{
int i;
@@ -541,7 +556,7 @@ bool CWindow::DeleteControl(EventMsg eventMsg)
{
if ( m_table[i] != 0 )
{
- if ( eventMsg == m_table[i]->RetEventMsg() )
+ if ( eventMsg == m_table[i]->GetEventType() )
{
delete m_table[i];
m_table[i] = 0;
@@ -554,7 +569,7 @@ bool CWindow::DeleteControl(EventMsg eventMsg)
// Gives a control.
-CControl* CWindow::SearchControl(EventMsg eventMsg)
+CControl* CWindow::SearchControl(EventType eventMsg)
{
int i;
@@ -562,7 +577,7 @@ CControl* CWindow::SearchControl(EventMsg eventMsg)
{
if ( m_table[i] != 0 )
{
- if ( eventMsg == m_table[i]->RetEventMsg() )
+ if ( eventMsg == m_table[i]->GetEventType() )
{
return m_table[i];
}
@@ -646,11 +661,11 @@ void CWindow::SetName(char* name)
if ( m_name[0] != 0 && m_bRedim ) // title bar exists?
{
- m_buttonReduce = new CButton(m_iMan);
+ m_buttonReduce = new CButton();
pc = (CButton*)m_buttonReduce;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
- m_buttonFull = new CButton(m_iMan);
+ m_buttonFull = new CButton();
pc = (CButton*)m_buttonFull;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
@@ -659,7 +674,7 @@ void CWindow::SetName(char* name)
if ( m_name[0] != 0 && m_bClosable ) // title bar exists?
{
- m_buttonClose = new CButton(m_iMan);
+ m_buttonClose = new CButton();
pc = (CButton*)m_buttonClose;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
@@ -697,7 +712,7 @@ void CWindow::MoveAdjust()
Math::Point pos, dim;
float h, offset;
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
dim.y = h*1.2f;
dim.x = dim.y*0.75f;
@@ -742,12 +757,12 @@ void CWindow::SetMaxDim(Math::Point dim)
m_maxDim = dim;
}
-Math::Point CWindow::RetMinDim()
+Math::Point CWindow::GetMinDim()
{
return m_minDim;
}
-Math::Point CWindow::RetMaxDim()
+Math::Point CWindow::GetMaxDim()
{
return m_maxDim;
}
@@ -760,7 +775,7 @@ void CWindow::SetMovable(bool bMode)
m_bMovable = bMode;
}
-bool CWindow::RetMovable()
+bool CWindow::GetMovable()
{
return m_bMovable;
}
@@ -773,7 +788,7 @@ void CWindow::SetRedim(bool bMode)
m_bRedim = bMode;
}
-bool CWindow::RetRedim()
+bool CWindow::GetRedim()
{
return m_bRedim;
}
@@ -786,7 +801,7 @@ void CWindow::SetClosable(bool bMode)
m_bClosable = bMode;
}
-bool CWindow::RetClosable()
+bool CWindow::GetClosable()
{
return m_bClosable;
}
@@ -798,7 +813,7 @@ void CWindow::SetMaximized(bool bMaxi)
AdjustButtons();
}
-bool CWindow::RetMaximized()
+bool CWindow::GetMaximized()
{
return m_bMaximized;
}
@@ -809,7 +824,7 @@ void CWindow::SetMinimized(bool bMini)
AdjustButtons();
}
-bool CWindow::RetMinimized()
+bool CWindow::GetMinimized()
{
return m_bMinimized;
}
@@ -819,7 +834,7 @@ void CWindow::SetFixed(bool bFix)
m_bFixed = bFix;
}
-bool CWindow::RetFixed()
+bool CWindow::GetFixed()
{
return m_bFixed;
}
@@ -877,7 +892,7 @@ void CWindow::SetTrashEvent(bool bTrash)
m_bTrashEvent = bTrash;
}
-bool CWindow::RetTrashEvent()
+bool CWindow::GetTrashEvent()
{
return m_bTrashEvent;
}
@@ -885,26 +900,26 @@ bool CWindow::RetTrashEvent()
// Returns the message from the button "reduce".
-EventMsg CWindow::RetEventMsgReduce()
+EventType CWindow::GetEventTypeReduce()
{
if ( m_buttonReduce == 0 ) return EVENT_NULL;
- return m_buttonReduce->RetEventMsg();
+ return m_buttonReduce->GetEventType();
}
// Returns the message from the button "full".
-EventMsg CWindow::RetEventMsgFull()
+EventType CWindow::GetEventTypeFull()
{
if ( m_buttonFull == 0 ) return EVENT_NULL;
- return m_buttonFull->RetEventMsg();
+ return m_buttonFull->GetEventType();
}
// Returns the message from the button "close".
-EventMsg CWindow::RetEventMsgClose()
+EventType CWindow::GetEventTypeClose()
{
if ( m_buttonClose == 0 ) return EVENT_NULL;
- return m_buttonClose->RetEventMsg();
+ return m_buttonClose->GetEventType();
}
@@ -947,7 +962,7 @@ int CWindow::BorderDetect(Math::Point pos)
if ( flags == 0 )
{
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
dim.y = h*1.2f;
dim.x = dim.y*0.75f;
if ( pos.x < m_pos.x+m_dim.x-0.01f-dim.x*3.0f &&
@@ -967,7 +982,7 @@ bool CWindow::EventProcess(const Event &event)
Math::Point pos;
int i, flags;
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( m_bCapture )
{
@@ -975,7 +990,7 @@ bool CWindow::EventProcess(const Event &event)
}
else
{
- m_pressMouse = D3DMOUSENORM;
+ m_pressMouse = Gfx::ENG_MOUSE_NORM;
if ( m_name[0] != 0 && m_bMovable && // title bar?
Detect(event.pos) )
@@ -983,29 +998,29 @@ bool CWindow::EventProcess(const Event &event)
flags = BorderDetect(event.pos);
if ( flags == -1 )
{
- m_pressMouse = D3DMOUSEMOVE; // +
+ m_pressMouse = Gfx::ENG_MOUSE_MOVE; // +
}
else if ( ((flags & (1<<0)) && (flags & (1<<3))) ||
((flags & (1<<1)) && (flags & (1<<2))) )
{
- m_pressMouse = D3DMOUSEMOVEI; // \ //
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEI; // \ //
}
else if ( ((flags & (1<<0)) && (flags & (1<<1))) ||
((flags & (1<<2)) && (flags & (1<<3))) )
{
- m_pressMouse = D3DMOUSEMOVED; // /
+ m_pressMouse = Gfx::ENG_MOUSE_MOVED; // /
}
else if ( (flags & (1<<0)) || (flags & (1<<2)) )
{
- m_pressMouse = D3DMOUSEMOVEH; // -
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEH; // -
}
else if ( (flags & (1<<1)) || (flags & (1<<3)) )
{
- m_pressMouse = D3DMOUSEMOVEV; // |
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEV; // |
}
}
- if ( m_pressMouse != D3DMOUSENORM )
+ if ( m_pressMouse != Gfx::ENG_MOUSE_NORM )
{
m_engine->SetMouseType(m_pressMouse);
}
@@ -1039,7 +1054,8 @@ bool CWindow::EventProcess(const Event &event)
}
}
- if ( m_bTrashEvent && event.event == EVENT_LBUTTONDOWN )
+ if ( m_bTrashEvent && event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
if ( Detect(event.pos) )
{
@@ -1056,7 +1072,7 @@ bool CWindow::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
pos = event.pos;
if ( m_pressFlags == -1 ) // all moves?
@@ -1105,11 +1121,13 @@ bool CWindow::EventProcess(const Event &event)
AdjustButtons();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton == 1 &&
+ m_bCapture )
{
m_bCapture = false;
}
@@ -1137,7 +1155,7 @@ void CWindow::Draw()
if ( m_name[0] != 0 ) // title bar?
{
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
// Draws the shadow under the title bar.
{
@@ -1160,7 +1178,7 @@ void CWindow::Draw()
dim.y = h*1.2f;
DrawVertex(pos, dim, (m_state&STATE_ENABLE)?2:9);
- sw = m_engine->RetText()->RetStringWidth(m_name, strlen(m_name), m_fontSize, m_fontStretch, m_fontType);
+ sw = m_engine->GetText()->GetStringWidth(m_name, m_fontType, m_fontSize);
if ( m_state&STATE_ENABLE )
{
@@ -1175,7 +1193,7 @@ void CWindow::Draw()
pos.x = m_pos.x+width/2.0f;
pos.y = m_pos.y+m_dim.y-0.01f-h*1.10f;
- m_engine->RetText()->DrawText(m_name, pos, width, 0, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, width, Gfx::TEXT_ALIGN_CENTER, 0);
if ( m_buttonReduce != 0 )
{
@@ -1215,7 +1233,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 64.0f/256.0f; // dark blue transparent
uv1.y = 64.0f/256.0f;
uv2.x = 128.0f/256.0f;
@@ -1231,7 +1249,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 128.0f/256.0f; // yellow tooltip
uv1.y = 0.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1245,7 +1263,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 2 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // yellow
uv1.y = 16.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1259,7 +1277,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 3 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 0.0f/256.0f; // transparent blue bar with yellow upper
uv1.y = 64.0f/256.0f;
uv2.x = 64.0f/256.0f;
@@ -1278,7 +1296,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y += 60.0f/480.0f;
m_engine->SetTexture("human.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 140.0f/256.0f;
uv1.y = 32.0f/256.0f;
uv2.x = 182.0f/256.0f;
@@ -1295,7 +1313,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y += 0.0f/480.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 192.0f/256.0f;
uv1.y = 32.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1314,7 +1332,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y -= 20.0f/480.0f;
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f;
uv1.y = 0.0f/256.0f;
uv2.x = 96.0f/256.0f;
@@ -1433,7 +1451,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 5 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent green
uv1.y = 160.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1447,7 +1465,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 6 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent red
uv1.y = 176.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1461,7 +1479,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 7 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent blue
uv1.y = 192.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1475,7 +1493,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 8 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // opaque orange
uv1.y = 0.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -1491,7 +1509,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 9 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 32.0f/256.0f; // opaque gray
uv1.y = 32.0f/256.0f;
uv2.x = 64.0f/256.0f;
@@ -1511,7 +1529,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 11 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent yellow
uv1.y = 224.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1525,7 +1543,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 12 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // dirty opaque gray
uv1.y = 128.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1541,7 +1559,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 13 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 192.0f/256.0f; // dirty opaque blue
uv1.y = 128.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1557,7 +1575,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 14 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f/256.0f; // dirty opaque red
uv1.y = 128.0f/256.0f;
uv2.x = 192.0f/256.0f;
@@ -1585,7 +1603,7 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
dp = 0.5f/256.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // hatching
uv1.y = 208.0f/256.0f;
uv2.x = 145.0f/256.0f;
@@ -1618,3 +1636,4 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
#endif
}
+}
diff --git a/src/ui/window.h b/src/ui/window.h
index 8884c6f..b122b67 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -20,8 +21,9 @@
#include <ui/control.h>
-#include <common/event.h>
+//#include <common/event.h>
+namespace Ui {
const int MAXWINDOW = 100;
@@ -54,38 +56,38 @@ public:
bool DeleteControl(EventType eventMsg);
CControl* SearchControl(EventType eventMsg);
- EventType RetEventTypeReduce();
- EventType RetEventTypeFull();
- EventType RetEventTypeClose();
+ EventType GetEventTypeReduce();
+ EventType GetEventTypeFull();
+ EventType GetEventTypeClose();
void SetName(char* name);
void SetTrashEvent(bool bTrash);
- bool RetTrashEvent();
+ bool GetTrashEvent();
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
void SetMinDim(Math::Point dim);
void SetMaxDim(Math::Point dim);
- Math::Point RetMinDim();
- Math::Point RetMaxDim();
+ Math::Point GetMinDim();
+ Math::Point GetMaxDim();
void SetMovable(bool bMode);
- bool RetMovable();
+ bool GetMovable();
void SetRedim(bool bMode);
- bool RetRedim();
+ bool GetRedim();
void SetClosable(bool bMode);
- bool RetClosable();
+ bool GetClosable();
void SetMaximized(bool bMaxi);
- bool RetMaximized();
+ bool GetMaximized();
void SetMinimized(bool bMini);
- bool RetMinimized();
+ bool GetMinimized();
void SetFixed(bool bFix);
- bool RetFixed();
+ bool GetFixed();
bool GetTooltip(Math::Point pos, char* name);
@@ -121,7 +123,8 @@ protected:
bool m_bCapture;
Math::Point m_pressPos;
int m_pressFlags;
- D3DMouse m_pressMouse;
+ Gfx::EngineMouseType m_pressMouse;
};
+}