Skip to content

Instantly share code, notes, and snippets.

View Dark.scala
game.movePlayerShip(newY = Some(updatedY))
View Double.js
var $uD = function(value) {
return $asDouble(value);
};
View Compiled.js
$c_Lmain_Game.prototype.movePlayerShip__s_Option__s_Option__Lorg_denigma_threejs_Vector3 = (function(newX, newY) {
return this.playerShip$1.object3d$1
["position"]["set"](
$uD((newX.isEmpty__Z() ?
$uD(this.playerShip$1.object3d$1["position"]["x"]) :
newX.get__O())),
$uD((newY.isEmpty__Z() ?
$uD(this.playerShip$1.object3d$1["position"]["y"]) :
newY.get__O())),
$uD(this.playerShip$1.object3d$1["position"]["z"]))
View MoveShip.scala
def movePlayerShip(newX: Option[Double] = None, newY: Option[Doufragmentble] = None) = {
import playerShip.object3d._
position.set(newX.getOrElse(position.x), newY.getOrElse(position.y), position.z)
}
View GameScene.scala
class GameScene(
val scene: threejs.Scene = new threejs.Scene, // scene is mutable object
var objects: Map[Double, GameObject] = Map[Double, GameObject]()) {
def add(gameObject: GameObject) = {
scene.add(gameObject.object3d)
objects = objects + (gameObject.object3d.id -> gameObject)
}
View MainCast.scala
val mouseY = event.asInstanceOf[org.scalajs.dom.MouseEvent].clientY
View MainPM.scala
jQuery("div").mousemove { event: JQueryEventObject =>
event match {
case e: org.scalajs.dom.MouseEvent => ...
View MainMixin.scala
jQuery("div").mousemove{ event: JQueryEventObject with org.scalajs.dom.MouseEvent => ... }
View MainPF.scala
jQuery("div").mousemove{ case event: org.scalajs.dom.MouseEvent => ... }
@andrjew
andrjew / Main_v2.scala
Created Dec 10, 2015
MouseEvent mixing
View Main_v2.scala
jQuery("div").mousemove{ event: JQueryEventObject with org.scalajs.dom.MouseEvent => ... }
You can’t perform that action at this time.