mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-13 07:45:39 +07:00
fix samples for new prefabs
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [-512,0]
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [-256,0]
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [0,0]
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [256,0]
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [-512,-256]
|
||||
@@ -55,7 +55,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [-256,-256]
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [0,-256]
|
||||
@@ -75,7 +75,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [256,-256]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "spine_prefab.json",
|
||||
"prefab" : "spine_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "coin"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "spine_prefab.json",
|
||||
"prefab" : "spine_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "dragon"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "model_prefab.json",
|
||||
"prefab" : "model_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "gnome"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "widget_prefab.json",
|
||||
"prefab" : "widget_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "layout"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "panel"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "spine_prefab.json",
|
||||
"prefab" : "spine_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "raptor"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"prototype" : "sprite_prefab.json",
|
||||
"prefab" : "sprite_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "ship"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"prototype" : "../prefabs/scene_prefab.json",
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : 0.5
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : -0.5
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : 0.5
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : -0.5
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/gnome_prefab.json",
|
||||
"prefab" : "../prefabs/gnome_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [0,0],
|
||||
@@ -64,7 +64,7 @@
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"sprite_renderer" : {
|
||||
"blending" : "additive"
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"sprite_renderer" : {
|
||||
"tint" : [255,0,0,255]
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
"prototype" : "../prefabs/label_bm_prefab.json",
|
||||
"prefab" : "../prefabs/label_bm_prefab.json",
|
||||
"components" : {
|
||||
"label" : {
|
||||
"text" : "bm font",
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"prototype" : "../prefabs/label_sdf_prefab.json",
|
||||
"prefab" : "../prefabs/label_sdf_prefab.json",
|
||||
"components" : {
|
||||
"label" : {
|
||||
"text" : "sdf font",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"prototype" : "../prefabs/scene_prefab.json",
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/camera_prefab.json"
|
||||
"prefab" : "../prefabs/camera_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/coin_prefab.json",
|
||||
"prefab" : "../prefabs/coin_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [350,250],
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"prototype" : "../prefabs/raptor_prefab.json",
|
||||
"prefab" : "../prefabs/raptor_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [300,-350],
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"prototype" : "../prefabs/dragon_prefab.json",
|
||||
"prefab" : "../prefabs/dragon_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [-100,0],
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"prototype" : "../prefabs/scene_prefab.json",
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"components" : {
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_07/sample_07.lua"
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/camera_prefab.json"
|
||||
"prefab" : "../prefabs/camera_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/background_prefab.json"
|
||||
"prefab" : "../prefabs/background_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/gnome_prefab.json",
|
||||
"prefab" : "../prefabs/gnome_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [0,0],
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/label_sdf_prefab.json",
|
||||
"prefab" : "../prefabs/label_sdf_prefab.json",
|
||||
"components" : {
|
||||
"label" : {
|
||||
"text" : "FPS: ",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"prototype" : "../prefabs/scene_prefab.json",
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"components" : {
|
||||
"behaviour" : {
|
||||
"script" : "../scripts/sample_08/sample_08.lua"
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : 0.5
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/camera_prefab.json",
|
||||
"prefab" : "../prefabs/camera_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"rotation" : -0.5
|
||||
@@ -32,7 +32,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "ship(1)"
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "ship(11)"
|
||||
@@ -69,11 +69,10 @@
|
||||
"offset" : [10,15],
|
||||
"radius" : 33
|
||||
}
|
||||
},
|
||||
"children" : []
|
||||
}
|
||||
}]
|
||||
},{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "ship(2)"
|
||||
@@ -113,7 +112,7 @@
|
||||
}
|
||||
}
|
||||
},{
|
||||
"prototype" : "../prefabs/label_sdf_prefab.json",
|
||||
"prefab" : "../prefabs/label_sdf_prefab.json",
|
||||
"components" : {
|
||||
"named" : {
|
||||
"name" : "label"
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"prototype" : "../prefabs/scene_prefab.json",
|
||||
"prefab" : "../prefabs/scene_prefab.json",
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/background_prefab.json"
|
||||
"prefab" : "../prefabs/background_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/camera_prefab.json"
|
||||
"prefab" : "../prefabs/camera_prefab.json"
|
||||
},{
|
||||
"prototype" : "../prefabs/panel_prefab.json",
|
||||
"prefab" : "../prefabs/panel_prefab.json",
|
||||
"components" : {
|
||||
"sprite_renderer" : {
|
||||
"scale" : [4,2]
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/layout_prefab.json",
|
||||
"prefab" : "../prefabs/layout_prefab.json",
|
||||
"components" : {
|
||||
"layout" : {
|
||||
"justify_content" : "space_evenly"
|
||||
@@ -22,14 +22,14 @@
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/widget_prefab.json",
|
||||
"prefab" : "../prefabs/widget_prefab.json",
|
||||
"components" : {
|
||||
"widget" : {
|
||||
"size" : [66,113]
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [33,56.5]
|
||||
@@ -37,14 +37,14 @@
|
||||
}
|
||||
}]
|
||||
},{
|
||||
"prototype" : "../prefabs/widget_prefab.json",
|
||||
"prefab" : "../prefabs/widget_prefab.json",
|
||||
"components" : {
|
||||
"widget" : {
|
||||
"size" : [66,113]
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [33,56.5]
|
||||
@@ -52,14 +52,14 @@
|
||||
}
|
||||
}]
|
||||
},{
|
||||
"prototype" : "../prefabs/widget_prefab.json",
|
||||
"prefab" : "../prefabs/widget_prefab.json",
|
||||
"components" : {
|
||||
"widget" : {
|
||||
"size" : [66,113]
|
||||
}
|
||||
},
|
||||
"children" : [{
|
||||
"prototype" : "../prefabs/ship_prefab.json",
|
||||
"prefab" : "../prefabs/ship_prefab.json",
|
||||
"components" : {
|
||||
"actor" : {
|
||||
"translation" : [33,56.5]
|
||||
|
||||
@@ -259,28 +259,6 @@ TEST_CASE("library"){
|
||||
REQUIRE(model_res->content().mesh()->content().indices_submesh_count() == 1);
|
||||
REQUIRE_FALSE(model_res->content().mesh()->content().indices(0).empty());
|
||||
}
|
||||
|
||||
{
|
||||
auto prefab_res = l.load_asset<prefab_asset>("prefab.json");
|
||||
REQUIRE(prefab_res);
|
||||
|
||||
ecs::registry w;
|
||||
ecs::entity e = w.create_entity(prefab_res->content().prototype());
|
||||
|
||||
REQUIRE(e.exists_component<touchable>());
|
||||
|
||||
REQUIRE(e.exists_component<rect_collider>());
|
||||
REQUIRE(e.get_component<rect_collider>().size() == v2f(1.f,2.f));
|
||||
REQUIRE(e.get_component<rect_collider>().offset() == v2f(2.f,4.f));
|
||||
|
||||
REQUIRE(e.exists_component<circle_collider>());
|
||||
REQUIRE(math::approximately(e.get_component<circle_collider>().radius(), 5.f));
|
||||
REQUIRE(e.get_component<circle_collider>().offset() == v2f(4.f,2.f));
|
||||
|
||||
REQUIRE(e.exists_component<polygon_collider>());
|
||||
REQUIRE(e.get_component<polygon_collider>().points() == vector<v2f>{{1,2},{2,3},{3,4}});
|
||||
REQUIRE(e.get_component<polygon_collider>().offset() == v2f(8.f,4.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user