summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 22e86f91b7..d501694b46 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -619,6 +619,15 @@ RB_WRAP(kbd_input)
619 return 1; 619 return 1;
620} 620}
621 621
622#ifdef HAVE_TOUCHSCREEN
623RB_WRAP(touchscreen_set_mode)
624{
625 enum touchscreen_mode mode = luaL_checkint(L, 1);
626 rb->touchscreen_set_mode(mode);
627 return 0;
628}
629#endif
630
622RB_WRAP(backlight_on) 631RB_WRAP(backlight_on)
623{ 632{
624 (void)L; 633 (void)L;
@@ -827,6 +836,18 @@ RB_WRAP(read_bmp_file)
827 return 0; 836 return 0;
828} 837}
829 838
839RB_WRAP(current_path)
840{
841 char buffer[MAX_PATH];
842 if(get_cur_path(L, buffer, sizeof(buffer)))
843 {
844 lua_pushstring(L, buffer);
845 return 1;
846 }
847 else
848 return 0;
849}
850
830#define R(NAME) {#NAME, rock_##NAME} 851#define R(NAME) {#NAME, rock_##NAME}
831static const luaL_Reg rocklib[] = 852static const luaL_Reg rocklib[] =
832{ 853{
@@ -901,6 +922,7 @@ static const luaL_Reg rocklib[] =
901 R(action_userabort), 922 R(action_userabort),
902#ifdef HAVE_TOUCHSCREEN 923#ifdef HAVE_TOUCHSCREEN
903 R(action_get_touchscreen_press), 924 R(action_get_touchscreen_press),
925 R(touchscreen_set_mode),
904#endif 926#endif
905 R(kbd_input), 927 R(kbd_input),
906 928
@@ -916,6 +938,7 @@ static const luaL_Reg rocklib[] =
916 R(read_bmp_file), 938 R(read_bmp_file),
917 R(set_viewport), 939 R(set_viewport),
918 R(clear_viewport), 940 R(clear_viewport),
941 R(current_path),
919 942
920 {"new_image", rli_new}, 943 {"new_image", rli_new},
921 944
@@ -945,10 +968,19 @@ LUALIB_API int luaopen_rock(lua_State *L)
945 RB_CONSTANT(SEEK_SET); 968 RB_CONSTANT(SEEK_SET);
946 RB_CONSTANT(SEEK_CUR); 969 RB_CONSTANT(SEEK_CUR);
947 RB_CONSTANT(SEEK_END); 970 RB_CONSTANT(SEEK_END);
948 971
949 RB_CONSTANT(FONT_SYSFIXED); 972 RB_CONSTANT(FONT_SYSFIXED);
950 RB_CONSTANT(FONT_UI); 973 RB_CONSTANT(FONT_UI);
951 974
975#ifdef HAVE_TOUCHSCREEN
976 RB_CONSTANT(TOUCHSCREEN_POINT);
977 RB_CONSTANT(TOUCHSCREEN_BUTTON);
978 RB_CONSTANT(BUTTON_TOUCHSCREEN);
979#endif
980
981 RB_CONSTANT(BUTTON_REL);
982 RB_CONSTANT(BUTTON_REPEAT);
983
952 rli_init(L); 984 rli_init(L);
953 985
954 return 1; 986 return 1;