Further improvements in UI porting

dev-ui
Michał Konopacki 2012-08-18 22:56:42 +02:00
parent 10b2c562fb
commit 574c07e388
22 changed files with 892 additions and 804 deletions

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -24,22 +25,22 @@
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
//#include "common/language.h" //#include "common/language.h"
//#include "old/math3d.h" //#include "old/math3d.h"
//#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/restext.h" #include "common/restext.h"
#include "ui/button.h" #include "ui/button.h"
namespace Ui {
const float DELAY1 = 0.4f; const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f; const float DELAY2 = 0.1f;
// Object's constructor. // Object's constructor.
CButton::CButton(CInstanceManager* iMan) : CControl(iMan) CButton::CButton() : CControl()
{ {
m_bCapture = false; m_bCapture = false;
m_bImmediat = false; m_bImmediat = false;
@ -248,3 +249,4 @@ bool CButton::GetRepeat()
return m_bRepeat; return m_bRepeat;
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,15 +22,15 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CEngine;
}
//class CD3DEngine; namespace Ui {
class CButton : public CControl class CButton : public CControl
{ {
public: public:
CButton(CInstanceManager* iMan); CButton ();
virtual ~CButton (); virtual ~CButton ();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -53,4 +54,4 @@ protected:
float m_repeat; float m_repeat;
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -16,10 +17,10 @@
//#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
//#include <d3d.h> //#include <d3d.h>
#include "common/struct.h" //#include "common/struct.h"
//#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
//#include "old/math3d.h" //#include "old/math3d.h"
@ -28,14 +29,15 @@
#include "common/iman.h" #include "common/iman.h"
#include "common/restext.h" #include "common/restext.h"
//#include "old/text.h" //#include "old/text.h"
#include "graphics/engine/text.h"
#include "ui/check.h" #include "ui/check.h"
namespace Ui {
// Object's constructor. // Object's constructor.
CCheck::CCheck(CInstanceManager* iMan) : CControl(iMan) CCheck::CCheck() : CControl()
{ {
} }
@ -165,4 +167,4 @@ void CCheck::Draw()
m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0); m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,15 +22,15 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CEngine;
}
class CD3DEngine; namespace Ui {
class CCheck : public CControl class CCheck : public CControl
{ {
public: public:
CCheck(CInstanceManager* iMan); CCheck();
virtual ~CCheck(); virtual ~CCheck();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -43,4 +44,5 @@ protected:
protected: protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -16,7 +17,7 @@
//#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
//#include <d3d.h> //#include <d3d.h>
//#include "common/struct.h" //#include "common/struct.h"
@ -32,7 +33,7 @@
#include "ui/color.h" #include "ui/color.h"
namespace Ui {
const float DELAY1 = 0.4f; const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f; const float DELAY2 = 0.1f;
@ -40,7 +41,8 @@ const float DELAY2 = 0.1f;
// Object's constructor. // Object's constructor.
CColor::CColor(CInstanceManager* iMan) : CControl(iMan) //CColor::CColor(CInstanceManager* iMan) : CControl(iMan)
CColor::CColor() : CControl()
{ {
m_bRepeat = false; m_bRepeat = false;
m_repeat = 0.0f; m_repeat = 0.0f;
@ -164,20 +166,20 @@ void CColor::Draw()
p1.y = m_pos.y + (4.0f / 480.0f); p1.y = m_pos.y + (4.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (4.0f / 640.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); 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[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, 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, 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, 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); device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
p1.x = m_pos.x + (5.0f / 640.0f); p1.x = m_pos.x + (5.0f / 640.0f);
p1.y = m_pos.y + (5.0f / 480.0f); p1.y = m_pos.y + (5.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (5.0f / 640.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); 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[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, 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, 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, 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); device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(4); m_engine->AddStatisticTriangle(4);
@ -226,3 +228,4 @@ Gfx::Color CColor::GetColor()
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -22,15 +23,17 @@
#include "ui/control.h" #include "ui/control.h"
//#include "graphics/engine/engine.h" //#include "graphics/engine/engine.h"
namespace Gfx{
class CEngine;
struct Color;
}
//class CEngine; namespace Ui {
class CColor : public CControl class CColor : public CControl
{ {
public: public:
CColor(CInstanceManager* iMan); // 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);
@ -54,3 +57,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -16,7 +17,7 @@
//#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
//#include <d3d.h> //#include <d3d.h>
//#include "common/struct.h" //#include "common/struct.h"
@ -32,10 +33,11 @@
namespace Ui {
// Object's constructor. // Object's constructor.
CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan) //CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan)
CCompass::CCompass() : CControl()
{ {
m_dir = 0.0f; m_dir = 0.0f;
} }
@ -170,9 +172,10 @@ void CCompass::SetDirection(float dir)
m_dir = dir; m_dir = dir;
} }
float CCompass::RetDirection() float CCompass::GetDirection()
{ {
return m_dir; return m_dir;
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,15 +22,16 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx {
class CEngine;
}
//class CEngine; namespace Ui {
class CCompass : public CControl class CCompass : public CControl
{ {
public: public:
CCompass(CInstanceManager* iMan); // CCompass(CInstanceManager* iMan);
CCompass();
virtual ~CCompass(); virtual ~CCompass();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -39,7 +41,7 @@ public:
void Draw(); void Draw();
void SetDirection(float dir); void SetDirection(float dir);
float RetDirection(); float GetDirection();
protected: protected:
@ -48,3 +50,4 @@ protected:
}; };
}

View File

@ -21,7 +21,7 @@
//#include <d3d.h> //#include <d3d.h>
#include "graphics/core/device.h" #include "graphics/core/device.h"
#include "common/struct.h" //#include "common/struct.h"
//#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "common/language.h" #include "common/language.h"
@ -36,22 +36,23 @@
//#include "old/text.h" //#include "old/text.h"
#include "graphics/engine/text.h" #include "graphics/engine/text.h"
//#include "old/sound.h" //#include "old/sound.h"
#include "sound/sound.h"
#include "ui/control.h" #include "ui/control.h"
namespace Ui {
// Object's constructor. // Object's constructor.
CControl::CControl(CInstanceManager* iMan) CControl::CControl()
{ {
m_iMan = iMan; m_iMan = CInstanceManager::GetInstancePointer();
m_engine = static_cast< Gfx::CEngine* > ( m_iMan->SearchInstance(CLASS_ENGINE) ); m_engine = static_cast< Gfx::CEngine* > ( m_iMan->SearchInstance(CLASS_ENGINE) );
m_event = static_cast< CEventQueue* > ( m_iMan->SearchInstance(CLASS_EVENT) ); m_event = static_cast< CEventQueue* > ( m_iMan->SearchInstance(CLASS_EVENT) );
m_main = static_cast< CRobotMain* > ( m_iMan->SearchInstance(CLASS_MAIN) ); m_main = static_cast< CRobotMain* > ( m_iMan->SearchInstance(CLASS_MAIN) );
m_particle = static_cast< Gfx::CParticle* > (m_iMan->SearchInstance(CLASS_PARTICULE)); m_particle = static_cast< Gfx::CParticle* > (m_iMan->SearchInstance(CLASS_PARTICULE));
m_sound = static_cast< CSound* > (m_iMan->SearchInstance(CLASS_SOUND)); m_sound = static_cast< CSoundInterface* > (m_iMan->SearchInstance(CLASS_SOUND));
m_eventType = EVENT_NULL; m_eventType = EVENT_NULL;
m_state = STATE_ENABLE|STATE_VISIBLE|STATE_GLINT; m_state = STATE_ENABLE|STATE_VISIBLE|STATE_GLINT;
m_fontSize = Gfx::FONT_SIZE_SMALL; m_fontSize = Gfx::FONT_SIZE_SMALL;
@ -880,4 +881,4 @@ bool CControl::Detect(Math::Point pos)
pos.y <= m_pos.y + m_dim.y ); pos.y <= m_pos.y + m_dim.y );
} }
}

View File

@ -20,20 +20,23 @@
//#include "old/text.h" //#include "old/text.h"
#include "common/struct.h"
#include "common/event.h"
#include "graphics/engine/engine.h"
#include "graphics/engine/text.h" #include "graphics/engine/text.h"
#include "graphics/engine/particle.h" //#include "common/struct.h"
#include "common/event.h"
namespace Gfx {
class CEngine;
class CParticle;
};
class CInstanceManager; class CInstanceManager;
class CEvent; class CEvent;
//class Gfx::CEngine; //class Gfx::CEngine;
class CRobotMain; class CRobotMain;
//class Gfx::CParticle; //class Gfx::CParticle;
class CSound; class CSoundInterface;
namespace Ui {
enum ControlState enum ControlState
{ {
STATE_ENABLE = (1<<0), // active STATE_ENABLE = (1<<0), // active
@ -60,7 +63,8 @@ enum ControlState
class CControl class CControl
{ {
public: public:
CControl(CInstanceManager* iMan); // CControl(CInstanceManager* iMan);
CControl ();
virtual ~CControl(); virtual ~CControl();
virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -114,7 +118,7 @@ protected:
CEventQueue* m_event; CEventQueue* m_event;
CRobotMain* m_main; CRobotMain* m_main;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
CSound* m_sound; CSoundInterface* m_sound;
Math::Point m_pos; // corner upper / left Math::Point m_pos; // corner upper / left
Math::Point m_dim; // dimensions Math::Point m_dim; // dimensions
@ -139,3 +143,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -17,21 +18,22 @@
// displayinfo.cpp // displayinfo.cpp
#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
#include <d3d.h> //#include <d3d.h>
#include "common/struct.h" //#include "common/struct.h"
#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "old/d3dmath.h" //#include "old/d3dmath.h"
#include "graphics/engine/engine.h"
#include "common/language.h" #include "common/language.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/restext.h" #include "common/restext.h"
#include "old/math3d.h" //#include "old/math3d.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "old/camera.h" //#include "old/camera.h"
#include "object/object.h" #include "object/object.h"
#include "object/motion/motion.h" #include "object/motion/motion.h"
#include "object/motion/motiontoto.h" #include "object/motion/motiontoto.h"
@ -41,29 +43,31 @@
#include "ui/edit.h" #include "ui/edit.h"
#include "ui/group.h" #include "ui/group.h"
#include "ui/window.h" #include "ui/window.h"
#include "old/particule.h" //#include "old/particule.h"
#include "old/light.h" #include "graphics/engine/particle.h"
#include "old/text.h" //#include "old/light.h"
//#include "old/text.h"
#include "script/cbottoken.h" #include "script/cbottoken.h"
#include "ui/displayinfo.h" #include "ui/displayinfo.h"
namespace Ui {
// Object's constructor. // 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_iMan->AddInstance(CLASS_STUDIO, this);
m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE); m_engine = static_cast <Gfx::CEngine*> (m_iMan->SearchInstance(CLASS_ENGINE));
m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT); m_event = static_cast <CEventQueue*> (m_iMan->SearchInstance(CLASS_EVENT));
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE); m_interface = static_cast <CInterface*> (m_iMan->SearchInstance(CLASS_INTERFACE));
m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN); m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN));
m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA); m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA));
m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE); m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE));
m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT); m_light = static_cast <Gfx::CLight*> (m_iMan->SearchInstance(CLASS_LIGHT));
m_bInfoMaximized = true; m_bInfoMaximized = true;
m_bInfoMinimized = false; m_bInfoMinimized = false;
@ -87,22 +91,22 @@ CDisplayInfo::~CDisplayInfo()
bool CDisplayInfo::EventProcess(const Event &event) bool CDisplayInfo::EventProcess(const Event &event)
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
CSlider* slider; Ui::CSlider* slider;
CMotionToto* toto; CMotionToto* toto;
if ( event.event == EVENT_FRAME ) if ( event.type == EVENT_FRAME )
{ {
EventFrame(event); EventFrame(event);
HyperUpdate(); HyperUpdate();
} }
if ( event.event == EVENT_MOUSEMOVE ) if ( event.type == EVENT_MOUSE_MOVE )
{ {
if ( m_toto != 0 ) if ( m_toto != 0 )
{ {
toto = (CMotionToto*)m_toto->RetMotion(); toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 ) if ( toto != 0 )
{ {
toto->SetMousePos(event.pos); 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 ( pw != 0 )
{ {
if ( event.event == pw->RetEventMsgClose() ) if ( event.type == pw->GetEventTypeClose() )
{ {
Event newEvent = event; Event newEvent = event;
newEvent.event = EVENT_OBJECT_INFOOK; newEvent.type = EVENT_OBJECT_INFOOK;
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
} }
if ( event.event == EVENT_SATCOM_HUSTON ) if ( event.type == EVENT_SATCOM_HUSTON )
{ {
ChangeIndexButton(SATCOM_HUSTON); ChangeIndexButton(SATCOM_HUSTON);
} }
if ( event.event == EVENT_SATCOM_SAT ) if ( event.type == EVENT_SATCOM_SAT )
{ {
ChangeIndexButton(SATCOM_SAT); ChangeIndexButton(SATCOM_SAT);
} }
@ -132,90 +136,90 @@ bool CDisplayInfo::EventProcess(const Event &event)
//? { //? {
//? ChangeIndexButton(SATCOM_OBJECT); //? ChangeIndexButton(SATCOM_OBJECT);
//? } //? }
if ( event.event == EVENT_SATCOM_LOADING ) if ( event.type == EVENT_SATCOM_LOADING )
{ {
ChangeIndexButton(SATCOM_LOADING); ChangeIndexButton(SATCOM_LOADING);
} }
if ( event.event == EVENT_SATCOM_PROG ) if ( event.type == EVENT_SATCOM_PROG )
{ {
ChangeIndexButton(SATCOM_PROG); ChangeIndexButton(SATCOM_PROG);
} }
if ( event.event == EVENT_SATCOM_SOLUCE ) if ( event.type == EVENT_SATCOM_SOLUCE )
{ {
ChangeIndexButton(SATCOM_SOLUCE); ChangeIndexButton(SATCOM_SOLUCE);
} }
if ( event.event == EVENT_HYPER_HOME || if ( event.type == EVENT_HYPER_HOME ||
event.event == EVENT_HYPER_PREV || event.type == EVENT_HYPER_PREV ||
event.event == EVENT_HYPER_NEXT ) event.type == EVENT_HYPER_NEXT )
{ {
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 ) if ( edit != 0 )
{ {
edit->HyperGo(event.event); edit->HyperGo(event.type);
HyperUpdate(); HyperUpdate();
} }
} }
if ( event.event == EVENT_HYPER_SIZE1 ) // size 1? if ( event.type == EVENT_HYPER_SIZE1 ) // size 1?
{ {
m_main->SetFontSize(9.0f); m_main->SetFontSize(9.0f);
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f); if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.event == EVENT_HYPER_SIZE2 ) // size 2? if ( event.type == EVENT_HYPER_SIZE2 ) // size 2?
{ {
m_main->SetFontSize(10.0f); m_main->SetFontSize(10.0f);
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f); if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.event == EVENT_HYPER_SIZE3 ) // size 3? if ( event.type == EVENT_HYPER_SIZE3 ) // size 3?
{ {
m_main->SetFontSize(12.0f); m_main->SetFontSize(12.0f);
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f); if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo(); ViewDisplayInfo();
} }
if ( event.event == EVENT_HYPER_SIZE4 ) // size 4? if ( event.type == EVENT_HYPER_SIZE4 ) // size 4?
{ {
m_main->SetFontSize(15.0f); m_main->SetFontSize(15.0f);
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f); if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo(); 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; if ( slider == 0 ) return false;
m_main->SetFontSize(9.0f+slider->RetVisibleValue()*6.0f); m_main->SetFontSize(9.0f+slider->GetVisibleValue()*6.0f);
ViewDisplayInfo(); 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 ) if ( edit != 0 )
{ {
edit->Copy(); edit->Copy();
} }
} }
if ( event.event == EVENT_LBUTTONDOWN || if ( ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 )||
event.event == EVENT_LBUTTONUP ) ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 ))
{ {
UpdateCopyButton(); UpdateCopyButton();
} }
if ( event.event == EVENT_WINDOW4 ) // window moved? if ( event.type == EVENT_WINDOW4 ) // window moved?
{ {
m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->RetPos(); m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->GetPos();
m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->RetDim(); m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->GetDim();
AdjustDisplayInfo(m_infoActualPos, m_infoActualDim); AdjustDisplayInfo(m_infoActualPos, m_infoActualDim);
} }
if ( event.event == pw->RetEventMsgReduce() ) if ( event.type == pw->GetEventTypeReduce() )
{ {
if ( m_bInfoMinimized ) if ( m_bInfoMinimized )
{ {
@ -241,7 +245,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
pw->SetMinimized(m_bInfoMinimized); pw->SetMinimized(m_bInfoMinimized);
} }
} }
if ( event.event == pw->RetEventMsgFull() ) if ( event.type == pw->GetEventTypeFull() )
{ {
if ( m_bInfoMaximized ) if ( m_bInfoMaximized )
{ {
@ -260,7 +264,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
m_bInfoMaximized = true; m_bInfoMaximized = true;
} }
//? m_main->SetEditFull(m_bInfoMaximized); //? 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 ) if ( pw != 0 )
{ {
pw->SetMaximized(m_bInfoMaximized); pw->SetMaximized(m_bInfoMaximized);
@ -299,31 +303,31 @@ bool CDisplayInfo::EventFrame(const Event &event)
void CDisplayInfo::HyperUpdate() void CDisplayInfo::HyperUpdate()
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
CButton* button; Ui::CButton* button;
bool bEnable; bool bEnable;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return; if ( edit == 0 ) return;
button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 ) if ( button != 0 )
{ {
bEnable = edit->HyperTest(EVENT_HYPER_HOME); bEnable = edit->HyperTest(EVENT_HYPER_HOME);
button->SetState(STATE_ENABLE, bEnable); 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 ) if ( button != 0 )
{ {
bEnable = edit->HyperTest(EVENT_HYPER_PREV); bEnable = edit->HyperTest(EVENT_HYPER_PREV);
button->SetState(STATE_ENABLE, bEnable); 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 ) if ( button != 0 )
{ {
bEnable = edit->HyperTest(EVENT_HYPER_NEXT); bEnable = edit->HyperTest(EVENT_HYPER_NEXT);
@ -336,12 +340,12 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce) void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
{ {
D3DLIGHT7 light; Gfx::CLight light;
Math::Point pos, dim; Math::Point pos, dim;
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
CButton* button; Ui::CButton* button;
CSlider* slider; Ui::CSlider* slider;
CMotionToto* toto; CMotionToto* toto;
m_index = index; m_index = index;
@ -349,10 +353,10 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
//? CreateObjectsFile(); //? CreateObjectsFile();
m_bEditLock = m_main->RetEditLock(); m_bEditLock = m_main->GetEditLock();
if ( m_bEditLock ) // edition running program? 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 ) if ( pw != 0 )
{ {
pw->ClearState(STATE_ENABLE); // CStudio inactive 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->SetEditLock(true, false);
m_main->SetEditFull(false); m_main->SetEditFull(false);
m_bInitPause = m_engine->RetPause(); m_bInitPause = m_engine->GetPause();
m_engine->SetPause(true); m_engine->SetPause(true);
m_infoCamera = m_camera->RetType(); m_infoCamera = m_camera->GetType();
m_camera->SetType(CAMERA_INFO); m_camera->SetType(Gfx::CAM_TYPE_INFO);
pos = m_infoActualPos = m_infoFinalPos; pos = m_infoActualPos = m_infoFinalPos;
dim = m_infoActualDim = m_infoFinalDim; dim = m_infoActualDim = m_infoFinalDim;
@ -383,7 +387,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
edit->SetState(STATE_SHADOW); edit->SetState(STATE_SHADOW);
edit->SetMultiFont(true); edit->SetMultiFont(true);
edit->SetMaxChar(10000); edit->SetMaxChar(10000);
edit->SetFontType(FONT_COLOBOT); edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce); edit->SetSoluceMode(bSoluce);
edit->ReadText(filename); edit->ReadText(filename);
edit->HyperHome(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->SetDrawWorld(false); // doesn't draw anything in the interface
m_engine->SetDrawFront(true); // toto draws on 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(); m_toto = SearchToto();
if ( m_toto != 0 ) if ( m_toto != 0 )
{ {
m_toto->SetDrawFront(true); m_toto->SetDrawFront(true);
toto = (CMotionToto*)m_toto->RetMotion(); toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 ) if ( toto != 0 )
{ {
toto->StartDisplayInfo(); toto->StartDisplayInfo();
} }
} }
// TODO
ZeroMemory(&light, sizeof(light)); ZeroMemory(&light, sizeof(light));
light.dltType = D3DLIGHT_DIRECTIONAL; light.dltType = D3DLIGHT_DIRECTIONAL;
light.dcvDiffuse.r = 1.0f; light.dcvDiffuse.r = 1.0f;
@ -488,26 +492,26 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
wdim.x = 540.0f / 640.0f; wdim.x = 540.0f / 640.0f;
wdim.y = 420.0f / 480.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 ) if ( pw != 0 )
{ {
pw->SetPos(wpos); pw->SetPos(wpos);
pw->SetDim(wdim); pw->SetDim(wdim);
wdim = pw->RetDim(); wdim = pw->GetDim();
} }
pos.x = (50.0f + 10.0f) / 640.0f; pos.x = (50.0f + 10.0f) / 640.0f;
pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f - 48.0f) / 480.0f; pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f - 48.0f) / 480.0f;
dim.x = 48.0f / 640.0f; dim.x = 48.0f / 640.0f;
dim.y = 48.0f / 480.0f; dim.y = 48.0f / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.y -= (48.0f + 4.0f) / 480.0f; pos.y -= (48.0f + 4.0f) / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_SAT); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SAT));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -521,21 +525,21 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
//? button->SetDim(dim); //? button->SetDim(dim);
//? } //? }
pos.y -= (48.0f + 4.0f) / 480.0f; pos.y -= (48.0f + 4.0f) / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.y -= (48.0f + 4.0f) / 480.0f; pos.y -= (48.0f + 4.0f) / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_PROG); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_PROG));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.y -= (48.0f + 4.0f) / 480.0f; pos.y -= (48.0f + 4.0f) / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_SOLUCE); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SOLUCE));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -546,7 +550,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
pos.y = (30.0f + 10.0f + 4.0f) / 480.0f; pos.y = (30.0f + 10.0f + 4.0f) / 480.0f;
dim.x = (48.0f - 10.0f) / 640.0f; dim.x = (48.0f - 10.0f) / 640.0f;
dim.y = 24.0f / 480.0f; dim.y = 24.0f / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_OBJECT_INFOOK); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_OBJECT_INFOOK));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -557,7 +561,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
pos.y = (30.0f + 10.0f) / 480.0f; pos.y = (30.0f + 10.0f) / 480.0f;
dim.x = 462.0f / 640.0f; dim.x = 462.0f / 640.0f;
dim.y = 358.0f / 480.0f; dim.y = 358.0f / 480.0f;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 ) if ( edit != 0 )
{ {
edit->SetPos(pos); edit->SetPos(pos);
@ -568,21 +572,21 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
pos.y = (30.0f + 10.0f + 358.0f + 10.0f) / 480.0f; pos.y = (30.0f + 10.0f + 358.0f + 10.0f) / 480.0f;
dim.x = 32.0f / 640.0f; dim.x = 32.0f / 640.0f;
dim.y = 32.0f / 480.0f; dim.y = 32.0f / 480.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_PREV); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_PREV));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_NEXT); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_NEXT));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -590,28 +594,28 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
} }
pos.x += 50.0f / 640.0f; pos.x += 50.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE1); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE1));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE2); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE2));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE3); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE3));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
button->SetDim(dim); button->SetDim(dim);
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE4); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE4));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -619,7 +623,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
} }
pos.x += 35.0f / 640.0f; pos.x += 35.0f / 640.0f;
dim.x = 18.0f / 640.0f; dim.x = 18.0f / 640.0f;
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 ) if ( slider != 0 )
{ {
slider->SetPos(pos); slider->SetPos(pos);
@ -627,7 +631,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
} }
pos.x += 50.0f / 640.0f; pos.x += 50.0f / 640.0f;
dim.x = 32.0f / 640.0f; dim.x = 32.0f / 640.0f;
button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_COPY));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetPos(pos); button->SetPos(pos);
@ -638,7 +642,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f + 6.0f) / 480.0f; pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f + 6.0f) / 480.0f;
dim.x = 48.0f / 640.0f; dim.x = 48.0f / 640.0f;
dim.y = 40.0f / 480.0f; dim.y = 40.0f / 480.0f;
group = (CGroup*)pw->SearchControl(EVENT_LABEL2); // symbol SatCom group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL2)); // symbol SatCom
if ( group != 0 ) if ( group != 0 )
{ {
group->SetPos(pos); group->SetPos(pos);
@ -649,7 +653,7 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
pos.y = (30.0f + 10.0f + 6.0f) / 480.0f; pos.y = (30.0f + 10.0f + 6.0f) / 480.0f;
dim.x = 20.0f / 640.0f; dim.x = 20.0f / 640.0f;
dim.y = 20.0f / 480.0f; dim.y = 20.0f / 480.0f;
group = (CGroup*)pw->SearchControl(EVENT_LABEL3); // symbol stand-by group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL3)); // symbol stand-by
if ( group != 0 ) if ( group != 0 )
{ {
group->SetPos(pos); group->SetPos(pos);
@ -661,26 +665,26 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
void CDisplayInfo::ChangeIndexButton(int index) void CDisplayInfo::ChangeIndexButton(int index)
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
char* filename; char* filename;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
if ( m_index != -1 ) if ( m_index != -1 )
{ {
m_main->SetDisplayInfoPosition(m_index, RetPosition()); m_main->SetDisplayInfoPosition(m_index, GetPosition());
} }
m_index = index; m_index = index;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 ) if ( edit != 0 )
{ {
filename = m_main->RetDisplayInfoName(m_index); filename = m_main->GetDisplayInfoName(m_index);
edit->ReadText(filename); edit->ReadText(filename);
edit->HyperHome(filename); edit->HyperHome(filename);
SetPosition(m_main->RetDisplayInfoPosition(m_index)); SetPosition(m_main->GetDisplayInfoPosition(m_index));
} }
UpdateIndexButton(); UpdateIndexButton();
@ -690,10 +694,10 @@ void CDisplayInfo::ChangeIndexButton(int index)
void CDisplayInfo::UpdateIndexButton() void CDisplayInfo::UpdateIndexButton()
{ {
CWindow* pw; Ui::CWindow* pw;
CButton* button; Ui::CButton* button;
CGroup* group; Ui::CGroup* group;
CEdit* edit; Ui::CEdit* edit;
Math::Point pos, dim; Math::Point pos, dim;
char* filename; char* filename;
char* loading; char* loading;
@ -708,10 +712,10 @@ void CDisplayInfo::UpdateIndexButton()
4, // SATCOM_SOLUCE 4, // SATCOM_SOLUCE
}; };
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON); button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON);
@ -719,7 +723,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0); 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 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_SAT); button->SetState(STATE_CHECK, m_index==SATCOM_SAT);
@ -736,7 +740,7 @@ void CDisplayInfo::UpdateIndexButton()
//? } //? }
loading = 0; loading = 0;
button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING); button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_LOADING); button->SetState(STATE_CHECK, m_index==SATCOM_LOADING);
@ -744,7 +748,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, loading[0]!=0); 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 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_PROG); 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->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 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE); button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE);
@ -760,7 +764,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce); 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 ( group != 0 )
{ {
if ( m_index == -1 ) if ( m_index == -1 )
@ -789,7 +793,7 @@ void CDisplayInfo::UpdateIndexButton()
} }
#endif #endif
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 ) if ( edit != 0 )
{ {
//? edit->SetHiliteCap(m_index==SATCOM_LOADING); //? edit->SetHiliteCap(m_index==SATCOM_LOADING);
@ -803,20 +807,20 @@ void CDisplayInfo::UpdateIndexButton()
void CDisplayInfo::UpdateCopyButton() void CDisplayInfo::UpdateCopyButton()
{ {
CWindow* pw; Ui::CWindow* pw;
CButton* button; Ui::CButton* button;
CEdit* edit; Ui::CEdit* edit;
int c1, c2; int c1, c2;
//? if ( m_index != SATCOM_LOADING ) return; //? 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; 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; if ( button == 0 ) return;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return; if ( edit == 0 ) return;
edit->GetCursor(c1, c2); edit->GetCursor(c1, c2);
@ -828,10 +832,10 @@ void CDisplayInfo::UpdateCopyButton()
void CDisplayInfo::StopDisplayInfo() void CDisplayInfo::StopDisplayInfo()
{ {
CWindow* pw; Ui::CWindow* pw;
CMotionToto* toto; CMotionToto* toto;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
m_interface->DeleteControl(EVENT_WINDOW4); m_interface->DeleteControl(EVENT_WINDOW4);
@ -853,13 +857,13 @@ void CDisplayInfo::StopDisplayInfo()
m_engine->SetDrawWorld(true); // draws all on the interface m_engine->SetDrawWorld(true); // draws all on the interface
m_engine->SetDrawFront(false); // draws nothing on the interface m_engine->SetDrawFront(false); // draws nothing on the interface
m_particule->SetFrameUpdate(SH_WORLD, true); m_particle->SetFrameUpdate(Gfx::SH_WORLD, true);
m_particule->FlushParticule(SH_FRONT); m_particle->FlushParticule(Gfx::SH_FRONT);
m_particule->FlushParticule(SH_INTERFACE); m_particle->FlushParticule(Gfx::SH_INTERFACE);
if ( m_toto != 0 ) if ( m_toto != 0 )
{ {
toto = (CMotionToto*)m_toto->RetMotion(); toto = (CMotionToto*)m_toto->GetMotion();
if ( toto != 0 ) if ( toto != 0 )
{ {
toto->StopDisplayInfo(); toto->StopDisplayInfo();
@ -875,13 +879,13 @@ void CDisplayInfo::StopDisplayInfo()
void CDisplayInfo::SetPosition(int pos) void CDisplayInfo::SetPosition(int pos)
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return; if ( edit == 0 ) return;
edit->SetFirstLine(pos); edit->SetFirstLine(pos);
@ -889,18 +893,18 @@ void CDisplayInfo::SetPosition(int pos)
// Returns the position. // Returns the position.
int CDisplayInfo::RetPosition() int CDisplayInfo::GetPosition()
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; 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; 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; if ( edit == 0 ) return 0;
return edit->RetFirstLine(); return edit->GetFirstLine();
} }
@ -909,18 +913,18 @@ int CDisplayInfo::RetPosition()
void CDisplayInfo::ViewDisplayInfo() void CDisplayInfo::ViewDisplayInfo()
{ {
CWindow* pw; Ui::CWindow* pw;
CEdit* edit; Ui::CEdit* edit;
POINT dim; Math::Point dim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
edit = (CEdit*)pw->SearchControl(EVENT_EDIT1); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return; if ( edit == 0 ) return;
dim = m_engine->RetDim(); dim = m_engine->GetDim();
edit->SetFontSize(m_main->RetFontSize()/(dim.x/640.0f)); edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f));
} }
// Returns the object human. // Returns the object human.
@ -936,7 +940,7 @@ CObject* CDisplayInfo::SearchToto()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break; if ( pObj == 0 ) break;
type = pObj->RetType(); type = pObj->GetType();
if ( type == OBJECT_TOTO ) if ( type == OBJECT_TOTO )
{ {
return pObj; return pObj;
@ -995,7 +999,7 @@ void ObjectWrite(FILE* file, ObjectList list[], int i)
strcat(line, res); strcat(line, res);
strcat(line, "\\u "); strcat(line, "\\u ");
p = RetHelpFilename(list[i].type); p = GetHelpFilename(list[i].type);
if ( p[0] == 0 ) return; if ( p[0] == 0 ) return;
strcat(line, p+5); // skip "help\" strcat(line, p+5); // skip "help\"
p = strstr(line, ".txt"); p = strstr(line, ".txt");
@ -1026,11 +1030,11 @@ void CDisplayInfo::CreateObjectsFile()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i); pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break; if ( pObj == 0 ) break;
if ( !pObj->RetActif() ) continue; if ( !pObj->GetActif() ) continue;
if ( !pObj->RetSelectable() ) continue; if ( !pObj->GetSelectable() ) continue;
if ( pObj->RetProxyActivate() ) continue; if ( pObj->GetProxyActivate() ) continue;
type = pObj->RetType(); type = pObj->GetType();
if ( type == OBJECT_NULL ) continue; if ( type == OBJECT_NULL ) continue;
if ( type == OBJECT_FIX ) continue; if ( type == OBJECT_FIX ) continue;
@ -1217,3 +1221,4 @@ void CDisplayInfo::CreateObjectsFile()
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -19,25 +20,37 @@
#pragma once #pragma once
#include "common/struct.h" //#include "common/struct.h"
#include "old/camera.h" //#include "graphics/engine/engine.h"
//#include "graphics/engine/camera.h"
//#include "graphics/engine/particle.h"
//#include "old/camera.h"
class CInstanceManager; class CInstanceManager;
class CD3DEngine; //class CD3DEngine;
class CEvent; class CEvent;
class CRobotMain; class CRobotMain;
class CCamera; //class CCamera;
class CInterface;
class CObject;
class CParticule;
class CLight;
class CObject;
//class CLight;
namespace Gfx {
class CEngine;
class Camera;
class Particle;
class CLight;
}
namespace Ui {
class CInterface;
class CDisplayInfo class CDisplayInfo
{ {
public: public:
CDisplayInfo(CInstanceManager* iMan); // CDisplayInfo(CInstanceManager* iMan);
CDisplayInfo();
~CDisplayInfo(); ~CDisplayInfo();
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
@ -46,7 +59,7 @@ public:
void StopDisplayInfo(); void StopDisplayInfo();
void SetPosition(int pos); void SetPosition(int pos);
int RetPosition(); int GetPosition();
protected: protected:
bool EventFrame(const Event &event); bool EventFrame(const Event &event);
@ -61,19 +74,19 @@ protected:
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
CD3DEngine* m_engine; Gfx::CEngine* m_engine;
CEvent* m_event; CEventQueue* m_event;
CRobotMain* m_main; CRobotMain* m_main;
CCamera* m_camera; Gfx::CCamera* m_camera;
CInterface* m_interface; CInterface* m_interface;
CParticule* m_particule; Gfx::CParticle* m_particle;
CLight* m_light; Gfx::CLight* m_light;
bool m_bInfoMaximized; bool m_bInfoMaximized;
bool m_bInfoMinimized; bool m_bInfoMinimized;
int m_index; int m_index;
CameraType m_infoCamera; Gfx::CameraType m_infoCamera;
Math::Point m_infoNormalPos; Math::Point m_infoNormalPos;
Math::Point m_infoNormalDim; Math::Point m_infoNormalDim;
Math::Point m_infoActualPos; Math::Point m_infoActualPos;
@ -88,3 +101,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -17,12 +18,13 @@
// displaytext.cpp // displaytext.cpp
#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
#include <d3d.h> //#include <d3d.h>
#include "common/struct.h" //#include "common/struct.h"
#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
@ -35,28 +37,31 @@
#include "ui/label.h" #include "ui/label.h"
#include "ui/window.h" #include "ui/window.h"
#include "ui/group.h" #include "ui/group.h"
#include "old/text.h" //#include "old/text.h"
#include "old/sound.h" //#include "old/sound.h"
//#include "sound/sound.h"
#include "ui/displaytext.h" #include "ui/displaytext.h"
namespace Ui {
const float FONTSIZE = 12.0f; const float FONTSIZE = 12.0f;
// Object's constructor. // Object's constructor.
CDisplayText::CDisplayText(CInstanceManager* iMan) //CDisplayText::CDisplayText(CInstanceManager* iMan)
CDisplayText::CDisplayText()
{ {
int i; int i;
m_iMan = iMan; // m_iMan = iMan;
m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_DISPLAYTEXT, this); 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_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++ ) for ( i=0 ; i<MAXDTLINE ; i++ )
{ {
@ -94,9 +99,9 @@ bool CDisplayText::EventProcess(const Event &event)
{ {
int i; 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++ ) for ( i=0 ; i<MAXDTLINE ; i++ )
{ {
@ -124,9 +129,9 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time)
if ( pObj == 0 ) return; if ( pObj == 0 ) return;
pos = pObj->RetPosition(0); pos = pObj->GetPosition(0);
h = RetIdealHeight(pObj); h = GetIdealHeight(pObj);
d = RetIdealDist(pObj); d = GetIdealDist(pObj);
DisplayError(err, pos, h, d, time); DisplayError(err, pos, h, d, time);
} }
@ -186,9 +191,9 @@ void CDisplayText::DisplayText(char *text, CObject* pObj,
if ( pObj == 0 ) return; if ( pObj == 0 ) return;
pos = pObj->RetPosition(0); pos = pObj->GetPosition(0);
h = RetIdealHeight(pObj); h = GetIdealHeight(pObj);
d = RetIdealDist(pObj); d = GetIdealDist(pObj);
DisplayText(text, pos, h, d, time, type); DisplayText(text, pos, h, d, time, type);
} }
@ -199,10 +204,10 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
{ {
CObject* toto; CObject* toto;
CMotion* motion; CMotion* motion;
CWindow* pw; Ui::CWindow* pw;
CButton* button; Ui::CButton* button;
CGroup* group; Ui::CGroup* group;
CLabel* label; Ui::CLabel* label;
Math::Point pos, ppos, dim; Math::Point pos, ppos, dim;
Sound sound; Sound sound;
float hLine, hBox; float hLine, hBox;
@ -210,7 +215,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
if ( !m_bEnable ) return; if ( !m_bEnable ) return;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) if ( pw == 0 )
{ {
pos.x = 0.0f; pos.x = 0.0f;
@ -221,12 +226,12 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
} }
hBox = 0.045f; hBox = 0.045f;
hLine = m_engine->RetText()->RetHeight(FONTSIZE, FONT_COLOBOT); hLine = m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, FONTSIZE);
nLine = 0; nLine = 0;
for ( i=0 ; i<MAXDTLINE ; i++ ) 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; if ( group == 0 ) break;
nLine ++; 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_WARNING ) icon = 10; // blue
if ( type == TT_INFO ) icon = 8; // green if ( type == TT_INFO ) icon = 8; // green
if ( type == TT_MESSAGE ) icon = 11; // yellow 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); pw->SetTrashEvent(false);
ppos = pos; ppos = pos;
ppos.y -= hLine/2.0f; 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 ) if ( label != 0 )
{ {
label->SetFontSize(FONTSIZE); label->SetFontSize(FONTSIZE);
@ -261,7 +266,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
dim.x = dim.y*0.75f; dim.x = dim.y*0.75f;
pos.x -= dim.x; 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 && if ( goal.x == 0.0f &&
goal.y == 0.0f && goal.y == 0.0f &&
@ -279,7 +284,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
toto = SearchToto(); toto = SearchToto();
if ( toto != 0 ) if ( toto != 0 )
{ {
motion = toto->RetMotion(); motion = toto->GetMotion();
if ( motion != 0 ) if ( motion != 0 )
{ {
if ( type == TT_ERROR ) if ( type == TT_ERROR )
@ -324,18 +329,18 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
void CDisplayText::ClearText() void CDisplayText::ClearText()
{ {
CWindow* pw; Ui::CWindow* pw;
int i; 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++ ) for ( i=0 ; i<MAXDTLINE ; i++ )
{ {
if ( pw != 0 ) if ( pw != 0 )
{ {
pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i)); pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i)); pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i)); pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
} }
m_bExist[i] = false; m_bExist[i] = false;
m_visitGoal[i] = Math::Vector(0.0f, 0.0f, 0.0f); m_visitGoal[i] = Math::Vector(0.0f, 0.0f, 0.0f);
@ -349,32 +354,32 @@ void CDisplayText::ClearText()
void CDisplayText::HideText(bool bHide) void CDisplayText::HideText(bool bHide)
{ {
CWindow* pw; Ui::CWindow* pw;
CGroup* pg; Ui::CGroup* pg;
CLabel* pl; Ui::CLabel* pl;
CButton* pb; Ui::CButton* pb;
int i; int i;
m_bHide = bHide; m_bHide = bHide;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return; if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ ) 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 ) if ( pg != 0 )
{ {
pg->SetState(STATE_VISIBLE, !bHide); 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 ) if ( pl != 0 )
{ {
pl->SetState(STATE_VISIBLE, !bHide); 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 ) if ( pb != 0 )
{ {
pb->SetState(STATE_VISIBLE, !bHide); pb->SetState(STATE_VISIBLE, !bHide);
@ -386,20 +391,20 @@ void CDisplayText::HideText(bool bHide)
bool CDisplayText::ClearLastText() bool CDisplayText::ClearLastText()
{ {
CWindow *pw; Ui::CWindow *pw;
CButton *pb1, *pb2; Ui::CButton *pb1, *pb2;
CGroup *pg1, *pg2; Ui::CGroup *pg1, *pg2;
CLabel *pl1, *pl2; Ui::CLabel *pl1, *pl2;
int i; int i;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return false; 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 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; 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; if ( pl2 == 0 ) return false;
for ( i=0 ; i<MAXDTLINE-1 ; i++ ) for ( i=0 ; i<MAXDTLINE-1 ; i++ )
@ -408,18 +413,18 @@ bool CDisplayText::ClearLastText()
pg1 = pg2; pg1 = pg2;
pl1 = pl2; 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; 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; 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; if ( pl2 == 0 ) break;
pb1->SetState(STATE_ENABLE, pb2->TestState(STATE_ENABLE)); pb1->SetState(STATE_ENABLE, pb2->TestState(STATE_ENABLE));
pg1->SetIcon(pg2->RetIcon()); pg1->SetIcon(pg2->GetIcon());
pl1->SetName(pl2->RetName()); pl1->SetName(pl2->GetName());
m_time[i] = m_time[i+1]; m_time[i] = m_time[i+1];
m_visitGoal[i] = m_visitGoal[i+1]; m_visitGoal[i] = m_visitGoal[i+1];
@ -427,9 +432,9 @@ bool CDisplayText::ClearLastText()
m_visitHeight[i] = m_visitHeight[i+1]; // shift m_visitHeight[i] = m_visitHeight[i+1]; // shift
} }
pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i)); pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i)); pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i)); pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
m_bExist[i] = false; m_bExist[i] = false;
return true; return true;
} }
@ -453,7 +458,7 @@ void CDisplayText::SetEnable(bool bEnable)
// Returns the goal during a visit. // Returns the goal during a visit.
Math::Vector CDisplayText::RetVisitGoal(EventMsg event) Math::Vector CDisplayText::GetVisitGoal(EventType event)
{ {
int i; int i;
@ -464,7 +469,7 @@ Math::Vector CDisplayText::RetVisitGoal(EventMsg event)
// Returns the distance during a visit. // Returns the distance during a visit.
float CDisplayText::RetVisitDist(EventMsg event) float CDisplayText::GetVisitDist(EventType event)
{ {
int i; int i;
@ -475,7 +480,7 @@ float CDisplayText::RetVisitDist(EventMsg event)
// Returns the height on a visit. // Returns the height on a visit.
float CDisplayText::RetVisitHeight(EventMsg event) float CDisplayText::GetVisitHeight(EventType event)
{ {
int i; int i;
@ -487,13 +492,13 @@ float CDisplayText::RetVisitHeight(EventMsg event)
// Ranges from ideal visit for a given object. // Ranges from ideal visit for a given object.
float CDisplayText::RetIdealDist(CObject* pObj) float CDisplayText::GetIdealDist(CObject* pObj)
{ {
ObjectType type; ObjectType type;
if ( pObj == 0 ) return 40.0f; if ( pObj == 0 ) return 40.0f;
type = pObj->RetType(); type = pObj->GetType();
if ( type == OBJECT_PORTICO ) return 200.0f; if ( type == OBJECT_PORTICO ) return 200.0f;
if ( type == OBJECT_BASE ) return 200.0f; if ( type == OBJECT_BASE ) return 200.0f;
if ( type == OBJECT_NUCLEAR ) return 100.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. // Returns the height of ideal visit for a given object.
float CDisplayText::RetIdealHeight(CObject* pObj) float CDisplayText::GetIdealHeight(CObject* pObj)
{ {
ObjectType type; ObjectType type;
if ( pObj == 0 ) return 5.0f; if ( pObj == 0 ) return 5.0f;
type = pObj->RetType(); type = pObj->GetType();
if ( type == OBJECT_DERRICK ) return 35.0f; if ( type == OBJECT_DERRICK ) return 35.0f;
if ( type == OBJECT_FACTORY ) return 22.0f; if ( type == OBJECT_FACTORY ) return 22.0f;
if ( type == OBJECT_REPAIR ) return 30.0f; if ( type == OBJECT_REPAIR ) return 30.0f;
@ -537,16 +542,16 @@ float CDisplayText::RetIdealHeight(CObject* pObj)
void CDisplayText::ClearVisit() void CDisplayText::ClearVisit()
{ {
CWindow* pw; Ui::CWindow* pw;
CButton* pb; Ui::CButton* pb;
int i; int i;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return; if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ ) 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; if ( pb == 0 ) break;
pb->SetIcon(14); // eyes pb->SetIcon(14); // eyes
} }
@ -554,38 +559,38 @@ void CDisplayText::ClearVisit()
// Puts a button in "visit". // Puts a button in "visit".
void CDisplayText::SetVisit(EventMsg event) void CDisplayText::SetVisit(EventType event)
{ {
CWindow* pw; Ui::CWindow* pw;
CButton* pb; Ui::CButton* pb;
int i; int i;
i = event-EVENT_DT_VISIT0; i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return; 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; 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; if ( pb == 0 ) return;
pb->SetIcon(48); // > pb->SetIcon(48); // >
} }
// Indicates whether a button is set to "visit". // Indicates whether a button is set to "visit".
bool CDisplayText::IsVisit(EventMsg event) bool CDisplayText::IsVisit(EventType event)
{ {
CWindow* pw; Ui::CWindow* pw;
CButton* pb; Ui::CButton* pb;
int i; int i;
i = event-EVENT_DT_VISIT0; i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return false; 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; 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; 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++ ) 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 == 0 ) break;
type = pObj->RetType(); type = pObj->GetType();
if ( type == OBJECT_TOTO ) if ( type == OBJECT_TOTO )
{ {
return pObj; return pObj;
@ -611,3 +616,4 @@ CObject* CDisplayText::SearchToto()
return 0; return 0;
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,15 +22,18 @@
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "old/d3dengine.h" #include "sound/sound.h"
//#include "old/d3dengine.h"
class CInstanceManager; class CInstanceManager;
class CD3DEngine; //class CD3DEngine
class CInterface;
class CObject; class CObject;
class CSound; class CSound;
namespace Ui {;
class CInterface;
enum TextType enum TextType
{ {
@ -45,7 +49,8 @@ const int MAXDTLINE = 4;
class CDisplayText class CDisplayText
{ {
public: public:
CDisplayText(CInstanceManager* iMan); // CDisplayText(CInstanceManager* iMan);
CDisplayText();
~CDisplayText(); ~CDisplayText();
void DeleteObject(); void DeleteObject();
@ -62,25 +67,25 @@ public:
void SetDelay(float factor); void SetDelay(float factor);
void SetEnable(bool bEnable); void SetEnable(bool bEnable);
Math::Vector RetVisitGoal(EventMsg event); Math::Vector GetVisitGoal(EventType event);
float RetVisitDist(EventMsg event); float GetVisitDist(EventType event);
float RetVisitHeight(EventMsg event); float GetVisitHeight(EventType event);
float RetIdealDist(CObject* pObj); float GetIdealDist(CObject* pObj);
float RetIdealHeight(CObject* pObj); float GetIdealHeight(CObject* pObj);
void ClearVisit(); void ClearVisit();
void SetVisit(EventMsg event); void SetVisit(EventType event);
bool IsVisit(EventMsg event); bool IsVisit(EventType event);
protected: protected:
CObject* SearchToto(); CObject* SearchToto();
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
CD3DEngine* m_engine; Gfx::CEngine* m_engine;
CInterface* m_interface; Ui::CInterface* m_interface;
CSound* m_sound; CSoundInterface* m_sound;
bool m_bExist[MAXDTLINE]; bool m_bExist[MAXDTLINE];
float m_time[MAXDTLINE]; float m_time[MAXDTLINE];
@ -94,3 +99,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -18,11 +19,12 @@
//#include <windows.h> //#include <windows.h>
#include <stdio.h> //#include <stdio.h>
//#include <d3d.h> //#include <d3d.h>
//#include "common/struct.h" //#include "common/struct.h"
//#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
//#include "old/math3d.h" //#include "old/math3d.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
@ -31,10 +33,11 @@
namespace Ui {
// Object's constructor. // Object's constructor.
CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan) //CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan)
CGauge::CGauge() : CControl()
{ {
m_level = 0.0f; m_level = 0.0f;
} }
@ -155,3 +158,4 @@ float CGauge::GetLevel()
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,15 +22,17 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CEngine;
};
//class CD3DEngine; namespace Ui {
class CGauge : public CControl class CGauge : public CControl
{ {
public: public:
CGauge(CInstanceManager* iMan); // CGauge(CInstanceManager* iMan);
CGauge();
virtual ~CGauge(); virtual ~CGauge();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -48,3 +51,4 @@ protected:
}; };
}

View File

@ -33,10 +33,11 @@
namespace Ui {
// Object's constructor. // Object's constructor.
CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan) //CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan)
CGroup::CGroup() : CControl()
{ {
} }
@ -643,3 +644,4 @@ void CGroup::Draw()
} }
}

View File

@ -21,15 +21,17 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CEngine;
};
class CD3DEngine; namespace Ui {
class CGroup : public CControl class CGroup : public CControl
{ {
public: public:
CGroup(CInstanceManager* iMan); // CGroup(CInstanceManager* iMan);
CGroup();
virtual ~CGroup(); virtual ~CGroup();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@ -44,3 +46,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -17,13 +18,14 @@
// image.cpp // image.cpp
#include <windows.h> //#include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <d3d.h> //#include <d3d.h>
#include "common/struct.h" //#include "common/struct.h"
#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "old/math3d.h" #include "graphics/engine/engine.h"
//#include "old/math3d.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
@ -32,10 +34,11 @@
namespace Ui {
// Object's constructor. // Object's constructor.
CImage::CImage(CInstanceManager* iMan) : CControl(iMan) //CImage::CImage(CInstanceManager* iMan) : CControl(iMan)
CImage::CImage() : CControl()
{ {
m_filename[0] = 0; m_filename[0] = 0;
} }
@ -46,25 +49,25 @@ CImage::~CImage()
{ {
if ( m_filename[0] != 0 ) if ( m_filename[0] != 0 )
{ {
m_engine->FreeTexture(m_filename); m_engine->DeleteTexture(m_filename);
} }
} }
// Creates a new button. // 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 ) if ( icon == -1 )
{ {
char name[100]; char name[100];
char* p; char* p;
GetResource(RES_EVENT, eventMsg, name); GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\'); p = strchr(name, '\\');
if ( p != 0 ) *p = 0; if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
@ -80,13 +83,13 @@ void CImage::SetFilenameImage(char *name)
{ {
if ( m_filename[0] != 0 ) if ( m_filename[0] != 0 )
{ {
m_engine->FreeTexture(m_filename); m_engine->DeleteTexture(m_filename);
} }
strcpy(m_filename, name); strcpy(m_filename, name);
} }
char* CImage::RetFilenameImage() char* CImage::GetFilenameImage()
{ {
return m_filename; return m_filename;
} }
@ -119,7 +122,7 @@ void CImage::Draw()
if ( m_icon == 0 ) // hollow frame? if ( m_icon == 0 ) // hollow frame?
{ {
m_engine->SetTexture("button2.tga"); m_engine->SetTexture("button2.tga");
m_engine->SetState(D3DSTATENORMAL); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f / 256.0f; uv1.x = 160.0f / 256.0f;
uv1.y = 192.0f / 256.0f; // u-v texture uv1.y = 192.0f / 256.0f; // u-v texture
uv2.x = 192.0f / 256.0f; uv2.x = 192.0f / 256.0f;
@ -137,7 +140,7 @@ void CImage::Draw()
{ {
m_engine->LoadTexture(m_filename); m_engine->LoadTexture(m_filename);
m_engine->SetTexture(m_filename); m_engine->SetTexture(m_filename);
m_engine->SetState(D3DSTATENORMAL); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos; pos = m_pos;
dim = m_dim; dim = m_dim;
pos.x += 5.0f / 640.0f; pos.x += 5.0f / 640.0f;
@ -153,3 +156,4 @@ void CImage::Draw()
} }
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,25 +22,28 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CD3DEngine; class CEngine;
};
namespace Ui {
class CImage : public CControl class CImage : public CControl
{ {
public: public:
CImage(CInstanceManager* iMan); // CImage(CInstanceManager* iMan);
CImage ();
virtual ~CImage(); virtual ~CImage();
bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg); 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 SetFilenameImage(char *name); void SetFilenameImage(char *name);
char* RetFilenameImage(); char* GetFilenameImage();
protected: protected:
@ -48,3 +52,4 @@ protected:
}; };
}

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -17,17 +18,19 @@
// slider.cpp // slider.cpp
#include <windows.h> //#include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <d3d.h> //#include <d3d.h>
#include "common/struct.h" //#include "common/struct.h"
#include "old/d3dengine.h" //#include "old/d3dengine.h"
#include "old/math3d.h" //#include "old/math3d.h"
#include "graphics/engine/engine.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "old/text.h" //#include "old/text.h"
#include "graphics/engine.text.h"
#include "ui/button.h" #include "ui/button.h"
#include "ui/slider.h" #include "ui/slider.h"
@ -71,10 +74,10 @@ CSlider::~CSlider()
// Creates a new button. // 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(); if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg); CControl::Create(pos, dim, icon, eventType);
MoveAdjust(); MoveAdjust();
return true; return true;
@ -119,7 +122,7 @@ void CSlider::MoveAdjust()
m_buttonLeft->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?55:49, EVENT_NULL); // </^ 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); m_buttonLeft->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW); if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW);
m_eventUp = m_buttonLeft->RetEventMsg(); m_eventUp = m_buttonLeft->GetEventType();
} }
if ( m_buttonRight == 0 ) if ( m_buttonRight == 0 )
@ -128,7 +131,7 @@ void CSlider::MoveAdjust()
m_buttonRight->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?48:50, EVENT_NULL); // >/v 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); m_buttonRight->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonRight->SetState(STATE_SHADOW); 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); m_marginButton = m_bHoriz?(m_dim.y*0.75f):(m_dim.x/0.75f);
@ -261,7 +264,7 @@ bool CSlider::EventProcess(const Event &event)
if ( !m_buttonRight->EventProcess(event) ) return false; 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; m_visibleValue -= m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f; if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@ -269,11 +272,11 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint(); AdjustGlint();
Event newEvent = event; Event newEvent = event;
newEvent.event = m_eventMsg; newEvent.type = m_eventType;
m_event->AddEvent(newEvent); 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; m_visibleValue += m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f; if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@ -281,11 +284,12 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint(); AdjustGlint();
Event newEvent = event; Event newEvent = event;
newEvent.event = m_eventMsg; newEvent.type = m_eventType;
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
} }
if ( event.event == EVENT_LBUTTONDOWN && if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
(event.mouseButton.button == 1 ) &&
(m_state & STATE_VISIBLE) && (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) ) (m_state & STATE_ENABLE) )
{ {
@ -311,7 +315,7 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint(); AdjustGlint();
Event newEvent = event; Event newEvent = event;
newEvent.event = m_eventMsg; newEvent.type = m_eventType;
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
m_bCapture = true; m_bCapture = true;
@ -320,7 +324,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 ) if ( m_bHoriz )
{ {
@ -345,32 +349,35 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint(); AdjustGlint();
Event newEvent = event; Event newEvent = event;
newEvent.event = m_eventMsg; newEvent.type = m_eventType;
m_event->AddEvent(newEvent); 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; m_bCapture = false;
} }
/*/TODO */
if ( event.event == EVENT_KEYDOWN && if ( event.type == EVENT_KEY_DOWN &&
event.param == VK_WHEELUP && event.param == VK_WHEELUP &&
Detect(event.pos) && Detect(event.pos) &&
m_buttonLeft != 0 ) m_buttonLeft != 0 )
{ {
Event newEvent = event; Event newEvent = event;
newEvent.event = m_buttonLeft->RetEventMsg(); newEvent.type = m_buttonLeft->GetEventType();
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
} }
if ( event.event == EVENT_KEYDOWN && /*/TODO */
if ( event.type == EVENT_KEY_DOWN &&
event.param == VK_WHEELDOWN && event.param == VK_WHEELDOWN &&
Detect(event.pos) && Detect(event.pos) &&
m_buttonRight != 0 ) m_buttonRight != 0 )
{ {
Event newEvent = event; Event newEvent = event;
newEvent.event = m_buttonRight->RetEventMsg(); newEvent.type = m_buttonRight->GetEventType();
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
} }
@ -466,10 +473,10 @@ void CSlider::Draw()
if ( m_bHoriz ) if ( m_bHoriz )
{ {
sprintf(text, "%d", (int)(m_min+m_visibleValue*(m_max-m_min))); 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.x = m_pos.x+m_dim.x+(10.0f/640.0f);
pos.y = m_pos.y+(m_dim.y-h)/2.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 else
{ {
@ -482,7 +489,7 @@ void CSlider::Draw()
dim.x = 50.0f/640.0f; dim.x = 50.0f/640.0f;
dim.y = 16.0f/480.0f; dim.y = 16.0f/480.0f;
sprintf(text, "%d", (int)(m_min+(m_visibleValue*(m_max-m_min)))); 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 +504,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 ) if ( icon == 0 )
{ {
m_engine->SetTexture("button2.tga"); 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.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f; uv1.y = 32.0f/256.0f;
uv2.x = 32.0f/256.0f; uv2.x = 32.0f/256.0f;
@ -509,7 +516,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 ) else if ( icon == 1 )
{ {
m_engine->SetTexture("button2.tga"); 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.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f; uv1.y = 32.0f/256.0f;
uv2.x = 160.0f/256.0f; uv2.x = 160.0f/256.0f;
@ -521,7 +528,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else else
{ {
m_engine->SetTexture("button2.tga"); m_engine->SetTexture("button2.tga");
m_engine->SetState(D3DSTATENORMAL); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 224.0f/256.0f; // cursor uv1.x = 224.0f/256.0f; // cursor
uv1.y = 32.0f/256.0f; uv1.y = 32.0f/256.0f;
uv2.x = 256.0f/256.0f; uv2.x = 256.0f/256.0f;
@ -561,7 +568,7 @@ void CSlider::SetVisibleValue(float value)
AdjustGlint(); AdjustGlint();
} }
float CSlider::RetVisibleValue() float CSlider::GetVisibleValue()
{ {
return m_min+m_visibleValue*(m_max-m_min); return m_min+m_visibleValue*(m_max-m_min);
} }
@ -572,7 +579,7 @@ void CSlider::SetArrowStep(float step)
m_step = step/(m_max-m_min); m_step = step/(m_max-m_min);
} }
float CSlider::RetArrowStep() float CSlider::GetArrowStep()
{ {
return m_step*(m_max-m_min); return m_step*(m_max-m_min);
} }

View File

@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code // * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch // * 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 // * 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 // * it under the terms of the GNU General Public License as published by
@ -21,8 +22,9 @@
#include "ui/control.h" #include "ui/control.h"
namespace Gfx{
class CD3DEngine; class CEngine;
};
class CButton; class CButton;
@ -33,7 +35,7 @@ public:
CSlider(CInstanceManager* iMan); CSlider(CInstanceManager* iMan);
~CSlider(); ~CSlider();
bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void SetPos(Math::Point pos); void SetPos(Math::Point pos);
void SetDim(Math::Point dim); void SetDim(Math::Point dim);
@ -48,10 +50,10 @@ public:
void SetLimit(float min, float max); void SetLimit(float min, float max);
void SetVisibleValue(float value); void SetVisibleValue(float value);
float RetVisibleValue(); float GetVisibleValue();
void SetArrowStep(float step); void SetArrowStep(float step);
float RetArrowStep(); float GetArrowStep();
protected: protected:
void MoveAdjust(); void MoveAdjust();
@ -74,8 +76,8 @@ protected:
Math::Point m_pressPos; Math::Point m_pressPos;
float m_pressValue; float m_pressValue;
EventMsg m_eventUp; EventType m_eventUp;
EventMsg m_eventDown; EventType m_eventDown;
}; };