Fix callbacks for scripting
This commit is contained in:
parent
2eb8988d73
commit
8e3f2f83c4
@ -26,16 +26,15 @@ namespace game
|
||||
chai->add(chaiscript::fun(&entity::on_notify), "onNotify");
|
||||
chai->add(chaiscript::fun([](const entity& ent, const std::string& event,
|
||||
const std::function<void(
|
||||
const std::vector<chaiscript::Boxed_Value>&)>&
|
||||
std::vector<chaiscript::Boxed_Value>)>&
|
||||
callback)
|
||||
{
|
||||
return ent.on_notify(event, callback, false);
|
||||
}), "onNotify");
|
||||
|
||||
chai->add(chaiscript::fun([context](const std::string& event,
|
||||
const std::function<void(const entity&,
|
||||
const std::vector<chaiscript::
|
||||
Boxed_Value>&)>&
|
||||
const std::function<void(
|
||||
entity, std::vector<chaiscript::Boxed_Value>)>&
|
||||
callback)
|
||||
{
|
||||
generic_event_listener listener;
|
||||
@ -47,9 +46,8 @@ namespace game
|
||||
}), "onNotify");
|
||||
|
||||
chai->add(chaiscript::fun([context](const std::string& event,
|
||||
const std::function<void(const entity&,
|
||||
const std::vector<chaiscript::
|
||||
Boxed_Value>&)>&
|
||||
const std::function<void(
|
||||
entity, std::vector<chaiscript::Boxed_Value>)>&
|
||||
callback, const bool is_volatile)
|
||||
{
|
||||
generic_event_listener listener;
|
||||
|
@ -66,7 +66,7 @@ namespace game
|
||||
}
|
||||
|
||||
event_listener_handle entity::on_notify(const std::string& event,
|
||||
const std::function<void(const std::vector<chaiscript::Boxed_Value>&)>&
|
||||
const std::function<void(std::vector<chaiscript::Boxed_Value>)>&
|
||||
callback,
|
||||
const bool is_volatile)
|
||||
const
|
||||
|
@ -21,7 +21,7 @@ namespace game
|
||||
entity& operator=(entity&& other) noexcept;
|
||||
|
||||
event_listener_handle on_notify(const std::string& event,
|
||||
const std::function<void(const std::vector<chaiscript::Boxed_Value>&)>& callback,
|
||||
const std::function<void(std::vector<chaiscript::Boxed_Value>)>& callback,
|
||||
bool is_volatile) const;
|
||||
|
||||
unsigned int get_entity_id() const;
|
||||
|
@ -11,9 +11,11 @@ namespace game
|
||||
|
||||
chai->add(chaiscript::user_type<event_listener_handle>(), "_event_listener_handle");
|
||||
chai->add(chaiscript::constructor<event_listener_handle()>(), "_event_listener_handle");
|
||||
chai->add(chaiscript::constructor<event_listener_handle(const event_listener_handle&)>(), "_event_listener_handle");
|
||||
chai->add(chaiscript::constructor<event_listener_handle(const event_listener_handle&)>(),
|
||||
"_event_listener_handle");
|
||||
|
||||
chai->add(chaiscript::fun([](event_listener_handle& lhs, const event_listener_handle& rhs) -> event_listener_handle&
|
||||
chai->add(chaiscript::fun(
|
||||
[](event_listener_handle& lhs, const event_listener_handle& rhs) -> event_listener_handle&
|
||||
{
|
||||
return lhs = rhs;
|
||||
}), "=");
|
||||
|
@ -20,7 +20,7 @@ namespace game
|
||||
public:
|
||||
std::string event = {};
|
||||
unsigned int entity_id = 0;
|
||||
std::function<void(const std::vector<chaiscript::Boxed_Value>&)> callback = {};
|
||||
std::function<void(std::vector<chaiscript::Boxed_Value>)> callback = {};
|
||||
bool is_volatile = false;
|
||||
};
|
||||
|
||||
@ -28,7 +28,7 @@ namespace game
|
||||
{
|
||||
public:
|
||||
std::string event = {};
|
||||
std::function<void(const entity&, const std::vector<chaiscript::Boxed_Value>&)> callback = {};
|
||||
std::function<void(entity, std::vector<chaiscript::Boxed_Value>)> callback = {};
|
||||
bool is_volatile = false;
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
html_frame();
|
||||
virtual ~html_frame();
|
||||
|
||||
void initialize(const HWND window);
|
||||
void initialize(HWND window);
|
||||
|
||||
void resize(DWORD width, DWORD height) const;
|
||||
bool load_url(const std::string& url) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user