Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/minimap/MiniMap.js
/** | /** | ||||
* This class is concerned with handling events occurring when the interacts with the minimap, | * This class is concerned with handling events occurring when the interacts with the minimap, | ||||
* except for changing the camera position on leftclick. | * except for changing the camera position on leftclick. | ||||
*/ | */ | ||||
class MiniMap | class MiniMap | ||||
{ | { | ||||
constructor() | constructor() | ||||
{ | { | ||||
Engine.GetGUIObjectByName("minimap").onWorldClick = this.onWorldClick.bind(this); | this.miniMap = Engine.GetGUIObjectByName("minimap"); | ||||
Engine.GetGUIObjectByName("minimap").onMouseEnter = this.onMouseEnter.bind(this); | this.miniMap.onWorldClick = this.onWorldClick.bind(this); | ||||
Engine.GetGUIObjectByName("minimap").onMouseLeave = this.onMouseLeave.bind(this); | this.miniMap.onMouseEnter = this.onMouseEnter.bind(this); | ||||
this.miniMap.onMouseLeave = this.onMouseLeave.bind(this); | |||||
this.mouseIsOverMiniMap = false; | this.mouseIsOverMiniMap = false; | ||||
} | } | ||||
onWorldClick(target, button) | onWorldClick(target, button) | ||||
{ | { | ||||
// Partly duplicated from handleInputAfterGui(), but with the input being | // Partly duplicated from handleInputAfterGui(), but with the input being | ||||
// world coordinates instead of screen coordinates. | // world coordinates instead of screen coordinates. | ||||
if (button == SDL_BUTTON_LEFT) | if (button == SDL_BUTTON_LEFT) | ||||
Show All 39 Lines | class MiniMap | ||||
{ | { | ||||
this.mouseIsOverMiniMap = false; | this.mouseIsOverMiniMap = false; | ||||
} | } | ||||
isMouseOverMiniMap() | isMouseOverMiniMap() | ||||
{ | { | ||||
return this.mouseIsOverMiniMap; | return this.mouseIsOverMiniMap; | ||||
} | } | ||||
flare(target, playerID) | |||||
{ | |||||
return this.miniMap.flare([target.x, target.z], g_DiplomacyColors.getPlayerColor(playerID)); | |||||
} | |||||
} | } |
Wildfire Games · Phabricator