Migrate the rest to function_ptr_command
[lsnes.git] / lua.hpp
blob02360372f6391c216ec767af3b4ff3ed0e04df2a
1 #ifndef _lua__hpp__included__
2 #define _lua__hpp__included__
4 #include "render.hpp"
5 #include "controllerdata.hpp"
7 struct lua_State;
9 /**
10 * Function implemented in C++ exported to Lua.
12 class lua_function
14 public:
15 /**
16 * Register function.
18 lua_function(const std::string& name) throw(std::bad_alloc);
19 /**
20 * Unregister function.
22 virtual ~lua_function() throw();
24 /**
25 * Invoke function.
27 virtual int invoke(lua_State* L) = 0;
28 protected:
29 std::string fname;
32 struct lua_render_context
34 uint32_t left_gap;
35 uint32_t right_gap;
36 uint32_t top_gap;
37 uint32_t bottom_gap;
38 struct render_queue* queue;
39 uint32_t width;
40 uint32_t height;
41 uint32_t rshift;
42 uint32_t gshift;
43 uint32_t bshift;
46 void init_lua() throw();
47 void lua_callback_do_paint(struct lua_render_context* ctx) throw();
48 void lua_callback_do_video(struct lua_render_context* ctx) throw();
49 void lua_callback_do_input(controls_t& data, bool subframe) throw();
50 void lua_callback_do_reset() throw();
51 void lua_callback_do_readwrite() throw();
52 void lua_callback_startup() throw();
53 void lua_callback_pre_load(const std::string& name) throw();
54 void lua_callback_err_load(const std::string& name) throw();
55 void lua_callback_post_load(const std::string& name, bool was_state) throw();
56 void lua_callback_pre_save(const std::string& name, bool is_state) throw();
57 void lua_callback_err_save(const std::string& name) throw();
58 void lua_callback_post_save(const std::string& name, bool is_state) throw();
59 void lua_callback_snoop_input(uint32_t port, uint32_t controller, uint32_t index, short value) throw();
60 void lua_callback_quit() throw();
62 extern bool lua_requests_repaint;
63 extern bool lua_requests_subframe_paint;
65 #endif