summaryrefslogtreecommitdiff
path: root/src/graphyx/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphyx/graphics')
-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
5 files changed, 14 insertions, 14 deletions
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)
}