Added Wren scene module ⛏

This commit is contained in:
Antoine Pilote
2021-06-10 15:15:11 -04:00
parent 19db72aa22
commit 41742ce0ad
5 changed files with 107 additions and 11 deletions

View File

@@ -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)
}
}

View File

@@ -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)")
}
}