3#include <monort/mono_pod_wrapper.h>
4#include <hpp/small_vector.hpp>
6#include <monopp/mono_field_invoker.h>
7#include <monopp/mono_domain.h>
8#include <monopp/mono_assembly.h>
16template <
typename T,
size_t StaticCapacity>
17struct mono_converter<hpp::small_vector<T, StaticCapacity>>
24 const auto& domain = mono_domain::get_current_domain();
25 return mono_array<T>(domain, obj).get_internal_ptr();
34 return mono_array<T>(mono_object(obj)).template to_vector<native_type>();
39namespace managed_interface
48auto converter::convert(
const math::vec2& v) ->
vector2;
51auto converter::convert(
const vector2& v) -> math::vec2;
60auto converter::convert(
const math::vec3& v) ->
vector3;
63auto converter::convert(
const vector3& v) -> math::vec3;
73auto converter::convert(
const math::vec4& v) ->
vector4;
75auto converter::convert(
const vector4& v) -> math::vec4;
85auto converter::convert(
const math::quat& q) ->
quaternion;
87auto converter::convert(
const quaternion& q) -> math::quat;
108auto converter::convert(
const math::bbox& v) -> bbox;
110auto converter::convert(
const bbox& v) ->
math::bbox;
222struct mono_converter<managed_interface::ui_event_base>
227 static auto create_instance(
const std::string& namespace_name,
const std::string& type_name) -> mono::mono_object
231 auto type = app_assembly.get_type(namespace_name, type_name);
232 return type.new_instance();
236 mono::set_field_value(instance,
"nativePtr", obj.
native_ptr);
241 mono::set_field_value(instance,
"phase", obj.
phase);
242 mono::set_field_value(instance,
"eventType", obj.
event_type);
246 mono::get_field_value(
object,
"nativePtr", data.
native_ptr);
251 mono::get_field_value(
object,
"phase", data.
phase);
252 mono::get_field_value(
object,
"eventType", data.
event_type);
257 auto instance = create_instance(
"Unravel.Core",
"UIEventBase");
258 to_mono_base(obj, instance);
260 return instance.get_internal_ptr();
265 mono::mono_object
object(obj);
267 from_mono_base(
object, data);
275struct mono_converter<managed_interface::ui_pointer_event> : mono_converter<managed_interface::ui_event_base>
282 auto instance = create_instance(
"Unravel.Core",
"UIPointerEvent");
285 to_mono_base(obj, instance);
288 mono::set_field_value(instance,
"x", obj.x);
289 mono::set_field_value(instance,
"y", obj.y);
290 mono::set_field_value(instance,
"button", obj.button);
291 mono::set_field_value(instance,
"ctrlKey", obj.ctrl_key);
292 mono::set_field_value(instance,
"shiftKey", obj.shift_key);
293 mono::set_field_value(instance,
"altKey", obj.alt_key);
294 mono::set_field_value(instance,
"metaKey", obj.meta_key);
295 mono::set_field_value(instance,
"deltaX", obj.delta_x);
296 mono::set_field_value(instance,
"deltaY", obj.delta_y);
298 return instance.get_internal_ptr();
304 mono::mono_object
object(obj);
307 from_mono_base(
object, data);
309 mono::get_field_value(
object,
"x", data.
x);
310 mono::get_field_value(
object,
"y", data.
y);
311 mono::get_field_value(
object,
"button", data.
button);
312 mono::get_field_value(
object,
"ctrlKey", data.
ctrl_key);
313 mono::get_field_value(
object,
"shiftKey", data.
shift_key);
314 mono::get_field_value(
object,
"altKey", data.
alt_key);
315 mono::get_field_value(
object,
"metaKey", data.
meta_key);
316 mono::get_field_value(
object,
"deltaX", data.
delta_x);
317 mono::get_field_value(
object,
"deltaY", data.
delta_y);
324struct mono_converter<managed_interface::ui_key_event> : mono_converter<managed_interface::ui_event_base>
331 auto instance = create_instance(
"Unravel.Core",
"UIKeyEvent");
334 to_mono_base(obj, instance);
337 mono::set_field_value(instance,
"keyCode", obj.key_code);
338 mono::set_field_value(instance,
"ctrlKey", obj.ctrl_key);
339 mono::set_field_value(instance,
"shiftKey", obj.shift_key);
340 mono::set_field_value(instance,
"altKey", obj.alt_key);
341 mono::set_field_value(instance,
"metaKey", obj.meta_key);
343 return instance.get_internal_ptr();
349 mono::mono_object
object(obj);
352 from_mono_base(
object, data);
354 mono::get_field_value(
object,
"keyCode", data.
key_code);
355 mono::get_field_value(
object,
"ctrlKey", data.
ctrl_key);
356 mono::get_field_value(
object,
"shiftKey", data.
shift_key);
357 mono::get_field_value(
object,
"altKey", data.
alt_key);
358 mono::get_field_value(
object,
"metaKey", data.
meta_key);
365struct mono_converter<managed_interface::ui_textinput_event> : mono_converter<managed_interface::ui_event_base>
372 auto instance = create_instance(
"Unravel.Core",
"UITextInputEvent");
375 to_mono_base(obj, instance);
378 mono::set_field_value(instance,
"text", obj.text);
379 mono::set_field_value(instance,
"ctrlKey", obj.ctrl_key);
380 mono::set_field_value(instance,
"shiftKey", obj.shift_key);
381 mono::set_field_value(instance,
"altKey", obj.alt_key);
382 mono::set_field_value(instance,
"metaKey", obj.meta_key);
384 return instance.get_internal_ptr();
390 mono::mono_object
object(obj);
393 from_mono_base(
object, data);
395 mono::get_field_value(
object,
"text", data.
text);
396 mono::get_field_value(
object,
"ctrlKey", data.
ctrl_key);
397 mono::get_field_value(
object,
"shiftKey", data.
shift_key);
398 mono::get_field_value(
object,
"altKey", data.
alt_key);
399 mono::get_field_value(
object,
"metaKey", data.
meta_key);
406struct mono_converter<managed_interface::ui_slider_event> : mono_converter<managed_interface::ui_event_base>
413 auto instance = create_instance(
"Unravel.Core",
"UISliderEvent");
416 to_mono_base(obj, instance);
419 mono::set_field_value(instance,
"value", obj.value);
420 mono::set_field_value(instance,
"minValue", obj.min_value);
421 mono::set_field_value(instance,
"maxValue", obj.max_value);
422 mono::set_field_value(instance,
"step", obj.step);
424 return instance.get_internal_ptr();
430 mono::mono_object
object(obj);
433 from_mono_base(
object, data);
435 mono::get_field_value(
object,
"value", data.
value);
436 mono::get_field_value(
object,
"minValue", data.
min_value);
437 mono::get_field_value(
object,
"maxValue", data.
max_value);
438 mono::get_field_value(
object,
"step", data.
step);
445struct mono_converter<managed_interface::ui_change_event> : mono_converter<managed_interface::ui_event_base>
452 auto instance = create_instance(
"Unravel.Core",
"UIChangeEvent");
455 to_mono_base(obj, instance);
458 mono::set_field_value(instance,
"value", obj.value);
460 return instance.get_internal_ptr();
466 mono::mono_object
object(obj);
469 from_mono_base(
object, data);
471 mono::get_field_value(
object,
"value", data.
value);
const btCollisionObject * object
register_basic_mono_converter_for_pod(math::vec2, managed_interface::vector2)
Storage for box vector values and wraps up common functionality.
std::string current_element_id
std::intptr_t current_element_ptr
std::string target_element_id
std::intptr_t target_element_ptr
MonoObject * managed_type
hpp::small_vector< T, StaticCapacity > native_type
static auto to_mono(const native_type &obj) -> managed_type
static auto from_mono(const managed_type &obj) -> native_type
static auto to_mono(const native_type &obj) -> managed_type
MonoObject * managed_type
static auto from_mono(const managed_type &obj) -> native_type
MonoObject * managed_type
static auto to_mono(const native_type &obj) -> managed_type
static auto create_instance(const std::string &namespace_name, const std::string &type_name) -> mono::mono_object
static void to_mono_base(const native_type &obj, mono::mono_object &instance)
static auto from_mono(const managed_type &obj) -> native_type
static void from_mono_base(const mono::mono_object &object, native_type &data)
MonoObject * managed_type
static auto to_mono(const native_type &obj) -> managed_type
static auto from_mono(const managed_type &obj) -> native_type
MonoObject * managed_type
static auto from_mono(const managed_type &obj) -> native_type
static auto to_mono(const native_type &obj) -> managed_type
MonoObject * managed_type
static auto to_mono(const native_type &obj) -> managed_type
static auto from_mono(const managed_type &obj) -> native_type
static auto to_mono(const native_type &obj) -> managed_type
MonoObject * managed_type
static auto from_mono(const managed_type &obj) -> native_type
static auto context() -> rtti::context &