package wow.doge.mygame.state import com.jme3.app.Application import wow.doge.mygame.implicits._ import wow.doge.mygame.components.TestComponent import com.jme3.scene.shape.Box import com.jme3.scene.Geometry import com.jme3.material.Material import com.jme3.math.ColorRGBA import com.jme3.asset.AssetManager import com.jme3.math.Vector3f class TestAppState( // private var _entity: Option[EntityData] = Some(new DefaultEntityData()) ) extends MyBaseState { var geom: Option[Geometry] = None // def entity = _entity // override def initialize(app: Application): Unit = { // super.initialize(app) // } override def init() = { entityData .createEntity() .withComponents(TestComponent()) // entityData.setComponents(x, TestComponent()) val es = entityData.getEntities(classOf[TestComponent]) println(es) val b = new Box(1, 1, 1) geom = Some(new Geometry("Box", b)) val mat = MyMaterial( assetManager = assetManager, path = "Common/MatDefs/Misc/Unshaded.j3md" ) geom.foreach(e => { e.setMaterial(mat) rootNode.attachChild(e) }) } override def update(tpf: Float) = { geom.foreach(_.rotate(0, 0.5f * tpf, 0)) geom.foreach(_.move(new Vector3f(0, 1 * tpf, 0))) } override def cleanup(app: Application): Unit = { // _entity.map(_.close()) // _entity = None } override def onEnable(): Unit = {} override def onDisable(): Unit = {} } object MyMaterial { def apply( color: String = "Color", colorType: com.jme3.math.ColorRGBA = ColorRGBA.Blue, assetManager: AssetManager, path: String ): Material = { val mat = new Material(assetManager, path) mat.setColor(color, colorType) mat } }