diff --git a/game/engine/HotkeysDisplay.lua b/game/engine/HotkeysDisplay.lua index 20fe8d6d1e87a01675916b353dc7283bcc83ca59..6e950d588dd42e6c24a29ac104ddc2dbecabb7d5 100644 --- a/game/engine/HotkeysDisplay.lua +++ b/game/engine/HotkeysDisplay.lua @@ -95,12 +95,10 @@ function _M:display() txt = ("%2d) %-"..(self.max_char_w-4-24).."s Key: %s"):format(i, txt, ts[4]) local w, h = self.font:size(txt) - s = core.display.newSurface(w + 4, h + 4) - if self.cur_sel and self.cur_sel == i then s:erase(0, 50, 120) end - s:drawString(self.font, txt, 2, 2, color[1], color[2], color[3]) + if self.cur_sel and self.cur_sel == i then self.surface:erase(0, 50, 120, nil, x, y, w+4, h+4) end + self.surface:drawString(self.font, txt, x+2, y+2, color[1], color[2], color[3]) self.clics[i] = {x,y,w+4,h+4} - self.surface:merge(s, x, y) if y + self.font_h * 2 > self.h then x = x + self.w / 2 y = 0 diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 9e3c59c1f43da7e6f692a0c07af4d6d80315bb19..6458c653f0f7e78655c5b1e5b96653e0246cad1e 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -343,13 +343,6 @@ function _M:onTurn() end function _M:display() - -- We display the player's interface - self.flash:display():toScreen(self.flash.display_x, self.flash.display_y) - self.logdisplay:display():toScreen(self.logdisplay.display_x, self.logdisplay.display_y) - self.player_display:display():toScreen(self.player_display.display_x, self.player_display.display_y) - self.hotkeys_display:display():toScreen(self.hotkeys_display.display_x, self.hotkeys_display.display_y) - if self.player then self.player.changed = false end - -- Now the map, if any if self.level and self.level.map and self.level.map.finished then -- Display the map and compute FOV for the player if needed @@ -399,6 +392,13 @@ function _M:display() end end + -- We display the player's interface + self.flash:display():toScreen(self.flash.display_x, self.flash.display_y) + self.logdisplay:display():toScreen(self.logdisplay.display_x, self.logdisplay.display_y) + self.player_display:display():toScreen(self.player_display.display_x, self.player_display.display_y) + self.hotkeys_display:display():toScreen(self.hotkeys_display.display_x, self.hotkeys_display.display_y) + if self.player then self.player.changed = false end + engine.GameTurnBased.display(self) end diff --git a/game/modules/tome/data/maps/wilderness/arda-west.lua b/game/modules/tome/data/maps/wilderness/arda-west.lua index deffd92787cb72e5a580bbc25ef4cc7c2966b16c..a34fc006c1690468fed18bd11650ea1ada0fe1a0 100644 --- a/game/modules/tome/data/maps/wilderness/arda-west.lua +++ b/game/modules/tome/data/maps/wilderness/arda-west.lua @@ -21,7 +21,7 @@ quickEntity('a', {show_tooltip=true, name='Ephel Duath', display='^', color=colors.LIGHT_DARK, back_color=colors.UMBER, image="terrain/mountain.png", block_move=true}) quickEntity('d', {show_tooltip=true, name='Haradwaith', display='.', color={r=203,g=189,b=72}, back_color={r=163,g=149,b=42}, image="terrain/sand.png", block_move=true}) -quickEntity('b', {show_tooltip=true, name='blue mountains', display='^', color=colors.LIGHT_BLUE, back_color=colors.BLUE, image="terrain/mountain.png", block_move=true}) +quickEntity('b', {show_tooltip=true, name='blue mountains', display='^', color=colors.LIGHT_BLUE, back_color=colors.BLUE, tint=colors.LIGHT_BLUE, image="terrain/mountain.png", block_move=true}) quickEntity('m', {show_tooltip=true, name='misty mountains', display='^', color=colors.LIGHT_UMBER, back_color=colors.UMBER, image="terrain/mountain.png", block_move=true}) quickEntity('f', {show_tooltip=true, name='grey mountains', display='^', color=colors.SLATE, back_color=colors.UMBER, image="terrain/mountain.png", block_move=true}) quickEntity('u', {show_tooltip=true, name='deep forest', display='#', color=colors.GREEN, back_color=colors.DARK_GREEN, image="terrain/tree.png", block_move=true}) diff --git a/src/core_lua.c b/src/core_lua.c index b9dbf5e42407429a7213ccaf73214be0f7c0bfa5..3017b111f26c3eb18cf9239fa393736e948a800b 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -427,6 +427,7 @@ static int sdl_new_font(lua_State *L) auxiliar_setclass(L, "sdl{font}", -1); *f = TTF_OpenFontRW(PHYSFSRWOPS_openRead(name), TRUE, size); +// TTF_SetFontOutline(*f, 2); return 1; } @@ -480,7 +481,7 @@ static int sdl_surface_drawstring(lua_State *L) int b = luaL_checknumber(L, 8); SDL_Color color = {r,g,b}; - SDL_Surface *txt = TTF_RenderUTF8_Solid(*f, str, color); + SDL_Surface *txt = TTF_RenderUTF8_Blended(*f, str, color); if (txt) { sdlDrawImage(*s, txt, x, y); @@ -499,7 +500,7 @@ static int sdl_surface_drawstring_newsurface(lua_State *L) int b = luaL_checknumber(L, 5); SDL_Color color = {r,g,b}; - SDL_Surface *txt = TTF_RenderUTF8_Solid(*f, str, color); + SDL_Surface *txt = TTF_RenderUTF8_Blended(*f, str, color); if (txt) { SDL_Surface **s = (SDL_Surface**)lua_newuserdata(L, sizeof(SDL_Surface*)); @@ -648,7 +649,17 @@ static int sdl_surface_erase(lua_State *L) int g = lua_tonumber(L, 3); int b = lua_tonumber(L, 4); int a = lua_isnumber(L, 5) ? lua_tonumber(L, 5) : 255; - SDL_FillRect(*s, NULL, SDL_MapRGBA((*s)->format, r, g, b, a)); + if (lua_isnumber(L, 6)) + { + SDL_Rect rect; + rect.x = lua_tonumber(L, 6); + rect.y = lua_tonumber(L, 7); + rect.w = lua_tonumber(L, 8); + rect.h = lua_tonumber(L, 9); + SDL_FillRect(*s, &rect, SDL_MapRGBA((*s)->format, r, g, b, a)); + } + else + SDL_FillRect(*s, NULL, SDL_MapRGBA((*s)->format, r, g, b, a)); return 0; } @@ -752,6 +763,14 @@ static int sdl_surface_toscreen(lua_State *L) SDL_Surface **s = (SDL_Surface**)auxiliar_checkclass(L, "sdl{surface}", 1); int x = luaL_checknumber(L, 2); int y = luaL_checknumber(L, 3); + if (lua_isnumber(L, 4)) + { + float r = luaL_checknumber(L, 4); + float g = luaL_checknumber(L, 5); + float b = luaL_checknumber(L, 6); + float a = luaL_checknumber(L, 7); + glColor4f(r, g, b, a); + } GLuint t; glGenTextures(1, &t); @@ -763,6 +782,8 @@ static int sdl_surface_toscreen(lua_State *L) glDeleteTextures(1, &t); + if (lua_isnumber(L, 4)) glColor4f(1, 1, 1, 1); + return 0; } @@ -772,12 +793,22 @@ static int sdl_surface_toscreen_with_texture(lua_State *L) GLuint *t = (GLuint*)auxiliar_checkclass(L, "gl{texture}", 2); int x = luaL_checknumber(L, 3); int y = luaL_checknumber(L, 4); + if (lua_isnumber(L, 5)) + { + float r = luaL_checknumber(L, 5); + float g = luaL_checknumber(L, 6); + float b = luaL_checknumber(L, 7); + float a = luaL_checknumber(L, 8); + glColor4f(r, g, b, a); + } glBindTexture(GL_TEXTURE_2D, *t); copy_surface_to_texture(*s); draw_textured_quad(x,y,(*s)->w,(*s)->h); + if (lua_isnumber(L, 5)) glColor4f(1, 1, 1, 1); + return 0; } @@ -833,6 +864,14 @@ static int sdl_texture_toscreen(lua_State *L) int y = luaL_checknumber(L, 3); int w = luaL_checknumber(L, 4); int h = luaL_checknumber(L, 5); + if (lua_isnumber(L, 6)) + { + float r = luaL_checknumber(L, 6); + float g = luaL_checknumber(L, 7); + float b = luaL_checknumber(L, 8); + float a = luaL_checknumber(L, 9); + glColor4f(r, g, b, a); + } glBindTexture(GL_TEXTURE_2D, *t); glBegin( GL_QUADS ); /* Draw A Quad */ @@ -842,6 +881,7 @@ static int sdl_texture_toscreen(lua_State *L) glTexCoord2f(1,0); glVertex2f(w + x, 0 + y); glEnd( ); /* Done Drawing The Quad */ + if (lua_isnumber(L, 6)) glColor4f(1, 1, 1, 1); return 0; }