2011-02-03 02:12:24 +01:00
|
|
|
/* Copyright (C) 2011 Wildfire Games.
|
2009-04-18 19:00:33 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_MINIMAP
|
|
|
|
#define INCLUDED_MINIMAP
|
2004-10-08 03:10:14 +02:00
|
|
|
|
2005-10-19 19:16:34 +02:00
|
|
|
#include "gui/GUI.h"
|
2006-12-15 17:09:30 +01:00
|
|
|
|
|
|
|
class CCamera;
|
2004-12-12 20:43:55 +01:00
|
|
|
class CTerrain;
|
2004-10-08 03:10:14 +02:00
|
|
|
|
|
|
|
class CMiniMap : public IGUIObject
|
|
|
|
{
|
|
|
|
GUI_OBJECT(CMiniMap)
|
|
|
|
public:
|
|
|
|
CMiniMap();
|
|
|
|
virtual ~CMiniMap();
|
|
|
|
protected:
|
|
|
|
virtual void Draw();
|
|
|
|
|
2011-04-28 22:42:11 +02:00
|
|
|
/**
|
|
|
|
* @see IGUIObject#HandleMessage()
|
|
|
|
*/
|
|
|
|
virtual void HandleMessage(SGUIMessage &Message);
|
2005-10-20 17:27:39 +02:00
|
|
|
|
2005-10-19 05:02:51 +02:00
|
|
|
// create the minimap textures
|
|
|
|
void CreateTextures();
|
2004-10-08 03:10:14 +02:00
|
|
|
|
2005-10-19 05:02:51 +02:00
|
|
|
// rebuild the terrain texture map
|
|
|
|
void RebuildTerrainTexture();
|
2004-10-08 03:10:14 +02:00
|
|
|
|
|
|
|
// destroy and free any memory and textures
|
|
|
|
void Destroy();
|
|
|
|
|
2006-01-21 12:07:25 +01:00
|
|
|
void SetCameraPos();
|
|
|
|
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
void FireWorldClickEvent(int button, int clicks);
|
2004-10-08 03:10:14 +02:00
|
|
|
|
|
|
|
// the terrain we are mini-mapping
|
2005-10-19 19:16:34 +02:00
|
|
|
const CTerrain* m_Terrain;
|
2004-10-08 03:10:14 +02:00
|
|
|
|
2010-08-13 15:26:29 +02:00
|
|
|
const CCamera* m_Camera;
|
2006-01-21 12:07:25 +01:00
|
|
|
|
|
|
|
//Whether or not the mouse is currently down
|
2010-11-14 23:47:39 +01:00
|
|
|
bool m_Clicking;
|
|
|
|
bool m_Hovering;
|
2005-10-19 19:16:34 +02:00
|
|
|
|
2005-10-19 05:02:51 +02:00
|
|
|
// minimap texture handles
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
GLuint m_TerrainTexture;
|
2010-09-24 18:52:29 +02:00
|
|
|
|
2004-10-08 03:10:14 +02:00
|
|
|
// texture data
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
u32* m_TerrainData;
|
2004-10-08 03:10:14 +02:00
|
|
|
|
2010-09-10 23:02:10 +02:00
|
|
|
// whether we need to regenerate the terrain texture
|
|
|
|
bool m_TerrainDirty;
|
|
|
|
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
ssize_t m_Width, m_Height;
|
2004-10-08 03:10:14 +02:00
|
|
|
|
|
|
|
// map size
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
ssize_t m_MapSize;
|
2004-10-08 03:10:14 +02:00
|
|
|
|
|
|
|
// texture size
|
had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).
it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.
after several hours, the code now requires fewer casts and less
guesswork.
other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.
This was SVN commit r5942.
2008-05-11 20:48:32 +02:00
|
|
|
GLsizei m_TextureSize;
|
2005-10-19 19:16:34 +02:00
|
|
|
|
2011-05-27 05:04:59 +02:00
|
|
|
// 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
|
|
|
|
float m_MapScale;
|
|
|
|
|
2010-10-25 23:59:52 +02:00
|
|
|
void DrawTexture(float coordMax, float angle, float x, float y, float x2, float y2, float z);
|
|
|
|
|
|
|
|
void DrawViewRect();
|
|
|
|
|
|
|
|
void GetMouseWorldCoordinates(float& x, float& z);
|
|
|
|
|
|
|
|
float GetAngle();
|
2004-10-08 03:10:14 +02:00
|
|
|
};
|
|
|
|
|
2004-11-07 22:30:47 +01:00
|
|
|
#endif
|