mirror of
https://github.com/enduro2d/enduro2d.git
synced 2026-03-22 12:55:33 +07:00
basic component inspectors
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../node.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -25,7 +28,10 @@ namespace e2d
|
||||
private:
|
||||
node_iptr node_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<actor> final : factory_loader<> {
|
||||
public:
|
||||
@@ -41,6 +47,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<actor> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<actor>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline actor::actor(const node_iptr& node)
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/script_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -27,7 +30,10 @@ namespace e2d
|
||||
sol::table meta_;
|
||||
script_asset::ptr script_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<behaviour> final : factory_loader<> {
|
||||
public:
|
||||
@@ -43,6 +49,18 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
@@ -34,7 +36,10 @@ namespace e2d
|
||||
render_target_ptr target_ = nullptr;
|
||||
color background_ = color::clear();
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<camera> final : factory_loader<> {
|
||||
public:
|
||||
@@ -50,6 +55,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<camera> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<camera>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline camera& camera::depth(i32 value) noexcept {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/flipbook_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -56,7 +59,10 @@ namespace e2d
|
||||
str_hash sequence_;
|
||||
flipbook_asset::ptr flipbook_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<flipbook_player> final : factory_loader<> {
|
||||
public:
|
||||
@@ -72,6 +78,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<flipbook_player> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<flipbook_player>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline flipbook_player::flipbook_player(const flipbook_asset::ptr& flipbook)
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/font_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -77,7 +80,13 @@ namespace e2d
|
||||
f32 outline_width_ = 0.f;
|
||||
color32 outline_color_ = color32::white();
|
||||
};
|
||||
}
|
||||
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::label::haligns)
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::label::valigns)
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<label> final : factory_loader<> {
|
||||
public:
|
||||
@@ -107,8 +116,16 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::label::haligns)
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::label::valigns)
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<label> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<label>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/model_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -23,7 +26,10 @@ namespace e2d
|
||||
private:
|
||||
model_asset::ptr model_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<model_renderer> final : factory_loader<> {
|
||||
public:
|
||||
@@ -39,6 +45,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<model_renderer> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<model_renderer>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline model_renderer::model_renderer(const model_asset::ptr& model)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
@@ -23,7 +25,10 @@ namespace e2d
|
||||
private:
|
||||
str name_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<named> final : factory_loader<> {
|
||||
public:
|
||||
@@ -39,6 +44,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<named> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<named>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline named& named::name(str value) noexcept {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/material_asset.hpp"
|
||||
|
||||
namespace e2d
|
||||
@@ -45,7 +48,10 @@ namespace e2d
|
||||
render::property_block properties_;
|
||||
vector<material_asset::ptr> materials_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<renderer> final : factory_loader<> {
|
||||
public:
|
||||
@@ -61,6 +67,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<renderer> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<renderer>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline renderer& renderer::transform(const t3f& transform) noexcept {
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
@@ -21,7 +23,10 @@ namespace e2d
|
||||
private:
|
||||
i32 depth_ = 0;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<scene> final : factory_loader<> {
|
||||
public:
|
||||
@@ -37,6 +42,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<scene> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<scene>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
inline scene& scene::depth(i32 value) noexcept {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/spine_asset.hpp"
|
||||
#include "../assets/material_asset.hpp"
|
||||
|
||||
@@ -86,7 +89,10 @@ namespace e2d
|
||||
animation_ptr animation_;
|
||||
flat_map<str_hash, material_asset::ptr> materials_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<spine_player> final : factory_loader<> {
|
||||
public:
|
||||
@@ -130,6 +136,17 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<spine_player> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<spine_player>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d::spine_player_events
|
||||
{
|
||||
class custom_evt final {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
#include "../gobject.hpp"
|
||||
#include "../inspector.hpp"
|
||||
|
||||
#include "../assets/atlas_asset.hpp"
|
||||
#include "../assets/sprite_asset.hpp"
|
||||
#include "../assets/material_asset.hpp"
|
||||
@@ -48,7 +51,12 @@ namespace e2d
|
||||
sprite_asset::ptr sprite_;
|
||||
flat_map<str_hash, material_asset::ptr> materials_;
|
||||
};
|
||||
}
|
||||
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::sprite_renderer::blendings)
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<sprite_renderer> final : factory_loader<> {
|
||||
public:
|
||||
@@ -64,7 +72,16 @@ namespace e2d
|
||||
};
|
||||
}
|
||||
|
||||
ENUM_HPP_REGISTER_TRAITS(e2d::sprite_renderer::blendings)
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class component_inspector<sprite_renderer> final : component_inspector<> {
|
||||
public:
|
||||
static const char* title;
|
||||
|
||||
void operator()(gcomponent<sprite_renderer>& c) const;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/coin_spine.json"
|
||||
},
|
||||
"spine_player_commands" : {
|
||||
"spine_player.commands" : {
|
||||
"commands" : [{
|
||||
"type" : "set_anim_cmd",
|
||||
"desc" : {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/dragon_spine.json"
|
||||
},
|
||||
"spine_player_commands" : {
|
||||
"spine_player.commands" : {
|
||||
"commands" : [{
|
||||
"type" : "set_anim_cmd",
|
||||
"desc" : {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"spine_player" : {
|
||||
"spine" : "../spines/raptor_spine.json"
|
||||
},
|
||||
"spine_player_commands" : {
|
||||
"spine_player.commands" : {
|
||||
"commands" : [{
|
||||
"type" : "add_anim_cmd",
|
||||
"desc" : {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"screen" : "../materials/spine_material_screen.json"
|
||||
}
|
||||
},
|
||||
"spine_player_events" : {},
|
||||
"spine_player_commands" : {}
|
||||
"spine_player.events" : {},
|
||||
"spine_player.commands" : {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace
|
||||
public:
|
||||
bool initialize() final {
|
||||
return create_scene()
|
||||
&& create_camera()
|
||||
&& create_systems();
|
||||
}
|
||||
private:
|
||||
@@ -101,6 +100,17 @@ namespace
|
||||
auto scene_i = the<world>().instantiate();
|
||||
scene_i.component<scene>().assign();
|
||||
|
||||
{
|
||||
prefab prefab;
|
||||
prefab.prototype()
|
||||
.component<camera>(camera()
|
||||
.background({1.f, 0.4f, 0.f, 1.f}));
|
||||
|
||||
the<world>().instantiate(
|
||||
prefab,
|
||||
scene_i.component<actor>()->node());
|
||||
}
|
||||
|
||||
{
|
||||
prefab prefab;
|
||||
prefab.prototype()
|
||||
@@ -168,14 +178,6 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
bool create_camera() {
|
||||
auto camera_i = the<world>().instantiate();
|
||||
camera_i.component<camera>().assign(camera()
|
||||
.background({1.f, 0.4f, 0.f, 1.f}));
|
||||
camera_i.component<actor>().assign(node::create(camera_i));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool create_systems() {
|
||||
ecs::registry_filler(the<world>().registry())
|
||||
.feature<struct game_feature>(ecs::feature()
|
||||
|
||||
@@ -65,3 +65,30 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<actor>::title = "actor";
|
||||
|
||||
void component_inspector<actor>::operator()(gcomponent<actor>& c) const {
|
||||
if ( node_iptr n = c->node() ) {
|
||||
if ( v2f translation = n->translation();
|
||||
ImGui::DragFloat2("translation", translation.data(), 1.f) )
|
||||
{
|
||||
n->translation(translation);
|
||||
}
|
||||
|
||||
if ( f32 rotation = n->rotation() * math::rad_to_deg<f32>();
|
||||
ImGui::DragFloat("rotation", &rotation, 0.1f) )
|
||||
{
|
||||
n->rotation(rotation * math::deg_to_rad<f32>());
|
||||
}
|
||||
|
||||
if ( v2f scale = n->scale();
|
||||
ImGui::DragFloat2("scale", scale.data(), 0.01f) )
|
||||
{
|
||||
n->scale(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,3 +52,14 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<behaviour>::title = "behaviour";
|
||||
|
||||
void component_inspector<behaviour>::operator()(gcomponent<behaviour>& c) const {
|
||||
E2D_UNUSED(c);
|
||||
///TODO(BlackMat): add 'meta' inspector
|
||||
///TODO(BlackMat): add 'script' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,3 +75,26 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<camera>::title = "camera";
|
||||
|
||||
void component_inspector<camera>::operator()(gcomponent<camera>& c) const {
|
||||
if ( i32 depth = c->depth();
|
||||
ImGui::DragInt("depth", &depth) )
|
||||
{
|
||||
c->depth(depth);
|
||||
}
|
||||
|
||||
///TODO(BlackMat): add 'viewport' inspector
|
||||
///TODO(BlackMat): add 'projection' inspector
|
||||
///TODO(BlackMat): add 'target' inspector
|
||||
|
||||
if ( color background = c->background();
|
||||
ImGui::ColorEdit4("background", background.data()) )
|
||||
{
|
||||
c->background(background);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,3 +110,43 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<flipbook_player>::title = "flipbook_player";
|
||||
|
||||
void component_inspector<flipbook_player>::operator()(gcomponent<flipbook_player>& c) const {
|
||||
if ( f32 time = c->time();
|
||||
ImGui::DragFloat("time", &time, 0.01f) )
|
||||
{
|
||||
c->time(time);
|
||||
}
|
||||
|
||||
if ( f32 speed = c->speed();
|
||||
ImGui::DragFloat("speed", &speed, 0.01f) )
|
||||
{
|
||||
c->speed(speed);
|
||||
}
|
||||
|
||||
if ( bool looped = c->looped();
|
||||
ImGui::Checkbox("looped", &looped) )
|
||||
{
|
||||
c->looped(looped);
|
||||
}
|
||||
|
||||
if ( bool stopped = c->stopped();
|
||||
ImGui::Checkbox("stopped", &stopped) )
|
||||
{
|
||||
c->stopped(stopped);
|
||||
}
|
||||
|
||||
if ( bool playing = c->playing();
|
||||
ImGui::Checkbox("playing", &playing) )
|
||||
{
|
||||
c->playing(playing);
|
||||
}
|
||||
|
||||
///TODO(BlackMat): add 'sequence' inspector
|
||||
///TODO(BlackMat): add 'flipbook' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,3 +195,82 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<label>::title = "label";
|
||||
|
||||
void component_inspector<label>::operator()(gcomponent<label>& c) const {
|
||||
if ( str text = c->text();
|
||||
ImGui::InputTextMultiline("text", &text) )
|
||||
{
|
||||
c->text(std::move(text));
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
///TODO(BlackMat): add 'font' inspector
|
||||
|
||||
if ( color tint = color(c->tint());
|
||||
ImGui::ColorEdit4("tint", tint.data()) )
|
||||
{
|
||||
c->tint(color32(tint));
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( label::haligns halign = c->halign();
|
||||
imgui_utils::show_enum_combo_box("halign", &halign) )
|
||||
{
|
||||
c->halign(halign);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( label::valigns valign = c->valign();
|
||||
imgui_utils::show_enum_combo_box("valign", &valign) )
|
||||
{
|
||||
c->valign(valign);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( f32 leading = c->leading();
|
||||
ImGui::DragFloat("leading", &leading, 0.01f) )
|
||||
{
|
||||
c->leading(leading);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( f32 tracking = c->tracking();
|
||||
ImGui::DragFloat("tracking", &tracking, 0.01f) )
|
||||
{
|
||||
c->tracking(tracking);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( f32 text_width = c->text_width();
|
||||
ImGui::DragFloat("text_width", &text_width, 1.f) )
|
||||
{
|
||||
c->text_width(text_width);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( f32 glyph_dilate = c->glyph_dilate();
|
||||
ImGui::SliderFloat("glyph_dilate", &glyph_dilate, -1.f, 1.f) )
|
||||
{
|
||||
c->glyph_dilate(glyph_dilate);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( f32 outline_width = c->outline_width();
|
||||
ImGui::SliderFloat("outline_width", &outline_width, 0.f, 1.f) )
|
||||
{
|
||||
c->outline_width(outline_width);
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
|
||||
if ( color outline_color = color(c->outline_color());
|
||||
ImGui::ColorEdit4("outline_color", outline_color.data()) )
|
||||
{
|
||||
c->outline_color(color32(outline_color));
|
||||
c.owner().component<label::dirty>().ensure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,3 +50,13 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<model_renderer>::title = "model_renderer";
|
||||
|
||||
void component_inspector<model_renderer>::operator()(gcomponent<model_renderer>& c) const {
|
||||
E2D_UNUSED(c);
|
||||
///TODO(BlackMat): add 'model' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,3 +41,16 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<named>::title = "named";
|
||||
|
||||
void component_inspector<named>::operator()(gcomponent<named>& c) const {
|
||||
if ( str name = c->name();
|
||||
ImGui::InputText("name", &name) )
|
||||
{
|
||||
c->name(std::move(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,3 +78,31 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<renderer>::title = "renderer";
|
||||
|
||||
void component_inspector<renderer>::operator()(gcomponent<renderer>& c) const {
|
||||
if ( v3f translation = c->translation();
|
||||
ImGui::DragFloat3("translation", translation.data(), 1.f) )
|
||||
{
|
||||
c->translation(translation);
|
||||
}
|
||||
|
||||
if ( v3f rotation = c->rotation() * math::rad_to_deg<f32>();
|
||||
ImGui::DragFloat3("rotation", rotation.data(), 0.1f) )
|
||||
{
|
||||
c->rotation(rotation * math::deg_to_rad<f32>());
|
||||
}
|
||||
|
||||
if ( v3f scale = c->scale();
|
||||
ImGui::DragFloat3("scale", scale.data(), 0.01f) )
|
||||
{
|
||||
c->scale(scale);
|
||||
}
|
||||
|
||||
///TODO(BlackMat): add 'properties' inspector
|
||||
///TODO(BlackMat): add 'materials' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,3 +41,16 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<scene>::title = "scene";
|
||||
|
||||
void component_inspector<scene>::operator()(gcomponent<scene>& c) const {
|
||||
if ( i32 depth = c->depth();
|
||||
ImGui::DragInt("depth", &depth) )
|
||||
{
|
||||
c->depth(depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,3 +909,14 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<spine_player>::title = "spine_player";
|
||||
|
||||
void component_inspector<spine_player>::operator()(gcomponent<spine_player>& c) const {
|
||||
E2D_UNUSED(c);
|
||||
///TODO(BlackMat): add 'spine' inspector
|
||||
///TODO(BlackMat): add 'materials' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,3 +169,31 @@ namespace e2d
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* component_inspector<sprite_renderer>::title = "sprite_renderer";
|
||||
|
||||
void component_inspector<sprite_renderer>::operator()(gcomponent<sprite_renderer>& c) const {
|
||||
if ( color tint = color(c->tint());
|
||||
ImGui::ColorEdit4("tint", tint.data()) )
|
||||
{
|
||||
c->tint(color32(tint));
|
||||
}
|
||||
|
||||
if ( sprite_renderer::blendings blending = c->blending();
|
||||
imgui_utils::show_enum_combo_box("blending", &blending) )
|
||||
{
|
||||
c->blending(blending);
|
||||
}
|
||||
|
||||
if ( bool filtering = c->filtering();
|
||||
ImGui::Checkbox("filtering", &filtering) )
|
||||
{
|
||||
c->filtering(filtering);
|
||||
}
|
||||
|
||||
///TODO(BlackMat): add 'sprite' inspector
|
||||
///TODO(BlackMat): add 'materials' inspector
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,11 +191,25 @@ namespace e2d
|
||||
.register_component<renderer>("renderer")
|
||||
.register_component<scene>("scene")
|
||||
.register_component<spine_player>("spine_player")
|
||||
.register_component<events<spine_player_events::event>>("spine_player_events")
|
||||
.register_component<commands<spine_player_commands::command>>("spine_player_commands")
|
||||
.register_component<events<spine_player_events::event>>("spine_player.events")
|
||||
.register_component<commands<spine_player_commands::command>>("spine_player.commands")
|
||||
.register_component<sprite_renderer>("sprite_renderer");
|
||||
|
||||
safe_module_initialize<inspector>();
|
||||
safe_module_initialize<inspector>()
|
||||
.register_component<actor>("actor")
|
||||
.register_component<behaviour>("behaviour")
|
||||
.register_component<camera>("camera")
|
||||
.register_component<flipbook_player>("flipbook_player")
|
||||
.register_component<label>("label")
|
||||
//.register_component<label::dirty>("label.dirty")
|
||||
.register_component<model_renderer>("model_renderer")
|
||||
.register_component<named>("named")
|
||||
.register_component<renderer>("renderer")
|
||||
.register_component<scene>("scene")
|
||||
.register_component<spine_player>("spine_player")
|
||||
//.register_component<events<spine_player_events::event>>("spine_player.events")
|
||||
//.register_component<commands<spine_player_commands::command>>("spine_player.commands")
|
||||
.register_component<sprite_renderer>("sprite_renderer");
|
||||
|
||||
safe_module_initialize<luasol>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user