mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
dummy collider components
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "components/actor.hpp"
|
||||
#include "components/behaviour.hpp"
|
||||
#include "components/camera.hpp"
|
||||
#include "components/colliders.hpp"
|
||||
#include "components/commands.hpp"
|
||||
#include "components/disabled.hpp"
|
||||
#include "components/events.hpp"
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace e2d
|
||||
class actor;
|
||||
class behaviour;
|
||||
class camera;
|
||||
class box_collider;
|
||||
class circle_collider;
|
||||
class polygon_collider;
|
||||
template < typename C >
|
||||
class commands;
|
||||
template < typename T >
|
||||
|
||||
74
headers/enduro2d/high/components/colliders.hpp
Normal file
74
headers/enduro2d/high/components/colliders.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../_high.hpp"
|
||||
|
||||
#include "../factory.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class box_collider final {
|
||||
public:
|
||||
box_collider() = default;
|
||||
};
|
||||
|
||||
class circle_collider final {
|
||||
public:
|
||||
circle_collider() = default;
|
||||
};
|
||||
|
||||
class polygon_collider final {
|
||||
public:
|
||||
polygon_collider() = default;
|
||||
};
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
template <>
|
||||
class factory_loader<box_collider> final : factory_loader<> {
|
||||
public:
|
||||
static const char* schema_source;
|
||||
|
||||
bool operator()(
|
||||
box_collider& component,
|
||||
const fill_context& ctx) const;
|
||||
|
||||
bool operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
class factory_loader<circle_collider> final : factory_loader<> {
|
||||
public:
|
||||
static const char* schema_source;
|
||||
|
||||
bool operator()(
|
||||
circle_collider& component,
|
||||
const fill_context& ctx) const;
|
||||
|
||||
bool operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
class factory_loader<polygon_collider> final : factory_loader<> {
|
||||
public:
|
||||
static const char* schema_source;
|
||||
|
||||
bool operator()(
|
||||
polygon_collider& component,
|
||||
const fill_context& ctx) const;
|
||||
|
||||
bool operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const;
|
||||
};
|
||||
}
|
||||
20
samples/bin/library/scripts/emmy/components/colliders.lua
Normal file
20
samples/bin/library/scripts/emmy/components/colliders.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
---@class box_collider
|
||||
local box_collider = {
|
||||
}
|
||||
|
||||
---@class circle_collider
|
||||
local circle_collider = {
|
||||
}
|
||||
|
||||
---@class polygon_collider
|
||||
local polygon_collider = {
|
||||
}
|
||||
|
||||
---@type box_collider
|
||||
_G.box_collider = _G.box_collider or box_collider
|
||||
|
||||
---@type circle_collider
|
||||
_G.circle_collider = _G.circle_collider or circle_collider
|
||||
|
||||
---@type polygon_collider
|
||||
_G.polygon_collider = _G.polygon_collider or polygon_collider
|
||||
@@ -15,6 +15,15 @@ local gobject = {
|
||||
---@type camera
|
||||
camera = nil,
|
||||
|
||||
---@type box_collider
|
||||
box_collider = nil,
|
||||
|
||||
---@type circle_collider
|
||||
circle_collider = nil,
|
||||
|
||||
---@type polygon_collider
|
||||
polygon_collider = nil,
|
||||
|
||||
---@type flipbook_player
|
||||
flipbook_player = nil,
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace e2d::bindings::high
|
||||
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_model_renderer(sol::state& l);
|
||||
@@ -43,6 +44,7 @@ namespace e2d::bindings
|
||||
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_model_renderer(l);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include "../_high_binds.hpp"
|
||||
|
||||
#include <enduro2d/high/gobject.hpp>
|
||||
#include <enduro2d/high/components/colliders.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace e2d;
|
||||
|
||||
void bind_box_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<box_collider>>("box_collider",
|
||||
sol::no_constructor
|
||||
);
|
||||
}
|
||||
|
||||
void bind_circle_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<circle_collider>>("circle_collider",
|
||||
sol::no_constructor
|
||||
);
|
||||
}
|
||||
|
||||
void bind_polygon_collider(sol::state& l) {
|
||||
l.new_usertype<gcomponent<polygon_collider>>("polygon_collider",
|
||||
sol::no_constructor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d::bindings::high
|
||||
{
|
||||
void bind_colliders(sol::state& l) {
|
||||
bind_box_collider(l);
|
||||
bind_circle_collider(l);
|
||||
bind_polygon_collider(l);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
#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>
|
||||
@@ -41,6 +42,9 @@ namespace e2d::bindings::high
|
||||
"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}; }),
|
||||
"box_collider", sol::property([](gobject& go){ return component_wrapper<box_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}; }),
|
||||
|
||||
89
sources/enduro2d/high/components/colliders.cpp
Normal file
89
sources/enduro2d/high/components/colliders.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "Enduro2D"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <enduro2d/high/components/colliders.hpp>
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* factory_loader<box_collider>::schema_source = R"json({
|
||||
"type" : "object",
|
||||
"required" : [],
|
||||
"additionalProperties" : false,
|
||||
"properties" : {
|
||||
}
|
||||
})json";
|
||||
|
||||
bool factory_loader<box_collider>::operator()(
|
||||
box_collider& component,
|
||||
const fill_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(component, ctx);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool factory_loader<box_collider>::operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(dependencies, ctx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* factory_loader<circle_collider>::schema_source = R"json({
|
||||
"type" : "object",
|
||||
"required" : [],
|
||||
"additionalProperties" : false,
|
||||
"properties" : {
|
||||
}
|
||||
})json";
|
||||
|
||||
bool factory_loader<circle_collider>::operator()(
|
||||
circle_collider& component,
|
||||
const fill_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(component, ctx);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool factory_loader<circle_collider>::operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(dependencies, ctx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
const char* factory_loader<polygon_collider>::schema_source = R"json({
|
||||
"type" : "object",
|
||||
"required" : [],
|
||||
"additionalProperties" : false,
|
||||
"properties" : {
|
||||
}
|
||||
})json";
|
||||
|
||||
bool factory_loader<polygon_collider>::operator()(
|
||||
polygon_collider& component,
|
||||
const fill_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(component, ctx);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool factory_loader<polygon_collider>::operator()(
|
||||
asset_dependencies& dependencies,
|
||||
const collect_context& ctx) const
|
||||
{
|
||||
E2D_UNUSED(dependencies, ctx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
#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/commands.hpp>
|
||||
#include <enduro2d/high/components/disabled.hpp>
|
||||
#include <enduro2d/high/components/events.hpp>
|
||||
@@ -181,6 +182,9 @@ namespace e2d
|
||||
.register_component<actor>("actor")
|
||||
.register_component<behaviour>("behaviour")
|
||||
.register_component<camera>("camera")
|
||||
.register_component<box_collider>("box_collider")
|
||||
.register_component<circle_collider>("circle_collider")
|
||||
.register_component<polygon_collider>("polygon_collider")
|
||||
.register_component<flipbook_player>("flipbook_player")
|
||||
.register_component<label>("label")
|
||||
.register_component<label::dirty>("label.dirty")
|
||||
|
||||
Reference in New Issue
Block a user