Added support for a text that is shown above a kart to the
kart (and changed the FTL code to display 'Leader' so that it uses this feature now). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11284 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -387,7 +387,10 @@ public:
|
||||
virtual btTransform getAlignedTransform(const float customPitch=-1) = 0;
|
||||
// -------------------------------------------------------------------------
|
||||
virtual void onFirePressed() = 0;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
/** Set a text that is displayed on top of a kart.
|
||||
*/
|
||||
virtual void setOnScreenText(const wchar_t *text) = 0;
|
||||
}; // AbstractKart
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "graphics/skid_marks.hpp"
|
||||
#include "graphics/slip_stream.hpp"
|
||||
#include "graphics/stars.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "karts/explosion_animation.hpp"
|
||||
#include "karts/kart_gfx.hpp"
|
||||
#include "karts/rescue_animation.hpp"
|
||||
@@ -2220,5 +2221,26 @@ btQuaternion Kart::getVisualRotation() const
|
||||
* btQuaternion(m_skidding->getVisualSkidRotation(), 0, 0);
|
||||
} // getVisualRotation
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets a text that is being displayed on top of a kart. This can be 'leader'
|
||||
* for the leader kart in a FTL race, the name of a driver, or even debug
|
||||
* output.
|
||||
* \param text The text to display
|
||||
*/
|
||||
void Kart::setOnScreenText(const wchar_t *text)
|
||||
{
|
||||
core::dimension2d<u32> textsize = GUIEngine::getFont()->getDimension(text);
|
||||
scene::ISceneManager* sm = irr_driver->getSceneManager();
|
||||
sm->addBillboardTextSceneNode(GUIEngine::getFont(),
|
||||
text,
|
||||
getNode(),
|
||||
core::dimension2df(textsize.Width/55.0f,
|
||||
textsize.Height/55.0f),
|
||||
core::vector3df(0.0f, 1.5f, 0.0f),
|
||||
-1 /* id */,
|
||||
video::SColor(255, 255, 225, 0),
|
||||
video::SColor(255, 255, 89, 0));
|
||||
|
||||
} // setOnScreenText
|
||||
|
||||
/* EOF */
|
||||
|
||||
@@ -403,6 +403,8 @@ public:
|
||||
TerrainInfo *getTerrainInfo() { return m_terrain_info; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void onFirePressed();
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void setOnScreenText(const wchar_t *text);
|
||||
}; // Kart
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "states_screens/race_gui_base.hpp"
|
||||
@@ -56,18 +55,7 @@ FollowTheLeaderRace::~FollowTheLeaderRace()
|
||||
void FollowTheLeaderRace::init()
|
||||
{
|
||||
LinearWorld::init();
|
||||
|
||||
core::dimension2d<u32> textsize = GUIEngine::getFont()->getDimension(_("Leader"));
|
||||
scene::ISceneManager* sm = irr_driver->getSceneManager();
|
||||
sm->addBillboardTextSceneNode(GUIEngine::getFont(),
|
||||
_("Leader"),
|
||||
getKart(0)->getNode(),
|
||||
core::dimension2df(textsize.Width/55.0f,
|
||||
textsize.Height/55.0f),
|
||||
core::vector3df(0.0f, 1.5f, 0.0f),
|
||||
-1 /* id */,
|
||||
video::SColor(255, 255, 225, 0),
|
||||
video::SColor(255, 255, 89, 0));
|
||||
getKart(0)->setOnScreenText(_("Leader"));
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
Reference in New Issue
Block a user