Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
ffe657b1c2
@ -12,6 +12,7 @@ uniform mat4 ViewMatrix;
|
|||||||
uniform mat4 ProjectionMatrix;
|
uniform mat4 ProjectionMatrix;
|
||||||
uniform mat4 InverseViewMatrix;
|
uniform mat4 InverseViewMatrix;
|
||||||
uniform mat4 InverseProjectionMatrix;
|
uniform mat4 InverseProjectionMatrix;
|
||||||
|
uniform vec2 screen;
|
||||||
#else
|
#else
|
||||||
layout (std140) uniform MatrixesData
|
layout (std140) uniform MatrixesData
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ uniform mat4 ViewMatrix;
|
|||||||
uniform mat4 ProjectionMatrix;
|
uniform mat4 ProjectionMatrix;
|
||||||
uniform mat4 InverseViewMatrix;
|
uniform mat4 InverseViewMatrix;
|
||||||
uniform mat4 InverseProjectionMatrix;
|
uniform mat4 InverseProjectionMatrix;
|
||||||
|
uniform vec2 screen;
|
||||||
#else
|
#else
|
||||||
layout (std140) uniform MatrixesData
|
layout (std140) uniform MatrixesData
|
||||||
{
|
{
|
||||||
|
@ -687,11 +687,11 @@ namespace GUIEngine
|
|||||||
{
|
{
|
||||||
IGUIEnvironment* g_env;
|
IGUIEnvironment* g_env;
|
||||||
Skin* g_skin = NULL;
|
Skin* g_skin = NULL;
|
||||||
ScalableFont* g_font;
|
ScalableFont *g_font;
|
||||||
ScalableFont* g_large_font;
|
ScalableFont *g_large_font;
|
||||||
ScalableFont* g_title_font;
|
ScalableFont *g_title_font;
|
||||||
ScalableFont* g_small_font;
|
ScalableFont *g_small_font;
|
||||||
ScalableFont* g_digit_font;
|
ScalableFont *g_digit_font;
|
||||||
|
|
||||||
IrrlichtDevice* g_device;
|
IrrlichtDevice* g_device;
|
||||||
IVideoDriver* g_driver;
|
IVideoDriver* g_driver;
|
||||||
@ -1062,7 +1062,7 @@ namespace GUIEngine
|
|||||||
ScalableFont* sfont =
|
ScalableFont* sfont =
|
||||||
new ScalableFont(g_env,
|
new ScalableFont(g_env,
|
||||||
file_manager->getAssetChecked(FileManager::FONT,
|
file_manager->getAssetChecked(FileManager::FONT,
|
||||||
"StkFont.xml",true).c_str() );
|
"StkFont.xml",true) );
|
||||||
sfont->setScale(normal_text_scale);
|
sfont->setScale(normal_text_scale);
|
||||||
sfont->setKerningHeight(-5);
|
sfont->setKerningHeight(-5);
|
||||||
g_font = sfont;
|
g_font = sfont;
|
||||||
@ -1070,13 +1070,12 @@ namespace GUIEngine
|
|||||||
ScalableFont* digit_font =
|
ScalableFont* digit_font =
|
||||||
new ScalableFont(g_env,
|
new ScalableFont(g_env,
|
||||||
file_manager->getAssetChecked(FileManager::FONT,
|
file_manager->getAssetChecked(FileManager::FONT,
|
||||||
"BigDigitFont.xml",true).c_str());
|
"BigDigitFont.xml",true));
|
||||||
digit_font->lazyLoadTexture(0); // make sure the texture is loaded for this one
|
digit_font->lazyLoadTexture(0); // make sure the texture is loaded for this one
|
||||||
g_digit_font = digit_font;
|
g_digit_font = digit_font;
|
||||||
|
|
||||||
Private::font_height = g_font->getDimension( L"X" ).Height;
|
Private::font_height = g_font->getDimension( L"X" ).Height;
|
||||||
|
|
||||||
|
|
||||||
ScalableFont* sfont_larger = sfont->getHollowCopy();
|
ScalableFont* sfont_larger = sfont->getHollowCopy();
|
||||||
sfont_larger->setScale(normal_text_scale*1.4f);
|
sfont_larger->setScale(normal_text_scale*1.4f);
|
||||||
sfont_larger->setKerningHeight(-5);
|
sfont_larger->setKerningHeight(-5);
|
||||||
@ -1097,7 +1096,7 @@ namespace GUIEngine
|
|||||||
new ScalableFont(g_env,
|
new ScalableFont(g_env,
|
||||||
file_manager->getAssetChecked(FileManager::FONT,
|
file_manager->getAssetChecked(FileManager::FONT,
|
||||||
"title_font.xml",
|
"title_font.xml",
|
||||||
true).c_str() );
|
true) );
|
||||||
sfont2->m_fallback_font = sfont;
|
sfont2->m_fallback_font = sfont;
|
||||||
// Because the fallback font is much smaller than the title font:
|
// Because the fallback font is much smaller than the title font:
|
||||||
sfont2->m_fallback_font_scale = 4.0f;
|
sfont2->m_fallback_font_scale = 4.0f;
|
||||||
|
@ -21,9 +21,9 @@ namespace gui
|
|||||||
{
|
{
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
ScalableFont::ScalableFont(IGUIEnvironment *env, const io::path& filename)
|
ScalableFont::ScalableFont(IGUIEnvironment *env, const std::string &filename)
|
||||||
: Driver(0), SpriteBank(0), Environment(env), WrongCharacter(0),
|
: Driver(0), SpriteBank(0), Environment(env), WrongCharacter(0),
|
||||||
MaxHeight(0), GlobalKerningWidth(0), GlobalKerningHeight(0)
|
MaxHeight(0), GlobalKerningWidth(0), GlobalKerningHeight(0)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("ScalableFont");
|
setDebugName("ScalableFont");
|
||||||
@ -44,7 +44,7 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, const io::path& filename)
|
|||||||
// don't grab environment, to avoid circular references
|
// don't grab environment, to avoid circular references
|
||||||
Driver = Environment->getVideoDriver();
|
Driver = Environment->getVideoDriver();
|
||||||
|
|
||||||
SpriteBank = Environment->addEmptySpriteBank(filename);
|
SpriteBank = Environment->addEmptySpriteBank(io::path(filename.c_str()));
|
||||||
if (SpriteBank)
|
if (SpriteBank)
|
||||||
SpriteBank->grab();
|
SpriteBank->grab();
|
||||||
}
|
}
|
||||||
@ -676,7 +676,6 @@ void ScalableFont::draw(const core::stringw& text,
|
|||||||
source,
|
source,
|
||||||
clip,
|
clip,
|
||||||
color, true);
|
color, true);
|
||||||
|
|
||||||
#ifdef FONT_DEBUG
|
#ifdef FONT_DEBUG
|
||||||
driver->draw2DLine(core::position2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y),
|
driver->draw2DLine(core::position2d<s32>(dest.UpperLeftCorner.X, dest.UpperLeftCorner.Y),
|
||||||
core::position2d<s32>(dest.UpperLeftCorner.X, dest.LowerRightCorner.Y),
|
core::position2d<s32>(dest.UpperLeftCorner.X, dest.LowerRightCorner.Y),
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
int m_fallback_kerning_width;
|
int m_fallback_kerning_width;
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
ScalableFont(IGUIEnvironment* env, const io::path& filename);
|
ScalableFont(IGUIEnvironment* env, const std::string &filename);
|
||||||
|
|
||||||
/** Creates a hollow copy of this font; i.e. the underlying font data is the *same* for
|
/** Creates a hollow copy of this font; i.e. the underlying font data is the *same* for
|
||||||
* both fonts. The advantage of doing this is that you can change "view" parameters
|
* both fonts. The advantage of doing this is that you can change "view" parameters
|
||||||
|
@ -308,6 +308,10 @@ void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
|||||||
|
|
||||||
float fire_th = (dx*dist - dz * sqrtf(dx*dx + dz*dz - dist*dist))
|
float fire_th = (dx*dist - dz * sqrtf(dx*dx + dz*dz - dist*dist))
|
||||||
/ (dx*dx + dz*dz);
|
/ (dx*dx + dz*dz);
|
||||||
|
if(fire_th>1)
|
||||||
|
fire_th = 1.0f;
|
||||||
|
else if (fire_th<-1.0f)
|
||||||
|
fire_th = -1.0f;
|
||||||
fire_th = (((dist - dx*fire_th) / dz > 0) ? -acosf(fire_th)
|
fire_th = (((dist - dx*fire_th) / dz > 0) ? -acosf(fire_th)
|
||||||
: acosf(fire_th));
|
: acosf(fire_th));
|
||||||
|
|
||||||
@ -326,8 +330,10 @@ void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
|||||||
fire_th += M_PI;
|
fire_th += M_PI;
|
||||||
|
|
||||||
//createPhysics offset
|
//createPhysics offset
|
||||||
|
assert(sqrt(a*a+b*b)!=0);
|
||||||
time -= forw_offset / sqrt(a*a+b*b);
|
time -= forw_offset / sqrt(a*a+b*b);
|
||||||
|
|
||||||
|
assert(time!=0);
|
||||||
*fire_angle = fire_th;
|
*fire_angle = fire_th;
|
||||||
*up_velocity = (0.5f * time * gravity) + (dy / time)
|
*up_velocity = (0.5f * time * gravity) + (dy / time)
|
||||||
+ (gy * target_kart->getSpeed());
|
+ (gy * target_kart->getSpeed());
|
||||||
|
@ -77,6 +77,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
}; // WorldWithRank
|
}; // WorldWithRank
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,6 +123,13 @@ RaceGUI::RaceGUI()
|
|||||||
w = font->getDimension(m_string_rank.c_str()).Width;
|
w = font->getDimension(m_string_rank.c_str()).Width;
|
||||||
if(m_rank_lap_width < w) m_rank_lap_width = w;
|
if(m_rank_lap_width < w) m_rank_lap_width = w;
|
||||||
|
|
||||||
|
// Technically we only need getNumLocalPlayers, but using the
|
||||||
|
// global kart id to find the data for a specific kart.
|
||||||
|
int n = race_manager->getNumberOfKarts();
|
||||||
|
|
||||||
|
m_animation_states.resize(n);
|
||||||
|
m_rank_animation_start_times.resize(n);
|
||||||
|
m_last_ranks.resize(n);
|
||||||
} // RaceGUI
|
} // RaceGUI
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -130,6 +137,19 @@ RaceGUI::~RaceGUI()
|
|||||||
{
|
{
|
||||||
} // ~Racegui
|
} // ~Racegui
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Reset the gui before a race. It initialised all rank animation related
|
||||||
|
* values back to the default.
|
||||||
|
*/
|
||||||
|
void RaceGUI::reset()
|
||||||
|
{
|
||||||
|
for(unsigned int i=0; i<race_manager->getNumberOfKarts(); i++)
|
||||||
|
{
|
||||||
|
m_animation_states[i] = AS_NONE;
|
||||||
|
m_last_ranks[i] = i+1;
|
||||||
|
}
|
||||||
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Render all global parts of the race gui, i.e. things that are only
|
/** Render all global parts of the race gui, i.e. things that are only
|
||||||
* displayed once even in splitscreen.
|
* displayed once even in splitscreen.
|
||||||
@ -219,6 +239,8 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
|
|||||||
} // renderPlayerView
|
} // renderPlayerView
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Shows the current soccer result.
|
||||||
|
*/
|
||||||
void RaceGUI::drawScores()
|
void RaceGUI::drawScores()
|
||||||
{
|
{
|
||||||
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
|
||||||
@ -271,7 +293,8 @@ void RaceGUI::drawScores()
|
|||||||
numLeader++;
|
numLeader++;
|
||||||
offsetX += position.LowerRightCorner.X;
|
offsetX += position.LowerRightCorner.X;
|
||||||
}
|
}
|
||||||
}
|
} // drawScores
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Displays the racing time on the screen.s
|
/** Displays the racing time on the screen.s
|
||||||
*/
|
*/
|
||||||
@ -388,10 +411,10 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling)
|
const core::vector2df &scaling)
|
||||||
{
|
{
|
||||||
float minRatio = std::min(scaling.X, scaling.Y);
|
float min_ratio = std::min(scaling.X, scaling.Y);
|
||||||
const int GAUGEWIDTH = 78;
|
const int GAUGEWIDTH = 78;
|
||||||
int gauge_width = (int)(GAUGEWIDTH*minRatio);
|
int gauge_width = (int)(GAUGEWIDTH*min_ratio);
|
||||||
int gauge_height = (int)(GAUGEWIDTH*minRatio);
|
int gauge_height = (int)(GAUGEWIDTH*min_ratio);
|
||||||
|
|
||||||
float state = (float)(kart->getEnergy())
|
float state = (float)(kart->getEnergy())
|
||||||
/ kart->getKartProperties()->getNitroMax();
|
/ kart->getKartProperties()->getNitroMax();
|
||||||
@ -404,14 +427,13 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
|
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
draw2DImage(m_gauge_empty,
|
draw2DImage(m_gauge_empty, core::rect<s32>((int)offset.X,
|
||||||
core::rect<s32>((int)offset.X,
|
(int)offset.Y-gauge_height,
|
||||||
(int) offset.Y-gauge_height,
|
(int)offset.X + gauge_width,
|
||||||
(int) offset.X + gauge_width,
|
(int)offset.Y) /* dest rect */,
|
||||||
(int)offset.Y) /* dest rect */,
|
core::rect<s32>(0, 0, 256, 256) /* source rect */,
|
||||||
core::rect<s32>(0, 0, 256, 256) /* source rect */,
|
NULL /* clip rect */, NULL /* colors */,
|
||||||
NULL /* clip rect */, NULL /* colors */,
|
true /* alpha */);
|
||||||
true /* alpha */);
|
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
|
|
||||||
@ -581,10 +603,8 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
|
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
|
||||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // drawEnergyMeter
|
} // drawEnergyMeter
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -593,10 +613,10 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
|||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling)
|
const core::vector2df &scaling)
|
||||||
{
|
{
|
||||||
float minRatio = std::min(scaling.X, scaling.Y);
|
float min_ratio = std::min(scaling.X, scaling.Y);
|
||||||
const int SPEEDWIDTH = 128;
|
const int SPEEDWIDTH = 128;
|
||||||
int meter_width = (int)(SPEEDWIDTH*minRatio);
|
int meter_width = (int)(SPEEDWIDTH*min_ratio);
|
||||||
int meter_height = (int)(SPEEDWIDTH*minRatio);
|
int meter_height = (int)(SPEEDWIDTH*min_ratio);
|
||||||
|
|
||||||
drawEnergyMeter(viewport.LowerRightCorner.X ,
|
drawEnergyMeter(viewport.LowerRightCorner.X ,
|
||||||
(int)(viewport.LowerRightCorner.Y),
|
(int)(viewport.LowerRightCorner.Y),
|
||||||
@ -604,8 +624,6 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
|||||||
|
|
||||||
// First draw the meter (i.e. the background )
|
// First draw the meter (i.e. the background )
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
core::vector2df offset;
|
core::vector2df offset;
|
||||||
offset.X = (float)(viewport.LowerRightCorner.X-meter_width) - 24.0f*scaling.X;
|
offset.X = (float)(viewport.LowerRightCorner.X-meter_width) - 24.0f*scaling.X;
|
||||||
offset.Y = viewport.LowerRightCorner.Y-10.0f*scaling.Y;
|
offset.Y = viewport.LowerRightCorner.Y-10.0f*scaling.Y;
|
||||||
@ -699,30 +717,79 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
|
|||||||
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
|
||||||
|
|
||||||
|
|
||||||
// Draw Speed in Numbers
|
// Draw rank
|
||||||
|
WorldWithRank *world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||||
|
|
||||||
core::recti pos;
|
if (world && world->displayRank())
|
||||||
pos.UpperLeftCorner.X=(int)(offset.X + 0.5f*meter_width);
|
{
|
||||||
pos.UpperLeftCorner.Y=(int)(offset.Y - 0.62f*meter_height);
|
core::recti pos;
|
||||||
pos.LowerRightCorner.X=(int)(offset.X + 0.8f*meter_width);
|
pos.UpperLeftCorner.X = (int)(offset.X + 0.5f*meter_width);
|
||||||
pos.LowerRightCorner.Y=(int)(offset.X - 0.5f*meter_height);
|
pos.UpperLeftCorner.Y = (int)(offset.Y - 0.62f*meter_height);
|
||||||
|
pos.LowerRightCorner.X = (int)(offset.X + 0.8f*meter_width);
|
||||||
|
pos.LowerRightCorner.Y = (int)(offset.X - 0.5f*meter_height);
|
||||||
|
|
||||||
gui::ScalableFont* font;
|
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||||
|
|
||||||
if (pos.getWidth() > 55)
|
int id = kart->getWorldKartId();
|
||||||
font = GUIEngine::getLargeFont();
|
|
||||||
else if (pos.getWidth() > 40)
|
|
||||||
font = GUIEngine::getFont();
|
|
||||||
else
|
|
||||||
font = GUIEngine::getSmallFont();
|
|
||||||
|
|
||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
if(m_animation_states[id] == AS_NONE)
|
||||||
std::ostringstream oss;
|
{
|
||||||
oss << (int)(speed*10);
|
if(m_last_ranks[id]!=kart->getPosition())
|
||||||
|
{
|
||||||
|
m_rank_animation_start_times[id] = world->getTime();
|
||||||
|
m_animation_states[id] = AS_SMALLER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
font->draw(oss.str().c_str(), pos, color);
|
float scale = 1.0f;
|
||||||
|
int rank = kart->getPosition();
|
||||||
|
const float DURATION = 0.8f;
|
||||||
|
if(m_animation_states[id] == AS_SMALLER)
|
||||||
|
{
|
||||||
|
scale = 1.0f - (world->getTime()-m_rank_animation_start_times[id])
|
||||||
|
/ DURATION;
|
||||||
|
rank = m_last_ranks[id];
|
||||||
|
if(scale<0)
|
||||||
|
{
|
||||||
|
m_animation_states[id] = AS_BIGGER;
|
||||||
|
m_rank_animation_start_times[id] = world->getTime();
|
||||||
|
// Store the new rank
|
||||||
|
m_last_ranks[id] = kart->getPosition();
|
||||||
|
scale = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_animation_states[id] == AS_BIGGER)
|
||||||
|
{
|
||||||
|
scale = (world->getTime() - m_rank_animation_start_times[id])
|
||||||
|
/ DURATION;
|
||||||
|
rank = m_last_ranks[id];
|
||||||
|
if(scale>1.0f)
|
||||||
|
{
|
||||||
|
m_animation_states[id] = AS_NONE;
|
||||||
|
scale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_last_ranks[id] = kart->getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
font->setScale(min_ratio * scale * 0.7f);
|
||||||
|
font->setShadow(video::SColor(255, 128, 0, 0));
|
||||||
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << rank; // the current font has no . :( << ".";
|
||||||
|
|
||||||
|
pos.LowerRightCorner = core::vector2di(offset.X+int(0.6f*meter_width),
|
||||||
|
int(offset.Y-0.5f*meter_height));
|
||||||
|
pos.UpperLeftCorner = core::vector2di(offset.X+int(0.6f*meter_width),
|
||||||
|
int(offset.Y-0.5f*meter_height));
|
||||||
|
|
||||||
|
font->draw(oss.str().c_str(), pos, color, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // drawSpeedAndEnergy
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Displays the rank and the lap of the kart.
|
/** Displays the rank and the lap of the kart.
|
||||||
@ -755,21 +822,6 @@ void RaceGUI::drawRankLap(const AbstractKart* kart,
|
|||||||
static video::SColor color = video::SColor(255, 255, 255, 255);
|
static video::SColor color = video::SColor(255, 255, 255, 255);
|
||||||
WorldWithRank *world = (WorldWithRank*)(World::getWorld());
|
WorldWithRank *world = (WorldWithRank*)(World::getWorld());
|
||||||
|
|
||||||
if (world->displayRank())
|
|
||||||
{
|
|
||||||
const int rank = kart->getPosition();
|
|
||||||
|
|
||||||
font->draw(m_string_rank.c_str(), pos, color);
|
|
||||||
pos.UpperLeftCorner.Y += font_height;
|
|
||||||
pos.LowerRightCorner.Y += font_height;
|
|
||||||
|
|
||||||
char str[256];
|
|
||||||
const unsigned int kart_amount = world->getCurrentNumKarts();
|
|
||||||
sprintf(str, "%d/%d", rank, kart_amount);
|
|
||||||
font->draw(core::stringw(str).c_str(), pos, color);
|
|
||||||
pos.UpperLeftCorner.Y += font_height;
|
|
||||||
pos.LowerRightCorner.Y += font_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't display laps in follow the leader mode
|
// Don't display laps in follow the leader mode
|
||||||
if(world->raceHasLaps())
|
if(world->raceHasLaps())
|
||||||
|
@ -88,8 +88,18 @@ private:
|
|||||||
/** Maximum string length for the timer */
|
/** Maximum string length for the timer */
|
||||||
int m_timer_width;
|
int m_timer_width;
|
||||||
|
|
||||||
|
/** Animation state: none, getting smaller (old value),
|
||||||
|
* getting bigger (new number). */
|
||||||
|
enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER};
|
||||||
|
std::vector<AnimationState> m_animation_states;
|
||||||
|
|
||||||
bool m_is_tutorial;
|
/** When the animation state was changed. */
|
||||||
|
std::vector<float> m_rank_animation_start_times;
|
||||||
|
|
||||||
|
/** Stores the previous rank for each kart. Used for the rank animation. */
|
||||||
|
std::vector<int> m_last_ranks;
|
||||||
|
|
||||||
|
bool m_is_tutorial;
|
||||||
|
|
||||||
/* Display informat for one player on the screen. */
|
/* Display informat for one player on the screen. */
|
||||||
void drawEnergyMeter (int x, int y, const AbstractKart *kart,
|
void drawEnergyMeter (int x, int y, const AbstractKart *kart,
|
||||||
@ -111,6 +121,7 @@ public:
|
|||||||
|
|
||||||
RaceGUI();
|
RaceGUI();
|
||||||
~RaceGUI();
|
~RaceGUI();
|
||||||
|
virtual void reset();
|
||||||
virtual void renderGlobal(float dt);
|
virtual void renderGlobal(float dt);
|
||||||
virtual void renderPlayerView(const Camera *camera, float dt);
|
virtual void renderPlayerView(const Camera *camera, float dt);
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@ const int fontsizes[] = {4,6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,56,68,72
|
|||||||
|
|
||||||
char bUsed[0x10000]={0};
|
char bUsed[0x10000]={0};
|
||||||
|
|
||||||
|
/** True if pot files where given, which indicates that Asian fonts
|
||||||
|
* are to be created, and an offset needs to be used for the index. */
|
||||||
|
bool has_pot_files = false;
|
||||||
|
|
||||||
inline u32 getTextureSizeFromSurfaceSize(u32 size)
|
inline u32 getTextureSizeFromSurfaceSize(u32 size)
|
||||||
{
|
{
|
||||||
u32 ts = 0x01;
|
u32 ts = 0x01;
|
||||||
@ -19,6 +23,7 @@ inline u32 getTextureSizeFromSurfaceSize(u32 size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LoadPoFiles(const char* sListFileName){
|
bool LoadPoFiles(const char* sListFileName){
|
||||||
|
has_pot_files = true;
|
||||||
char s[1024];
|
char s[1024];
|
||||||
std::ifstream fin(sListFileName);
|
std::ifstream fin(sListFileName);
|
||||||
if(!fin){
|
if(!fin){
|
||||||
@ -762,7 +767,8 @@ bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
|
|||||||
writer->writeLineBreak();
|
writer->writeLineBreak();
|
||||||
|
|
||||||
// write images and link to them
|
// write images and link to them
|
||||||
u32 offset_for_asian_fonts=100;
|
// Only use the offset if Asian fonts are created.
|
||||||
|
u32 offset_for_asian_fonts=has_pot_files ? 100 : 0;
|
||||||
for (u32 i=0; i<currentImages.size(); ++i)
|
for (u32 i=0; i<currentImages.size(); ++i)
|
||||||
{
|
{
|
||||||
imagename = filename;
|
imagename = filename;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user