Show translucent icon for ghost kart in race gui

This commit is contained in:
Benau 2016-04-03 11:27:46 +08:00
parent 2e016e63b4
commit 508ddfcd45
3 changed files with 10 additions and 5 deletions

View File

@ -377,7 +377,8 @@ void draw2DImage(const video::ITexture* texture,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clip_rect,
const video::SColor* const colors,
bool use_alpha_channel_of_texture)
bool use_alpha_channel_of_texture,
bool draw_translucently)
{
if (!CVS->isGLSL())
{
@ -395,7 +396,12 @@ void draw2DImage(const video::ITexture* texture,
center_pos_x, center_pos_y, tex_width, tex_height,
tex_center_pos_x, tex_center_pos_y);
if (use_alpha_channel_of_texture)
if (draw_translucently)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
else if (use_alpha_channel_of_texture)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View File

@ -47,7 +47,7 @@ void draw2DImage(const irr::video::ITexture* texture,
const irr::core::rect<irr::s32>& sourceRect,
const irr::core::rect<irr::s32>* clipRect,
const irr::video::SColor* const colors,
bool useAlphaChannelOfTexture);
bool useAlphaChannelOfTexture, bool draw_translucently = false);
void draw2DVertexPrimitiveList(irr::video::ITexture *t, const void* vertices,
irr::u32 vertexCount, const void* indexList,

View File

@ -828,8 +828,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
{
const core::rect<s32> rect(core::position2d<s32>(0,0),
icon->getSize());
draw2DImage(icon, pos, rect,
NULL, NULL, true);
draw2DImage(icon, pos, rect, NULL, NULL, true, kart->isGhostKart());
}
//draw status info - icon fade out in case of rescue/explode