Skip to content
Snippets Groups Projects
Commit b0a528ed authored by dg's avatar dg
Browse files

Switched the font used by 16x16 map modes

git-svn-id: http://svn.net-core.org/repos/t-engine4@2250 51575b47-30f0-44d4-a5cc-537603b46e54
parent 11693ebb
No related branches found
No related tags found
No related merge requests found
......@@ -300,7 +300,7 @@ function _M:setupDisplayMode(reboot)
Map.tiles.use_images = true
elseif self.gfxmode == 2 then
print("[DISPLAY MODE] 16x16 GFX")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, nil, 14, true, true)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, "/data/font/FSEX300.ttf", 16, true, true)
Map:resetTiles()
Map.tiles.use_images = true
elseif self.gfxmode == 3 then
......@@ -310,7 +310,8 @@ function _M:setupDisplayMode(reboot)
Map.tiles.use_images = false
elseif self.gfxmode == 4 then
print("[DISPLAY MODE] 16x16 ASCII")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, nil, 14, false, false)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, "/data/font/FSEX300.ttf", 16, false, false)
-- Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 14, 20, "/data/font/FSEX300.ttf", 16, false, false)
Map:resetTiles()
Map.tiles.use_images = false
elseif self.gfxmode == 5 then
......@@ -320,7 +321,7 @@ function _M:setupDisplayMode(reboot)
Map.tiles.use_images = false
elseif self.gfxmode == 6 then
print("[DISPLAY MODE] 16x16 ASCII/background")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, nil, 14, true, true)
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 16, 16, "/data/font/FSEX300.ttf", 16, true, true)
Map:resetTiles()
Map.tiles.use_images = false
else
......
......@@ -34,9 +34,9 @@
#define DO_QUAD(dx, dy, dz, zoom) {\
glBegin(GL_QUADS); \
glTexCoord2f(0,0); glVertex3f((dx), (dy), (dz)); \
glTexCoord2f(1,0); glVertex3f(map->tile_w * (zoom) + (dx), (dy), (dz)); \
glTexCoord2f(1,1); glVertex3f(map->tile_w * (zoom) + (dx), map->tile_h * (zoom) + (dy), (dz)); \
glTexCoord2f(0,1); glVertex3f((dx), map->tile_h * (zoom) + (dy), (dz)); \
glTexCoord2f(map->tex_tile_w,0); glVertex3f(map->tile_w * (zoom) + (dx), (dy), (dz)); \
glTexCoord2f(map->tex_tile_w,map->tex_tile_h); glVertex3f(map->tile_w * (zoom) + (dx), map->tile_h * (zoom) + (dy), (dz)); \
glTexCoord2f(0,map->tex_tile_h); glVertex3f((dx), map->tile_h * (zoom) + (dy), (dz)); \
glEnd(); }
static int map_object_new(lua_State *L)
......@@ -425,6 +425,15 @@ static int map_new(lua_State *L)
map->zdepth = zdepth;
map->tile_w = tile_w;
map->tile_h = tile_h;
// In case we can't support NPOT textures round up to nearest POT
int realw=1;
int realh=1;
while (realw < tile_w) realw *= 2;
while (realh < tile_h) realh *= 2;
map->tex_tile_w = (GLfloat)tile_w / realw;
map->tex_tile_h = (GLfloat)tile_h / realh;
map->mx = mx;
map->my = my;
map->mwidth = mwidth;
......
......@@ -61,6 +61,7 @@ typedef struct {
int h;
int zdepth;
int tile_w, tile_h;
GLfloat tex_tile_w, tex_tile_h;
// Scrolling
int mx, my, mwidth, mheight;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment