Line data Source code
1 : /* Copyright (C) 2026 Wildfire Games. 2 : * This file is part of 0 A.D. 3 : * 4 : * 0 A.D. is free software: you can redistribute it and/or modify 5 : * it under the terms of the GNU General Public License as published by 6 : * the Free Software Foundation, either version 2 of the License, or 7 : * (at your option) any later version. 8 : * 9 : * 0 A.D. is distributed in the hope that it will be useful, 10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 : * GNU General Public License for more details. 13 : * 14 : * You should have received a copy of the GNU General Public License 15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 : */ 17 : 18 : #ifndef INCLUDED_ICMPMINIMAP 19 : #define INCLUDED_ICMPMINIMAP 20 : 21 : #include "simulation2/helpers/Position.h" 22 : #include "simulation2/system/Component.h" 23 : #include "simulation2/system/Interface.h" 24 : 25 : #include <js/Value.h> 26 : #include <string> 27 : 28 : /** 29 : * Per-unit minimap data. 30 : */ 31 186 : class ICmpMinimap : public IComponent 32 : { 33 : public: 34 : /** 35 : * Gets the data for rendering this entity on the minimap. 36 : * If it should not be drawn, returns false; otherwise the arguments are set 37 : * to the color and world position. 38 : */ 39 : virtual bool GetRenderData(std::uint8_t& r, std::uint8_t& g, std::uint8_t& b, entity_pos_t& x, 40 : entity_pos_t& z) const = 0; 41 : 42 : /** 43 : * Returns true if the entity is actively pinging based on the current time. 44 : */ 45 : virtual bool CheckPing(double currentTime, double pingDuration) = 0; 46 : 47 : /** 48 : * Updates the entity's minimap color to match the player color. 49 : */ 50 : virtual void UpdateColor() = 0; 51 : 52 : /** 53 : * Returns true if a minimap should have icon of this entity. 54 : */ 55 : virtual bool HasIcon() = 0; 56 : 57 : /** 58 : * Returns a path to icon of this entity. 59 : */ 60 : virtual std::string GetIconPath() = 0; 61 : 62 : virtual float GetIconSize() = 0; 63 : 64 : DECLARE_INTERFACE_TYPE(Minimap) 65 : }; 66 : 67 : #endif // INCLUDED_ICMPMINIMAP