Changeset 218
- Timestamp:
- Jan 17, 2011, 2:22:07 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
.auto
aclocal.m4
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
libtool
Makefile
Makefile.in
stamp-h1
-
Property
svn:ignore
set to
-
trunk/art
-
Property
svn:ignore
set to
Makefile.in
Makefile
-
Property
svn:ignore
set to
-
trunk/art/test
-
Property
svn:ignore
set to
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/gfx
-
Property
svn:ignore
set to
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/gfx/font
-
Property
svn:ignore
set to
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/maps
-
Property
svn:ignore
set to
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/src
-
Property
svn:ignore
set to
.deps
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/src/Makefile.am
r208 r218 12 12 debugfps.cpp debugfps.h debugsprite.cpp debugsprite.h \ 13 13 debugrecord.cpp debugrecord.h debugstats.cpp debugstats.h \ 14 debugsphere.cpp debugsphere.h 14 debugsphere.cpp debugsphere.h debugboard.cpp debugboard.h 15 15 libcommon_a_CXXFLAGS = `pkg-config --cflags sdl gl SDL_image` 16 16 -
trunk/src/debugsprite.cpp
r210 r218 37 37 data->game = game; 38 38 Ticker::Ref(game); 39 data->tiler = Tiler::Register("art/test/character-dress.png" );39 data->tiler = Tiler::Register("art/test/character-dress.png", 32); 40 40 data->x = 320; 41 41 data->y = 206; -
trunk/src/map.cpp
r186 r218 122 122 { 123 123 /* This is a tileset image file. Associate it with firstgid. */ 124 data->tilers[data->ntilers] = Tiler::Register(str );124 data->tilers[data->ntilers] = Tiler::Register(str, 32); 125 125 data->ntilers++; 126 126 //fprintf(stderr, "new tiler %s\n", str); -
trunk/src/test-map.cpp
r208 r218 10 10 #include <cstdio> 11 11 #include <cmath> 12 #if defined _WIN32 13 # include <direct.h> 14 #endif 12 15 13 16 #include <SDL.h> … … 16 19 #include "sdlinput.h" 17 20 #include "debugfps.h" 21 #include "debugboard.h" 18 22 #include "debugsprite.h" 19 23 #include "debugsphere.h" … … 50 54 51 55 /* Create a game */ 56 #if defined _WIN32 57 _chdir(".."); /* Temporary Win32 hack */ 58 #endif 52 59 Game *game = new Game("maps/testmap.tmx"); 60 game->SetMouse(160, 96); 53 61 54 62 /* Register an input driver and some debug stuff */ … … 56 64 new DebugFps(); 57 65 new DebugSprite(game); 66 new DebugBoard(game); 58 67 new DebugSphere(); 59 68 //new DebugRecord("lolengine.ogg"); -
trunk/src/tiler.cpp
r172 r218 29 29 */ 30 30 31 int Tiler::Register(char const *path )31 int Tiler::Register(char const *path, int size) 32 32 { 33 33 int id = data->tilesets.MakeSlot(path); … … 35 35 if (!data->tilesets.GetEntity(id)) 36 36 { 37 TileSet *tileset = new TileSet(path );37 TileSet *tileset = new TileSet(path, size); 38 38 data->tilesets.SetEntity(id, tileset); 39 39 } -
trunk/src/tiler.h
r138 r218 18 18 { 19 19 public: 20 static int Register(char const *path );20 static int Register(char const *path, int size); 21 21 static void Deregister(int id); 22 22 -
trunk/src/tileset.cpp
r210 r218 38 38 char *name; 39 39 int *tiles; 40 int nw, nh, ntiles;40 int size, nw, nh, ntiles; 41 41 float tx, ty; 42 42 … … 49 49 */ 50 50 51 TileSet::TileSet(char const *path )51 TileSet::TileSet(char const *path, int size) 52 52 { 53 53 data = new TileSetData(); … … 67 67 } 68 68 69 data->nw = data->img->w / 32; 70 data->nh = data->img->h / 32; 69 if (size <= 0) 70 size = 32; 71 72 data->size = size; 73 data->nw = data->img->w / size; 74 data->nh = data->img->h / size; 71 75 data->ntiles = data->nw * data->nh; 72 data->tx = 32.0f/ data->img->w;73 data->ty = 32.0f/ data->img->h;76 data->tx = (float)size / data->img->w; 77 data->ty = (float)size / data->img->h; 74 78 75 79 drawgroup = DRAWGROUP_BEFORE; … … 121 125 122 126 float sqrt2 = sqrtf(2.0f); 123 int off = o ? 32 : 0; 127 int off = o ? data->size : 0; 128 int dx = data->size; 129 int dy = data->size * 38 / 32; /* Magic... fix this one day */ 130 int dy2 = data->size * 70 / 32; 124 131 125 132 if (!data->img) … … 128 135 glBegin(GL_QUADS); 129 136 glTexCoord2f(tx, ty); 130 glVertex3f(x, sqrt2 * (y - 38- off), sqrt2 * (z + off));137 glVertex3f(x, sqrt2 * (y - dy - off), sqrt2 * (z + off)); 131 138 glTexCoord2f(tx + data->tx, ty); 132 glVertex3f(x + 32, sqrt2 * (y - 38- off), sqrt2 * (z + off));139 glVertex3f(x + dx, sqrt2 * (y - dy - off), sqrt2 * (z + off)); 133 140 glTexCoord2f(tx + data->tx, ty + data->ty); 134 glVertex3f(x + 32, sqrt2 * (y - 70), sqrt2 * z);141 glVertex3f(x + dx, sqrt2 * (y - dy2), sqrt2 * z); 135 142 glTexCoord2f(tx, ty + data->ty); 136 glVertex3f(x, sqrt2 * (y - 70), sqrt2 * z);143 glVertex3f(x, sqrt2 * (y - dy2), sqrt2 * z); 137 144 glEnd(); 138 145 } -
trunk/src/tileset.h
r210 r218 24 24 { 25 25 public: 26 TileSet(char const *path );26 TileSet(char const *path, int size); 27 27 virtual ~TileSet(); 28 28 -
trunk/tools
-
Property
svn:ignore
set to
.deps
make-font
Makefile
Makefile.in
-
Property
svn:ignore
set to
Note: See TracChangeset
for help on using the changeset viewer.