From 7a17a981a776d1c9dc123c9380f571a63c61adc0 Mon Sep 17 00:00:00 2001 From: Jarek Sacha Date: Wed, 14 Nov 2018 22:39:11 -0500 Subject: [PATCH] Add release notes for v.0.2.1. --- notes/0.2.1.md | 10 ++++++ .../org/scalafx/extras/pong/Paddle.scala | 32 ++++++++++++++++-- .../scala/org/scalafx/extras/pong/Pong.scala | 33 +++++++++++++++++-- 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 notes/0.2.1.md diff --git a/notes/0.2.1.md b/notes/0.2.1.md new file mode 100644 index 0000000..dbb1cd4 --- /dev/null +++ b/notes/0.2.1.md @@ -0,0 +1,10 @@ +### ScalaFX-Extras Release v.0.2.1 + +Changes: + +* Build is done now against ScalaFX 11 + +To post questions please use [ScalaFX Users Group][5] of [StackOverflow ScalaFX][6] + +[5]: https://groups.google.com/forum/#!forum/scalafx-users +[6]: https://stackoverflow.com/questions/tagged/scalafx diff --git a/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Paddle.scala b/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Paddle.scala index 3dd63ca..02fe463 100644 --- a/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Paddle.scala +++ b/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Paddle.scala @@ -1,10 +1,36 @@ +/* + * Copyright (c) 2011-2018, ScalaFX Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the ScalaFX Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE SCALAFX PROJECT OR ITS CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package org.scalafx.extras.pong import scalafx.Includes._ import scalafx.beans.property.DoubleProperty import scalafx.geometry.Bounds import scalafx.scene.Cursor -import scalafx.scene.input.MouseEvent import scalafx.scene.paint.Color import scalafx.scene.shape.Rectangle @@ -25,12 +51,12 @@ private[pong] class Paddle(val xPos: Int) { fill = Color.LightBlue cursor = Cursor.Hand translateY <== positionY - onMousePressed = (me: MouseEvent) => { + onMousePressed = me => { initPaddleTranslateY = rect.translateY() dragAnchorY = me.sceneY } - onMouseDragged = (me: MouseEvent) => { + onMouseDragged = me => { val dragY = me.sceneY - dragAnchorY positionY() = initPaddleTranslateY + dragY } diff --git a/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Pong.scala b/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Pong.scala index 7ba5a33..835d952 100644 --- a/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Pong.scala +++ b/scalafx-extras/src/main/scala/org/scalafx/extras/pong/Pong.scala @@ -1,3 +1,30 @@ +/* + * Copyright (c) 2011-2018, ScalaFX Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the ScalaFX Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE SCALAFX PROJECT OR ITS CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package org.scalafx.extras.pong import scalafx.Includes._ @@ -6,7 +33,7 @@ import scalafx.beans.property.BooleanProperty import scalafx.event.ActionEvent import scalafx.scene.Group import scalafx.scene.control.Button -import scalafx.scene.input.{KeyCode, KeyEvent} +import scalafx.scene.input.KeyCode import scalafx.scene.shape.Rectangle import scala.language.postfixOps @@ -64,14 +91,14 @@ class Pong { startButton ) - onKeyPressed = (k: KeyEvent) => k.code match { + onKeyPressed = k => k.code match { case KeyCode.L => rightPaddle.moveUp = true case KeyCode.Comma => rightPaddle.moveDown = true case KeyCode.A => leftPaddle.moveUp = true case KeyCode.Z => leftPaddle.moveDown = true case _ => } - onKeyReleased = (k: KeyEvent) => k.code match { + onKeyReleased = k => k.code match { case KeyCode.L => rightPaddle.moveUp = false case KeyCode.Comma => rightPaddle.moveDown = false case KeyCode.A => leftPaddle.moveUp = false