From 508ddfcd452de5e12c6ca0a26f7c9441b0dffc1c Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 3 Apr 2016 11:27:46 +0800 Subject: [PATCH] Show translucent icon for ghost kart in race gui --- src/graphics/2dutils.cpp | 10 ++++++++-- src/graphics/2dutils.hpp | 2 +- src/states_screens/race_gui_base.cpp | 3 +-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/graphics/2dutils.cpp b/src/graphics/2dutils.cpp index 5323b118b..ec58cbaee 100644 --- a/src/graphics/2dutils.cpp +++ b/src/graphics/2dutils.cpp @@ -377,7 +377,8 @@ void draw2DImage(const video::ITexture* texture, const core::rect& sourceRect, const core::rect* 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); diff --git a/src/graphics/2dutils.hpp b/src/graphics/2dutils.hpp index aafc9b442..4c6e0d59c 100644 --- a/src/graphics/2dutils.hpp +++ b/src/graphics/2dutils.hpp @@ -47,7 +47,7 @@ void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect& sourceRect, const irr::core::rect* 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, diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 3639898c8..6a2ff4248 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -828,8 +828,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin) { const core::rect rect(core::position2d(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