diff options
author | Michał Konopacki <konopacki.m@gmail.com> | 2012-08-15 01:48:49 +0200 |
---|---|---|
committer | Michał Konopacki <konopacki.m@gmail.com> | 2012-08-15 01:48:49 +0200 |
commit | 10b2c562fb7635f9850f1441f08ba8b1a71e31e1 (patch) | |
tree | 34d2b49911923481a41ba8b24edf630bae27d314 /src/ui/group.cpp | |
parent | e942400c8bb9b6836bdfe705111f7ec63ef19e28 (diff) | |
download | colobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.tar.gz colobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.tar.bz2 colobot-10b2c562fb7635f9850f1441f08ba8b1a71e31e1.zip |
First approach to port 2D UI Interface
- changes in src/ui ; be CAREFUL, not every file is changed in a proper way -> bugs
- necessary changes in object/robotmain.h and common/misc.h/.cpp in order to compile
Diffstat (limited to 'src/ui/group.cpp')
-rw-r--r-- | src/ui/group.cpp | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/src/ui/group.cpp b/src/ui/group.cpp index 06290e4..d2cd192 100644 --- a/src/ui/group.cpp +++ b/src/ui/group.cpp @@ -17,13 +17,14 @@ // group.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" @@ -48,18 +49,18 @@ CGroup::~CGroup() // Creates a new button. -bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg) +bool CGroup::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); @@ -97,7 +98,7 @@ void CGroup::Draw() if ( m_icon == 0 ) // hollow frame? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -113,7 +114,7 @@ void CGroup::Draw() if ( m_icon == 1 ) // orange solid opaque? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -127,7 +128,7 @@ void CGroup::Draw() if ( m_icon == 2 ) // orange degrade -> transparent? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -141,7 +142,7 @@ void CGroup::Draw() if ( m_icon == 3 ) // transparent gradient -> gray? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -155,7 +156,7 @@ void CGroup::Draw() if ( m_icon == 4 ) // degrade blue corner? { 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 = 128.0f/256.0f; uv2.x = 224.0f/256.0f; @@ -169,7 +170,7 @@ void CGroup::Draw() if ( m_icon == 5 ) // degrade orange corner? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -183,7 +184,7 @@ void CGroup::Draw() if ( m_icon == 6 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -199,7 +200,7 @@ void CGroup::Draw() if ( m_icon == 7 ) { 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; @@ -213,7 +214,7 @@ void CGroup::Draw() if ( m_icon == 8 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -227,7 +228,7 @@ void CGroup::Draw() if ( m_icon == 9 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTb); + m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f/256.0f; // red transparent uv1.y = 176.0f/256.0f; uv2.x = 160.0f/256.0f; @@ -241,7 +242,7 @@ void CGroup::Draw() if ( m_icon == 10 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -255,7 +256,7 @@ void CGroup::Draw() if ( m_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; // yellow transparent uv1.y = 224.0f/256.0f; uv2.x = 160.0f/256.0f; @@ -272,7 +273,7 @@ void CGroup::Draw() dim.y = m_dim.y/2.0f; m_engine->SetTexture("mouse.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -290,7 +291,7 @@ void CGroup::Draw() Math::Swap(uv1.x, uv2.x); DrawIcon(pos, dim, uv1, uv2); // dl - m_engine->SetState(D3DSTATETTw); + 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; @@ -311,7 +312,7 @@ void CGroup::Draw() if ( m_icon == 13 ) // corner upper / left? { m_engine->SetTexture("mouse.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -320,7 +321,7 @@ void CGroup::Draw() uv2.y = 255.5f/256.0f; DrawIcon(pos, m_dim, uv1, uv2); - m_engine->SetState(D3DSTATETTw); + 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; @@ -332,7 +333,7 @@ void CGroup::Draw() if ( m_icon == 14 ) // corner upper / right? { m_engine->SetTexture("mouse.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -341,7 +342,7 @@ void CGroup::Draw() uv2.y = 255.5f/256.0f; DrawIcon(pos, m_dim, uv1, uv2); - m_engine->SetState(D3DSTATETTw); + 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; @@ -353,7 +354,7 @@ void CGroup::Draw() if ( m_icon == 15 ) // corner lower / left? { m_engine->SetTexture("mouse.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -362,7 +363,7 @@ void CGroup::Draw() uv1.y = 255.5f/256.0f; DrawIcon(pos, m_dim, uv1, uv2); - m_engine->SetState(D3DSTATETTw); + 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; @@ -374,7 +375,7 @@ void CGroup::Draw() if ( m_icon == 16 ) // corner lower / left? { m_engine->SetTexture("mouse.tga"); - m_engine->SetState(D3DSTATETTb); + 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; @@ -383,7 +384,7 @@ void CGroup::Draw() uv1.y = 255.5f/256.0f; DrawIcon(pos, m_dim, uv1, uv2); - m_engine->SetState(D3DSTATETTw); + 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; @@ -395,7 +396,7 @@ void CGroup::Draw() if ( m_icon == 17 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -411,7 +412,7 @@ void CGroup::Draw() if ( m_icon == 18 ) // arrow> for SatCom? { m_engine->SetTexture("button1.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -425,7 +426,7 @@ void CGroup::Draw() if ( m_icon == 19 ) // SatCom symbol? { m_engine->SetTexture("button1.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -439,7 +440,7 @@ void CGroup::Draw() if ( m_icon == 20 ) // solid blue background? { m_engine->SetTexture("button1.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -453,7 +454,7 @@ void CGroup::Draw() if ( m_icon == 21 ) // stand-by symbol? { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATETTw); + 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; @@ -467,7 +468,7 @@ void CGroup::Draw() if ( m_icon == 22 ) { m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -484,7 +485,7 @@ void CGroup::Draw() if ( m_icon == 23 ) { m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -500,7 +501,7 @@ void CGroup::Draw() if ( m_icon == 24 ) { m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -516,7 +517,7 @@ void CGroup::Draw() if ( m_icon == 25 ) { m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -532,7 +533,7 @@ void CGroup::Draw() if ( m_icon == 26 ) { m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -548,7 +549,7 @@ void CGroup::Draw() if ( m_icon == 27 ) { m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -566,7 +567,7 @@ void CGroup::Draw() dim = m_dim; m_engine->SetTexture("button2.tga"); - m_engine->SetState(D3DSTATENORMAL); + m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 32.0f/256.0f; uv1.y = 32.0f/256.0f; uv2.x = uv1.x+32.0f/256.0f; @@ -578,7 +579,7 @@ void CGroup::Draw() DrawIcon(pos, dim, uv1, uv2); m_engine->SetTexture("button3.tga"); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -593,7 +594,7 @@ void CGroup::Draw() uv2.y -= dp; DrawIcon(pos, dim, uv1, uv2); - m_engine->SetState(D3DSTATENORMAL); + 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; @@ -608,7 +609,7 @@ void CGroup::Draw() uv2.y -= dp; DrawIcon(pos, dim, uv1, uv2); - m_engine->SetState(D3DSTATETTb); + 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; |