win.align added

This commit is contained in:
p.kosyh 2011-07-26 08:06:15 +00:00
parent 6d802759d2
commit 97ff78b954
6 changed files with 29 additions and 7 deletions

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ instead (1.4.5) unstable; urgency=low
* bug fix in rnd() w/o parameter;
* callpush/callpop/cctx/strip moved to stead;
* bug fix in for_each;
* win.align added to theme;
* theme_name added;
-- Peter Kosyh <p.kosyh@gmail.com> Thu, 14 Jul 2011 16:18:00 +0400

View File

@ -551,7 +551,7 @@ int game_apply_theme(void)
if (!DIRECT_MODE)
game_clear(0, 0, game_theme.w, game_theme.h);
gfx_flip();
lay = txt_layout(game_theme.font, ALIGN_JUSTIFY, game_theme.win_w, game_theme.win_h);
lay = txt_layout(game_theme.font, game_theme.win_align, game_theme.win_w, game_theme.win_h);
if (!lay)
return -1;
box = txt_box(game_theme.win_w, game_theme.win_h);

View File

@ -580,8 +580,9 @@ static int luaB_theme_var(lua_State *L) {
static int luaB_theme_name(lua_State *L) {
if (game_own_theme && opt_owntheme)
return 0;
lua_pushstring(L, curtheme_dir);
lua_pushstring(L, ".");
else
lua_pushstring(L, curtheme_dir);
return 1;
}

View File

@ -1,4 +1,3 @@
#include "externals.h"
#include "internals.h"
@ -6,6 +5,22 @@ int theme_relative = 0;
char *curtheme_dir = NULL;
static int parse_win_align(const char *v, void *data)
{
int *i = (int *)data;
if (!strcmp(v, "left"))
*i = ALIGN_LEFT;
else if (!strcmp(v, "justify"))
*i = ALIGN_JUSTIFY;
else if (!strcmp(v, "center"))
*i = ALIGN_CENTER;
else if (!strcmp(v, "right"))
*i = ALIGN_RIGHT;
else
return -1;
return 0;
}
static int parse_gfx_mode(const char *v, void *data)
{
int *i = (int *)data;
@ -149,6 +164,7 @@ struct parser cmd_parser[] = {
{ "scr.gfx.h", parse_int, &game_theme.max_scene_h },
{ "scr.gfx.mode", parse_gfx_mode, &game_theme.gfx_mode },
{ "win.align", parse_win_align, &game_theme.win_align },
{ "win.x", parse_int, &game_theme.win_x },
{ "win.y", parse_int, &game_theme.win_y },
{ "win.w", parse_int, &game_theme.win_w },
@ -296,6 +312,7 @@ struct game_theme game_theme = {
.menu_font = NULL,
.menu_button_name = NULL,
.menu_button = NULL,
.win_align = ALIGN_JUSTIFY,
.gfx_mode = GFX_MODE_EMBEDDED,
.inv_mode = INV_MODE_VERT | INV_ALIGN_SET(ALIGN_LEFT),
.click_name = NULL,

View File

@ -26,8 +26,9 @@ struct game_theme {
img_t use;
img_t cursor;
int pad;
int win_x;
int win_align;
int win_x;
int win_y;
int win_w;
int win_h;

View File

@ -19,6 +19,7 @@ scr.gfx.cursor.use = cursor-use.png
scr.gfx.pad = 16
scr.gfx.mode = embedded
win.align = justify
win.x = 48
win.y = 8
win.w = 500
@ -50,7 +51,7 @@ inv.gfx.down = adown.png
inv.col.fg = #CCCCCC
inv.col.link = #CCCCCC
inv.col.alink = goldenrod
inv.mode = vertical
inv.mode = vertical-left
inv.up.x = -1
inv.up.y = -1
inv.down.x = -1