1
/************************************************************************************
3
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
Copyright © 2006-2012 Michael Kurinnoy, Viewizard
7
AstroMenace is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
AstroMenace is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
21
Web Site: http://www.viewizard.com/
22
Project: http://sourceforge.net/projects/openastromenace/
23
E-mail: viewizard@viewizard.com
25
*************************************************************************************/
28
#include "GameLvlText.h"
32
//-----------------------------------------------------------------------------
33
// инициализация класса
34
//-----------------------------------------------------------------------------
35
CGameLvlText::CGameLvlText()
37
TimeLastUpdate = -1.0f;
44
AttachGameLvlText(this);
49
//-----------------------------------------------------------------------------
50
// При разрушении класса
51
//-----------------------------------------------------------------------------
52
CGameLvlText::~CGameLvlText()
54
if (DrawText != 0){delete [] DrawText; DrawText = 0;}
55
DetachGameLvlText(this);
59
//-----------------------------------------------------------------------------
61
//-----------------------------------------------------------------------------
62
bool CGameLvlText::Update(float Time)
64
// первый раз... просто берем время
65
if (TimeLastUpdate == -1.0f) {TimeLastUpdate = Time;return true;}
67
// Time - это абсолютное время, вычисляем дельту
68
float TimeDelta = Time - TimeLastUpdate;
69
// быстро вызвали еще раз... время не изменилось, или почти не изменилось
70
if (TimeDelta == 0.0f) return true;
72
TimeLastUpdate = Time;
75
// проверяем, сколько объекту жить, если нужно...-1.0f - проверка не нужна
78
// считаем, сколько осталось жить
79
Lifetime -= TimeDelta;
80
// если уже ничего не осталось - его нужно уничтожить
81
if (Lifetime <= 0.0f) return false;
85
if (DrawText == 0) return false;
94
//-----------------------------------------------------------------------------
96
//-----------------------------------------------------------------------------
97
void CGameLvlText::Draw()
108
R=1.0f;G=1.0f;B=1.0f;
111
R=1.0f;G=1.0f;B=0.0f;
114
R=1.0f;G=0.0f;B=0.0f;
117
R=0.0f;G=1.0f;B=0.0f;
120
R=1.0f;G=0.5f;B=0.0f;
123
R=0.5f;G=0.5f;B=0.5f;
127
vw_DrawFont(PosX, PosY, 0, 0, 1.0f, R,G,B, 1.0f, DrawText);