浏览代码

build: rename Map to LevelMap so that we can use Map for the hashmap.

legacy
Sam Hocevar sam 13 年前
父节点
当前提交
2a5d9ed4d8
共有 7 个文件被更改,包括 58 次插入21 次删除
  1. +1
    -0
      src/Makefile.am
  2. +4
    -0
      src/core.h
  3. +28
    -0
      src/lol/core/map.h
  4. +1
    -0
      src/lolcore.vcxproj
  5. +3
    -0
      src/lolcore.vcxproj.filters
  6. +11
    -11
      src/map.cpp
  7. +10
    -10
      src/map.h

+ 1
- 0
src/Makefile.am 查看文件

@@ -18,6 +18,7 @@ liblol_a_SOURCES = \
\ \
lol/unit.h lol/debug.h \ lol/unit.h lol/debug.h \
lol/core/types.h lol/core/array.h lol/core/string.h lol/core/hash.h \ lol/core/types.h lol/core/array.h lol/core/string.h lol/core/hash.h \
lol/core/map.h \
lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \ lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \
lol/math/math.h \ lol/math/math.h \
\ \


+ 4
- 0
src/core.h 查看文件

@@ -75,14 +75,18 @@ static inline int isnan(float f)


// Base types // Base types
#include <lol/debug.h> #include <lol/debug.h>

#include <lol/core/types.h> #include <lol/core/types.h>
#include <lol/core/array.h> #include <lol/core/array.h>
#include <lol/core/string.h> #include <lol/core/string.h>
#include <lol/core/hash.h> #include <lol/core/hash.h>
#include <lol/core/map.h>

#include <lol/math/math.h> #include <lol/math/math.h>
#include <lol/math/half.h> #include <lol/math/half.h>
#include <lol/math/real.h> #include <lol/math/real.h>
#include <lol/math/vector.h> #include <lol/math/vector.h>

#include "numeric.h" #include "numeric.h"
#include "timer.h" #include "timer.h"
#include "thread/thread.h" #include "thread/thread.h"


+ 28
- 0
src/lol/core/map.h 查看文件

@@ -0,0 +1,28 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// The Map class
// -------------
// A very simple Map class.
//

#if !defined __LOL_CORE_MAP_H__
#define __LOL_CORE_MAP_H__

namespace lol
{

template<typename K, typename V> class Map;

} /* namespace lol */

#endif // __LOL_CORE_MAP_H__


+ 1
- 0
src/lolcore.vcxproj 查看文件

@@ -584,6 +584,7 @@
<ClInclude Include="lolgl.h" /> <ClInclude Include="lolgl.h" />
<ClInclude Include="lol\core\array.h" /> <ClInclude Include="lol\core\array.h" />
<ClInclude Include="lol\core\hash.h" /> <ClInclude Include="lol\core\hash.h" />
<ClInclude Include="lol\core\map.h" />
<ClInclude Include="lol\core\string.h" /> <ClInclude Include="lol\core\string.h" />
<ClInclude Include="lol\core\types.h" /> <ClInclude Include="lol\core\types.h" />
<ClInclude Include="lol\debug.h" /> <ClInclude Include="lol\debug.h" />


+ 3
- 0
src/lolcore.vcxproj.filters 查看文件

@@ -741,6 +741,9 @@
<ClInclude Include="hash.h"> <ClInclude Include="hash.h">
<Filter>src\core</Filter> <Filter>src\core</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="map.h">
<Filter>src\core</Filter>
</ClInclude>
<ClInclude Include="audio.h"> <ClInclude Include="audio.h">
<Filter>src\...</Filter> <Filter>src\...</Filter>
</ClInclude> </ClInclude>


+ 11
- 11
src/map.cpp 查看文件

@@ -25,12 +25,12 @@ namespace lol
{ {


/* /*
* Map implementation class
* LevelMap implementation class
*/ */


class MapData
class LevelMapData
{ {
friend class Map;
friend class LevelMap;


static int const MAX_TILESETS = 128; static int const MAX_TILESETS = 128;


@@ -44,18 +44,18 @@ private:
}; };


/* /*
* Public Map class
* Public LevelMap class
*/ */


Map::Map(char const *path)
: data(new MapData())
LevelMap::LevelMap(char const *path)
: data(new LevelMapData())
{ {
data->ntilers = 0; data->ntilers = 0;
data->width = 0; data->width = 0;
data->height = 0; data->height = 0;


char tmp[BUFSIZ]; char tmp[BUFSIZ];
int gids[MapData::MAX_TILESETS];
int gids[LevelMapData::MAX_TILESETS];
uint32_t *tiles = NULL; uint32_t *tiles = NULL;
int level = 0, orientation = 0, ntiles = 0; int level = 0, orientation = 0, ntiles = 0;


@@ -151,7 +151,7 @@ Map::Map(char const *path)
fclose(fp); fclose(fp);
} }


Map::~Map()
LevelMap::~LevelMap()
{ {
for (int i = 0; i < data->ntilers; i++) for (int i = 0; i < data->ntilers; i++)
Tiler::Deregister(data->tilesets[i]); Tiler::Deregister(data->tilesets[i]);
@@ -160,18 +160,18 @@ Map::~Map()
delete data; delete data;
} }


void Map::Render(int x, int y, int z)
void LevelMap::Render(int x, int y, int z)
{ {
for (int i = 0; i < data->m_layers.Count(); i++) for (int i = 0; i < data->m_layers.Count(); i++)
data->m_layers[i]->Render(x, y, z); data->m_layers[i]->Render(x, y, z);
} }


int Map::GetWidth()
int LevelMap::GetWidth()
{ {
return data->width * 32; return data->width * 32;
} }


int Map::GetHeight()
int LevelMap::GetHeight()
{ {
return data->height * 32; return data->height * 32;
} }


+ 10
- 10
src/map.h 查看文件

@@ -9,32 +9,32 @@
// //


// //
// The Map class
// -------------
// A Map object is a collection of Layers and other information (to be
// The LevelMap class
// ------------------
// A LevelMap object is a collection of Layers and other information (to be
// determined later). // determined later).
// //


#if !defined __LOL_MAP_H__
#define __LOL_MAP_H__
#if !defined __LOL_LEVELMAP_H__
#define __LOL_LEVELMAP_H__


namespace lol namespace lol
{ {


class MapData;
class LevelMapData;


class Map
class LevelMap
{ {
public: public:
Map(char const *path);
~Map();
LevelMap(char const *path);
~LevelMap();


void Render(int x, int y, int z); void Render(int x, int y, int z);
int GetWidth(); int GetWidth();
int GetHeight(); int GetHeight();


private: private:
MapData *data;
LevelMapData *data;
}; };


} /* namespace lol */ } /* namespace lol */


正在加载...
取消
保存