WiP
This commit is contained in:
parent
8f815a33ef
commit
42c9fac38e
9 changed files with 87 additions and 18 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "pw/core/geometry.hpp"
|
||||
#include "pw/core/image.hpp"
|
||||
#include "pw/core/matrix_transform.hpp"
|
||||
#include "pw/core/rectangle.hpp"
|
||||
|
||||
#include "runtime_lua.hpp"
|
||||
|
||||
|
@ -18,11 +19,30 @@ template <> struct is_automagical<pw::matrix4x4> : std::false_type {};
|
|||
template <> struct is_automagical<pw::vector3> : std::false_type {};
|
||||
template <> struct is_automagical<pw::vector4> : std::false_type {};
|
||||
template <> struct is_automagical<pw::quaternion> : std::false_type {};
|
||||
template <> struct is_automagical<pw::rectangle> : std::false_type {};
|
||||
}
|
||||
|
||||
namespace pw {
|
||||
|
||||
void register_core_function(sol::state& lua,sol::table& ns)
|
||||
|
||||
rectangle from_lua_table(sol::table t)
|
||||
{
|
||||
float v[4];
|
||||
|
||||
for (std::size_t i {1}; i <= t.size();i++){
|
||||
v[i-1] = t[i];
|
||||
}
|
||||
return rectangle(v);
|
||||
}
|
||||
|
||||
vector3 vector3_from_lua_table(sol::table t)
|
||||
{
|
||||
|
||||
return vector3();
|
||||
}
|
||||
|
||||
|
||||
void register_core_function(sol::state&,sol::table& ns)
|
||||
{
|
||||
|
||||
typedef real_t Scalar;
|
||||
|
@ -93,8 +113,15 @@ void register_core_function(sol::state& lua,sol::table& ns)
|
|||
, sol::constructors<size(),size(Scalar,Scalar)>()
|
||||
, "width",&size::width
|
||||
, "height",&size::height
|
||||
, "cast_to_float",&size::cast<float>
|
||||
);
|
||||
|
||||
ns.new_usertype<sizef>("sizef"
|
||||
, sol::constructors<sizef(),sizef(Scalar,Scalar)>()
|
||||
, "width",&sizef::width
|
||||
, "height",&sizef::height
|
||||
, "cast_to_int",&sizef::cast<int>
|
||||
);
|
||||
|
||||
ns.new_usertype<point>("point",
|
||||
sol::constructors<point(),point(Scalar,Scalar)>(),
|
||||
|
@ -154,6 +181,10 @@ void register_core_function(sol::state& lua,sol::table& ns)
|
|||
,"gray", image::LUM);
|
||||
|
||||
|
||||
ns.new_usertype<rectangle>("rectangle"
|
||||
,sol::constructors<rectangle(),rectangle(const point_<float>&,const size_<float>&)>()
|
||||
);
|
||||
|
||||
auto mathf_table = ns.create_named("mathf");
|
||||
mathf_table.set_function("ping_pong",ping_pong<real_t>);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ void register_system_function(sol::state&, sol::table &ns)
|
|||
,"new", sol::no_constructor
|
||||
,"get",&path::get
|
||||
,"separator",sol::readonly_property(&path::separator)
|
||||
,"resource_paths",sol::readonly_property(&path::resource_paths)
|
||||
,"executable_path",sol::readonly_property(&path::executable_path)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "pw/visual/shader.hpp"
|
||||
#include "pw/visual/framebuffer.hpp"
|
||||
#include "pw/visual/texture.hpp"
|
||||
#include "pw/visual/context.hpp"
|
||||
|
||||
#include "pw/core/size.hpp"
|
||||
|
||||
|
@ -62,6 +63,12 @@ void register_visual_function(sol::state&,sol::table &ns)
|
|||
,sol::constructors<texture(),texture(texture::image_ref,texture::data_layout)>()
|
||||
,"image",sol::property(&texture::set_image,&texture::image)
|
||||
);
|
||||
|
||||
ns.new_usertype<context>("context"
|
||||
,sol::constructors<context()>()
|
||||
,"clear",&context::clear
|
||||
,"set_viewport",&context::set_viewport
|
||||
);
|
||||
}
|
||||
|
||||
PW_REGISTER_LUA(visual)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue