LuaYard/LuaCommon.h

24 lines
943 B
C
Raw Normal View History

2019-08-18 02:00:57 +08:00
#pragma once
#include "LuaVM.h"
#include "SDL2/include/SDL.h"
2019-08-18 02:00:57 +08:00
#include <vector>
bool LuaCompareType(lua_State* L, int index, const char* type, bool leave = false);
// <20><>Lua Rect/Pointת<74><D7AA><EFBFBD><EFBFBD>SDL_Rect. <20><><EFBFBD><EFBFBD>index<65><78><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD>table (<28>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Ƿ<EFBFBD>Ϊtable)
// <20><>ȷת<C8B7><D7AA><EFBFBD>򷵻<EFBFBD> 0
// <20><><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> 1, ͬʱ<CDAC><CAB1> type <20><><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB>. (<28>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD>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);
// <20><>Lua RGBAת<41><D7AA><EFBFBD><EFBFBD>SDL_Color. <20><><EFBFBD><EFBFBD>index<65><78><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD>table. (<28>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>Ƿ<EFBFBD>Ϊtable)
// <20><>ȷת<C8B7><D7AA><EFBFBD>򷵻<EFBFBD> 0
// <20><><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> 1, ͬʱ<CDAC><CAB1> type <20><><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB>. (<28>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD>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);