From 998d27dc5fafeed09078357e0737e52080c71d42 Mon Sep 17 00:00:00 2001 From: Mrxx99 <33566379+Mrxx99@users.noreply.github.com> Date: Tue, 6 Nov 2018 00:22:59 +0100 Subject: [PATCH] added lap icon to the the kart icons in RaceUI that have finished the race already (#3538) * added lap icon to the the kart icons in RaceUI that have finished the race already * fixed identation * implemented Aurias feedback --- src/states_screens/race_gui.cpp | 1 - src/states_screens/race_gui.hpp | 1 - src/states_screens/race_gui_base.cpp | 13 +++++++++++++ src/states_screens/race_gui_base.hpp | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 17ea294a1..1f774b5c2 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -191,7 +191,6 @@ RaceGUI::RaceGUI() //createMarkerTexture(); // Load icon textures for later reuse - m_lap_flag = irr_driver->getTexture(FileManager::GUI_ICON, "lap_flag.png"); m_red_team = irr_driver->getTexture(FileManager::GUI_ICON, "soccer_ball_red.png"); m_blue_team = irr_driver->getTexture(FileManager::GUI_ICON, "soccer_ball_blue.png"); m_red_flag = irr_driver->getTexture(FileManager::GUI_ICON, "red_flag.png"); diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index 674a6750b..b183e1eec 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -93,7 +93,6 @@ private: /** Icon textures (stored as variables to not look up their location on every frame) */ - irr::video::ITexture *m_lap_flag; irr::video::ITexture *m_red_team; irr::video::ITexture *m_blue_team; irr::video::ITexture *m_red_flag; diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 28491e620..5d579c9c4 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -100,6 +100,7 @@ RaceGUIBase::RaceGUIBase() m_gauge_full_bright = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI_ICON,"gauge_full_bright.png")); m_gauge_empty = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI_ICON,"gauge_empty.png")); m_gauge_goal = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI_ICON,"gauge_goal.png" )); + m_lap_flag = irr_driver->getTexture(FileManager::GUI_ICON, "lap_flag.png"); m_dist_show_overlap = 2; m_icons_inertia = 2; @@ -1048,6 +1049,18 @@ void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w) NULL, true); } } + + //lap flag for finished karts + if (kart->hasFinishedRace()) + { + if (m_lap_flag != NULL) + { + const core::rect rect(core::position2d(0, 0), + m_lap_flag->getSize()); + const core::rect pos1(x - 20, y - 10, x + w - 20, y + w - 10); + draw2DImage(m_lap_flag, pos1, rect, NULL, NULL, true); + } + } #endif } // drawPlayerIcon diff --git a/src/states_screens/race_gui_base.hpp b/src/states_screens/race_gui_base.hpp index 18cd35c87..f22448c98 100644 --- a/src/states_screens/race_gui_base.hpp +++ b/src/states_screens/race_gui_base.hpp @@ -186,6 +186,9 @@ protected: /** The frame around player karts in the mini map. */ video::ITexture* m_icons_frame; + + /** Texture for the lap icon*/ + video::ITexture* m_lap_flag; RaceGUIMultitouch* m_multitouch_gui;