summaryrefslogtreecommitdiff
path: root/src/graphyx
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphyx')
-rw-r--r--src/graphyx/Graphyx.scala1
-rw-r--r--src/graphyx/graphics/GraphicalAABB.scala2
-rw-r--r--src/graphyx/graphics/GraphicalCircle.scala2
-rw-r--r--src/graphyx/graphics/GraphicalRectangle.scala2
-rw-r--r--src/graphyx/graphics/GraphicalRegularPolygon.scala2
-rw-r--r--src/graphyx/graphics/Parser.scala20
-rw-r--r--src/graphyx/gui/InfoPanel.scala6
-rw-r--r--src/graphyx/gui/MainFrame.scala3
-rw-r--r--src/graphyx/gui/WorldPanel.scala2
-rw-r--r--src/graphyx/tests/Cannon.scala2
10 files changed, 22 insertions, 20 deletions
diff --git a/src/graphyx/Graphyx.scala b/src/graphyx/Graphyx.scala
index 192b897..5720566 100644
--- a/src/graphyx/Graphyx.scala
+++ b/src/graphyx/Graphyx.scala
@@ -13,7 +13,6 @@ import sims.geometry._
import sims.dynamics._
object Graphyx{
-
val tests: List[graphyx.tests.Test] = List(
CompositeShape,
Joints1,
diff --git a/src/graphyx/graphics/GraphicalAABB.scala b/src/graphyx/graphics/GraphicalAABB.scala
index 3d8999c..cb3694b 100644
--- a/src/graphyx/graphics/GraphicalAABB.scala
+++ b/src/graphyx/graphics/GraphicalAABB.scala
@@ -7,7 +7,7 @@
package graphyx.graphics
import sims.collision._
-case class GraphicalAABB(real: AABB) extends AABB(real.minVertex, real.maxVertex) with GraphicalObject {
+class GraphicalAABB(val real: AABB) extends AABB(real.minVertex, real.maxVertex) with GraphicalObject {
override def draw() = {
g.setColor(java.awt.Color.BLACK)
g.drawRect((minVertex.x * scale * ppm).toInt,
diff --git a/src/graphyx/graphics/GraphicalCircle.scala b/src/graphyx/graphics/GraphicalCircle.scala
index 31f057d..ffbd7a6 100644
--- a/src/graphyx/graphics/GraphicalCircle.scala
+++ b/src/graphyx/graphics/GraphicalCircle.scala
@@ -9,7 +9,7 @@ package graphyx.graphics
import sims._
import geometry._
import dynamics._
-case class GraphicalCircle(real: Circle) extends Circle(real.radius, real.density) with GraphicalShape{
+class GraphicalCircle(val real: Circle) extends Circle(real.radius, real.density) with GraphicalShape{
override def draw() = {
//val b = Math.min(density / 100 * 255, 255)
//g.setColor(new java.awt.Color(0,0,255, b.toInt))
diff --git a/src/graphyx/graphics/GraphicalRectangle.scala b/src/graphyx/graphics/GraphicalRectangle.scala
index ae65c5e..05dfa76 100644
--- a/src/graphyx/graphics/GraphicalRectangle.scala
+++ b/src/graphyx/graphics/GraphicalRectangle.scala
@@ -8,7 +8,7 @@ package graphyx.graphics
import sims._
import sims.dynamics._
-case class GraphicalRectangle(real: Rectangle) extends Rectangle(real.halfWidth, real.halfHeight, real.density) with GraphicalShape {
+class GraphicalRectangle(val real: Rectangle) extends Rectangle(real.halfWidth, real.halfHeight, real.density) with GraphicalShape {
override def draw() = {
g.setColor(java.awt.Color.red)
fillPolygon(vertices)
diff --git a/src/graphyx/graphics/GraphicalRegularPolygon.scala b/src/graphyx/graphics/GraphicalRegularPolygon.scala
index a3906c3..fff8a9e 100644
--- a/src/graphyx/graphics/GraphicalRegularPolygon.scala
+++ b/src/graphyx/graphics/GraphicalRegularPolygon.scala
@@ -9,7 +9,7 @@ package graphyx.graphics
import sims._
import geometry._
import dynamics._
-case class GraphicalRegularPolygon(real: RegularPolygon) extends RegularPolygon(real.n, real.radius, real.density) with GraphicalShape{
+class GraphicalRegularPolygon(val real: RegularPolygon) extends RegularPolygon(real.n, real.radius, real.density) with GraphicalShape{
override def draw() = {
g.setColor(java.awt.Color.orange)
fillPolygon(vertices)
diff --git a/src/graphyx/graphics/Parser.scala b/src/graphyx/graphics/Parser.scala
index 9468d16..785d985 100644
--- a/src/graphyx/graphics/Parser.scala
+++ b/src/graphyx/graphics/Parser.scala
@@ -14,22 +14,22 @@ object Parser {
val throwOnUnknown = false
def toGraphical(real: Shape) = real match {
- case c: Circle => GraphicalCircle(c)
- case r: Rectangle => GraphicalRectangle(r)
- case p: RegularPolygon => GraphicalRegularPolygon(p)
+ case c: Circle => new GraphicalCircle(c)
+ case r: Rectangle => new GraphicalRectangle(r)
+ case p: RegularPolygon => new GraphicalRegularPolygon(p)
case _ => throw new IllegalArgumentException("Cannot cast '" + real.getClass + "' to a graphical object.")
}
def toGraphical(real: Joint) = real match {
- case j: DistanceJoint => GraphicalDistanceJoint(j)
- case j: SpringJoint => GraphicalSpringJoint(j)
- case j: RevoluteJoint => GraphicalRevoluteJoint(j)
+ case j: DistanceJoint => new GraphicalDistanceJoint(j)
+ case j: SpringJoint => new GraphicalSpringJoint(j)
+ case j: RevoluteJoint => new GraphicalRevoluteJoint(j)
case j: Joint => if (!throwOnUnknown) new GraphicalJoint{override val real = j; def draw = ()}
else throw new IllegalArgumentException("Cannot cast '" + real.getClass + "' to a graphical object.")
}
- def toGraphical(real: Collision) = GraphicalCollision(real)
- def toGraphical(real: Pair) = GraphicalPair(real)
- def toGraphical(real: AABB) = GraphicalAABB(real)
- def toGraphical(real: Body) = GraphicalBody(real)
+ def toGraphical(real: Collision) = new GraphicalCollision(real)
+ def toGraphical(real: Pair) = new GraphicalPair(real)
+ def toGraphical(real: AABB) = new GraphicalAABB(real)
+ def toGraphical(real: Body) = new GraphicalBody(real)
}
diff --git a/src/graphyx/gui/InfoPanel.scala b/src/graphyx/gui/InfoPanel.scala
index 6e58ba3..d9dad43 100644
--- a/src/graphyx/gui/InfoPanel.scala
+++ b/src/graphyx/gui/InfoPanel.scala
@@ -7,9 +7,11 @@
package graphyx.gui
import scala.swing._
+import scala.swing._
+
class InfoPanel(container: Container) extends BoxPanel(Orientation.Vertical){
- preferredSize = (200, 50)
-
+ preferredSize = new java.awt.Dimension(200, 50)
+
val out = new TextArea
out.editable = false
contents += out
diff --git a/src/graphyx/gui/MainFrame.scala b/src/graphyx/gui/MainFrame.scala
index 6b1f2fe..4fdc9a2 100644
--- a/src/graphyx/gui/MainFrame.scala
+++ b/src/graphyx/gui/MainFrame.scala
@@ -13,7 +13,8 @@ import scala.swing._
class MainFrame(container: Container) extends Frame{
super.background = java.awt.Color.WHITE
title = "graphyx"
- preferredSize = (1000,800)
+ preferredSize = new java.awt.Dimension(1000,800)
+
reactions += {
case event.WindowClosing(w) => Graphyx.exit()
}
diff --git a/src/graphyx/gui/WorldPanel.scala b/src/graphyx/gui/WorldPanel.scala
index 7f9fbee..ad14726 100644
--- a/src/graphyx/gui/WorldPanel.scala
+++ b/src/graphyx/gui/WorldPanel.scala
@@ -128,7 +128,7 @@ class WorldPanel(container: Container) extends BoxPanel(Orientation.Vertical){
grabbedBody = None
}
- listenTo(Mouse.clicks, Mouse.moves, Mouse.wheel)
+ listenTo(mouse.clicks, mouse.moves, mouse.wheel)
reactions += {
case MousePressed(c,p,x,y,b) => {
mousePressed = true; startPoint = p; endPoint = p
diff --git a/src/graphyx/tests/Cannon.scala b/src/graphyx/tests/Cannon.scala
index 7738103..01ce4e5 100644
--- a/src/graphyx/tests/Cannon.scala
+++ b/src/graphyx/tests/Cannon.scala
@@ -35,7 +35,7 @@ object Cannon extends Test{
) {fixed = (i == 0)}
}
world += cannon
- world ++= List.flatten(stack)
+ world ++= stack.flatten
}