mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-21 20:08:40 +03:00
Added Wren scene module ⛏
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
groups="screen"
|
||||
color="25 25 25 9"
|
||||
>
|
||||
<p groups="hello">Hello, world</p>
|
||||
<p groups="header">Hello, world!</p>
|
||||
|
||||
<Rect onclick="hello()"
|
||||
groups="rect"
|
||||
color="128 128 255 255">
|
||||
</Rect>
|
||||
<Slider value="sliderValue"/>
|
||||
</Canvas>
|
||||
|
||||
@@ -2,14 +2,25 @@ class Engine {
|
||||
foreign static Log(msg)
|
||||
}
|
||||
|
||||
class Vector3 {
|
||||
construct new(x, y, z) {
|
||||
_x = x
|
||||
_y = y
|
||||
_z = z
|
||||
class Scene {
|
||||
foreign static GetEntityID(name)
|
||||
|
||||
static GetEntity(name) {
|
||||
var entId = Scene.GetEntityID(name)
|
||||
var ent = Entity.new(entId)
|
||||
return ent
|
||||
}
|
||||
|
||||
foreign static EntityHasComponent(id, name)
|
||||
}
|
||||
|
||||
class Entity {
|
||||
foreign GetComponent(type)
|
||||
}
|
||||
construct new(id) {
|
||||
_entityId = id
|
||||
}
|
||||
|
||||
HasComponent(component) {
|
||||
return Scene.EntityHasComponent(_entityId, component)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "Scripts/Engine" for Engine
|
||||
import "Scripts/Engine" for Engine, Scene, Entity
|
||||
class Test {
|
||||
init() {
|
||||
System.print("hello init")
|
||||
@@ -13,6 +13,10 @@ class Test {
|
||||
}
|
||||
|
||||
static hello() {
|
||||
Engine.Log("Hello from foreign")
|
||||
var entity = Scene.GetEntity("Trenchbroom map")
|
||||
var hasTransform = entity.HasComponent("Transform")
|
||||
var hasLight = entity.HasComponent("Light")
|
||||
|
||||
Engine.Log("trasnform: %(hasTransform) light:%(hasLight)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user