#pragma once #include "LuaVM.h" #include "SDL2/include/SDL.h" #include bool LuaCompareType(lua_State* L, int index, const char* type, bool leave = false); // 从Lua Rect/Point转换到SDL_Rect. 给定index类型必须是table (此方法不会校验是否为table) // 正确转换则返回 0 // 出错则返回 1, 同时将 type 放在栈上. (有可能是nil) int LuaRectPointToRect(lua_State* L, int index, SDL_Rect& r, int default_w = 0, int default_h = 0); int LuaRectToRect(lua_State* L, int index, SDL_Rect& rect); int LuaPointToPoint(lua_State* L, int index, SDL_Point& point); // 从Lua RGBA转换到SDL_Color. 给定index类型必须是table. (此方法不会校验是否为table) // 正确转换则返回 0 // 出错则返回 1, 同时将 type 放在栈上. (有可能是nil) int LuaColorToColor(lua_State* L, int index, SDL_Color& c); // Generate SDL error on lua stack. // NOTE: Never actually returns. If this function is used in C++ context, you should compile Lua as C++. int LuaSDLError(lua_State* L);