1
0
forked from 0ad/0ad

Fix minimap issue caused by 5b7027ec53. Fixes #1372.

This was SVN commit r11748.
This commit is contained in:
leper 2012-05-04 17:44:28 +00:00
parent f2f434ded4
commit d0784bd314
2 changed files with 32 additions and 33 deletions

View File

@ -59,7 +59,7 @@ CMiniMap::CMiniMap() :
AddSetting(GUIST_CStrW, "tooltip");
AddSetting(GUIST_CStr, "tooltip_style");
m_Clicking = false;
m_Hovering = false;
m_MouseHovering = false;
}
CMiniMap::~CMiniMap()
@ -73,7 +73,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message)
{
case GUIM_MOUSE_PRESS_LEFT:
{
if (m_Hovering)
if (m_MouseHovering)
{
SetCameraPos();
m_Clicking = true;
@ -82,7 +82,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message)
}
case GUIM_MOUSE_RELEASE_LEFT:
{
if(m_Hovering && m_Clicking)
if(m_MouseHovering && m_Clicking)
{
SetCameraPos();
}
@ -91,7 +91,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message)
}
case GUIM_MOUSE_DBLCLICK_LEFT:
{
if(m_Hovering && m_Clicking)
if(m_MouseHovering && m_Clicking)
{
SetCameraPos();
}
@ -100,13 +100,13 @@ void CMiniMap::HandleMessage(SGUIMessage &Message)
}
case GUIM_MOUSE_ENTER:
{
m_Hovering = true;
m_MouseHovering = true;
break;
}
case GUIM_MOUSE_LEAVE:
{
m_Clicking = false;
m_Hovering = false;
m_MouseHovering = false;
break;
}
case GUIM_MOUSE_RELEASE_RIGHT:
@ -121,7 +121,7 @@ void CMiniMap::HandleMessage(SGUIMessage &Message)
}
case GUIM_MOUSE_MOTION:
{
if (m_Hovering && m_Clicking)
if (m_MouseHovering && m_Clicking)
{
SetCameraPos();
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -25,56 +25,55 @@ class CTerrain;
class CMiniMap : public IGUIObject
{
GUI_OBJECT(CMiniMap)
GUI_OBJECT(CMiniMap)
public:
CMiniMap();
virtual ~CMiniMap();
CMiniMap();
virtual ~CMiniMap();
protected:
virtual void Draw();
virtual void Draw();
/**
* @see IGUIObject#HandleMessage()
*/
virtual void HandleMessage(SGUIMessage &Message);
// create the minimap textures
void CreateTextures();
// create the minimap textures
void CreateTextures();
// rebuild the terrain texture map
void RebuildTerrainTexture();
// rebuild the terrain texture map
void RebuildTerrainTexture();
// destroy and free any memory and textures
void Destroy();
// destroy and free any memory and textures
void Destroy();
void SetCameraPos();
void FireWorldClickEvent(int button, int clicks);
// the terrain we are mini-mapping
const CTerrain* m_Terrain;
// the terrain we are mini-mapping
const CTerrain* m_Terrain;
const CCamera* m_Camera;
//Whether or not the mouse is currently down
bool m_Clicking;
bool m_Hovering;
// minimap texture handles
GLuint m_TerrainTexture;
// minimap texture handles
GLuint m_TerrainTexture;
// texture data
u32* m_TerrainData;
// texture data
u32* m_TerrainData;
// whether we need to regenerate the terrain texture
bool m_TerrainDirty;
// whether we need to regenerate the terrain texture
bool m_TerrainDirty;
ssize_t m_Width, m_Height;
ssize_t m_Width, m_Height;
// map size
ssize_t m_MapSize;
// map size
ssize_t m_MapSize;
// texture size
GLsizei m_TextureSize;
// texture size
GLsizei m_TextureSize;
// 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
float m_MapScale;