1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
4 // This file is part of Scorched3D.
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #include <GLW/GLWChannelViewTextRenderer.h>
22 #include <GLW/GLWChannelView.h>
23 #include <GLW/GLWTranslate.h>
24 #include <tank/TankContainer.h>
25 #include <tankgraph/TargetRendererImplTank.h>
26 #include <client/ScorchedClient.h>
27 #include <lang/LangResource.h>
29 GLWChannelViewTextRenderer::GLWChannelViewTextRenderer(GLWChannelView
*channelView
) :
30 channelView_(channelView
)
34 GLWChannelViewTextRenderer::~GLWChannelViewTextRenderer()
38 void GLWChannelViewTextRenderer::drawCharacter(
39 int charPosition
, Vector
&position
,
40 GLFont2dStorage::CharEntry
&charEntry
, Vector4
&color
)
42 ChannelTextEntry
*textEntry
= getEntry(charPosition
);
43 if (!textEntry
) return;
45 // Set the appropriate tool tip
46 if (GLWToolTip::instance()->addToolTip(
48 GLWTranslate::getPosX() + position
[0],
49 GLWTranslate::getPosY() + position
[1],
52 switch (textEntry
->type
)
56 TargetRendererImplTank
*renderer
= 0;
57 Tank
*tank
= ScorchedClient::instance()->getTankContainer().getTankById(
59 if (tank
) renderer
= (TargetRendererImplTank
*) tank
->getRenderer();
62 GLWToolTip::instance()->addToolTip(
63 &renderer
->getTips()->tankTip
,
64 GLWTranslate::getPosX() + position
[0],
65 GLWTranslate::getPosY() + position
[1],
70 toolTip_
.setText(ToolTip::ToolTipInfo
,
71 LANG_RESOURCE("PLAYER_DISCONECTED", "Player disconnected"),
77 toolTip_
.setText(ToolTip::ToolTipHelp
,
78 LANG_RESOURCE("CHANNEL", "Channel"),
82 toolTip_
.setText(ToolTip::ToolTipHelp
,
83 LANG_RESOURCE("WEAPON", "Weapon"),
87 toolTip_
.setText(ToolTip::ToolTipHelp
,
88 LANG_RESOURCE("ADMIN", "Admin"),
94 // Set the appropriate text colours etc.
95 switch (textEntry
->type
)
100 color
[0] = textEntry
->color
[0];
101 color
[1] = textEntry
->color
[1];
102 color
[2] = textEntry
->color
[2];