forked from nova/jmonkey-test
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
2.7 KiB
108 lines
2.7 KiB
#!/usr/bin/env amm
|
|
// scala 2.13.3
|
|
|
|
// import coursierapi.MavenRepository
|
|
|
|
// interp.repositories.update(
|
|
// interp.repositories() ::: List(
|
|
// MavenRepository.of("file://home/rohan/.m2/repository")
|
|
// )
|
|
// )
|
|
|
|
// @
|
|
import $repo.`https://jcenter.bintray.com`
|
|
// import $repo.`https://bintray.com/jmonkeyengine/com.jme3`
|
|
// import $file.dep
|
|
import $ivy.`org.jmonkeyengine:jme3-core:3.2.4-stable`
|
|
// import $ivy.`wow.doge:game:1.0-SNAPSHOT`
|
|
import $ivy.`wow.doge::mygame:1.0-SNAPSHOT`
|
|
// import wow.doge.game.types.GameScript
|
|
import com.jme3.scene.control.Control
|
|
|
|
// println("hello from script")
|
|
|
|
// class Scr extends GameScript {
|
|
// def start(): Unit = println("hello from start")
|
|
|
|
// def stop(): Unit = println("hello from stop")
|
|
// }
|
|
|
|
// // class SomeClass extends Control {}
|
|
|
|
// @main
|
|
// def main(): GameScript = new Scr()
|
|
import com.simsilica.es.base.DefaultEntityData
|
|
import com.simsilica.es.EntityData
|
|
import com.jme3.app.Application
|
|
import wow.doge.mygame.game.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
|
|
import wow.doge.mygame.state._
|
|
class TestAppState(
|
|
// private var _entity: Option[EntityData] = Some(new DefaultEntityData())
|
|
) extends MyBaseState {
|
|
protected lazy val b = new Box(1, 1, 1)
|
|
protected lazy val geom = new Geometry("Box", b)
|
|
protected lazy val mat = Material(
|
|
assetManager = assetManager,
|
|
path = "Common/MatDefs/Misc/Unshaded.j3md"
|
|
)
|
|
|
|
// 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)
|
|
geom.setMaterial(mat)
|
|
rootNode.attachChild(geom)
|
|
|
|
// geom.foreach(e => {
|
|
|
|
// })
|
|
}
|
|
|
|
override def update(tpf: Float) = {
|
|
geom.rotate(0, 0.5f * tpf, 0)
|
|
geom.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 Material {
|
|
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
|
|
}
|
|
}
|
|
|
|
@main
|
|
def main(): MyBaseState = new TestAppState()
|