mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
remove script system and bindings
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include "assets/mesh_asset.hpp"
|
||||
#include "assets/model_asset.hpp"
|
||||
#include "assets/prefab_asset.hpp"
|
||||
#include "assets/script_asset.hpp"
|
||||
#include "assets/shader_asset.hpp"
|
||||
#include "assets/shape_asset.hpp"
|
||||
#include "assets/sound_asset.hpp"
|
||||
@@ -29,7 +28,6 @@
|
||||
#include "assets/xml_asset.hpp"
|
||||
|
||||
#include "components/actor.hpp"
|
||||
#include "components/behaviour.hpp"
|
||||
#include "components/camera.hpp"
|
||||
#include "components/colliders.hpp"
|
||||
#include "components/commands.hpp"
|
||||
@@ -51,7 +49,6 @@
|
||||
#include "resources/flipbook.hpp"
|
||||
#include "resources/model.hpp"
|
||||
#include "resources/prefab.hpp"
|
||||
#include "resources/script.hpp"
|
||||
#include "resources/spine.hpp"
|
||||
#include "resources/sprite.hpp"
|
||||
|
||||
@@ -62,7 +59,6 @@
|
||||
#include "systems/label_system.hpp"
|
||||
#include "systems/layout_system.hpp"
|
||||
#include "systems/render_system.hpp"
|
||||
#include "systems/script_system.hpp"
|
||||
#include "systems/spine_system.hpp"
|
||||
#include "systems/touch_system.hpp"
|
||||
#include "systems/world_system.hpp"
|
||||
@@ -78,7 +74,6 @@
|
||||
#include "inspector.inl"
|
||||
#include "library.hpp"
|
||||
#include "library.inl"
|
||||
#include "luasol.hpp"
|
||||
#include "node.hpp"
|
||||
#include "node.inl"
|
||||
#include "starter.hpp"
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
|
||||
#include <ecs.hpp/ecs.hpp>
|
||||
|
||||
#define SOL_ALL_SAFETIES_ON 1
|
||||
#include <3rdparty/sol/sol.hpp>
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
namespace ecs
|
||||
@@ -33,7 +30,6 @@ namespace e2d
|
||||
class mesh_asset;
|
||||
class model_asset;
|
||||
class prefab_asset;
|
||||
class script_asset;
|
||||
class shader_asset;
|
||||
class shape_asset;
|
||||
class sound_asset;
|
||||
@@ -44,7 +40,6 @@ namespace e2d
|
||||
class xml_asset;
|
||||
|
||||
class actor;
|
||||
class behaviour;
|
||||
class camera;
|
||||
class rect_collider;
|
||||
class circle_collider;
|
||||
@@ -71,7 +66,6 @@ namespace e2d
|
||||
class flipbook;
|
||||
class model;
|
||||
class prefab;
|
||||
class script;
|
||||
class spine;
|
||||
class sprite;
|
||||
|
||||
@@ -82,7 +76,6 @@ namespace e2d
|
||||
class label_system;
|
||||
class layout_system;
|
||||
class render_system;
|
||||
class script_system;
|
||||
class spine_system;
|
||||
class touch_system;
|
||||
class world_system;
|
||||
@@ -99,7 +92,6 @@ namespace e2d
|
||||
|
||||
class editor;
|
||||
class inspector;
|
||||
class luasol;
|
||||
class starter;
|
||||
class world;
|
||||
|
||||
@@ -111,24 +103,6 @@ namespace e2d
|
||||
class const_gcomponent;
|
||||
}
|
||||
|
||||
namespace sol
|
||||
{
|
||||
template < typename T >
|
||||
struct unique_usertype_traits<e2d::intrusive_ptr<T>> {
|
||||
using type = T;
|
||||
using actual_type = e2d::intrusive_ptr<T>;
|
||||
static const bool value = true;
|
||||
|
||||
static bool is_null(const actual_type& ptr) {
|
||||
return !ptr;
|
||||
}
|
||||
|
||||
static type* get(actual_type& ptr) {
|
||||
return ptr.get();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d::ecsex
|
||||
{
|
||||
template < typename T, typename Disposer, typename... Opts >
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../library.hpp"
|
||||
#include "../resources/script.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class script_asset final : public content_asset<script_asset, script> {
|
||||
public:
|
||||
static const char* type_name() noexcept { return "script_asset"; }
|
||||
static load_async_result load_async(const library& library, str_view address);
|
||||
};
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "_components.hpp"
|
||||
|
||||
#include "../assets/script_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class behaviour final {
|
||||
public:
|
||||
behaviour() = default;
|
||||
|
||||
behaviour& meta(sol::table value) noexcept;
|
||||
behaviour& script(const script_asset::ptr& value) noexcept;
|
||||
|
||||
[[nodiscard]] sol::table& meta() noexcept;
|
||||
[[nodiscard]] const sol::table& meta() const noexcept;
|
||||
[[nodiscard]] const script_asset::ptr& script() const noexcept;
|
||||
private:
|
||||
sol::table meta_;
|
||||
script_asset::ptr script_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<behaviour> final : factory_loader<> {
|
||||
public:
|
||||
static const char* schema_source;
|
||||
|
||||
bool operator()(
|
||||
behaviour& component,
|
||||
const fill_context& ctx) const;
|
||||
|
||||
bool operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<behaviour> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<behaviour>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline behaviour& behaviour::meta(sol::table value) noexcept {
|
||||
meta_ = std::move(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline behaviour& behaviour::script(const script_asset::ptr& value) noexcept {
|
||||
script_ = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline sol::table& behaviour::meta() noexcept {
|
||||
return meta_;
|
||||
}
|
||||
|
||||
inline const sol::table& behaviour::meta() const noexcept {
|
||||
return meta_;
|
||||
}
|
||||
|
||||
inline const script_asset::ptr& behaviour::script() const noexcept {
|
||||
return script_;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d::behaviours
|
||||
{
|
||||
ENUM_HPP_CLASS_DECL(fill_result, u8,
|
||||
(failed)
|
||||
(success))
|
||||
ENUM_HPP_REGISTER_TRAITS(fill_result)
|
||||
|
||||
inline fill_result fill_meta_table(behaviour& behaviour) {
|
||||
if ( !behaviour.script() ) {
|
||||
return fill_result::failed;
|
||||
}
|
||||
|
||||
sol::protected_function_result meta = behaviour.script()->content().call();
|
||||
|
||||
if ( !meta.valid() ) {
|
||||
sol::error err = meta;
|
||||
the<debug>().error("BEHAVIOUR: Behaviour script error:\n"
|
||||
"--> Error: %0",
|
||||
err.what());
|
||||
return fill_result::failed;
|
||||
}
|
||||
|
||||
if ( meta.get_type() != sol::type::table ) {
|
||||
the<debug>().error("BEHAVIOUR: Behaviour script must return a meta table");
|
||||
return fill_result::failed;
|
||||
}
|
||||
|
||||
behaviour.meta(std::move(meta));
|
||||
return fill_result::success;
|
||||
}
|
||||
|
||||
ENUM_HPP_CLASS_DECL(call_result, u8,
|
||||
(failed)
|
||||
(success)
|
||||
(method_not_found))
|
||||
ENUM_HPP_REGISTER_TRAITS(call_result)
|
||||
|
||||
template < typename... Args >
|
||||
call_result call_meta_method(behaviour& behaviour, str_view method, Args&&... args) {
|
||||
if ( method.empty() || !behaviour.meta() || !behaviour.meta().valid() ) {
|
||||
return call_result::method_not_found;
|
||||
}
|
||||
|
||||
sol::optional<sol::protected_function> f = behaviour.meta()[method];
|
||||
if ( !f ) {
|
||||
return call_result::method_not_found;
|
||||
}
|
||||
|
||||
sol::protected_function_result r = f->call(
|
||||
behaviour.meta(),
|
||||
std::forward<Args>(args)...);
|
||||
|
||||
if ( !r.valid() ) {
|
||||
sol::error err = r;
|
||||
the<debug>().error("BEHAVIOUR: Behaviour method error:\n"
|
||||
"--> Method: %0\n"
|
||||
"--> Error: %1",
|
||||
method,
|
||||
err.what());
|
||||
return call_result::failed;
|
||||
}
|
||||
|
||||
return call_result::success;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "_high.hpp"
|
||||
|
||||
#include "resources/script.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class luasol final : public module<luasol> {
|
||||
public:
|
||||
luasol();
|
||||
~luasol() noexcept final = default;
|
||||
|
||||
void collect_garbage();
|
||||
|
||||
template < typename F >
|
||||
decltype(auto) with_state(F&& f);
|
||||
template < typename F >
|
||||
decltype(auto) with_state(F&& f) const;
|
||||
|
||||
std::optional<script> load_script(str_view src);
|
||||
std::optional<script> load_script(buffer_view src);
|
||||
private:
|
||||
sol::state state_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template < typename F >
|
||||
decltype(auto) luasol::with_state(F&& f) {
|
||||
E2D_ASSERT(is_in_main_thread());
|
||||
return std::invoke(std::forward<F>(f), state_);
|
||||
}
|
||||
|
||||
template < typename F >
|
||||
decltype(auto) luasol::with_state(F&& f) const {
|
||||
E2D_ASSERT(is_in_main_thread());
|
||||
return std::invoke(std::forward<F>(f), state_);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../_high.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class bad_script_access final : public exception {
|
||||
public:
|
||||
const char* what() const noexcept final {
|
||||
return "bad script access";
|
||||
}
|
||||
};
|
||||
|
||||
class script final {
|
||||
public:
|
||||
script() = default;
|
||||
~script() noexcept = default;
|
||||
|
||||
script(script&& other) noexcept;
|
||||
script& operator=(script&& other) noexcept;
|
||||
|
||||
script(const script& other);
|
||||
script& operator=(const script& other);
|
||||
|
||||
script(sol::protected_function&& func) noexcept;
|
||||
script(const sol::protected_function& func);
|
||||
|
||||
script& assign(script&& other) noexcept;
|
||||
script& assign(const script& other);
|
||||
|
||||
script& assign(sol::protected_function&& func) noexcept;
|
||||
script& assign(const sol::protected_function& func);
|
||||
|
||||
void clear() noexcept;
|
||||
void swap(script& other) noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
template < typename... Ret, typename... Args >
|
||||
decltype(auto) call(Args&&... args) const;
|
||||
private:
|
||||
std::optional<sol::protected_function> func_;
|
||||
};
|
||||
|
||||
void swap(script& l, script& r) noexcept;
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template < typename... Ret, typename... Args >
|
||||
decltype(auto) script::call(Args&&... args) const {
|
||||
if ( !func_ ) {
|
||||
throw bad_script_access();
|
||||
}
|
||||
return func_->call<Ret...>(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "_systems.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class script_system final
|
||||
: public ecs::system<
|
||||
systems::update_event,
|
||||
ecs::before<systems::update_event>> {
|
||||
public:
|
||||
script_system();
|
||||
~script_system() noexcept;
|
||||
|
||||
void process(
|
||||
ecs::registry& owner,
|
||||
const systems::update_event& event) override;
|
||||
|
||||
void process(
|
||||
ecs::registry& owner,
|
||||
const ecs::before<systems::update_event>& trigger) override;
|
||||
private:
|
||||
class internal_state;
|
||||
std::unique_ptr<internal_state> state_;
|
||||
};
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
{
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"components" : {
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_07/sample_07.lua"
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prefab" : "../prefabs/camera_prefab.json"
|
||||
},{
|
||||
@@ -15,9 +10,6 @@
|
||||
"actor" : {
|
||||
"translation" : [0,0],
|
||||
"scale" : 20
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_07/gnome.lua"
|
||||
}
|
||||
}
|
||||
},{
|
||||
@@ -32,9 +24,6 @@
|
||||
"actor" : {
|
||||
"translation" : [-502,-246],
|
||||
"scale" : 1
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_07/fps_label.lua"
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
{
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"components" : {
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/sample_08.lua"
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
@@ -41,9 +36,6 @@
|
||||
"translation" : [0,0],
|
||||
"rotation" : 1
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/ship.lua"
|
||||
},
|
||||
"touchable" : {},
|
||||
"circle_collider" : {
|
||||
"offset" : [10,15],
|
||||
@@ -61,9 +53,6 @@
|
||||
"rotation" : 1,
|
||||
"scale" : [0.5,0.5]
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/ship.lua"
|
||||
},
|
||||
"touchable" : {},
|
||||
"circle_collider" : {
|
||||
"offset" : [10,15],
|
||||
@@ -81,9 +70,6 @@
|
||||
"translation" : [120,100],
|
||||
"rotation" : 0.2
|
||||
},
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/ship.lua"
|
||||
},
|
||||
"touchable" : {},
|
||||
"rect_collider" : {
|
||||
"size" : [66,113]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class atlas
|
||||
local atlas = {
|
||||
}
|
||||
|
||||
---@type atlas
|
||||
_G.atlas = _G.atlas or atlas
|
||||
|
||||
---@class atlas_asset
|
||||
local atlas_asset = {
|
||||
---@type atlas
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type atlas_asset
|
||||
_G.atlas_asset = _G.atlas_asset or atlas_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class binary
|
||||
local binary = {
|
||||
}
|
||||
|
||||
---@type binary
|
||||
_G.binary = _G.binary or binary
|
||||
|
||||
---@class binary_asset
|
||||
local binary_asset = {
|
||||
---@type binary
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type binary_asset
|
||||
_G.binary_asset = _G.binary_asset or binary_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class flipbook
|
||||
local flipbook = {
|
||||
}
|
||||
|
||||
---@type flipbook
|
||||
_G.flipbook = _G.flipbook or flipbook
|
||||
|
||||
---@class flipbook_asset
|
||||
local flipbook_asset = {
|
||||
---@type flipbook
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type flipbook_asset
|
||||
_G.flipbook_asset = _G.flipbook_asset or flipbook_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class font
|
||||
local font = {
|
||||
}
|
||||
|
||||
---@type font
|
||||
_G.font = _G.font or font
|
||||
|
||||
---@class font_asset
|
||||
local font_asset = {
|
||||
---@type font
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type font_asset
|
||||
_G.font_asset = _G.font_asset or font_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class image
|
||||
local image = {
|
||||
}
|
||||
|
||||
---@type image
|
||||
_G.image = _G.image or image
|
||||
|
||||
---@class image_asset
|
||||
local image_asset = {
|
||||
---@type image
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type image_asset
|
||||
_G.image_asset = _G.image_asset or image_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class json
|
||||
local json = {
|
||||
}
|
||||
|
||||
---@type json
|
||||
_G.json = _G.json or json
|
||||
|
||||
---@class json_asset
|
||||
local json_asset = {
|
||||
---@type json
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type json_asset
|
||||
_G.json_asset = _G.json_asset or json_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class material
|
||||
local material = {
|
||||
}
|
||||
|
||||
---@type material
|
||||
_G.material = _G.material or material
|
||||
|
||||
---@class material_asset
|
||||
local material_asset = {
|
||||
---@type material
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type material_asset
|
||||
_G.material_asset = _G.material_asset or material_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class mesh
|
||||
local mesh = {
|
||||
}
|
||||
|
||||
---@type mesh
|
||||
_G.mesh = _G.mesh or mesh
|
||||
|
||||
---@class mesh_asset
|
||||
local mesh_asset = {
|
||||
---@type mesh
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type mesh_asset
|
||||
_G.mesh_asset = _G.mesh_asset or mesh_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class model
|
||||
local model = {
|
||||
}
|
||||
|
||||
---@type model
|
||||
_G.model = _G.model or model
|
||||
|
||||
---@class model_asset
|
||||
local model_asset = {
|
||||
---@type model
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type model_asset
|
||||
_G.model_asset = _G.model_asset or model_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class prefab
|
||||
local prefab = {
|
||||
}
|
||||
|
||||
---@type prefab
|
||||
_G.prefab = _G.prefab or prefab
|
||||
|
||||
---@class prefab_asset
|
||||
local prefab_asset = {
|
||||
---@type prefab
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type prefab_asset
|
||||
_G.prefab_asset = _G.prefab_asset or prefab_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class script
|
||||
local script = {
|
||||
}
|
||||
|
||||
---@type script
|
||||
_G.script = _G.script or script
|
||||
|
||||
---@class script_asset
|
||||
local script_asset = {
|
||||
---@type script
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type script_asset
|
||||
_G.script_asset = _G.script_asset or script_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class shader
|
||||
local shader = {
|
||||
}
|
||||
|
||||
---@type shader
|
||||
_G.shader = _G.shader or shader
|
||||
|
||||
---@class shader_asset
|
||||
local shader_asset = {
|
||||
---@type shader
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type shader_asset
|
||||
_G.shader_asset = _G.shader_asset or shader_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class shape
|
||||
local shape = {
|
||||
}
|
||||
|
||||
---@type shape
|
||||
_G.shape = _G.shape or shape
|
||||
|
||||
---@class shape_asset
|
||||
local shape_asset = {
|
||||
---@type shape
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type shape_asset
|
||||
_G.shape_asset = _G.shape_asset or shape_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class sound
|
||||
local sound = {
|
||||
}
|
||||
|
||||
---@type sound
|
||||
_G.sound = _G.sound or sound
|
||||
|
||||
---@class sound_asset
|
||||
local sound_asset = {
|
||||
---@type sound
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type sound_asset
|
||||
_G.sound_asset = _G.sound_asset or sound_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class spine
|
||||
local spine = {
|
||||
}
|
||||
|
||||
---@type spine
|
||||
_G.spine = _G.spine or spine
|
||||
|
||||
---@class spine_asset
|
||||
local spine_asset = {
|
||||
---@type spine
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type spine_asset
|
||||
_G.spine_asset = _G.spine_asset or spine_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class sprite
|
||||
local sprite = {
|
||||
}
|
||||
|
||||
---@type sprite
|
||||
_G.sprite = _G.sprite or sprite
|
||||
|
||||
---@class sprite_asset
|
||||
local sprite_asset = {
|
||||
---@type sprite
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type sprite_asset
|
||||
_G.sprite_asset = _G.sprite_asset or sprite_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class text
|
||||
local text = {
|
||||
}
|
||||
|
||||
---@type text
|
||||
_G.text = _G.text or text
|
||||
|
||||
---@class text_asset
|
||||
local text_asset = {
|
||||
---@type text
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type text_asset
|
||||
_G.text_asset = _G.text_asset or text_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class texture
|
||||
local texture = {
|
||||
}
|
||||
|
||||
---@type texture
|
||||
_G.texture = _G.texture or texture
|
||||
|
||||
---@class texture_asset
|
||||
local texture_asset = {
|
||||
---@type texture
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type texture_asset
|
||||
_G.texture_asset = _G.texture_asset or texture_asset
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class xml
|
||||
local xml = {
|
||||
}
|
||||
|
||||
---@type xml
|
||||
_G.xml = _G.xml or xml
|
||||
|
||||
---@class xml_asset
|
||||
local xml_asset = {
|
||||
---@type xml
|
||||
content = nil
|
||||
}
|
||||
|
||||
---@type xml_asset
|
||||
_G.xml_asset = _G.xml_asset or xml_asset
|
||||
@@ -1,8 +0,0 @@
|
||||
---@class actor
|
||||
local actor = {
|
||||
---@type node
|
||||
node = {}
|
||||
}
|
||||
|
||||
---@type actor
|
||||
_G.actor = _G.actor or actor
|
||||
@@ -1,22 +0,0 @@
|
||||
---@class behaviour
|
||||
local behaviour = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type table
|
||||
meta = {}
|
||||
}
|
||||
|
||||
---@overload fun(self: behaviour)
|
||||
---@param self behaviour
|
||||
function behaviour.enable(self) end
|
||||
|
||||
---@overload fun(self: behaviour)
|
||||
---@param self behaviour
|
||||
function behaviour.disable(self) end
|
||||
|
||||
---@type behaviour
|
||||
_G.behaviour = _G.behaviour or behaviour
|
||||
@@ -1,58 +0,0 @@
|
||||
---@class camera
|
||||
local camera = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type boolean
|
||||
input = false,
|
||||
|
||||
---@type boolean
|
||||
gizmos = false,
|
||||
|
||||
---@type integer
|
||||
depth = 0,
|
||||
|
||||
---@type camera_modes
|
||||
mode = camera.modes.flexible,
|
||||
|
||||
---@type number
|
||||
znear = 0.0,
|
||||
|
||||
---@type number
|
||||
zfar = 1000.0,
|
||||
|
||||
---@type m4f
|
||||
view = m4f.identity(),
|
||||
|
||||
---@type rect
|
||||
viewport = rect.zero(),
|
||||
|
||||
---@type m4f
|
||||
projection = m4f.identity(),
|
||||
|
||||
---@type color
|
||||
background = color.white()
|
||||
}
|
||||
|
||||
---@class camera_modes
|
||||
camera.modes = {
|
||||
manual = "manual",
|
||||
stretch = "stretch",
|
||||
flexible = "flexible",
|
||||
fixed_fit = "fixed_fit",
|
||||
fixed_crop = "fixed_crop"
|
||||
}
|
||||
|
||||
---@overload fun(self: camera)
|
||||
---@param self camera
|
||||
function camera.enable(self) end
|
||||
|
||||
---@overload fun(self: camera)
|
||||
---@param self camera
|
||||
function camera.disable(self) end
|
||||
|
||||
---@type camera
|
||||
_G.camera = _G.camera or camera
|
||||
@@ -1,81 +0,0 @@
|
||||
---@class rect_collider
|
||||
local rect_collider = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type v2f
|
||||
size = v2f.unit(),
|
||||
|
||||
---@type v2f
|
||||
offset = v2f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(self: rect_collider)
|
||||
---@param self rect_collider
|
||||
function rect_collider.enable(self) end
|
||||
|
||||
---@overload fun(self: rect_collider)
|
||||
---@param self rect_collider
|
||||
function rect_collider.disable(self) end
|
||||
|
||||
---@type rect_collider
|
||||
_G.rect_collider = _G.rect_collider or rect_collider
|
||||
|
||||
---@class circle_collider
|
||||
local circle_collider = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type number
|
||||
radius = 1.0,
|
||||
|
||||
---@type v2f
|
||||
offset = v2f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(self: circle_collider)
|
||||
---@param self circle_collider
|
||||
function circle_collider.enable(self) end
|
||||
|
||||
---@overload fun(self: circle_collider)
|
||||
---@param self circle_collider
|
||||
function circle_collider.disable(self) end
|
||||
|
||||
---@type circle_collider
|
||||
_G.circle_collider = _G.circle_collider or circle_collider
|
||||
|
||||
---@class polygon_collider
|
||||
local polygon_collider = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type v2f[]
|
||||
points = {
|
||||
v2f.new(-0.5, -0.5),
|
||||
v2f.new( 0.5, -0.5),
|
||||
v2f.new( 0.5, 0.5),
|
||||
v2f.new(-0.5, 0.5)},
|
||||
|
||||
---@type v2f
|
||||
offset = v2f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(self: polygon_collider)
|
||||
---@param self polygon_collider
|
||||
function polygon_collider.enable(self) end
|
||||
|
||||
---@overload fun(self: polygon_collider)
|
||||
---@param self polygon_collider
|
||||
function polygon_collider.disable(self) end
|
||||
|
||||
---@type polygon_collider
|
||||
_G.polygon_collider = _G.polygon_collider or polygon_collider
|
||||
@@ -1,38 +0,0 @@
|
||||
---@class flipbook_player
|
||||
local flipbook_player = {
|
||||
---@type number
|
||||
time = 0,
|
||||
|
||||
---@type number
|
||||
speed = 1,
|
||||
|
||||
---@type boolean
|
||||
looped = false,
|
||||
|
||||
---@type boolean
|
||||
stopped = true,
|
||||
|
||||
---@type boolean
|
||||
playing = false,
|
||||
|
||||
---@type str_hash
|
||||
sequence = str_hash.new(),
|
||||
|
||||
---@type flipbook_asset
|
||||
flipbook = nil
|
||||
}
|
||||
|
||||
---@overload fun(self: flipbook_player, time: number)
|
||||
---@overload fun(self: flipbook_player, sequence: string)
|
||||
---@overload fun(self: flipbook_player, sequence: str_hash)
|
||||
---@param self flipbook_player
|
||||
function flipbook_player.stop(self, ...) end
|
||||
|
||||
---@overload fun(self: flipbook_player, time: number)
|
||||
---@overload fun(self: flipbook_player, sequence: string)
|
||||
---@overload fun(self: flipbook_player, sequence: str_hash)
|
||||
---@param self flipbook_player
|
||||
function flipbook_player.play(self, ...) end
|
||||
|
||||
---@type flipbook_player
|
||||
_G.flipbook_player = _G.flipbook_player or flipbook_player
|
||||
@@ -1,56 +0,0 @@
|
||||
---@class label
|
||||
local label = {
|
||||
---@type boolean
|
||||
dirty = false,
|
||||
|
||||
---@type string
|
||||
text = "",
|
||||
|
||||
---@type font_asset
|
||||
font = nil,
|
||||
|
||||
---@type color32
|
||||
tint = color32.white(),
|
||||
|
||||
---@type label_haligns
|
||||
halign = label.haligns.center,
|
||||
|
||||
---@type label_valigns
|
||||
valign = label.valigns.baseline,
|
||||
|
||||
---@type number
|
||||
leading = 1,
|
||||
|
||||
---@type number
|
||||
tracking = 0,
|
||||
|
||||
---@type number
|
||||
text_width = 0,
|
||||
|
||||
---@type number
|
||||
glyph_dilate = 0,
|
||||
|
||||
---@type number
|
||||
outline_width = 0,
|
||||
|
||||
---@type color32
|
||||
outline_color = color32.white()
|
||||
}
|
||||
|
||||
---@class label_haligns
|
||||
label.haligns = {
|
||||
left = "left",
|
||||
center = "center",
|
||||
right = "right"
|
||||
}
|
||||
|
||||
---@class label_valigns
|
||||
label.valigns = {
|
||||
top = "top",
|
||||
center = "center",
|
||||
bottom = "bottom",
|
||||
baseline = "baseline"
|
||||
}
|
||||
|
||||
---@type label
|
||||
_G.label = _G.label or label
|
||||
@@ -1,80 +0,0 @@
|
||||
---@class layout
|
||||
local layout = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type boolean
|
||||
dirty = false,
|
||||
|
||||
---@type layout_directions
|
||||
direction = layout.directions.ltr,
|
||||
|
||||
---@type layout_align_modes
|
||||
align_items = layout.align_modes.flex_start,
|
||||
|
||||
---@type layout_align_modes
|
||||
align_conten = layout.align_modes.flex_start,
|
||||
|
||||
---@type layout_justify_modes
|
||||
justify_content = layout.justify_modes.flex_start,
|
||||
|
||||
---@type layout_flex_wraps
|
||||
flex_wrap = layout.flex_wraps.no_wrap,
|
||||
|
||||
---@type layout_flex_directions
|
||||
flex_direction = layout.flex_directions.row
|
||||
}
|
||||
|
||||
---@class layout_directions
|
||||
layout.directions = {
|
||||
ltr = "ltr",
|
||||
rtl = "rtl"
|
||||
}
|
||||
|
||||
---@class layout_align_modes
|
||||
layout.align_modes = {
|
||||
flex_start = "flex_start",
|
||||
center = "center",
|
||||
flex_end = "flex_end",
|
||||
space_between = "space_between",
|
||||
space_around = "space_around"
|
||||
}
|
||||
|
||||
---@class layout_justify_modes
|
||||
layout.justify_modes = {
|
||||
flex_start = "flex_start",
|
||||
center = "center",
|
||||
flex_end = "flex_end",
|
||||
space_between = "space_between",
|
||||
space_around = "space_around",
|
||||
space_evenly = "space_evenly"
|
||||
}
|
||||
|
||||
---@class layout_flex_wraps
|
||||
layout.flex_wraps = {
|
||||
no_wrap = "no_wrap",
|
||||
wrap = "wrap",
|
||||
wrap_reversed = "wrap_reversed"
|
||||
}
|
||||
|
||||
---@class layout_flex_directions
|
||||
layout.flex_directions = {
|
||||
row = "row",
|
||||
row_reversed = "row_reversed",
|
||||
column = "column",
|
||||
column_reversed = "column_reversed"
|
||||
}
|
||||
|
||||
---@overload fun(self: layout)
|
||||
---@param self layout
|
||||
function layout.enable(self) end
|
||||
|
||||
---@overload fun(self: layout)
|
||||
---@param self layout
|
||||
function layout.disable(self) end
|
||||
|
||||
---@type layout
|
||||
_G.layout = _G.layout or layout
|
||||
@@ -1,8 +0,0 @@
|
||||
---@class model_renderer
|
||||
local model_renderer = {
|
||||
---@type model_asset
|
||||
model = nil
|
||||
}
|
||||
|
||||
---@type model_renderer
|
||||
_G.model_renderer = _G.model_renderer or model_renderer
|
||||
@@ -1,8 +0,0 @@
|
||||
---@class named
|
||||
local named = {
|
||||
---@type string
|
||||
name = ""
|
||||
}
|
||||
|
||||
---@type named
|
||||
_G.named = _G.named or named
|
||||
@@ -1,31 +0,0 @@
|
||||
---@class renderer
|
||||
local renderer = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type t3f
|
||||
transform = t3f.identity(),
|
||||
|
||||
---@type v3f
|
||||
translation = v3f.zero(),
|
||||
|
||||
---@type v3f
|
||||
rotation = v3f.zero(),
|
||||
|
||||
---@type v3f
|
||||
scale = v3f.unit()
|
||||
}
|
||||
|
||||
---@overload fun(self: renderer)
|
||||
---@param self renderer
|
||||
function renderer.enable(self) end
|
||||
|
||||
---@overload fun(self: renderer)
|
||||
---@param self renderer
|
||||
function renderer.disable(self) end
|
||||
|
||||
---@type renderer
|
||||
_G.renderer = _G.renderer or renderer
|
||||
@@ -1,22 +0,0 @@
|
||||
---@class scene
|
||||
local scene = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type integer
|
||||
depth = 0
|
||||
}
|
||||
|
||||
---@overload fun(self: scene)
|
||||
---@param self scene
|
||||
function scene.enable(self) end
|
||||
|
||||
---@overload fun(self: scene)
|
||||
---@param self scene
|
||||
function scene.disable(self) end
|
||||
|
||||
---@type scene
|
||||
_G.scene = _G.scene or scene
|
||||
@@ -1,229 +0,0 @@
|
||||
---@class spine_player
|
||||
local spine_player = {
|
||||
---@type spine_asset
|
||||
spine = nil
|
||||
}
|
||||
|
||||
---@param self spine_player
|
||||
---@param name string
|
||||
---@return boolean
|
||||
function spine_player.skin(self, name) end
|
||||
|
||||
---@param self spine_player
|
||||
---@param slot string
|
||||
---@param name string
|
||||
---@return boolean
|
||||
function spine_player.attachment(self, slot, name) end
|
||||
|
||||
---@param self spine_player
|
||||
---@param name string
|
||||
---@return boolean
|
||||
function spine_player.has_skin(self, name) end
|
||||
|
||||
---@param self spine_player
|
||||
---@param name string
|
||||
---@return boolean
|
||||
function spine_player.has_animation(self, name) end
|
||||
|
||||
---@param self spine_player
|
||||
---@param cmd spine_player_command
|
||||
function spine_player.add_command(self, cmd) end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- events
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@alias spine_player_event spine_player_custom_evt | spine_player_end_evt | spine_player_complete_evt
|
||||
|
||||
--
|
||||
-- custom_evt
|
||||
--
|
||||
|
||||
---@class spine_player_custom_evt
|
||||
spine_player.custom_evt = {
|
||||
---@type string
|
||||
name = "",
|
||||
|
||||
---@type integer
|
||||
int_value = 0,
|
||||
|
||||
---@type number
|
||||
float_value = 0,
|
||||
|
||||
---@type string
|
||||
string_value = ""
|
||||
}
|
||||
|
||||
---@overload fun(): spine_player_custom_evt
|
||||
---@overload fun(name: string): spine_player_custom_evt
|
||||
---@return spine_player_custom_evt
|
||||
function spine_player.custom_evt.new(...) end
|
||||
|
||||
--
|
||||
-- end_evt
|
||||
--
|
||||
|
||||
---@class spine_player_end_evt
|
||||
spine_player.end_evt = {
|
||||
---@type string
|
||||
message = ""
|
||||
}
|
||||
|
||||
---@overload fun(): spine_player_end_evt
|
||||
---@overload fun(message: string): spine_player_end_evt
|
||||
---@return spine_player_end_evt
|
||||
function spine_player.end_evt.new(...) end
|
||||
|
||||
--
|
||||
-- complete
|
||||
--
|
||||
|
||||
---@class spine_player_complete_evt
|
||||
spine_player.complete_evt = {
|
||||
---@type string
|
||||
message = ""
|
||||
}
|
||||
|
||||
---@overload fun(): spine_player_complete_evt
|
||||
---@overload fun(message: string): spine_player_complete_evt
|
||||
---@return spine_player_complete_evt
|
||||
function spine_player.complete_evt.new(...) end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- commands
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@alias spine_player_command spine_player_clear_track_cmd | spine_player_set_anim_cmd | spine_player_add_anim_cmd | spine_player_set_empty_anim_cmd | spine_player_add_empty_anim_cmd
|
||||
|
||||
--
|
||||
-- clear_track_cmd
|
||||
--
|
||||
|
||||
---@class spine_player_clear_track_cmd
|
||||
spine_player.clear_track_cmd = {
|
||||
---@type integer
|
||||
track = 0
|
||||
}
|
||||
|
||||
---@param track integer
|
||||
---@return spine_player_clear_track_cmd
|
||||
function spine_player.clear_track_cmd.new(track) end
|
||||
|
||||
--
|
||||
-- set_anim_cmd
|
||||
--
|
||||
|
||||
---@class spine_player_set_anim_cmd
|
||||
spine_player.set_anim_cmd = {
|
||||
---@type integer
|
||||
track = 0,
|
||||
|
||||
---@type string
|
||||
name = "",
|
||||
|
||||
---@type boolean
|
||||
loop = false,
|
||||
|
||||
---@type string
|
||||
end_message = "",
|
||||
|
||||
---@type string
|
||||
complete_message = ""
|
||||
}
|
||||
|
||||
---@param track integer
|
||||
---@param name string
|
||||
---@return spine_player_set_anim_cmd
|
||||
function spine_player.set_anim_cmd.new(track, name) end
|
||||
|
||||
--
|
||||
-- add_anim_cmd
|
||||
--
|
||||
|
||||
---@class spine_player_add_anim_cmd
|
||||
spine_player.add_anim_cmd = {
|
||||
---@type integer
|
||||
track = 0,
|
||||
|
||||
---@type string
|
||||
name = "",
|
||||
|
||||
---@type boolean
|
||||
loop = false,
|
||||
|
||||
---@type number
|
||||
delay = 0,
|
||||
|
||||
---@type string
|
||||
end_message = "",
|
||||
|
||||
---@type string
|
||||
complete_message = ""
|
||||
}
|
||||
|
||||
---@param track integer
|
||||
---@param name string
|
||||
---@return spine_player_add_anim_cmd
|
||||
function spine_player.add_anim_cmd.new(track, name) end
|
||||
|
||||
--
|
||||
-- set_empty_anim_cmd
|
||||
--
|
||||
|
||||
---@class spine_player_set_empty_anim_cmd
|
||||
spine_player.set_empty_anim_cmd = {
|
||||
---@type integer
|
||||
track = 0,
|
||||
|
||||
---@type number
|
||||
mix_duration = 0,
|
||||
|
||||
---@type string
|
||||
end_message = "",
|
||||
|
||||
---@type string
|
||||
complete_message = ""
|
||||
}
|
||||
|
||||
---@param track integer
|
||||
---@return spine_player_set_empty_anim_cmd
|
||||
function spine_player.set_empty_anim_cmd.new(track) end
|
||||
|
||||
--
|
||||
-- add_empty_anim_cmd
|
||||
--
|
||||
|
||||
---@class spine_player_add_empty_anim_cmd
|
||||
spine_player.add_empty_anim_cmd = {
|
||||
---@type integer
|
||||
track = 0,
|
||||
|
||||
---@type number
|
||||
delay = 0,
|
||||
|
||||
---@type number
|
||||
mix_duration = 0,
|
||||
|
||||
---@type string
|
||||
end_message = "",
|
||||
|
||||
---@type string
|
||||
complete_message = ""
|
||||
}
|
||||
|
||||
---@param track integer
|
||||
---@return spine_player_add_empty_anim_cmd
|
||||
function spine_player.add_empty_anim_cmd.new(track) end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- globals
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@type spine_player
|
||||
_G.spine_player = _G.spine_player or spine_player
|
||||
@@ -1,37 +0,0 @@
|
||||
---@class sprite_renderer
|
||||
local sprite_renderer = {
|
||||
---@type color32
|
||||
tint = color32.white(),
|
||||
|
||||
---@type v2f
|
||||
scale = v2f.unit(),
|
||||
|
||||
---@type sprite_renderer_modes
|
||||
mode = sprite_renderer.modes.simple,
|
||||
|
||||
---@type sprite_renderer_blendings
|
||||
blending = sprite_renderer.blendings.normal,
|
||||
|
||||
---@type boolean
|
||||
filtering = true,
|
||||
|
||||
---@type sprite_asset
|
||||
sprite = nil
|
||||
}
|
||||
|
||||
---@class sprite_renderer_modes
|
||||
sprite_renderer.modes = {
|
||||
simple = "simple",
|
||||
sliced = "sliced"
|
||||
}
|
||||
|
||||
---@class sprite_renderer_blendings
|
||||
sprite_renderer.blendings = {
|
||||
normal = "normal",
|
||||
additive = "additive",
|
||||
multiply = "multiply",
|
||||
screen = "screen"
|
||||
}
|
||||
|
||||
---@type sprite_renderer
|
||||
_G.sprite_renderer = _G.sprite_renderer or sprite_renderer
|
||||
@@ -1,81 +0,0 @@
|
||||
---@class touchable
|
||||
local touchable = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type boolean
|
||||
bubbling = true,
|
||||
|
||||
---@type boolean
|
||||
capturing = true
|
||||
}
|
||||
|
||||
---@overload fun(self: touchable)
|
||||
---@param self touchable
|
||||
function touchable.enable(self) end
|
||||
|
||||
---@overload fun(self: touchable)
|
||||
---@param self touchable
|
||||
function touchable.disable(self) end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- events
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
--
|
||||
-- input_evt
|
||||
--
|
||||
|
||||
---@class touchable_base_evt
|
||||
touchable.input_evt = {
|
||||
---@type gobject
|
||||
target = nil,
|
||||
|
||||
---@type boolean
|
||||
bubbling = true,
|
||||
|
||||
---@type boolean
|
||||
capturing = true
|
||||
}
|
||||
|
||||
--
|
||||
-- mouse_evt
|
||||
--
|
||||
|
||||
---@class touchable_mouse_evt : touchable_base_evt
|
||||
touchable.mouse_evt = {
|
||||
---@type string
|
||||
type = "pressed",
|
||||
|
||||
---@type string
|
||||
button = "left"
|
||||
}
|
||||
|
||||
--
|
||||
-- touch_evt
|
||||
--
|
||||
|
||||
---@class touchable_touch_evt : touchable_base_evt
|
||||
touchable.touch_evt = {
|
||||
---@type string
|
||||
type = "pressed",
|
||||
|
||||
---@type integer
|
||||
finger = 0
|
||||
}
|
||||
|
||||
---@alias touchable_event touchable_mouse_evt | touchable_touch_evt
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- globals
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@type touchable
|
||||
_G.touchable = _G.touchable or touchable
|
||||
@@ -1,31 +0,0 @@
|
||||
---@class widget
|
||||
local widget = {
|
||||
---@type boolean
|
||||
enabled = true,
|
||||
|
||||
---@type boolean
|
||||
disabled = false,
|
||||
|
||||
---@type boolean
|
||||
dirty = false,
|
||||
|
||||
---@type v2f
|
||||
size = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
margin = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
padding = v2f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(self: widget)
|
||||
---@param self widget
|
||||
function widget.enable(self) end
|
||||
|
||||
---@overload fun(self: widget)
|
||||
---@param self widget
|
||||
function widget.disable(self) end
|
||||
|
||||
---@type widget
|
||||
_G.widget = _G.widget or widget
|
||||
@@ -1,8 +0,0 @@
|
||||
---@class dbgui
|
||||
local dbgui = {
|
||||
---@type boolean
|
||||
visible = false
|
||||
}
|
||||
|
||||
---@type dbgui
|
||||
_G.the_dbgui = _G.the_dbgui or dbgui
|
||||
@@ -1,22 +0,0 @@
|
||||
---@class debug
|
||||
local debug = {
|
||||
}
|
||||
|
||||
---@param self debug
|
||||
---@param message string
|
||||
function debug.trace(self, message) end
|
||||
|
||||
---@param self debug
|
||||
---@param message string
|
||||
function debug.warning(self, message) end
|
||||
|
||||
---@param self debug
|
||||
---@param message string
|
||||
function debug.error(self, message) end
|
||||
|
||||
---@param self debug
|
||||
---@param message string
|
||||
function debug.fatal(self, message) end
|
||||
|
||||
---@type debug
|
||||
_G.the_debug = _G.the_debug or debug
|
||||
@@ -1,20 +0,0 @@
|
||||
---@class engine
|
||||
local engine = {
|
||||
---@type number
|
||||
time = 0,
|
||||
|
||||
---@type number
|
||||
delta_time = 0,
|
||||
|
||||
---@type integer
|
||||
frame_rate = 0,
|
||||
|
||||
---@type integer
|
||||
frame_count = 0,
|
||||
|
||||
---@type number
|
||||
realtime_time = 0
|
||||
}
|
||||
|
||||
---@type engine
|
||||
_G.the_engine = _G.the_engine or engine
|
||||
@@ -1,11 +0,0 @@
|
||||
---@class input
|
||||
local input = {
|
||||
---@type mouse
|
||||
mouse = nil,
|
||||
|
||||
---@type keyboard
|
||||
keyboard = nil
|
||||
}
|
||||
|
||||
---@type input
|
||||
_G.the_input = _G.the_input or input
|
||||
@@ -1,41 +0,0 @@
|
||||
---@class keyboard
|
||||
local keyboard = {
|
||||
---@type string
|
||||
input_text = "",
|
||||
|
||||
---@type boolean
|
||||
is_any_key_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_key_just_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_key_just_released = false,
|
||||
|
||||
---@type string[]
|
||||
pressed_keys = {},
|
||||
|
||||
---@type string[]
|
||||
just_pressed_keys = {},
|
||||
|
||||
---@type string[]
|
||||
just_released_keys = {}
|
||||
}
|
||||
|
||||
---@param self keyboard
|
||||
---@param key string
|
||||
---@return boolean
|
||||
function keyboard.is_key_pressed(self, key) end
|
||||
|
||||
---@param self keyboard
|
||||
---@param key string
|
||||
---@return boolean
|
||||
function keyboard.is_key_just_pressed(self, key) end
|
||||
|
||||
---@param self keyboard
|
||||
---@param key string
|
||||
---@return boolean
|
||||
function keyboard.is_key_just_released(self, key) end
|
||||
|
||||
---@type keyboard
|
||||
_G.the_keyboard = _G.the_keyboard or keyboard
|
||||
@@ -1,44 +0,0 @@
|
||||
---@class mouse
|
||||
local mouse = {
|
||||
---@type v2f
|
||||
cursor_pos = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
scroll_delta = v2f.zero(),
|
||||
|
||||
---@type boolean
|
||||
is_any_button_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_button_just_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_button_just_released = false,
|
||||
|
||||
---@type string[]
|
||||
pressed_buttons = {},
|
||||
|
||||
---@type string[]
|
||||
just_pressed_buttons = {},
|
||||
|
||||
---@type string[]
|
||||
just_released_buttons = {}
|
||||
}
|
||||
|
||||
---@param self mouse
|
||||
---@param button string
|
||||
---@return boolean
|
||||
function mouse.is_button_pressed(self, button) end
|
||||
|
||||
---@param self mouse
|
||||
---@param button string
|
||||
---@return boolean
|
||||
function mouse.is_button_just_pressed(self, button) end
|
||||
|
||||
---@param self mouse
|
||||
---@param button string
|
||||
---@return boolean
|
||||
function mouse.is_button_just_released(self, button) end
|
||||
|
||||
---@type mouse
|
||||
_G.the_mouse = _G.the_mouse or mouse
|
||||
@@ -1,50 +0,0 @@
|
||||
---@class window
|
||||
local window = {
|
||||
---@type boolean
|
||||
enable = true,
|
||||
|
||||
---@type boolean
|
||||
visible = true,
|
||||
|
||||
---@type boolean
|
||||
focused = true,
|
||||
|
||||
---@type boolean
|
||||
minimized = true,
|
||||
|
||||
---@type boolean
|
||||
fullscreen = false,
|
||||
|
||||
---@type boolean
|
||||
cursor_hidden = false,
|
||||
|
||||
---@type v2f
|
||||
real_size = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
virtual_size = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
framebuffer_size = v2f.zero(),
|
||||
|
||||
---@type string
|
||||
title = "",
|
||||
|
||||
---@type boolean
|
||||
should_close = false
|
||||
}
|
||||
|
||||
---@param self window
|
||||
function window.hide(self) end
|
||||
|
||||
---@param self window
|
||||
function window.show(self) end
|
||||
|
||||
---@param self window
|
||||
function window.restore(self) end
|
||||
|
||||
---@param self window
|
||||
function window.minimize(self) end
|
||||
|
||||
---@type window
|
||||
_G.the_window = _G.the_window or window
|
||||
@@ -1,15 +0,0 @@
|
||||
---@class editor
|
||||
local editor = {
|
||||
---@type gobject
|
||||
selection = nil
|
||||
}
|
||||
|
||||
---@param self editor
|
||||
---@param go gobject
|
||||
function editor.select(self, go) end
|
||||
|
||||
---@param self editor
|
||||
function editor.clear_selection(self) end
|
||||
|
||||
---@type editor
|
||||
_G.the_editor = _G.the_editor or editor
|
||||
@@ -1,65 +0,0 @@
|
||||
---@class gobject
|
||||
local gobject = {
|
||||
---@type boolean
|
||||
alive = true,
|
||||
|
||||
---@type boolean
|
||||
valid = true,
|
||||
|
||||
---@type actor
|
||||
actor = nil,
|
||||
|
||||
---@type behaviour
|
||||
behaviour = nil,
|
||||
|
||||
---@type camera
|
||||
camera = nil,
|
||||
|
||||
---@type rect_collider
|
||||
rect_collider = nil,
|
||||
|
||||
---@type circle_collider
|
||||
circle_collider = nil,
|
||||
|
||||
---@type polygon_collider
|
||||
polygon_collider = nil,
|
||||
|
||||
---@type flipbook_player
|
||||
flipbook_player = nil,
|
||||
|
||||
---@type label
|
||||
label = nil,
|
||||
|
||||
---@type layout
|
||||
layout = nil,
|
||||
|
||||
---@type model_renderer
|
||||
model_renderer = nil,
|
||||
|
||||
---@type named
|
||||
named = nil,
|
||||
|
||||
---@type renderer
|
||||
renderer = nil,
|
||||
|
||||
---@type scene
|
||||
scene = nil,
|
||||
|
||||
---@type spine_player
|
||||
spine_player = nil,
|
||||
|
||||
---@type sprite_renderer
|
||||
sprite_renderer = nil,
|
||||
|
||||
---@type touchable
|
||||
touchable = nil,
|
||||
|
||||
---@type widget
|
||||
widget = nil
|
||||
}
|
||||
|
||||
---@param self gobject
|
||||
function gobject.destroy(self) end
|
||||
|
||||
---@type gobject
|
||||
_G.gobject = _G.gobject or gobject
|
||||
@@ -1,101 +0,0 @@
|
||||
---@class library
|
||||
local library = {
|
||||
}
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return atlas_asset
|
||||
function library.load_atlas(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return binary_asset
|
||||
function library.load_binary(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return flipbook_asset
|
||||
function library.load_flipbook(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return font_asset
|
||||
function library.load_font(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return image_asset
|
||||
function library.load_image(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return json_asset
|
||||
function library.load_json(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return material_asset
|
||||
function library.load_material(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return mesh_asset
|
||||
function library.load_mesh(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return model_asset
|
||||
function library.load_model(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return prefab_asset
|
||||
function library.load_prefab(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return script_asset
|
||||
function library.load_script(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return shader_asset
|
||||
function library.load_shader(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return shape_asset
|
||||
function library.load_shape(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return sound_asset
|
||||
function library.load_sound(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return spine_asset
|
||||
function library.load_spine(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return sprite_asset
|
||||
function library.load_sprite(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return text_asset
|
||||
function library.load_text(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return texture_asset
|
||||
function library.load_texture(self, address) end
|
||||
|
||||
---@param self library
|
||||
---@param address string
|
||||
---@return xml_asset
|
||||
function library.load_xml(self, address) end
|
||||
|
||||
---@type library
|
||||
_G.the_library = _G.the_library or library
|
||||
@@ -1,177 +0,0 @@
|
||||
---@class node
|
||||
local node = {
|
||||
---@type gobject
|
||||
owner = nil,
|
||||
|
||||
---@type t2f
|
||||
transform = t2f.identity(),
|
||||
|
||||
---@type v2f
|
||||
translation = v2f.zero(),
|
||||
|
||||
---@type number
|
||||
rotation = 0,
|
||||
|
||||
---@type v2f
|
||||
scale = v2f.unit(),
|
||||
|
||||
---@type m4f
|
||||
local_matrix = m4f.identity(),
|
||||
|
||||
---@type m4f
|
||||
world_matrix = m4f.identity(),
|
||||
|
||||
---@type node
|
||||
root = nil,
|
||||
|
||||
---@type node
|
||||
parent = nil,
|
||||
|
||||
---@type integer
|
||||
child_count = 0,
|
||||
|
||||
---@type integer
|
||||
child_count_recursive = 0,
|
||||
|
||||
---@type node
|
||||
first_child = nil,
|
||||
|
||||
---@type node
|
||||
last_child = nil,
|
||||
|
||||
---@type node
|
||||
prev_sibling = nil,
|
||||
|
||||
---@type node
|
||||
next_sibling = nil
|
||||
}
|
||||
|
||||
---@param self node
|
||||
---@param point v4f
|
||||
---@return v4f
|
||||
function node.local_to_world(self, point) end
|
||||
|
||||
---@param self node
|
||||
---@param point v4f
|
||||
---@return v4f
|
||||
function node.world_to_local(self, point) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.has_parent(self) end
|
||||
|
||||
---@param self node
|
||||
---@param parent node
|
||||
---@return boolean
|
||||
function node.has_parent_recursive(self, parent) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.has_children(self) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.has_child_recursive(self, child) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.remove_from_parent(self) end
|
||||
|
||||
---@param self node
|
||||
---@return integer
|
||||
function node.remove_all_children(self) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.add_child(self, child) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@param index integer
|
||||
---@return boolean
|
||||
function node.add_child_at(self, child, index) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.add_child_to_back(self, child) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.add_child_to_front(self, child) end
|
||||
|
||||
---@param self node
|
||||
---@param before node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.add_child_before(self, before, child) end
|
||||
|
||||
---@param self node
|
||||
---@param after node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.add_child_after(self, after, child) end
|
||||
|
||||
---@param self node
|
||||
---@param sibling node
|
||||
---@return boolean
|
||||
function node.add_sibling_before(self, sibling) end
|
||||
|
||||
---@param self node
|
||||
---@param sibling node
|
||||
---@return boolean
|
||||
function node.add_sibling_after(self, sibling) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return boolean
|
||||
function node.remove_child(self, child) end
|
||||
|
||||
---@param self node
|
||||
---@param index integer
|
||||
---@return node
|
||||
function node.remove_child_at(self, index) end
|
||||
|
||||
---@param self node
|
||||
---@param child_l node
|
||||
---@param child_r node
|
||||
---@return boolean
|
||||
function node.swap_children(self, child_l, child_r) end
|
||||
|
||||
---@param self node
|
||||
---@param child_l integer
|
||||
---@param child_r integer
|
||||
---@return boolean
|
||||
function node.swap_children_at(self, child_l, child_r) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.send_backward(self) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.bring_to_back(self) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.send_forward(self) end
|
||||
|
||||
---@param self node
|
||||
---@return boolean
|
||||
function node.bring_to_front(self) end
|
||||
|
||||
---@param self node
|
||||
---@param index integer
|
||||
---@return node
|
||||
function node.child_at(self, index) end
|
||||
|
||||
---@param self node
|
||||
---@param child node
|
||||
---@return integer, boolean
|
||||
function node.child_index(self, child) end
|
||||
|
||||
---@type node
|
||||
_G.node = _G.node or node
|
||||
@@ -1,17 +0,0 @@
|
||||
---@class world
|
||||
local world = {
|
||||
}
|
||||
|
||||
---@overload fun(): gobject
|
||||
---@overload fun(transform: t2f): gobject
|
||||
---@overload fun(parent: node): gobject
|
||||
---@overload fun(parent: node, transform: t2f): gobject
|
||||
---@overload fun(prefab: prefab): gobject
|
||||
---@overload fun(prefab: prefab, transform: t2f): gobject
|
||||
---@overload fun(prefab: prefab, parent: node): gobject
|
||||
---@overload fun(prefab: prefab, parent: node, transform: t2f): gobject
|
||||
---@return gobject
|
||||
function world:instantiate(...) end
|
||||
|
||||
---@type world
|
||||
_G.the_world = _G.the_world or world
|
||||
@@ -1,79 +0,0 @@
|
||||
---@class aabb
|
||||
local aabb = {
|
||||
---@type v3f
|
||||
position = v3f.zero(),
|
||||
|
||||
---@type v3f
|
||||
size = v3f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(): aabb
|
||||
---@overload fun(r: aabb): aabb
|
||||
---@overload fun(w: number, h: number, l: number): aabb
|
||||
---@overload fun(x: number, y: number, z: number, w: number, h: number, l: number): aabb
|
||||
---@overload fun(s: v3f): aabb
|
||||
---@overload fun(p: v3f, s: v3f): aabb
|
||||
---@return aabb
|
||||
function aabb.new(...) end
|
||||
|
||||
---@return aabb
|
||||
function aabb.zero() end
|
||||
|
||||
---@return aabb
|
||||
function aabb.unit() end
|
||||
|
||||
---@overload fun(r: aabb): aabb
|
||||
---@overload fun(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): aabb
|
||||
---@overload fun(p1: v3f, p2: v3f): aabb
|
||||
---@param r aabb
|
||||
---@return aabb
|
||||
function aabb.make_minmax(r) end
|
||||
|
||||
---@param l aabb
|
||||
---@param r aabb
|
||||
---@return boolean
|
||||
function aabb.approximately(l, r) end
|
||||
|
||||
---@param r aabb
|
||||
---@return v3f
|
||||
function aabb.minimum(r) end
|
||||
|
||||
---@param r aabb
|
||||
---@return v3f
|
||||
function aabb.maximum(r) end
|
||||
|
||||
---@param r aabb
|
||||
---@return number
|
||||
function aabb.volume(r) end
|
||||
|
||||
---@param r aabb
|
||||
---@return number
|
||||
function aabb.abs_volume(r) end
|
||||
|
||||
---@param l aabb
|
||||
---@param r aabb
|
||||
---@return aabb
|
||||
function aabb.merged(l, r) end
|
||||
|
||||
---@param r aabb
|
||||
---@param p v3f
|
||||
---@return boolean
|
||||
function aabb.inside(r, p) end
|
||||
|
||||
---@param l aabb
|
||||
---@param r aabb
|
||||
---@return boolean
|
||||
function aabb.overlaps(l, r) end
|
||||
|
||||
---@param r aabb
|
||||
---@param p v3f
|
||||
---@return v3f
|
||||
function aabb.normalized_to_point(r, p) end
|
||||
|
||||
---@param r aabb
|
||||
---@param p v3f
|
||||
---@return v3f
|
||||
function aabb.point_to_normalized(r, p) end
|
||||
|
||||
---@type aabb
|
||||
_G.aabb = _G.aabb or aabb
|
||||
@@ -1,41 +0,0 @@
|
||||
---@class m2f
|
||||
local m2f = {
|
||||
---@type v2f[]
|
||||
rows = {}
|
||||
}
|
||||
|
||||
---@overload fun(): m2f
|
||||
---@overload fun(r0: v2f, r1: v2f): m2f
|
||||
---@return m2f
|
||||
function m2f.new(...) end
|
||||
|
||||
---@return m2f
|
||||
function m2f.zero() end
|
||||
|
||||
---@return m2f
|
||||
function m2f.identity() end
|
||||
|
||||
---@overload fun(x: number, y: number): m2f
|
||||
---@overload fun(xy: v2f): m2f
|
||||
---@return m2f
|
||||
function m2f.make_scale(...) end
|
||||
|
||||
---@param a number
|
||||
---@return m2f
|
||||
function m2f.make_rotation(a) end
|
||||
|
||||
---@param l m2f
|
||||
---@param r m2f
|
||||
---@return boolean
|
||||
function m2f.approximately(l, r) end
|
||||
|
||||
---@param m m2f
|
||||
---@return m2f, boolean
|
||||
function m2f.inversed(m) end
|
||||
|
||||
---@param m m2f
|
||||
---@return m2f
|
||||
function m2f.transposed(m) end
|
||||
|
||||
---@type m2f
|
||||
_G.m2f = _G.m2f or m2f
|
||||
@@ -1,46 +0,0 @@
|
||||
---@class m3f
|
||||
local m3f = {
|
||||
---@type v3f[]
|
||||
rows = {}
|
||||
}
|
||||
|
||||
---@overload fun(): m3f
|
||||
---@overload fun(r0: v3f, r1: v3f, r2: v3f): m3f
|
||||
---@return m3f
|
||||
function m3f.new(...) end
|
||||
|
||||
---@return m3f
|
||||
function m3f.zero() end
|
||||
|
||||
---@return m3f
|
||||
function m3f.identity() end
|
||||
|
||||
---@overload fun(x: number, y: number, z: number): m3f
|
||||
---@overload fun(xyz: v4f): m3f
|
||||
---@overload fun(xyz: v3f): m3f
|
||||
---@overload fun(xy: v2f, z: number): m3f
|
||||
---@return m3f
|
||||
function m3f.make_scale(...) end
|
||||
|
||||
---@overload fun(a: number, x: number, y: number, z: number): m3f
|
||||
---@overload fun(a: number, xyz: v3f): m3f
|
||||
---@overload fun(r: number, p: number, y: number): m3f
|
||||
---@overload fun(rpy: v3f): m3f
|
||||
---@return m3f
|
||||
function m3f.make_rotation(...) end
|
||||
|
||||
---@param l m3f
|
||||
---@param r m3f
|
||||
---@return boolean
|
||||
function m3f.approximately(l, r) end
|
||||
|
||||
---@param m m3f
|
||||
---@return m3f, boolean
|
||||
function m3f.inversed(m) end
|
||||
|
||||
---@param m m3f
|
||||
---@return m3f
|
||||
function m3f.transposed(m) end
|
||||
|
||||
---@type m3f
|
||||
_G.m3f = _G.m3f or m3f
|
||||
@@ -1,96 +0,0 @@
|
||||
---@class m4f
|
||||
local m4f = {
|
||||
---@type v4f[]
|
||||
rows = {}
|
||||
}
|
||||
|
||||
---@overload fun(): m4f
|
||||
---@overload fun(r0: v4f, r1: v4f, r2: v4f, r3: v4f): m4f
|
||||
---@return m4f
|
||||
function m4f.new(...) end
|
||||
|
||||
---@return m4f
|
||||
function m4f.zero() end
|
||||
|
||||
---@return m4f
|
||||
function m4f.identity() end
|
||||
|
||||
---@overload fun(x: number, y: number, z: number): m4f
|
||||
---@overload fun(xyz: v3f): m4f
|
||||
---@overload fun(xy: v2f, z: number): m4f
|
||||
---@return m4f
|
||||
function m4f.make_scale(...) end
|
||||
|
||||
---@overload fun(x: number, y: number, z: number): m4f
|
||||
---@overload fun(xyz: v3f): m4f
|
||||
---@overload fun(xy: v2f, z: number): m4f
|
||||
---@return m4f
|
||||
function m4f.make_translation(...) end
|
||||
|
||||
---@overload fun(a: number, x: number, y: number, z: number): m4f
|
||||
---@overload fun(a: number, xyz: v3f): m4f
|
||||
---@overload fun(r: number, p: number, y: number): m3f
|
||||
---@overload fun(rpy: v3f): m3f
|
||||
---@return m4f
|
||||
function m4f.make_rotation(...) end
|
||||
|
||||
---@param t t2f | t3f
|
||||
---@return m4f
|
||||
function m4f.make_trs(t) end
|
||||
|
||||
---@param eye v3f
|
||||
---@param at v3f
|
||||
---@param up v3f
|
||||
---@return m4f
|
||||
function m4f.make_look_at_lh(eye, at, up) end
|
||||
|
||||
---@param eye v3f
|
||||
---@param at v3f
|
||||
---@param up v3f
|
||||
---@return m4f
|
||||
function m4f.make_look_at_rh(eye, at, up) end
|
||||
|
||||
|
||||
---@overload fun(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): m4f
|
||||
---@overload fun(lb: v2f, rt: v2f, znear: number, zfar: number): m4f
|
||||
---@overload fun(size: v2f, znear: number, zfar: number): m4f
|
||||
---@overload fun(width: number, height: number, znear: number, zfar: number): m4f
|
||||
---@return m4f
|
||||
function m4f.make_orthographic_lh() end
|
||||
|
||||
---@overload fun(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): m4f
|
||||
---@overload fun(lb: v2f, rt: v2f, znear: number, zfar: number): m4f
|
||||
---@overload fun(size: v2f, znear: number, zfar: number): m4f
|
||||
---@overload fun(width: number, height: number, znear: number, zfar: number): m4f
|
||||
---@return m4f
|
||||
function m4f.make_orthographic_rh(left, right, bottom, top, znear, zfar) end
|
||||
|
||||
---@param angle number
|
||||
---@param aspect number
|
||||
---@param znear number
|
||||
---@param zfar number
|
||||
---@return m4f
|
||||
function m4f.make_perspective_lh(angle, aspect, znear, zfar) end
|
||||
|
||||
---@param angle number
|
||||
---@param aspect number
|
||||
---@param znear number
|
||||
---@param zfar number
|
||||
---@return m4f
|
||||
function m4f.make_perspective_rh(angle, aspect, znear, zfar) end
|
||||
|
||||
---@param l m4f
|
||||
---@param r m4f
|
||||
---@return boolean
|
||||
function m4f.approximately(l, r) end
|
||||
|
||||
---@param m m4f
|
||||
---@return m4f, boolean
|
||||
function m4f.inversed(m) end
|
||||
|
||||
---@param m m4f
|
||||
---@return m4f
|
||||
function m4f.transposed(m) end
|
||||
|
||||
---@type m4f
|
||||
_G.m4f = _G.m4f or m4f
|
||||
@@ -1,79 +0,0 @@
|
||||
---@class rect
|
||||
local rect = {
|
||||
---@type v2f
|
||||
position = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
size = v2f.zero()
|
||||
}
|
||||
|
||||
---@overload fun(): rect
|
||||
---@overload fun(r: rect): rect
|
||||
---@overload fun(w: number, h: number): rect
|
||||
---@overload fun(x: number, y: number, w: number, h: number): rect
|
||||
---@overload fun(s: v2f): rect
|
||||
---@overload fun(p: v2f, s: v2f): rect
|
||||
---@return rect
|
||||
function rect.new(...) end
|
||||
|
||||
---@return rect
|
||||
function rect.zero() end
|
||||
|
||||
---@return rect
|
||||
function rect.unit() end
|
||||
|
||||
---@overload fun(r: rect): rect
|
||||
---@overload fun(x1: number, y1: number, x2: number, y2: number): rect
|
||||
---@overload fun(p1: v2f, p2: v2f): rect
|
||||
---@param r rect
|
||||
---@return rect
|
||||
function rect.make_minmax(r) end
|
||||
|
||||
---@param l rect
|
||||
---@param r rect
|
||||
---@return boolean
|
||||
function rect.approximately(l, r) end
|
||||
|
||||
---@param r rect
|
||||
---@return v2f
|
||||
function rect.minimum(r) end
|
||||
|
||||
---@param r rect
|
||||
---@return v2f
|
||||
function rect.maximum(r) end
|
||||
|
||||
---@param r rect
|
||||
---@return number
|
||||
function rect.area(r) end
|
||||
|
||||
---@param r rect
|
||||
---@return number
|
||||
function rect.abs_area(r) end
|
||||
|
||||
---@param l rect
|
||||
---@param r rect
|
||||
---@return rect
|
||||
function rect.merged(l, r) end
|
||||
|
||||
---@param r rect
|
||||
---@param p v2f
|
||||
---@return boolean
|
||||
function rect.inside(r, p) end
|
||||
|
||||
---@param l rect
|
||||
---@param r rect
|
||||
---@return boolean
|
||||
function rect.overlaps(l, r) end
|
||||
|
||||
---@param r rect
|
||||
---@param p v2f
|
||||
---@return v2f
|
||||
function rect.normalized_to_point(r, p) end
|
||||
|
||||
---@param r rect
|
||||
---@param p v2f
|
||||
---@return v2f
|
||||
function rect.point_to_normalized(r, p) end
|
||||
|
||||
---@type rect
|
||||
_G.rect = _G.rect or rect
|
||||
@@ -1,41 +0,0 @@
|
||||
---@class t2f
|
||||
local t2f = {
|
||||
---@type v2f
|
||||
translation = v2f.zero(),
|
||||
|
||||
---@type number
|
||||
rotation = 0,
|
||||
|
||||
---@type v2f
|
||||
scale = v2f.unit()
|
||||
}
|
||||
|
||||
---@overload fun(): t2f
|
||||
---@return t2f
|
||||
function t2f.new() end
|
||||
|
||||
---@return t2f
|
||||
function t2f.zero() end
|
||||
|
||||
---@return t2f
|
||||
function t2f.identity() end
|
||||
|
||||
---@param t v2f
|
||||
---@return t2f
|
||||
function t2f.make_translation(t) end
|
||||
|
||||
---@param r number
|
||||
---@return t2f
|
||||
function t2f.make_rotation(r) end
|
||||
|
||||
---@param s v2f
|
||||
---@return t2f
|
||||
function t2f.make_scale(s) end
|
||||
|
||||
---@param l t2f
|
||||
---@param r t2f
|
||||
---@return boolean
|
||||
function t2f.approximately(l, r) end
|
||||
|
||||
---@type t2f
|
||||
_G.t2f = _G.t2f or t2f
|
||||
@@ -1,41 +0,0 @@
|
||||
---@class t3f
|
||||
local t3f = {
|
||||
---@type v3f
|
||||
translation = v3f.zero(),
|
||||
|
||||
---@type v3f
|
||||
rotation = v3f.zero(),
|
||||
|
||||
---@type v3f
|
||||
scale = v3f.unit()
|
||||
}
|
||||
|
||||
---@overload fun(): t3f
|
||||
---@return t3f
|
||||
function t3f.new() end
|
||||
|
||||
---@return t3f
|
||||
function t3f.zero() end
|
||||
|
||||
---@return t3f
|
||||
function t3f.identity() end
|
||||
|
||||
---@param t v3f
|
||||
---@return t3f
|
||||
function t3f.make_translation(t) end
|
||||
|
||||
---@param r v3f
|
||||
---@return t3f
|
||||
function t3f.make_rotation(r) end
|
||||
|
||||
---@param s v3f
|
||||
---@return t3f
|
||||
function t3f.make_scale(s) end
|
||||
|
||||
---@param l t3f
|
||||
---@param r t3f
|
||||
---@return boolean
|
||||
function t3f.approximately(l, r) end
|
||||
|
||||
---@type t3f
|
||||
_G.t3f = _G.t3f or t3f
|
||||
@@ -1,109 +0,0 @@
|
||||
---@class v2f
|
||||
local v2f = {
|
||||
---@type number
|
||||
x = 0,
|
||||
|
||||
---@type number
|
||||
y = 0
|
||||
}
|
||||
|
||||
---@overload fun(): v2f
|
||||
---@overload fun(v: number): v2f
|
||||
---@overload fun(x: number, y: number): v2f
|
||||
---@overload fun(v: v2f): v2f
|
||||
---@overload fun(v: v3f): v2f
|
||||
---@overload fun(v: v4f): v2f
|
||||
---@return v2f
|
||||
function v2f.new(...) end
|
||||
|
||||
---@return v2f
|
||||
function v2f.zero() end
|
||||
|
||||
---@return v2f
|
||||
function v2f.unit() end
|
||||
|
||||
---@return v2f
|
||||
function v2f.unit_x() end
|
||||
|
||||
---@return v2f
|
||||
function v2f.unit_y() end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@return boolean
|
||||
function v2f.approximately(l, r) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@return number
|
||||
function v2f.dot(l, r) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@return number
|
||||
function v2f.abs_dot(l, r) end
|
||||
|
||||
---@param v v2f
|
||||
---@return number
|
||||
function v2f.length_squared(v) end
|
||||
|
||||
---@param v v2f
|
||||
---@return number
|
||||
function v2f.length(v) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@return number
|
||||
function v2f.distance_squared(l, r) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@return number
|
||||
function v2f.distance(l, r) end
|
||||
|
||||
---@param v v2f
|
||||
---@return v2f
|
||||
function v2f.normalized(v) end
|
||||
|
||||
---@param v v2f
|
||||
---@return number
|
||||
function v2f.minimum(v) end
|
||||
|
||||
---@param v v2f
|
||||
---@return number
|
||||
function v2f.maximum(v) end
|
||||
|
||||
---@param v v2f
|
||||
---@param vmin v2f
|
||||
---@return v2f
|
||||
function v2f.minimized(v,vmin) end
|
||||
|
||||
---@param v v2f
|
||||
---@param vmax v2f
|
||||
---@return v2f
|
||||
function v2f.maximized(v,vmax) end
|
||||
|
||||
---@param v v2f
|
||||
---@param vmin v2f
|
||||
---@param vmax v2f
|
||||
---@return v2f
|
||||
function v2f.clamped(v,vmin,vmax) end
|
||||
|
||||
---@param v v2f
|
||||
---@return v2f
|
||||
function v2f.saturated(v) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@param v number | v2f
|
||||
---@return v2f
|
||||
function v2f.lerp(l,r,v) end
|
||||
|
||||
---@param l v2f
|
||||
---@param r v2f
|
||||
---@param v v2f
|
||||
---@return v2f
|
||||
function v2f.inverse_lerp(l,r,v) end
|
||||
|
||||
---@type v2f
|
||||
_G.v2f = _G.v2f or v2f
|
||||
@@ -1,120 +0,0 @@
|
||||
---@class v3f
|
||||
local v3f = {
|
||||
---@type number
|
||||
x = 0,
|
||||
|
||||
---@type number
|
||||
y = 0,
|
||||
|
||||
---@type number
|
||||
z = 0
|
||||
}
|
||||
|
||||
---@overload fun(): v3f
|
||||
---@overload fun(v: number): v3f
|
||||
---@overload fun(x: number, y: number, z: number): v3f
|
||||
---@overload fun(v: v2f, z: number): v3f
|
||||
---@overload fun(v: v3f): v3f
|
||||
---@overload fun(v: v4f): v3f
|
||||
---@return v3f
|
||||
function v3f.new(...) end
|
||||
|
||||
---@return v3f
|
||||
function v3f.zero() end
|
||||
|
||||
---@return v3f
|
||||
function v3f.unit() end
|
||||
|
||||
---@return v3f
|
||||
function v3f.unit_x() end
|
||||
|
||||
---@return v3f
|
||||
function v3f.unit_y() end
|
||||
|
||||
---@return v3f
|
||||
function v3f.unit_z() end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return boolean
|
||||
function v3f.approximately(l, r) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return number
|
||||
function v3f.dot(l, r) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return number
|
||||
function v3f.abs_dot(l, r) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return v3f
|
||||
function v3f.cross(l, r) end
|
||||
|
||||
---@param v v3f
|
||||
---@return number
|
||||
function v3f.length_squared(v) end
|
||||
|
||||
---@param v v3f
|
||||
---@return number
|
||||
function v3f.length(v) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return number
|
||||
function v3f.distance_squared(l, r) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@return number
|
||||
function v3f.distance(l, r) end
|
||||
|
||||
---@param v v3f
|
||||
---@return v3f
|
||||
function v3f.normalized(v) end
|
||||
|
||||
---@param v v3f
|
||||
---@return number
|
||||
function v3f.minimum(v) end
|
||||
|
||||
---@param v v3f
|
||||
---@return number
|
||||
function v3f.maximum(v) end
|
||||
|
||||
---@param v v3f
|
||||
---@param vmin v3f
|
||||
---@return v3f
|
||||
function v3f.minimized(v,vmin) end
|
||||
|
||||
---@param v v3f
|
||||
---@param vmax v3f
|
||||
---@return v3f
|
||||
function v3f.maximized(v,vmax) end
|
||||
|
||||
---@param v v3f
|
||||
---@param vmin v3f
|
||||
---@param vmax v3f
|
||||
---@return v3f
|
||||
function v3f.clamped(v,vmin,vmax) end
|
||||
|
||||
---@param v v3f
|
||||
---@return v3f
|
||||
function v3f.saturated(v) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@param v number | v3f
|
||||
---@return v3f
|
||||
function v3f.lerp(l,r,v) end
|
||||
|
||||
---@param l v3f
|
||||
---@param r v3f
|
||||
---@param v v3f
|
||||
---@return v3f
|
||||
function v3f.inverse_lerp(l,r,v) end
|
||||
|
||||
---@type v3f
|
||||
_G.v3f = _G.v3f or v3f
|
||||
@@ -1,121 +0,0 @@
|
||||
---@class v4f
|
||||
local v4f = {
|
||||
---@type number
|
||||
x = 0,
|
||||
|
||||
---@type number
|
||||
y = 0,
|
||||
|
||||
---@type number
|
||||
z = 0,
|
||||
|
||||
---@type number
|
||||
w = 0
|
||||
}
|
||||
|
||||
---@overload fun(): v4f
|
||||
---@overload fun(v: number): v4f
|
||||
---@overload fun(x: number, y: number, z: number, w: number): v4f
|
||||
---@overload fun(v: v2f, z: number, w: number): v4f
|
||||
---@overload fun(v: v3f, w: number): v4f
|
||||
---@overload fun(v: v4f): v4f
|
||||
---@return v4f
|
||||
function v4f.new(...) end
|
||||
|
||||
---@return v4f
|
||||
function v4f.zero() end
|
||||
|
||||
---@return v4f
|
||||
function v4f.unit() end
|
||||
|
||||
---@return v4f
|
||||
function v4f.unit_x() end
|
||||
|
||||
---@return v4f
|
||||
function v4f.unit_y() end
|
||||
|
||||
---@return v4f
|
||||
function v4f.unit_z() end
|
||||
|
||||
---@return v4f
|
||||
function v4f.unit_w() end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@return boolean
|
||||
function v4f.approximately(l, r) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@return number
|
||||
function v4f.dot(l, r) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@return number
|
||||
function v4f.abs_dot(l, r) end
|
||||
|
||||
---@param v v4f
|
||||
---@return number
|
||||
function v4f.length_squared(v) end
|
||||
|
||||
---@param v v4f
|
||||
---@return number
|
||||
function v4f.length(v) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@return number
|
||||
function v4f.distance_squared(l, r) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@return number
|
||||
function v4f.distance(l, r) end
|
||||
|
||||
---@param v v4f
|
||||
---@return v4f
|
||||
function v4f.normalized(v) end
|
||||
|
||||
---@param v v4f
|
||||
---@return number
|
||||
function v4f.minimum(v) end
|
||||
|
||||
---@param v v4f
|
||||
---@return number
|
||||
function v4f.maximum(v) end
|
||||
|
||||
---@param v v4f
|
||||
---@param vmin v4f
|
||||
---@return v4f
|
||||
function v4f.minimized(v,vmin) end
|
||||
|
||||
---@param v v4f
|
||||
---@param vmax v4f
|
||||
---@return v4f
|
||||
function v4f.maximized(v,vmax) end
|
||||
|
||||
---@param v v4f
|
||||
---@param vmin v4f
|
||||
---@param vmax v4f
|
||||
---@return v4f
|
||||
function v4f.clamped(v,vmin,vmax) end
|
||||
|
||||
---@param v v4f
|
||||
---@return v4f
|
||||
function v4f.saturated(v) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@param v number | v4f
|
||||
---@return v4f
|
||||
function v4f.lerp(l,r,v) end
|
||||
|
||||
---@param l v4f
|
||||
---@param r v4f
|
||||
---@param v v4f
|
||||
---@return v4f
|
||||
function v4f.inverse_lerp(l,r,v) end
|
||||
|
||||
---@type v4f
|
||||
_G.v4f = _G.v4f or v4f
|
||||
@@ -1,82 +0,0 @@
|
||||
---@class color
|
||||
local color = {
|
||||
---@type number
|
||||
r = 1.0,
|
||||
|
||||
---@type number
|
||||
g = 1.0,
|
||||
|
||||
---@type number
|
||||
b = 1.0,
|
||||
|
||||
---@type number
|
||||
a = 1.0
|
||||
}
|
||||
|
||||
---@overload fun(): color
|
||||
---@overload fun(c: color): color
|
||||
---@overload fun(c: color32): color
|
||||
---@overload fun(v: v4f): color
|
||||
---@overload fun(v: v3f, a: number): color
|
||||
---@overload fun(r: number, g: number, b: number, a: number): color
|
||||
---@return color
|
||||
function color.new(...) end
|
||||
|
||||
---@return color
|
||||
function color.clear() end
|
||||
|
||||
---@return color
|
||||
function color.black() end
|
||||
|
||||
---@return color
|
||||
function color.white() end
|
||||
|
||||
---@return color
|
||||
function color.red() end
|
||||
|
||||
---@return color
|
||||
function color.green() end
|
||||
|
||||
---@return color
|
||||
function color.blue() end
|
||||
|
||||
---@return color
|
||||
function color.yellow() end
|
||||
|
||||
---@return color
|
||||
function color.magenta() end
|
||||
|
||||
---@return color
|
||||
function color.cyan() end
|
||||
|
||||
---@param l color
|
||||
---@param r color
|
||||
---@return boolean
|
||||
function color.approximately(l, r) end
|
||||
|
||||
---@param c color
|
||||
---@return number
|
||||
function color.minimum(c) end
|
||||
|
||||
---@param c color
|
||||
---@return number
|
||||
function color.maximum(c) end
|
||||
|
||||
---@param c color
|
||||
---@param cmin color
|
||||
---@return color
|
||||
function color.minimized(c,cmin) end
|
||||
|
||||
---@param c color
|
||||
---@param cmax color
|
||||
---@return color
|
||||
function color.maximized(c,cmax) end
|
||||
|
||||
---@param c color
|
||||
---@param cmin color
|
||||
---@param cmax color
|
||||
---@return color
|
||||
function color.clamped(c,cmin,cmax) end
|
||||
|
||||
---@type color
|
||||
_G.color = _G.color or color
|
||||
@@ -1,82 +0,0 @@
|
||||
---@class color32
|
||||
local color32 = {
|
||||
---@type number
|
||||
r = 255,
|
||||
|
||||
---@type number
|
||||
g = 255,
|
||||
|
||||
---@type number
|
||||
b = 255,
|
||||
|
||||
---@type number
|
||||
a = 255
|
||||
}
|
||||
|
||||
---@overload fun(): color32
|
||||
---@overload fun(c: color): color32
|
||||
---@overload fun(c: color32): color32
|
||||
---@overload fun(v: v4f): color32
|
||||
---@overload fun(v: v3f, a: number): color32
|
||||
---@overload fun(r: number, g: number, b: number, a: number): color32
|
||||
---@return color32
|
||||
function color32.new(...) end
|
||||
|
||||
---@return color32
|
||||
function color32.clear() end
|
||||
|
||||
---@return color32
|
||||
function color32.black() end
|
||||
|
||||
---@return color32
|
||||
function color32.white() end
|
||||
|
||||
---@return color32
|
||||
function color32.red() end
|
||||
|
||||
---@return color32
|
||||
function color32.green() end
|
||||
|
||||
---@return color32
|
||||
function color32.blue() end
|
||||
|
||||
---@return color32
|
||||
function color32.yellow() end
|
||||
|
||||
---@return color32
|
||||
function color32.magenta() end
|
||||
|
||||
---@return color32
|
||||
function color32.cyan() end
|
||||
|
||||
---@param l color32
|
||||
---@param r color32
|
||||
---@return boolean
|
||||
function color32.approximately(l, r) end
|
||||
|
||||
---@param c color32
|
||||
---@return number
|
||||
function color32.minimum(c) end
|
||||
|
||||
---@param c color32
|
||||
---@return number
|
||||
function color32.maximum(c) end
|
||||
|
||||
---@param c color32
|
||||
---@param cmin color32
|
||||
---@return color32
|
||||
function color32.minimized(c,cmin) end
|
||||
|
||||
---@param c color32
|
||||
---@param cmax color32
|
||||
---@return color32
|
||||
function color32.maximized(c,cmax) end
|
||||
|
||||
---@param c color32
|
||||
---@param cmin color32
|
||||
---@param cmax color32
|
||||
---@return color32
|
||||
function color32.clamped(c,cmin,cmax) end
|
||||
|
||||
---@type color32
|
||||
_G.color32 = _G.color32 or color32
|
||||
@@ -1,20 +0,0 @@
|
||||
---@class str_hash
|
||||
local str_hash = {
|
||||
---@type boolean
|
||||
empty = true,
|
||||
|
||||
---@type number
|
||||
hash = 0
|
||||
}
|
||||
|
||||
---@overload fun(): str_hash
|
||||
---@overload fun(s: string): str_hash
|
||||
---@return str_hash
|
||||
function str_hash.new(...) end
|
||||
|
||||
---@overload fun(s: str_hash)
|
||||
---@param s str_hash
|
||||
function str_hash.clear(s) end
|
||||
|
||||
---@type str_hash
|
||||
_G.str_hash = _G.str_hash or str_hash
|
||||
@@ -1,40 +0,0 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- private
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@class fps_label_meta
|
||||
---@field last_fps number
|
||||
|
||||
---@param meta fps_label_meta
|
||||
---@param go gobject
|
||||
local function update_label_text(meta, go)
|
||||
local curr_fps = the_engine.frame_rate
|
||||
if meta.last_fps ~= curr_fps then
|
||||
meta.last_fps = curr_fps
|
||||
go.label.text = "FPS: " .. curr_fps
|
||||
end
|
||||
end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- meta
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param meta fps_label_meta
|
||||
---@param go gobject
|
||||
function M.on_start(meta, go)
|
||||
meta.last_fps = -1
|
||||
end
|
||||
|
||||
---@param meta fps_label_meta
|
||||
---@param go gobject
|
||||
function M.on_update(meta, go)
|
||||
update_label_text(meta, go)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,48 +0,0 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- private
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@class gnome_meta
|
||||
---@field life_time number
|
||||
|
||||
---@param meta gnome_meta
|
||||
---@param go gobject
|
||||
local function update_life_time(meta, go)
|
||||
local dt = the_engine.delta_time
|
||||
meta.life_time = meta.life_time - dt
|
||||
if meta.life_time <= 0 then
|
||||
go:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
---@param meta gnome_meta
|
||||
---@param go gobject
|
||||
local function update_gnome_rotation(meta, go)
|
||||
local time = the_engine.time
|
||||
go.renderer.rotation = v3f.new(0, time, 0)
|
||||
end
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- meta
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param meta gnome_meta
|
||||
---@param go gobject
|
||||
function M.on_start(meta, go)
|
||||
meta.life_time = 5
|
||||
end
|
||||
|
||||
---@param meta gnome_meta
|
||||
---@param go gobject
|
||||
function M.on_update(meta, go)
|
||||
update_life_time(meta, go)
|
||||
update_gnome_rotation(meta, go)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,22 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
---@param go gobject
|
||||
function M:on_start(go)
|
||||
the_debug:trace("sample_07: on_start")
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_update(go)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
---@param type string
|
||||
---@param event any
|
||||
function M:on_event(go, type, event)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_shutdown(go)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,29 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
---@param go gobject
|
||||
function M:on_start(go)
|
||||
the_debug:trace("sample_08: on_start")
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_update(go)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
---@param type string
|
||||
---@param event touchable_base_evt | touchable_mouse_evt
|
||||
function M:on_event(go, type, event)
|
||||
if type == "touchable.mouse_evt" then
|
||||
the_debug:trace(string.format(
|
||||
"scene %q touched(%s %s)",
|
||||
go.named and go.named.name or "---",
|
||||
event.type,
|
||||
event.button))
|
||||
end
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
function M:on_shutdown(go)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,41 +0,0 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- private
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
---@class ship_meta
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
--
|
||||
-- meta
|
||||
--
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param meta ship_meta
|
||||
---@param go gobject
|
||||
function M.on_start(meta, go)
|
||||
end
|
||||
|
||||
---@param meta ship_meta
|
||||
---@param go gobject
|
||||
function M.on_update(meta, go)
|
||||
end
|
||||
|
||||
---@param go gobject
|
||||
---@param type string
|
||||
---@param event touchable_mouse_evt
|
||||
function M:on_event(go, type, event)
|
||||
if type == "touchable.mouse_evt" then
|
||||
the_debug:trace(string.format(
|
||||
"ship %q touched(%s %s) - %s",
|
||||
go.named and go.named.name or "---",
|
||||
event.type,
|
||||
event.button,
|
||||
go == event.target and "self" or "other"))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,48 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <enduro2d/high/assets/script_asset.hpp>
|
||||
|
||||
#include <enduro2d/high/luasol.hpp>
|
||||
#include <enduro2d/high/assets/binary_asset.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
|
||||
class script_asset_loading_exception final : public asset_loading_exception {
|
||||
const char* what() const noexcept final {
|
||||
return "script asset loading exception";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
script_asset::load_async_result script_asset::load_async(
|
||||
const library& library, str_view address)
|
||||
{
|
||||
return library.load_asset_async<binary_asset>(address)
|
||||
.then([
|
||||
address = str(address)
|
||||
](const binary_asset::load_result& script_data){
|
||||
return the<deferrer>().do_in_main_thread([
|
||||
script_data,
|
||||
address = std::move(address)
|
||||
](){
|
||||
E2D_PROFILER_SCOPE_EX("script_asset.parsing", {
|
||||
{"address", address}
|
||||
});
|
||||
std::optional<script> script_opt = the<luasol>().load_script(
|
||||
script_data->content());
|
||||
if ( !script_opt ) {
|
||||
throw script_asset_loading_exception();
|
||||
}
|
||||
return script_asset::create(std::move(*script_opt));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <enduro2d/high/_high.hpp>
|
||||
|
||||
namespace e2d::bindings
|
||||
{
|
||||
template < typename T >
|
||||
struct component_wrapper {
|
||||
gcomponent<T> component;
|
||||
};
|
||||
}
|
||||
|
||||
namespace sol
|
||||
{
|
||||
template < typename T >
|
||||
struct unique_usertype_traits<e2d::bindings::component_wrapper<T>> {
|
||||
using type = e2d::gcomponent<T>;
|
||||
using actual_type = e2d::bindings::component_wrapper<T>;
|
||||
static const bool value = true;
|
||||
|
||||
static bool is_null(const actual_type& ptr) {
|
||||
return !ptr.component.exists();
|
||||
}
|
||||
|
||||
static type* get(actual_type& ptr) {
|
||||
return &ptr.component;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../bindings.hpp"
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_dbgui(sol::state& l);
|
||||
void bind_debug(sol::state& l);
|
||||
void bind_engine(sol::state& l);
|
||||
void bind_input(sol::state& l);
|
||||
void bind_window(sol::state& l);
|
||||
}
|
||||
|
||||
namespace e2d::bindings
|
||||
{
|
||||
inline void bind_core(sol::state& l) {
|
||||
core::bind_dbgui(l);
|
||||
core::bind_debug(l);
|
||||
core::bind_engine(l);
|
||||
core::bind_input(l);
|
||||
core::bind_window(l);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_core_binds.hpp"
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_dbgui(sol::state& l) {
|
||||
l.new_usertype<dbgui>("dbgui",
|
||||
sol::no_constructor,
|
||||
|
||||
"visible", sol::property(
|
||||
[](const dbgui& d) -> bool {
|
||||
return d.visible();
|
||||
},
|
||||
[](dbgui& d, bool yesno){
|
||||
d.toggle_visible(yesno);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_core_binds.hpp"
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_debug(sol::state& l) {
|
||||
l.new_usertype<debug>("debug",
|
||||
sol::no_constructor,
|
||||
|
||||
"trace", [](debug& d, str_view s){
|
||||
d.trace(s);
|
||||
},
|
||||
|
||||
"warning", [](debug& d, str_view s){
|
||||
d.warning(s);
|
||||
},
|
||||
|
||||
"error", [](debug& d, str_view s){
|
||||
d.error(s);
|
||||
},
|
||||
|
||||
"fatal", [](debug& d, str_view s){
|
||||
d.fatal(s);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_core_binds.hpp"
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_engine(sol::state& l) {
|
||||
l.new_usertype<engine>("engine",
|
||||
sol::no_constructor,
|
||||
|
||||
"time", sol::property([](const engine& e) -> f32 {
|
||||
return e.time();
|
||||
}),
|
||||
|
||||
"delta_time", sol::property([](const engine& e) -> f32 {
|
||||
return e.delta_time();
|
||||
}),
|
||||
|
||||
"frame_rate", sol::property([](const engine& e) -> u32 {
|
||||
return e.frame_rate();
|
||||
}),
|
||||
|
||||
"frame_count", sol::property([](const engine& e) -> u32 {
|
||||
return e.frame_count();
|
||||
}),
|
||||
|
||||
"realtime_time", sol::property([](const engine& e) -> f32 {
|
||||
return e.realtime_time();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_core_binds.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
|
||||
vector<str> convert_keys_to_strings(const vector<keyboard_key>& keys) {
|
||||
vector<str> strings;
|
||||
strings.reserve(keys.size());
|
||||
for ( keyboard_key key : keys ) {
|
||||
strings.push_back(str(enum_hpp::to_string_or_throw(key)));
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
vector<str> convert_buttons_to_strings(const vector<mouse_button>& buttons) {
|
||||
vector<str> strings;
|
||||
strings.reserve(buttons.size());
|
||||
for ( mouse_button btn : buttons ) {
|
||||
strings.push_back(str(enum_hpp::to_string_or_throw(btn)));
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_input(sol::state& l) {
|
||||
l.new_usertype<input>("input",
|
||||
sol::no_constructor,
|
||||
|
||||
"mouse", sol::property([](const input& i) -> const mouse& {
|
||||
return i.mouse();
|
||||
}),
|
||||
|
||||
"keyboard", sol::property([](const input& i) -> const keyboard& {
|
||||
return i.keyboard();
|
||||
})
|
||||
);
|
||||
|
||||
l.new_usertype<mouse>("mouse",
|
||||
sol::no_constructor,
|
||||
|
||||
"cursor_pos", sol::property([](const mouse& m) -> v2f {
|
||||
return m.cursor_pos();
|
||||
}),
|
||||
|
||||
"scroll_delta", sol::property([](const mouse& m) -> v2f {
|
||||
return m.scroll_delta();
|
||||
}),
|
||||
|
||||
"is_any_button_pressed", sol::property([](const mouse& m) -> bool {
|
||||
return m.is_any_button_pressed();
|
||||
}),
|
||||
|
||||
"is_any_button_just_pressed", sol::property([](const mouse& m) -> bool {
|
||||
return m.is_any_button_just_pressed();
|
||||
}),
|
||||
|
||||
"is_any_button_just_released", sol::property([](const mouse& m) -> bool {
|
||||
return m.is_any_button_just_released();
|
||||
}),
|
||||
|
||||
"is_button_pressed", [](const mouse& m, str_view n) -> bool {
|
||||
if ( auto btn = enum_hpp::from_string<mouse_button>(n) ) {
|
||||
return m.is_button_pressed(*btn);
|
||||
}
|
||||
the<debug>().error("MOUSE: unknown button name:\n"
|
||||
"--> Function: `is_button_pressed`\n"
|
||||
"--> Button: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"is_button_just_pressed", [](const mouse& m, str_view n) -> bool {
|
||||
if ( auto btn = enum_hpp::from_string<mouse_button>(n) ) {
|
||||
return m.is_button_just_pressed(*btn);
|
||||
}
|
||||
the<debug>().error("MOUSE: unknown button name:\n"
|
||||
"--> Function: `is_button_just_pressed`\n"
|
||||
"--> Button: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"is_button_just_released", [](const mouse& m, str_view n) -> bool {
|
||||
if ( auto btn = enum_hpp::from_string<mouse_button>(n) ) {
|
||||
return m.is_button_just_released(*btn);
|
||||
}
|
||||
the<debug>().error("MOUSE: unknown button name:\n"
|
||||
"--> Function: `is_button_just_released`\n"
|
||||
"--> Button: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"pressed_buttons", sol::property([](const mouse& m) -> vector<str> {
|
||||
return convert_buttons_to_strings(m.pressed_buttons());
|
||||
}),
|
||||
|
||||
"just_pressed_buttons", sol::property([](const mouse& m) -> vector<str> {
|
||||
return convert_buttons_to_strings(m.just_pressed_buttons());
|
||||
}),
|
||||
|
||||
"just_released_buttons", sol::property([](const mouse& m) -> vector<str> {
|
||||
return convert_buttons_to_strings(m.just_released_buttons());
|
||||
})
|
||||
);
|
||||
|
||||
l.new_usertype<keyboard>("keyboard",
|
||||
sol::no_constructor,
|
||||
|
||||
"input_text", sol::property([](const keyboard& k) -> str {
|
||||
return make_utf8(k.input_text());
|
||||
}),
|
||||
|
||||
"is_any_key_pressed", sol::property([](const keyboard& k) -> bool {
|
||||
return k.is_any_key_pressed();
|
||||
}),
|
||||
|
||||
"is_any_key_just_pressed", sol::property([](const keyboard& k) -> bool {
|
||||
return k.is_any_key_just_pressed();
|
||||
}),
|
||||
|
||||
"is_any_key_just_released", sol::property([](const keyboard& k) -> bool {
|
||||
return k.is_any_key_just_released();
|
||||
}),
|
||||
|
||||
"is_key_pressed", [](const keyboard& k, str_view n) -> bool {
|
||||
if ( auto key = enum_hpp::from_string<keyboard_key>(n) ) {
|
||||
return k.is_key_pressed(*key);
|
||||
}
|
||||
the<debug>().error("KEYBOARD: unknown key name:\n"
|
||||
"--> Function: `is_key_pressed`\n"
|
||||
"--> Key: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"is_key_just_pressed", [](const keyboard& k, str_view n) -> bool {
|
||||
if ( auto key = enum_hpp::from_string<keyboard_key>(n) ) {
|
||||
return k.is_key_just_pressed(*key);
|
||||
}
|
||||
the<debug>().error("KEYBOARD: unknown key name:\n"
|
||||
"--> Function: `is_key_just_pressed`\n"
|
||||
"--> Key: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"is_key_just_released", [](const keyboard& k, str_view n) -> bool {
|
||||
if ( auto key = enum_hpp::from_string<keyboard_key>(n) ) {
|
||||
return k.is_key_just_released(*key);
|
||||
}
|
||||
the<debug>().error("KEYBOARD: unknown key name:\n"
|
||||
"--> Function: `is_key_just_released`\n"
|
||||
"--> Key: %0",
|
||||
n);
|
||||
return false;
|
||||
},
|
||||
|
||||
"pressed_keys", sol::property([](const keyboard& k) -> vector<str> {
|
||||
return convert_keys_to_strings(k.pressed_keys());
|
||||
}),
|
||||
|
||||
"just_pressed_keys", sol::property([](const keyboard& k) -> vector<str> {
|
||||
return convert_keys_to_strings(k.just_pressed_keys());
|
||||
}),
|
||||
|
||||
"just_released_keys", sol::property([](const keyboard& k) -> vector<str> {
|
||||
return convert_keys_to_strings(k.just_released_keys());
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_core_binds.hpp"
|
||||
|
||||
namespace e2d::bindings::core
|
||||
{
|
||||
void bind_window(sol::state& l) {
|
||||
l.new_usertype<window>("window",
|
||||
sol::no_constructor,
|
||||
|
||||
"hide", [](window& w) {
|
||||
w.hide();
|
||||
},
|
||||
|
||||
"show", [](window& w) {
|
||||
w.show();
|
||||
},
|
||||
|
||||
"restore", [](window& w) {
|
||||
w.restore();
|
||||
},
|
||||
|
||||
"minimize", [](window& w) {
|
||||
w.minimize();
|
||||
},
|
||||
|
||||
"enabled", sol::property([](const window& w) -> bool {
|
||||
return w.enabled();
|
||||
}),
|
||||
|
||||
"visible", sol::property([](const window& w) -> bool {
|
||||
return w.visible();
|
||||
}),
|
||||
|
||||
"focused", sol::property([](const window& w) -> bool {
|
||||
return w.focused();
|
||||
}),
|
||||
|
||||
"minimized", sol::property([](const window& w) -> bool {
|
||||
return w.minimized();
|
||||
}),
|
||||
|
||||
"fullscreen", sol::property(
|
||||
[](const window& w) -> bool {
|
||||
return w.fullscreen();
|
||||
},
|
||||
[](window& w, bool yesno){
|
||||
w.toggle_fullscreen(yesno);
|
||||
}),
|
||||
|
||||
"cursor_hidden", sol::property(
|
||||
&window::is_cursor_hidden,
|
||||
[](window& w, bool yesno){
|
||||
if ( yesno ) {
|
||||
w.hide_cursor();
|
||||
} else {
|
||||
w.show_cursor();
|
||||
}
|
||||
}),
|
||||
|
||||
"dpi_scale", sol::property([](const window& w) -> v2f {
|
||||
return w.dpi_scale().cast_to<f32>();
|
||||
}),
|
||||
|
||||
"real_size", sol::property([](const window& w) -> v2f {
|
||||
return w.real_size().cast_to<f32>();
|
||||
}),
|
||||
|
||||
"virtual_size", sol::property([](const window& w) -> v2f {
|
||||
return w.virtual_size().cast_to<f32>();
|
||||
}),
|
||||
|
||||
"framebuffer_size", sol::property([](const window& w) -> v2f {
|
||||
return w.framebuffer_size().cast_to<f32>();
|
||||
}),
|
||||
|
||||
"title", sol::property(
|
||||
[](const window& w) -> str {
|
||||
return w.title();
|
||||
},
|
||||
[](window& w, str_view t){
|
||||
w.set_title(t);
|
||||
}),
|
||||
|
||||
"should_close", sol::property(
|
||||
[](const window& w) -> bool {
|
||||
return w.should_close();
|
||||
},
|
||||
[](window& w, bool yesno){
|
||||
w.set_should_close(yesno);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../bindings.hpp"
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_editor(sol::state& l);
|
||||
void bind_library(sol::state& l);
|
||||
void bind_luasol(sol::state& l);
|
||||
void bind_world(sol::state& l);
|
||||
|
||||
void bind_node(sol::state& l);
|
||||
void bind_gobject(sol::state& l);
|
||||
|
||||
void bind_actor(sol::state& l);
|
||||
void bind_behaviour(sol::state& l);
|
||||
void bind_camera(sol::state& l);
|
||||
void bind_colliders(sol::state& l);
|
||||
void bind_flipbook_player(sol::state& l);
|
||||
void bind_label(sol::state& l);
|
||||
void bind_layout(sol::state& l);
|
||||
void bind_model_renderer(sol::state& l);
|
||||
void bind_named(sol::state& l);
|
||||
void bind_renderer(sol::state& l);
|
||||
void bind_scene(sol::state& l);
|
||||
void bind_spine_player(sol::state& l);
|
||||
void bind_sprite_renderer(sol::state& l);
|
||||
void bind_touchable(sol::state& l);
|
||||
void bind_widget(sol::state& l);
|
||||
}
|
||||
|
||||
namespace e2d::bindings
|
||||
{
|
||||
inline void bind_high(sol::state& l) {
|
||||
high::bind_editor(l);
|
||||
high::bind_library(l);
|
||||
high::bind_luasol(l);
|
||||
high::bind_world(l);
|
||||
|
||||
high::bind_node(l);
|
||||
high::bind_gobject(l);
|
||||
|
||||
high::bind_actor(l);
|
||||
high::bind_behaviour(l);
|
||||
high::bind_camera(l);
|
||||
high::bind_colliders(l);
|
||||
high::bind_flipbook_player(l);
|
||||
high::bind_label(l);
|
||||
high::bind_layout(l);
|
||||
high::bind_model_renderer(l);
|
||||
high::bind_named(l);
|
||||
high::bind_renderer(l);
|
||||
high::bind_scene(l);
|
||||
high::bind_spine_player(l);
|
||||
high::bind_sprite_renderer(l);
|
||||
high::bind_touchable(l);
|
||||
high::bind_widget(l);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/actor.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_actor(sol::state& l) {
|
||||
l.new_usertype<gcomponent<actor>>("actor",
|
||||
sol::no_constructor,
|
||||
|
||||
"node", sol::property([](gcomponent<actor>& c) -> node_iptr {
|
||||
return c->node();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/behaviour.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_behaviour(sol::state& l) {
|
||||
l.new_usertype<gcomponent<behaviour>>("behaviour",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<behaviour>& c){
|
||||
c.component<disabled<behaviour>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<behaviour>& c){
|
||||
c.component<disabled<behaviour>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<behaviour>& c) -> bool {
|
||||
return !c.component<disabled<behaviour>>().exists();
|
||||
},
|
||||
[](gcomponent<behaviour>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<behaviour>>().remove();
|
||||
} else {
|
||||
c.component<disabled<behaviour>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<behaviour>& c) -> bool {
|
||||
return c.component<disabled<behaviour>>().exists();
|
||||
},
|
||||
[](gcomponent<behaviour>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<behaviour>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<behaviour>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"meta", sol::property([](const gcomponent<behaviour>& c) -> sol::table {
|
||||
return c->meta();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/camera.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_camera(sol::state& l) {
|
||||
l.new_usertype<gcomponent<camera>>("camera",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<camera>& c){
|
||||
c.component<disabled<camera>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<camera>& c){
|
||||
c.component<disabled<camera>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<camera>& c) -> bool {
|
||||
return !c.component<disabled<camera>>().exists();
|
||||
},
|
||||
[](gcomponent<camera>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<camera>>().remove();
|
||||
} else {
|
||||
c.component<disabled<camera>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<camera>& c) -> bool {
|
||||
return c.component<disabled<camera>>().exists();
|
||||
},
|
||||
[](gcomponent<camera>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<camera>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<camera>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"input", sol::property(
|
||||
[](const gcomponent<camera>& c) -> bool {
|
||||
return c.component<camera::input>().exists();
|
||||
},
|
||||
[](gcomponent<camera>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<camera::input>().ensure();
|
||||
} else {
|
||||
c.component<camera::input>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"gizmos", sol::property(
|
||||
[](const gcomponent<camera>& c) -> bool {
|
||||
return c.component<camera::gizmos>().exists();
|
||||
},
|
||||
[](gcomponent<camera>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<camera::gizmos>().ensure();
|
||||
} else {
|
||||
c.component<camera::gizmos>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"depth", sol::property(
|
||||
[](const gcomponent<camera>& c) -> i32 {
|
||||
return c->depth();
|
||||
},
|
||||
[](gcomponent<camera>& c, i32 v){
|
||||
c->depth(v);
|
||||
}),
|
||||
|
||||
"mode", sol::property(
|
||||
[](const gcomponent<camera>& c) -> camera::modes {
|
||||
return c->mode();
|
||||
},
|
||||
[](gcomponent<camera>& c, camera::modes v){
|
||||
c->mode(v);
|
||||
}),
|
||||
|
||||
"znear", sol::property(
|
||||
[](const gcomponent<camera>& c) -> f32 {
|
||||
return c->znear();
|
||||
},
|
||||
[](gcomponent<camera>& c, f32 v){
|
||||
c->znear(v);
|
||||
}),
|
||||
|
||||
"zfar", sol::property(
|
||||
[](const gcomponent<camera>& c) -> f32 {
|
||||
return c->zfar();
|
||||
},
|
||||
[](gcomponent<camera>& c, f32 v){
|
||||
c->zfar(v);
|
||||
}),
|
||||
|
||||
"view", sol::property(
|
||||
[](const gcomponent<camera>& c) -> m4f {
|
||||
return c->view();
|
||||
},
|
||||
[](gcomponent<camera>& c, const m4f& v){
|
||||
c->view(v);
|
||||
}),
|
||||
|
||||
"viewport", sol::property(
|
||||
[](const gcomponent<camera>& c) -> b2f {
|
||||
return c->viewport();
|
||||
},
|
||||
[](gcomponent<camera>& c, const b2f& v){
|
||||
c->viewport(v);
|
||||
}),
|
||||
|
||||
"projection", sol::property(
|
||||
[](const gcomponent<camera>& c) -> m4f {
|
||||
return c->projection();
|
||||
},
|
||||
[](gcomponent<camera>& c, const m4f& v){
|
||||
c->projection(v);
|
||||
}),
|
||||
|
||||
"background", sol::property(
|
||||
[](const gcomponent<camera>& c) -> color {
|
||||
return c->background();
|
||||
},
|
||||
[](gcomponent<camera>& c, const color& v){
|
||||
c->background(v);
|
||||
})
|
||||
);
|
||||
|
||||
#define CAMERA_MODE_PAIR(x) {#x, camera::modes::x},
|
||||
l["camera"].get_or_create<sol::table>()
|
||||
.new_enum<camera::modes>("modes", {
|
||||
CAMERA_MODE_PAIR(manual)
|
||||
CAMERA_MODE_PAIR(stretch)
|
||||
CAMERA_MODE_PAIR(flexible)
|
||||
CAMERA_MODE_PAIR(fixed_fit)
|
||||
CAMERA_MODE_PAIR(fixed_crop)
|
||||
});
|
||||
#undef CAMERA_MODE_PAIR
|
||||
}
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/colliders.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
|
||||
void bind_rect_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<rect_collider>>("rect_collider",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<rect_collider>& c){
|
||||
c.component<disabled<rect_collider>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<rect_collider>& c){
|
||||
c.component<disabled<rect_collider>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<rect_collider>& c) -> bool {
|
||||
return !c.component<disabled<rect_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<rect_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<rect_collider>>().remove();
|
||||
} else {
|
||||
c.component<disabled<rect_collider>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<rect_collider>& c) -> bool {
|
||||
return c.component<disabled<rect_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<rect_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<rect_collider>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<rect_collider>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"size", sol::property(
|
||||
[](const gcomponent<rect_collider>& c) -> v2f {
|
||||
return c->size();
|
||||
},
|
||||
[](gcomponent<rect_collider>& c, const v2f& v){
|
||||
c->size(v);
|
||||
}),
|
||||
|
||||
"offset", sol::property(
|
||||
[](const gcomponent<rect_collider>& c) -> v2f {
|
||||
return c->offset();
|
||||
},
|
||||
[](gcomponent<rect_collider>& c, const v2f& v){
|
||||
c->offset(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
void bind_circle_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<circle_collider>>("circle_collider",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<circle_collider>& c){
|
||||
c.component<disabled<circle_collider>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<circle_collider>& c){
|
||||
c.component<disabled<circle_collider>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<circle_collider>& c) -> bool {
|
||||
return !c.component<disabled<circle_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<circle_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<circle_collider>>().remove();
|
||||
} else {
|
||||
c.component<disabled<circle_collider>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<circle_collider>& c) -> bool {
|
||||
return c.component<disabled<circle_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<circle_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<circle_collider>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<circle_collider>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"radius", sol::property(
|
||||
[](const gcomponent<circle_collider>& c) -> f32 {
|
||||
return c->radius();
|
||||
},
|
||||
[](gcomponent<circle_collider>& c, f32 v){
|
||||
c->radius(v);
|
||||
}),
|
||||
|
||||
"offset", sol::property(
|
||||
[](const gcomponent<circle_collider>& c) -> v2f {
|
||||
return c->offset();
|
||||
},
|
||||
[](gcomponent<circle_collider>& c, const v2f& v){
|
||||
c->offset(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
void bind_polygon_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<polygon_collider>>("polygon_collider",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<polygon_collider>& c){
|
||||
c.component<disabled<polygon_collider>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<polygon_collider>& c){
|
||||
c.component<disabled<polygon_collider>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<polygon_collider>& c) -> bool {
|
||||
return !c.component<disabled<polygon_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<polygon_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<polygon_collider>>().remove();
|
||||
} else {
|
||||
c.component<disabled<polygon_collider>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<polygon_collider>& c) -> bool {
|
||||
return c.component<disabled<polygon_collider>>().exists();
|
||||
},
|
||||
[](gcomponent<polygon_collider>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<polygon_collider>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<polygon_collider>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"points", sol::property(
|
||||
[](const gcomponent<polygon_collider>& c) -> vector<v2f> {
|
||||
return c->points();
|
||||
},
|
||||
[](gcomponent<polygon_collider>& c, vector<v2f> v){
|
||||
c->points(std::move(v));
|
||||
}),
|
||||
|
||||
"offset", sol::property(
|
||||
[](const gcomponent<polygon_collider>& c) -> v2f {
|
||||
return c->offset();
|
||||
},
|
||||
[](gcomponent<polygon_collider>& c, const v2f& v){
|
||||
c->offset(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_colliders(sol::state& l) {
|
||||
bind_rect_collider(l);
|
||||
bind_circle_collider(l);
|
||||
bind_polygon_collider(l);
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/flipbook_player.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_flipbook_player(sol::state& l) {
|
||||
l.new_usertype<gcomponent<flipbook_player>>("flipbook_player",
|
||||
sol::no_constructor,
|
||||
|
||||
"time", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> f32 {
|
||||
return c->time();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, f32 v){
|
||||
c->time(v);
|
||||
}),
|
||||
|
||||
"speed", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> f32 {
|
||||
return c->speed();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, f32 v){
|
||||
c->speed(v);
|
||||
}),
|
||||
|
||||
"looped", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> bool {
|
||||
return c->looped();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, bool v){
|
||||
c->looped(v);
|
||||
}),
|
||||
|
||||
"stopped", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> bool {
|
||||
return c->stopped();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, bool v){
|
||||
c->stopped(v);
|
||||
}),
|
||||
|
||||
"playing", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> bool {
|
||||
return c->playing();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, bool v) {
|
||||
c->playing(v);
|
||||
}),
|
||||
|
||||
"sequence", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> str_hash {
|
||||
return c->sequence();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, str_hash v){
|
||||
c->sequence(v);
|
||||
}),
|
||||
|
||||
"flipbook", sol::property(
|
||||
[](const gcomponent<flipbook_player>& c) -> flipbook_asset::ptr {
|
||||
return c->flipbook();
|
||||
},
|
||||
[](gcomponent<flipbook_player>& c, const flipbook_asset::ptr& v){
|
||||
c->flipbook(v);
|
||||
}),
|
||||
|
||||
"stop", sol::overload(
|
||||
[](gcomponent<flipbook_player>& c, f32 v){ c->stop(v); },
|
||||
[](gcomponent<flipbook_player>& c, str_view v){ c->stop(v); },
|
||||
[](gcomponent<flipbook_player>& c, str_hash v){ c->stop(v); }),
|
||||
|
||||
"play", sol::overload(
|
||||
[](gcomponent<flipbook_player>& c, f32 v){ c->play(v); },
|
||||
[](gcomponent<flipbook_player>& c, str_view v){ c->play(v); },
|
||||
[](gcomponent<flipbook_player>& c, str_hash v){ c->play(v); })
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/label.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_label(sol::state& l) {
|
||||
l.new_usertype<gcomponent<label>>("label",
|
||||
sol::no_constructor,
|
||||
|
||||
"dirty", sol::property(
|
||||
[](const gcomponent<label>& c) -> bool {
|
||||
return labels::is_dirty(c);
|
||||
},
|
||||
[](gcomponent<label>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
labels::mark_dirty(c);
|
||||
} else {
|
||||
labels::unmark_dirty(c);
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"text", sol::property(
|
||||
[](const gcomponent<label>& c) -> str {
|
||||
return c->text();
|
||||
},
|
||||
[](gcomponent<label>& c, str_view v){
|
||||
labels::change_text(c, str(v));
|
||||
}),
|
||||
|
||||
"font", sol::property(
|
||||
[](const gcomponent<label>& c) -> font_asset::ptr {
|
||||
return c->font();
|
||||
},
|
||||
[](gcomponent<label>& c, const font_asset::ptr& v){
|
||||
labels::change_font(c, v);
|
||||
}),
|
||||
|
||||
"tint", sol::property(
|
||||
[](const gcomponent<label>& c) -> color32 {
|
||||
return c->tint();
|
||||
},
|
||||
[](gcomponent<label>& c, const color32& v){
|
||||
labels::change_tint(c, v);
|
||||
}),
|
||||
|
||||
"halign", sol::property(
|
||||
[](const gcomponent<label>& c) -> label::haligns {
|
||||
return c->halign();
|
||||
},
|
||||
[](gcomponent<label>& c, label::haligns v){
|
||||
labels::change_halign(c, v);
|
||||
}),
|
||||
|
||||
"valign", sol::property(
|
||||
[](const gcomponent<label>& c) -> label::valigns {
|
||||
return c->valign();
|
||||
},
|
||||
[](gcomponent<label>& c, label::valigns v){
|
||||
labels::change_valign(c, v);
|
||||
}),
|
||||
|
||||
"leading", sol::property(
|
||||
[](const gcomponent<label>& c) -> f32 {
|
||||
return c->leading();
|
||||
},
|
||||
[](gcomponent<label>& c, f32 v){
|
||||
labels::change_leading(c, v);
|
||||
}),
|
||||
|
||||
"tracking", sol::property(
|
||||
[](const gcomponent<label>& c) -> f32 {
|
||||
return c->tracking();
|
||||
},
|
||||
[](gcomponent<label>& c, f32 v){
|
||||
labels::change_tracking(c, v);
|
||||
}),
|
||||
|
||||
"text_width", sol::property(
|
||||
[](const gcomponent<label>& c) -> f32 {
|
||||
return c->text_width();
|
||||
},
|
||||
[](gcomponent<label>& c, f32 v){
|
||||
labels::change_text_width(c, v);
|
||||
}),
|
||||
|
||||
"glyph_dilate", sol::property(
|
||||
[](const gcomponent<label>& c) -> f32 {
|
||||
return c->glyph_dilate();
|
||||
},
|
||||
[](gcomponent<label>& c, f32 v){
|
||||
labels::change_glyph_dilate(c, v);
|
||||
}),
|
||||
|
||||
"outline_width", sol::property(
|
||||
[](const gcomponent<label>& c) -> f32 {
|
||||
return c->outline_width();
|
||||
},
|
||||
[](gcomponent<label>& c, f32 v){
|
||||
labels::change_outline_width(c, v);
|
||||
}),
|
||||
|
||||
"outline_color", sol::property(
|
||||
[](const gcomponent<label>& c) -> color32 {
|
||||
return c->outline_color();
|
||||
},
|
||||
[](gcomponent<label>& c, const color32& v){
|
||||
labels::change_outline_color(c, v);
|
||||
})
|
||||
);
|
||||
|
||||
#define LABEL_HALIGN_PAIR(x) {#x, label::haligns::x},
|
||||
l["label"].get_or_create<sol::table>()
|
||||
.new_enum<label::haligns>("haligns", {
|
||||
LABEL_HALIGN_PAIR(left)
|
||||
LABEL_HALIGN_PAIR(center)
|
||||
LABEL_HALIGN_PAIR(right)
|
||||
});
|
||||
#undef LABEL_HALIGN_PAIR
|
||||
|
||||
#define LABEL_VALIGN_PAIR(x) {#x, label::valigns::x},
|
||||
l["label"].get_or_create<sol::table>()
|
||||
.new_enum<label::valigns>("valigns", {
|
||||
LABEL_VALIGN_PAIR(top)
|
||||
LABEL_VALIGN_PAIR(center)
|
||||
LABEL_VALIGN_PAIR(bottom)
|
||||
LABEL_VALIGN_PAIR(baseline)
|
||||
});
|
||||
#undef LABEL_VALIGN_PAIR
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/layout.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_layout(sol::state& l) {
|
||||
l.new_usertype<gcomponent<layout>>("layout",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<layout>& c){
|
||||
c.component<disabled<layout>>().remove();
|
||||
layouts::mark_dirty(c);
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<layout>& c){
|
||||
c.component<disabled<layout>>().ensure();
|
||||
layouts::mark_dirty(c);
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<layout>& c) -> bool {
|
||||
return !c.component<disabled<layout>>().exists();
|
||||
},
|
||||
[](gcomponent<layout>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<layout>>().remove();
|
||||
} else {
|
||||
c.component<disabled<layout>>().ensure();
|
||||
}
|
||||
layouts::mark_dirty(c);
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<layout>& c) -> bool {
|
||||
return c.component<disabled<layout>>().exists();
|
||||
},
|
||||
[](gcomponent<layout>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<layout>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<layout>>().remove();
|
||||
}
|
||||
layouts::mark_dirty(c);
|
||||
}
|
||||
),
|
||||
|
||||
"dirty", sol::property(
|
||||
[](const gcomponent<layout>& c) -> bool {
|
||||
return layouts::is_dirty(c);
|
||||
},
|
||||
[](gcomponent<layout>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
layouts::mark_dirty(c);
|
||||
} else {
|
||||
layouts::unmark_dirty(c);
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"direction", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::directions {
|
||||
return c->direction();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::directions v){
|
||||
layouts::change_direction(c, v);
|
||||
}),
|
||||
|
||||
"align_items", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::align_modes {
|
||||
return c->align_items();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::align_modes v){
|
||||
layouts::change_align_items(c, v);
|
||||
}),
|
||||
|
||||
"align_content", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::align_modes {
|
||||
return c->align_content();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::align_modes v){
|
||||
layouts::change_align_content(c, v);
|
||||
}),
|
||||
|
||||
"justify_content", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::justify_modes {
|
||||
return c->justify_content();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::justify_modes v){
|
||||
layouts::change_justify_content(c, v);
|
||||
}),
|
||||
|
||||
"flex_wrap", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::flex_wraps {
|
||||
return c->flex_wrap();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::flex_wraps v){
|
||||
layouts::change_flex_wrap(c, v);
|
||||
}),
|
||||
|
||||
"flex_direction", sol::property(
|
||||
[](const gcomponent<layout>& c) -> layout::flex_directions {
|
||||
return c->flex_direction();
|
||||
},
|
||||
[](gcomponent<layout>& c, layout::flex_directions v){
|
||||
layouts::change_flex_direction(c, v);
|
||||
})
|
||||
);
|
||||
|
||||
#define LAYOUT_DIRECTION_PAIR(x) {#x, layout::directions::x},
|
||||
l["layout"].get_or_create<sol::table>()
|
||||
.new_enum<layout::directions>("directions", {
|
||||
LAYOUT_DIRECTION_PAIR(ltr)
|
||||
LAYOUT_DIRECTION_PAIR(rtl)
|
||||
});
|
||||
#undef LAYOUT_DIRECTION_PAIR
|
||||
|
||||
#define LAYOUT_ALIGN_MODE_PAIR(x) {#x, layout::align_modes::x},
|
||||
l["layout"].get_or_create<sol::table>()
|
||||
.new_enum<layout::align_modes>("align_modes", {
|
||||
LAYOUT_ALIGN_MODE_PAIR(flex_start)
|
||||
LAYOUT_ALIGN_MODE_PAIR(center)
|
||||
LAYOUT_ALIGN_MODE_PAIR(flex_end)
|
||||
LAYOUT_ALIGN_MODE_PAIR(space_between)
|
||||
LAYOUT_ALIGN_MODE_PAIR(space_around)
|
||||
});
|
||||
#undef LAYOUT_ALIGN_MODE_PAIR
|
||||
|
||||
#define LAYOUT_JUSTIFY_MODE_PAIR(x) {#x, layout::justify_modes::x},
|
||||
l["layout"].get_or_create<sol::table>()
|
||||
.new_enum<layout::justify_modes>("justify_modes", {
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(flex_start)
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(center)
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(flex_end)
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(space_between)
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(space_around)
|
||||
LAYOUT_JUSTIFY_MODE_PAIR(space_evenly)
|
||||
});
|
||||
#undef LAYOUT_JUSTIFY_MODE_PAIR
|
||||
|
||||
#define LAYOUT_FLEX_WRAP_PAIR(x) {#x, layout::flex_wraps::x},
|
||||
l["layout"].get_or_create<sol::table>()
|
||||
.new_enum<layout::flex_wraps>("flex_wraps", {
|
||||
LAYOUT_FLEX_WRAP_PAIR(no_wrap)
|
||||
LAYOUT_FLEX_WRAP_PAIR(wrap)
|
||||
LAYOUT_FLEX_WRAP_PAIR(wrap_reversed)
|
||||
});
|
||||
#undef LAYOUT_FLEX_WRAP_PAIR
|
||||
|
||||
#define LAYOUT_FLEX_DIRECTION_PAIR(x) {#x, layout::flex_directions::x},
|
||||
l["layout"].get_or_create<sol::table>()
|
||||
.new_enum<layout::flex_directions>("flex_directions", {
|
||||
LAYOUT_FLEX_DIRECTION_PAIR(row)
|
||||
LAYOUT_FLEX_DIRECTION_PAIR(row_reversed)
|
||||
LAYOUT_FLEX_DIRECTION_PAIR(column)
|
||||
LAYOUT_FLEX_DIRECTION_PAIR(column_reversed)
|
||||
});
|
||||
#undef LAYOUT_FLEX_DIRECTION_PAIR
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/model_renderer.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_model_renderer(sol::state& l) {
|
||||
l.new_usertype<gcomponent<model_renderer>>("model_renderer",
|
||||
sol::no_constructor,
|
||||
|
||||
"model", sol::property(
|
||||
[](const gcomponent<model_renderer>& c) -> model_asset::ptr {
|
||||
return c->model();
|
||||
},
|
||||
[](gcomponent<model_renderer>& c, const model_asset::ptr& v){
|
||||
c->model(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/named.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_named(sol::state& l) {
|
||||
l.new_usertype<gcomponent<named>>("named",
|
||||
sol::no_constructor,
|
||||
|
||||
"name", sol::property(
|
||||
[](const gcomponent<named>& c) -> str {
|
||||
return c->name();
|
||||
},
|
||||
[](gcomponent<named>& c, str_view v){
|
||||
c->name(str(v));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/renderer.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_renderer(sol::state& l) {
|
||||
l.new_usertype<gcomponent<renderer>>("renderer",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<renderer>& c){
|
||||
c.component<disabled<renderer>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<renderer>& c){
|
||||
c.component<disabled<renderer>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> bool {
|
||||
return !c.component<disabled<renderer>>().exists();
|
||||
},
|
||||
[](gcomponent<renderer>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<renderer>>().remove();
|
||||
} else {
|
||||
c.component<disabled<renderer>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> bool {
|
||||
return c.component<disabled<renderer>>().exists();
|
||||
},
|
||||
[](gcomponent<renderer>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<renderer>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<renderer>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"transform", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> t3f { return c->transform(); },
|
||||
[](gcomponent<renderer>& c, const t3f& v) { c->transform(v); }),
|
||||
|
||||
"translation", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> v3f { return c->translation(); },
|
||||
[](gcomponent<renderer>& c, const v3f& v) { c->translation(v); }),
|
||||
|
||||
"rotation", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> v3f { return c->rotation(); },
|
||||
[](gcomponent<renderer>& c, const v3f& v) { c->rotation(v); }),
|
||||
|
||||
"scale", sol::property(
|
||||
[](const gcomponent<renderer>& c) -> v3f { return c->scale(); },
|
||||
[](gcomponent<renderer>& c, const v3f& v) { c->scale(v); })
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/scene.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_scene(sol::state& l) {
|
||||
l.new_usertype<gcomponent<scene>>("scene",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<scene>& c){
|
||||
c.component<disabled<scene>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<scene>& c){
|
||||
c.component<disabled<scene>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<scene>& c) -> bool {
|
||||
return !c.component<disabled<scene>>().exists();
|
||||
},
|
||||
[](gcomponent<scene>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<scene>>().remove();
|
||||
} else {
|
||||
c.component<disabled<scene>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<scene>& c) -> bool {
|
||||
return c.component<disabled<scene>>().exists();
|
||||
},
|
||||
[](gcomponent<scene>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<scene>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<scene>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"depth", sol::property(
|
||||
[](const gcomponent<scene>& c) -> i32 {
|
||||
return c->depth();
|
||||
},
|
||||
[](gcomponent<scene>& c, i32 v){
|
||||
c->depth(v);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/commands.hpp>
|
||||
#include <enduro2d/high/components/spine_player.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_spine_player(sol::state& l) {
|
||||
l.new_usertype<gcomponent<spine_player>>("spine_player",
|
||||
sol::no_constructor,
|
||||
|
||||
"spine", sol::property(
|
||||
[](const gcomponent<spine_player>& c) -> spine_asset::ptr {
|
||||
return c->spine();
|
||||
},
|
||||
[](gcomponent<spine_player>& c, const spine_asset::ptr& v){
|
||||
c->spine(v);
|
||||
}),
|
||||
|
||||
"skin", [](gcomponent<spine_player>& c, str_view name) -> bool {
|
||||
return c->skin(name);
|
||||
},
|
||||
|
||||
"attachment", [](gcomponent<spine_player>& c, str_view slot, str_view name) -> bool {
|
||||
return c->attachment(slot, name);
|
||||
},
|
||||
|
||||
"has_skin", [](const gcomponent<spine_player>& c, str_view name){
|
||||
return c->has_skin(name);
|
||||
},
|
||||
|
||||
"has_animation", [](const gcomponent<spine_player>& c, str_view name){
|
||||
return c->has_animation(name);
|
||||
},
|
||||
|
||||
"add_command", [](
|
||||
gcomponent<spine_player>& c,
|
||||
spine_player_commands::command cmd)
|
||||
{
|
||||
c.owner()
|
||||
.component<commands<spine_player_commands::command>>()
|
||||
.ensure()
|
||||
.add(std::move(cmd));
|
||||
}
|
||||
);
|
||||
|
||||
//
|
||||
// events
|
||||
//
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_events::custom_evt>("custom_evt",
|
||||
sol::constructors<
|
||||
spine_player_events::custom_evt(),
|
||||
spine_player_events::custom_evt(str)>(),
|
||||
|
||||
"name", sol::property(
|
||||
[](const spine_player_events::custom_evt& c) -> str {
|
||||
return c.name();
|
||||
},
|
||||
sol::resolve<spine_player_events::custom_evt&(str)>(
|
||||
&spine_player_events::custom_evt::name)),
|
||||
|
||||
"int_value", sol::property(
|
||||
[](const spine_player_events::custom_evt& c) -> i32 {
|
||||
return c.int_value();
|
||||
},
|
||||
sol::resolve<spine_player_events::custom_evt&(i32)>(
|
||||
&spine_player_events::custom_evt::int_value)),
|
||||
|
||||
"float_value", sol::property(
|
||||
[](const spine_player_events::custom_evt& c) -> f32 {
|
||||
return c.float_value();
|
||||
},
|
||||
sol::resolve<spine_player_events::custom_evt&(f32)>(
|
||||
&spine_player_events::custom_evt::float_value)),
|
||||
|
||||
"string_value", sol::property(
|
||||
[](const spine_player_events::custom_evt& c) -> str {
|
||||
return c.string_value();
|
||||
},
|
||||
sol::resolve<spine_player_events::custom_evt&(str)>(
|
||||
&spine_player_events::custom_evt::string_value))
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_events::end_evt>("end_evt",
|
||||
sol::constructors<
|
||||
spine_player_events::end_evt(),
|
||||
spine_player_events::end_evt(str)>(),
|
||||
|
||||
"message", sol::property(
|
||||
[](const spine_player_events::end_evt& c) -> str {
|
||||
return c.message();
|
||||
},
|
||||
sol::resolve<spine_player_events::end_evt&(str)>(
|
||||
&spine_player_events::end_evt::message))
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_events::complete_evt>("complete_evt",
|
||||
sol::constructors<
|
||||
spine_player_events::complete_evt(),
|
||||
spine_player_events::complete_evt(str)>(),
|
||||
|
||||
"message", sol::property(
|
||||
[](const spine_player_events::complete_evt& c) -> str {
|
||||
return c.message();
|
||||
},
|
||||
sol::resolve<spine_player_events::complete_evt&(str)>(
|
||||
&spine_player_events::complete_evt::message))
|
||||
);
|
||||
|
||||
//
|
||||
// commands
|
||||
//
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_commands::clear_track_cmd>("clear_track_cmd",
|
||||
sol::constructors<spine_player_commands::clear_track_cmd(u32)>(),
|
||||
|
||||
"track", sol::property(
|
||||
[](const spine_player_commands::clear_track_cmd& c) -> u32 {
|
||||
return c.track();
|
||||
})
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_commands::set_anim_cmd>("set_anim_cmd",
|
||||
sol::constructors<spine_player_commands::set_anim_cmd(u32,str)>(),
|
||||
|
||||
"track", sol::property(
|
||||
[](const spine_player_commands::set_anim_cmd& c) -> u32 {
|
||||
return c.track();
|
||||
}),
|
||||
|
||||
"name", sol::property(
|
||||
[](const spine_player_commands::set_anim_cmd& c) -> str {
|
||||
return c.name();
|
||||
}),
|
||||
|
||||
"loop", sol::property(
|
||||
[](const spine_player_commands::set_anim_cmd& c) -> bool {
|
||||
return c.loop();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_anim_cmd&(bool)>(
|
||||
&spine_player_commands::set_anim_cmd::loop)),
|
||||
|
||||
"end_message", sol::property(
|
||||
[](const spine_player_commands::set_anim_cmd& c) -> str {
|
||||
return c.end_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_anim_cmd&(str)>(
|
||||
&spine_player_commands::set_anim_cmd::end_message)),
|
||||
|
||||
"complete_message", sol::property(
|
||||
[](const spine_player_commands::set_anim_cmd& c) -> str {
|
||||
return c.complete_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_anim_cmd&(str)>(
|
||||
&spine_player_commands::set_anim_cmd::complete_message))
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_commands::add_anim_cmd>("add_anim_cmd",
|
||||
sol::constructors<spine_player_commands::add_anim_cmd(u32,str)>(),
|
||||
|
||||
"track", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> u32 {
|
||||
return c.track();
|
||||
}),
|
||||
|
||||
"name", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> str {
|
||||
return c.name();
|
||||
}),
|
||||
|
||||
"loop", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> bool {
|
||||
return c.loop();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_anim_cmd&(bool)>(
|
||||
&spine_player_commands::add_anim_cmd::loop)),
|
||||
|
||||
"delay", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> f32 {
|
||||
return c.delay();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_anim_cmd&(f32)>(
|
||||
&spine_player_commands::add_anim_cmd::delay)),
|
||||
|
||||
"end_message", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> str {
|
||||
return c.end_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_anim_cmd&(str)>(
|
||||
&spine_player_commands::add_anim_cmd::end_message)),
|
||||
|
||||
"complete_message", sol::property(
|
||||
[](const spine_player_commands::add_anim_cmd& c) -> str {
|
||||
return c.complete_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_anim_cmd&(str)>(
|
||||
&spine_player_commands::add_anim_cmd::complete_message))
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_commands::set_empty_anim_cmd>("set_empty_anim_cmd",
|
||||
sol::constructors<spine_player_commands::set_empty_anim_cmd(u32)>(),
|
||||
|
||||
"track", sol::property(
|
||||
[](const spine_player_commands::set_empty_anim_cmd& c) -> u32 {
|
||||
return c.track();
|
||||
}),
|
||||
|
||||
"mix_duration", sol::property(
|
||||
[](const spine_player_commands::set_empty_anim_cmd& c) -> f32 {
|
||||
return c.mix_duration();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_empty_anim_cmd&(f32)>(
|
||||
&spine_player_commands::set_empty_anim_cmd::mix_duration)),
|
||||
|
||||
"end_message", sol::property(
|
||||
[](const spine_player_commands::set_empty_anim_cmd& c) -> str {
|
||||
return c.end_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_empty_anim_cmd&(str)>(
|
||||
&spine_player_commands::set_empty_anim_cmd::end_message)),
|
||||
|
||||
"complete_message", sol::property(
|
||||
[](const spine_player_commands::set_empty_anim_cmd& c) -> str {
|
||||
return c.complete_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::set_empty_anim_cmd&(str)>(
|
||||
&spine_player_commands::set_empty_anim_cmd::complete_message))
|
||||
);
|
||||
|
||||
l["spine_player"].get_or_create<sol::table>()
|
||||
.new_usertype<spine_player_commands::add_empty_anim_cmd>("add_empty_anim_cmd",
|
||||
sol::constructors<spine_player_commands::add_empty_anim_cmd(u32)>(),
|
||||
|
||||
"track", sol::property(
|
||||
[](const spine_player_commands::add_empty_anim_cmd& c) -> u32 {
|
||||
return c.track();
|
||||
}),
|
||||
|
||||
"delay", sol::property(
|
||||
[](const spine_player_commands::add_empty_anim_cmd& c) -> f32 {
|
||||
return c.delay();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_empty_anim_cmd&(f32)>(
|
||||
&spine_player_commands::add_empty_anim_cmd::delay)),
|
||||
|
||||
"mix_duration", sol::property(
|
||||
[](const spine_player_commands::add_empty_anim_cmd& c) -> f32 {
|
||||
return c.mix_duration();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_empty_anim_cmd&(f32)>(
|
||||
&spine_player_commands::add_empty_anim_cmd::mix_duration)),
|
||||
|
||||
"end_message", sol::property(
|
||||
[](const spine_player_commands::add_empty_anim_cmd& c) -> str {
|
||||
return c.end_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_empty_anim_cmd&(str)>(
|
||||
&spine_player_commands::add_empty_anim_cmd::end_message)),
|
||||
|
||||
"complete_message", sol::property(
|
||||
[](const spine_player_commands::add_empty_anim_cmd& c) -> str {
|
||||
return c.complete_message();
|
||||
},
|
||||
sol::resolve<spine_player_commands::add_empty_anim_cmd&(str)>(
|
||||
&spine_player_commands::add_empty_anim_cmd::complete_message))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/sprite_renderer.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_sprite_renderer(sol::state& l) {
|
||||
l.new_usertype<gcomponent<sprite_renderer>>("sprite_renderer",
|
||||
sol::no_constructor,
|
||||
|
||||
"tint", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> color32 {
|
||||
return c->tint();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, const color32& v){
|
||||
c->tint(v);
|
||||
}),
|
||||
|
||||
"scale", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> v2f {
|
||||
return c->scale();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, const v2f& v){
|
||||
c->scale(v);
|
||||
}),
|
||||
|
||||
"mode", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> sprite_renderer::modes {
|
||||
return c->mode();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, sprite_renderer::modes v){
|
||||
c->mode(v);
|
||||
}),
|
||||
|
||||
"blending", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> sprite_renderer::blendings {
|
||||
return c->blending();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, sprite_renderer::blendings v){
|
||||
c->blending(v);
|
||||
}),
|
||||
|
||||
"filtering", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> bool {
|
||||
return c->filtering();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, bool v){
|
||||
c->filtering(v);
|
||||
}),
|
||||
|
||||
"sprite", sol::property(
|
||||
[](const gcomponent<sprite_renderer>& c) -> sprite_asset::ptr {
|
||||
return c->sprite();
|
||||
},
|
||||
[](gcomponent<sprite_renderer>& c, const sprite_asset::ptr& v){
|
||||
c->sprite(v);
|
||||
})
|
||||
);
|
||||
|
||||
#define SPRITE_RENDERER_MODES_PAIR(x) {#x, sprite_renderer::modes::x},
|
||||
l["sprite_renderer"].get_or_create<sol::table>()
|
||||
.new_enum<sprite_renderer::modes>("modes", {
|
||||
SPRITE_RENDERER_MODES_PAIR(simple)
|
||||
SPRITE_RENDERER_MODES_PAIR(sliced)
|
||||
});
|
||||
#undef SPRITE_RENDERER_MODES_PAIR
|
||||
|
||||
#define SPRITE_RENDERER_BLENDINGS_PAIR(x) {#x, sprite_renderer::blendings::x},
|
||||
l["sprite_renderer"].get_or_create<sol::table>()
|
||||
.new_enum<sprite_renderer::blendings>("blendings", {
|
||||
SPRITE_RENDERER_BLENDINGS_PAIR(normal)
|
||||
SPRITE_RENDERER_BLENDINGS_PAIR(additive)
|
||||
SPRITE_RENDERER_BLENDINGS_PAIR(multiply)
|
||||
SPRITE_RENDERER_BLENDINGS_PAIR(screen)
|
||||
});
|
||||
#undef SPRITE_RENDERER_BLENDINGS_PAIR
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/touchable.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_touchable(sol::state& l) {
|
||||
l.new_usertype<gcomponent<touchable>>("touchable",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<touchable>& c){
|
||||
c.component<disabled<touchable>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<touchable>& c){
|
||||
c.component<disabled<touchable>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<touchable>& c) -> bool {
|
||||
return !c.component<disabled<touchable>>().exists();
|
||||
},
|
||||
[](gcomponent<touchable>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<touchable>>().remove();
|
||||
} else {
|
||||
c.component<disabled<touchable>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<touchable>& c) -> bool {
|
||||
return c.component<disabled<touchable>>().exists();
|
||||
},
|
||||
[](gcomponent<touchable>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<touchable>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<touchable>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"bubbling", sol::property(
|
||||
[](const gcomponent<touchable>& c) -> bool {
|
||||
return c->bubbling();
|
||||
},
|
||||
[](gcomponent<touchable>& c, bool v){
|
||||
c->bubbling(v);
|
||||
}),
|
||||
|
||||
"capturing", sol::property(
|
||||
[](const gcomponent<touchable>& c) -> bool {
|
||||
return c->capturing();
|
||||
},
|
||||
[](gcomponent<touchable>& c, bool v){
|
||||
c->capturing(v);
|
||||
})
|
||||
);
|
||||
|
||||
//
|
||||
// events
|
||||
//
|
||||
|
||||
l["touchable"].get_or_create<sol::table>()
|
||||
.new_usertype<touchable_events::mouse_evt>("mouse_evt",
|
||||
sol::no_constructor,
|
||||
|
||||
"target", sol::property(
|
||||
[](const touchable_events::mouse_evt& c) -> gobject {
|
||||
return c.target();
|
||||
}),
|
||||
|
||||
"bubbling", sol::property(
|
||||
[](const touchable_events::mouse_evt& c) -> bool {
|
||||
return c.bubbling();
|
||||
}),
|
||||
|
||||
"capturing", sol::property(
|
||||
[](const touchable_events::mouse_evt& c) -> bool {
|
||||
return c.capturing();
|
||||
}),
|
||||
|
||||
"type", sol::property(
|
||||
[](const touchable_events::mouse_evt& c) -> str {
|
||||
return str(enum_hpp::to_string_or_throw(c.type()));
|
||||
}),
|
||||
|
||||
"button", sol::property(
|
||||
[](const touchable_events::mouse_evt& c) -> str {
|
||||
return str(enum_hpp::to_string_or_throw(c.button()));
|
||||
})
|
||||
);
|
||||
|
||||
l["touchable"].get_or_create<sol::table>()
|
||||
.new_usertype<touchable_events::touch_evt>("touch_evt",
|
||||
sol::no_constructor,
|
||||
|
||||
"target", sol::property(
|
||||
[](const touchable_events::touch_evt& c) -> gobject {
|
||||
return c.target();
|
||||
}),
|
||||
|
||||
"bubbling", sol::property(
|
||||
[](const touchable_events::touch_evt& c) -> bool {
|
||||
return c.bubbling();
|
||||
}),
|
||||
|
||||
"capturing", sol::property(
|
||||
[](const touchable_events::touch_evt& c) -> bool {
|
||||
return c.capturing();
|
||||
}),
|
||||
|
||||
"type", sol::property(
|
||||
[](const touchable_events::touch_evt& c) -> str {
|
||||
return str(enum_hpp::to_string_or_throw(c.type()));
|
||||
}),
|
||||
|
||||
"finger", sol::property(
|
||||
[](const touchable_events::touch_evt& c) -> u32 {
|
||||
return c.finger();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/widget.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_widget(sol::state& l) {
|
||||
l.new_usertype<gcomponent<widget>>("widget",
|
||||
sol::no_constructor,
|
||||
|
||||
"enable", [](gcomponent<widget>& c){
|
||||
c.component<disabled<widget>>().remove();
|
||||
},
|
||||
|
||||
"disable", [](gcomponent<widget>& c){
|
||||
c.component<disabled<widget>>().ensure();
|
||||
},
|
||||
|
||||
"enabled", sol::property(
|
||||
[](const gcomponent<widget>& c) -> bool {
|
||||
return !c.component<disabled<widget>>().exists();
|
||||
},
|
||||
[](gcomponent<widget>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<widget>>().remove();
|
||||
} else {
|
||||
c.component<disabled<widget>>().ensure();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"disabled", sol::property(
|
||||
[](const gcomponent<widget>& c) -> bool {
|
||||
return c.component<disabled<widget>>().exists();
|
||||
},
|
||||
[](gcomponent<widget>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
c.component<disabled<widget>>().ensure();
|
||||
} else {
|
||||
c.component<disabled<widget>>().remove();
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"dirty", sol::property(
|
||||
[](const gcomponent<widget>& c) -> bool {
|
||||
return widgets::is_dirty(c);
|
||||
},
|
||||
[](gcomponent<widget>& c, bool yesno){
|
||||
if ( yesno ) {
|
||||
widgets::mark_dirty(c);
|
||||
} else {
|
||||
widgets::unmark_dirty(c);
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
"size", sol::property(
|
||||
[](const gcomponent<widget>& c) -> v2f {
|
||||
return c->size();
|
||||
},
|
||||
[](gcomponent<widget>& c, const v2f& v){
|
||||
widgets::change_size(c, v);
|
||||
}),
|
||||
|
||||
"margin", sol::property(
|
||||
[](const gcomponent<widget>& c) -> v2f {
|
||||
return c->margin();
|
||||
},
|
||||
[](gcomponent<widget>& c, const v2f& v){
|
||||
widgets::change_margin(c, v);
|
||||
}),
|
||||
|
||||
"padding", sol::property(
|
||||
[](const gcomponent<widget>& c) -> v2f {
|
||||
return c->padding();
|
||||
},
|
||||
[](gcomponent<widget>& c, const v2f& v){
|
||||
widgets::change_padding(c, v);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/editor.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_editor(sol::state& l) {
|
||||
l.new_usertype<editor>("editor",
|
||||
sol::no_constructor,
|
||||
|
||||
"select", [](editor& e, const gobject& go) -> void {
|
||||
e.select(go);
|
||||
},
|
||||
|
||||
"clear_selection", [](editor& e) -> void {
|
||||
e.clear_selection();
|
||||
},
|
||||
|
||||
"selection", sol::property(
|
||||
[](const editor& e) -> gobject { return e.selection(); })
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
|
||||
#include <enduro2d/high/components/actor.hpp>
|
||||
#include <enduro2d/high/components/behaviour.hpp>
|
||||
#include <enduro2d/high/components/camera.hpp>
|
||||
#include <enduro2d/high/components/colliders.hpp>
|
||||
#include <enduro2d/high/components/flipbook_player.hpp>
|
||||
#include <enduro2d/high/components/label.hpp>
|
||||
#include <enduro2d/high/components/model_renderer.hpp>
|
||||
#include <enduro2d/high/components/named.hpp>
|
||||
#include <enduro2d/high/components/renderer.hpp>
|
||||
#include <enduro2d/high/components/scene.hpp>
|
||||
#include <enduro2d/high/components/spine_player.hpp>
|
||||
#include <enduro2d/high/components/sprite_renderer.hpp>
|
||||
#include <enduro2d/high/components/touchable.hpp>
|
||||
#include <enduro2d/high/components/widget.hpp>
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_gobject(sol::state& l) {
|
||||
l.new_usertype<gobject>("gobject",
|
||||
sol::no_constructor,
|
||||
|
||||
"alive", sol::property([](const gobject& go) -> bool {
|
||||
return go.alive();
|
||||
}),
|
||||
|
||||
"valid", sol::property([](const gobject& go) -> bool {
|
||||
return go.valid();
|
||||
}),
|
||||
|
||||
"destroy", [](gobject& go){
|
||||
go.destroy();
|
||||
},
|
||||
|
||||
"actor", sol::property([](gobject& go){ return component_wrapper<actor>{go}; }),
|
||||
"behaviour", sol::property([](gobject& go){ return component_wrapper<behaviour>{go}; }),
|
||||
"camera", sol::property([](gobject& go){ return component_wrapper<camera>{go}; }),
|
||||
"rect_collider", sol::property([](gobject& go){ return component_wrapper<rect_collider>{go}; }),
|
||||
"circle_collider", sol::property([](gobject& go){ return component_wrapper<circle_collider>{go}; }),
|
||||
"polygon_collider", sol::property([](gobject& go){ return component_wrapper<polygon_collider>{go}; }),
|
||||
"flipbook_player", sol::property([](gobject& go){ return component_wrapper<flipbook_player>{go}; }),
|
||||
"label", sol::property([](gobject& go){ return component_wrapper<label>{go}; }),
|
||||
"model_renderer", sol::property([](gobject& go){ return component_wrapper<model_renderer>{go}; }),
|
||||
"named", sol::property([](gobject& go){ return component_wrapper<named>{go}; }),
|
||||
"renderer", sol::property([](gobject& go){ return component_wrapper<renderer>{go}; }),
|
||||
"scene", sol::property([](gobject& go){ return component_wrapper<scene>{go}; }),
|
||||
"spine_player", sol::property([](gobject& go){ return component_wrapper<spine_player>{go}; }),
|
||||
"sprite_renderer", sol::property([](gobject& go){ return component_wrapper<sprite_renderer>{go}; }),
|
||||
"touchable", sol::property([](gobject& go){ return component_wrapper<touchable>{go}; }),
|
||||
"widget", sol::property([](gobject& go){ return component_wrapper<widget>{go}; })
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/assets/atlas_asset.hpp>
|
||||
#include <enduro2d/high/assets/binary_asset.hpp>
|
||||
#include <enduro2d/high/assets/flipbook_asset.hpp>
|
||||
#include <enduro2d/high/assets/font_asset.hpp>
|
||||
#include <enduro2d/high/assets/image_asset.hpp>
|
||||
#include <enduro2d/high/assets/json_asset.hpp>
|
||||
#include <enduro2d/high/assets/material_asset.hpp>
|
||||
#include <enduro2d/high/assets/mesh_asset.hpp>
|
||||
#include <enduro2d/high/assets/model_asset.hpp>
|
||||
#include <enduro2d/high/assets/prefab_asset.hpp>
|
||||
#include <enduro2d/high/assets/script_asset.hpp>
|
||||
#include <enduro2d/high/assets/shader_asset.hpp>
|
||||
#include <enduro2d/high/assets/shape_asset.hpp>
|
||||
#include <enduro2d/high/assets/sound_asset.hpp>
|
||||
#include <enduro2d/high/assets/spine_asset.hpp>
|
||||
#include <enduro2d/high/assets/sprite_asset.hpp>
|
||||
#include <enduro2d/high/assets/text_asset.hpp>
|
||||
#include <enduro2d/high/assets/texture_asset.hpp>
|
||||
#include <enduro2d/high/assets/xml_asset.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
|
||||
template < typename Asset >
|
||||
void bind_asset(const str& base_name, sol::state& l) {
|
||||
l.new_usertype<Asset>(base_name + "_asset",
|
||||
sol::no_constructor,
|
||||
|
||||
"content", sol::property([](const Asset& a){
|
||||
return a.content();
|
||||
})
|
||||
);
|
||||
|
||||
l["library"][str("load_") + base_name] =
|
||||
[](const library& l, str_view address){
|
||||
return l.load_main_asset<Asset>(address);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_library(sol::state& l) {
|
||||
l.new_usertype<library>("library",
|
||||
sol::no_constructor
|
||||
);
|
||||
|
||||
bind_asset<atlas_asset>("atlas", l);
|
||||
bind_asset<binary_asset>("binary", l);
|
||||
bind_asset<flipbook_asset>("flipbook", l);
|
||||
bind_asset<font_asset>("font", l);
|
||||
bind_asset<image_asset>("image", l);
|
||||
bind_asset<json_asset>("json", l);
|
||||
bind_asset<material_asset>("material", l);
|
||||
bind_asset<mesh_asset>("mesh", l);
|
||||
bind_asset<model_asset>("model", l);
|
||||
bind_asset<prefab_asset>("prefab", l);
|
||||
bind_asset<script_asset>("script", l);
|
||||
bind_asset<shader_asset>("shader", l);
|
||||
bind_asset<shape_asset>("shape", l);
|
||||
bind_asset<sound_asset>("sound", l);
|
||||
bind_asset<spine_asset>("spine", l);
|
||||
bind_asset<sprite_asset>("sprite", l);
|
||||
bind_asset<text_asset>("text", l);
|
||||
bind_asset<texture_asset>("texture", l);
|
||||
bind_asset<xml_asset>("xml", l);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user