ToyGraphics uses the usual type of coordinate system in Computer graphics. Y-axis goes from up to down. X-axis goes from left to right. Top left corner has coordinates 0,0
Here is an article: Coordinate System of a Screen
The unit of measure is a pixel. Display resolution at Wikipedia.
You specify a point by pair of integer numbers, Int type in Kotlin. If you calculate a coordinate using floating-point arithmetics (Double type in Kotlin) then you have to use roundToInt() to round a Double number to Int. Example:
val distance = 10000.0
val screenRatio = 10.0
val x = distance/screenRatio.roundToInt()
Look at the example below and you see how it works.
package demos import com.anysolo.toyGraphics.* fun main() { val wnd = Window(800, 600) val gc = Graphics(wnd) gc.color = Pal16.red gc.drawRect(0, 0, 50, 50, fill = true) gc.color = Pal16.blue gc.setStrokeWidth(5.0) gc.drawLine(25, 0, 25, wnd.height-1) gc.color = Pal16.green gc.setStrokeWidth(5.0) gc.drawLine(0, 25, wnd.width-1, 25) }
