Commit 4cae759d authored by h2b's avatar h2b

Some access restrictions lowered.

Applications might take advantage of this for, e.g., implementing new
shapes.
parent 46921b35
......@@ -46,7 +46,7 @@ abstract class World (val p1: Point, val p2: Point) {
require(p1.x<p2.x, s"left bound must be lower than right bound: ${p1.x}>=${p2.x}")
require(p1.y<p2.y, s"lower bound must be lower than upper bound: ${p1.y}>=${p2.y}")
protected[simgraf] val screen: Screen
val screen: Screen
def width: Int = screen.width
def height: Int = screen.height
......@@ -64,11 +64,11 @@ abstract class World (val p1: Point, val p2: Point) {
protected[simgraf] def scaleX = width/(p2.x-p1.x)
protected[simgraf] def scaleY = height/(p2.y-p1.y)
protected[simgraf] def screenX (x: Double): Int = ((x-p1.x)*scaleX).toInt
protected[simgraf] def screenY (y: Double): Int = ((y-p1.y)*scaleY).toInt
def screenX (x: Double): Int = ((x-p1.x)*scaleX).toInt
def screenY (y: Double): Int = ((y-p1.y)*scaleY).toInt
protected[simgraf] implicit def toPixel (p: Point): Pixel = Pixel(screenX(p.x), screenY(p.y))
protected[simgraf] def worldX (x: Int): Double = p1.x+x/scaleX
protected[simgraf] def worldY (y: Int): Double = p1.y+y/scaleY
def worldX (x: Int): Double = p1.x+x/scaleX
def worldY (y: Int): Double = p1.y+y/scaleY
protected[simgraf] implicit def toPoint (p: Pixel): Point = Point(worldX(p.x), worldY(p.y))
/**
......@@ -155,7 +155,7 @@ object World {
def apply (p1: Point, p2: Point)
(p0: Pixel, width: Int, height: Int, title: String = ""): World = {
trait ScreenObj {
protected[simgraf] val screen: Screen = Screen(p0, width, height, title)
val screen: Screen = Screen(p0, width, height, title)
}
new World(p1, p2) with ScreenObj
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment