From e1b44b6c26260328c11b29ae97e3df4a9e57d418 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Tue, 12 Apr 2011 11:34:50 +0000
Subject: [PATCH] menu_toggle
---
src/sdl-instead/game.c | 3 +--
src/sdl-instead/game.h | 1 +
src/sdl-instead/instead.c | 6 ++++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index fb7e181..407b913 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -22,7 +22,6 @@ static char *last_cmd = NULL;
void game_cursor(int on);
void mouse_reset(int hl);
-static void menu_toggle(void);
void game_err_msg(const char *s)
{
@@ -2011,7 +2010,7 @@ void mouse_reset(int hl)
}
-static void menu_toggle(void)
+void menu_toggle(void)
{
mouse_reset(1);
menu_shown ^= 1;
diff --git a/src/sdl-instead/game.h b/src/sdl-instead/game.h
index a27cdce..9831a2b 100644
--- a/src/sdl-instead/game.h
+++ b/src/sdl-instead/game.h
@@ -80,6 +80,7 @@ extern int game_from_disk(void);
extern int game_pict_modify(img_t p);
extern int game_pict_coord(int *x, int *y, int *w, int *h);
+extern void menu_toggle(void);
#define CURSOR_CLEAR -1
#define CURSOR_OFF 0
diff --git a/src/sdl-instead/instead.c b/src/sdl-instead/instead.c
index 00ac545..fcd62f1 100644
--- a/src/sdl-instead/instead.c
+++ b/src/sdl-instead/instead.c
@@ -1146,6 +1146,11 @@ static int luaB_free_sprite(lua_State *L) {
return 1;
}
+static int luaB_show_menu(lua_State *L) {
+ menu_toggle();
+ return 0;
+}
+
static int luaB_free_font(lua_State *L) {
const char *key = luaL_optstring(L, 1, NULL);
_fnt_t *fn;
@@ -1173,6 +1178,7 @@ static const luaL_Reg base_funcs[] = {
{"set_timer", luaB_set_timer},
{"theme_var", luaB_theme_var},
{"readdir", dir_iter_factory},
+ {"menu_toggle", luaB_show_menu},
{"font_load", luaB_load_font},
{"font_free", luaB_free_font},