Made use of std::function
Former-commit-id: 17e7ebe528071c6399383089ac1c0d089faccc34
This commit is contained in:
parent
20df395928
commit
ff2bf98623
|
|
@ -14,6 +14,7 @@
|
|||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Lua/Enums.hpp>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
struct lua_Debug;
|
||||
struct lua_State;
|
||||
|
|
@ -21,7 +22,7 @@ struct lua_State;
|
|||
class NzLuaInstance;
|
||||
|
||||
using NzLuaCFunction = int (*)(lua_State* state);
|
||||
using NzLuaFunction = int (*)(NzLuaInstance& instance);
|
||||
using NzLuaFunction = std::function<int(NzLuaInstance& instance)>;
|
||||
|
||||
class NAZARA_API NzLuaInstance : NzNonCopyable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
class NzPixelFormat
|
||||
|
|
@ -17,8 +18,8 @@ class NzPixelFormat
|
|||
friend class NzUtility;
|
||||
|
||||
public:
|
||||
using ConvertFunction = nzUInt8* (*)(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst);
|
||||
using FlipFunction = void (*)(unsigned int width, unsigned int height, unsigned int depth, const nzUInt8* src, nzUInt8* dst);
|
||||
using ConvertFunction = std::function<nzUInt8*(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst)>;
|
||||
using FlipFunction = std::function<void(unsigned int width, unsigned int height, unsigned int depth, const nzUInt8* src, nzUInt8* dst)>;
|
||||
|
||||
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* src, void* dst);
|
||||
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* start, const void* end, void* dst);
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ void NzLuaInstance::PushCFunction(NzLuaCFunction func, int upvalueCount)
|
|||
void NzLuaInstance::PushFunction(NzLuaFunction func)
|
||||
{
|
||||
NzLuaFunction* luaFunc = reinterpret_cast<NzLuaFunction*>(lua_newuserdata(m_state, sizeof(NzLuaFunction)));
|
||||
*luaFunc = func;
|
||||
*luaFunc = std::move(func);
|
||||
|
||||
lua_pushcclosure(m_state, ProxyFunc, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue