diff options
Diffstat (limited to 'src/ui/gauge.cpp')
-rw-r--r-- | src/ui/gauge.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp index a4571da..cc4eca0 100644 --- a/src/ui/gauge.cpp +++ b/src/ui/gauge.cpp @@ -1,5 +1,6 @@ // * This file is part of the COLOBOT source code // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch +// * Copyright (C) 2012, Polish Portal of Colobot (PPC) // * // * This program is free software: you can redistribute it and/or modify // * it under the terms of the GNU General Public License as published by @@ -18,11 +19,12 @@ //#include <windows.h> -#include <stdio.h> +//#include <stdio.h> //#include <d3d.h> //#include "common/struct.h" //#include "old/d3dengine.h" +#include "graphics/engine/engine.h" //#include "old/math3d.h" #include "common/event.h" #include "common/misc.h" @@ -31,10 +33,11 @@ - +namespace Ui { // Object's constructor. -CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan) +//CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan) +CGauge::CGauge() : CControl() { m_level = 0.0f; } @@ -95,40 +98,40 @@ void CGauge::Draw() pos = m_pos; dim = m_dim; - uv1.x = 32.0f/256.0f; - uv1.y = 32.0f/256.0f; - uv2.x = 64.0f/256.0f; - uv2.y = 64.0f/256.0f; + uv1.x = 32.0f / 256.0f; + uv1.y = 32.0f / 256.0f; + uv2.x = 64.0f / 256.0f; + uv2.y = 64.0f / 256.0f; uv1.x += dp; uv1.y += dp; uv2.x -= dp; uv2.y -= dp; - corner.x = 10.0f/640.0f; - corner.y = 10.0f/480.0f; + corner.x = 10.0f / 640.0f; + corner.y = 10.0f / 480.0f; DrawIcon(pos, dim, uv1, uv2, corner, 8.0f/256.0f); - pos.x += 3.0f/640.0f; - pos.y += 3.0f/480.0f; - dim.x -= 6.0f/640.0f; - dim.y -= 6.0f/480.0f; + pos.x += 3.0f / 640.0f; + pos.y += 3.0f / 480.0f; + dim.x -= 6.0f / 640.0f; + dim.y -= 6.0f / 480.0f; if ( m_dim.x < m_dim.y ) // vertical gauge? { - uv1.x = (0.0f+m_icon*16.0f)/256.0f; - uv2.x = uv1.x+16.0f/256.0f; - uv1.y = 128.0f/256.0f+m_level*(64.0f/256.0f); - uv2.y = uv1.y+64.0f/256.0f; + uv1.x = (0.0f + m_icon * 16.0f) / 256.0f; + uv2.x = uv1.x + 16.0f / 256.0f; + uv1.y = 128.0f/256.0f + m_level * (64.0f/256.0f); + uv2.y = uv1.y + 64.0f/256.0f; } else // horizontal gauge? { - uv1.x = 64.0f/256.0f+(1.0f-m_level)*(64.0f/256.0f); - uv2.x = uv1.x+64.0f/256.0f; - uv1.y = (128.0f+m_icon*16.0f)/256.0f; - uv2.y = uv1.y+16.0f/256.0f; + uv1.x = 64.0f/256.0f + (1.0f - m_level) * (64.0f/256.0f); + uv2.x = uv1.x + 64.0f/256.0f; + uv1.y = (128.0f + m_icon*16.0f) / 256.0f; + uv2.y = uv1.y + 16.0f/256.0f; } uv1.x += dp; @@ -155,3 +158,4 @@ float CGauge::GetLevel() } +} |