]> git.lizzy.rs Git - minetest.git/blob - src/script/lua_api/l_mainmenu.h
Rename macros with two leading underscores
[minetest.git] / src / script / lua_api / l_mainmenu.h
1 /*
2 Minetest
3 Copyright (C) 2013 sapier
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef L_MAINMENU_H_
21 #define L_MAINMENU_H_
22
23 #include "lua_api/l_base.h"
24
25 class AsyncEngine;
26
27 /** Implementation of lua api support for mainmenu */
28 class ModApiMainMenu : public ModApiBase {
29
30 private:
31         /**
32          * read a text variable from gamedata table within lua stack
33          * @param L stack to read variable from
34          * @param name name of variable to read
35          * @return string value of requested variable
36          */
37         static std::string getTextData(lua_State *L, std::string name);
38
39         /**
40          * read a integer variable from gamedata table within lua stack
41          * @param L stack to read variable from
42          * @param name name of variable to read
43          * @return integer value of requested variable
44          */
45         static int getIntegerData(lua_State *L, std::string name,bool& valid);
46
47         /**
48          * read a bool variable from gamedata table within lua stack
49          * @param L stack to read variable from
50          * @param name name of variable to read
51          * @return bool value of requested variable
52          */
53         static int getBoolData(lua_State *L, std::string name,bool& valid);
54
55         /**
56          * check if a path is within some of minetests folders
57          * @param path path to check
58          * @return true/false
59          */
60         static bool isMinetestPath(std::string path);
61
62         //api calls
63
64         static int l_start(lua_State *L);
65
66         static int l_close(lua_State *L);
67
68         static int l_create_world(lua_State *L);
69
70         static int l_delete_world(lua_State *L);
71
72         static int l_get_worlds(lua_State *L);
73
74         static int l_get_games(lua_State *L);
75
76         static int l_get_mapgen_names(lua_State *L);
77
78         static int l_get_favorites(lua_State *L);
79
80         static int l_delete_favorite(lua_State *L);
81
82         static int l_get_version(lua_State *L);
83
84         static int l_sound_play(lua_State *L);
85
86         static int l_sound_stop(lua_State *L);
87
88         static int l_gettext(lua_State *L);
89
90         //gui
91
92         static int l_show_keys_menu(lua_State *L);
93
94         static int l_show_file_open_dialog(lua_State *L);
95
96         static int l_set_topleft_text(lua_State *L);
97
98         static int l_set_clouds(lua_State *L);
99
100         static int l_get_textlist_index(lua_State *L);
101
102         static int l_get_table_index(lua_State *L);
103
104         static int l_set_background(lua_State *L);
105
106         static int l_update_formspec(lua_State *L);
107
108         static int l_get_screen_info(lua_State *L);
109
110         //filesystem
111
112         static int l_get_mainmenu_path(lua_State *L);
113
114         static int l_get_modpath(lua_State *L);
115
116         static int l_get_gamepath(lua_State *L);
117
118         static int l_get_texturepath(lua_State *L);
119
120         static int l_get_texturepath_share(lua_State *L);
121
122         static int l_create_dir(lua_State *L);
123
124         static int l_delete_dir(lua_State *L);
125
126         static int l_copy_dir(lua_State *L);
127
128         static int l_extract_zip(lua_State *L);
129
130         static int l_get_modstore_details(lua_State *L);
131
132         static int l_get_modstore_list(lua_State *L);
133
134         static int l_download_file(lua_State *L);
135
136         static int l_get_video_drivers(lua_State *L);
137
138         static int l_get_video_modes(lua_State *L);
139
140         //version compatibility
141         static int l_get_min_supp_proto(lua_State *L);
142
143         static int l_get_max_supp_proto(lua_State *L);
144
145
146         // async
147         static int l_do_async_callback(lua_State *L);
148
149 public:
150         /**
151          * initialize this API module
152          * @param L lua stack to initialize
153          * @param top index (in lua stack) of global API table
154          */
155         static void Initialize(lua_State *L, int top);
156
157         static void InitializeAsync(AsyncEngine& engine);
158
159 };
160
161 #endif /* L_MAINMENU_H_ */