# Width in world units, defaults to the width in pixels of the screen
var width: Float = display.width.to_f is lazy
- # Height in world units, defaults to the height in pixels of the screen
- var height: Float = display.height.to_f is lazy
+ # Height in world units, defaults to 1080.0
+ #
+ # Set this value using `reset_height`.
+ var height = 1080.0
# Reset the camera position so that `height` world units are visible on the Y axis
#
- # By default, `height` is set to `display.height`.
- #
# This can be used to set standardized UI units independently from the screen resolution.
fun reset_height(height: nullable Float)
do
# Center of the screen, from the point of view of the camera, at z = 0
fun center: Point3d[Float] do return new Point3d[Float](position.x + width / 2.0, position.y - height / 2.0, 0.0)
- # Anchor in the top left corner of the screen, at z = 0
+ # Center of the top of the screen, at z = 0
+ fun top: Point3d[Float] do return new Point3d[Float](position.x + width / 2.0, position.y, 0.0)
+
+ # Center of the bottom of the screen, at z = 0
+ fun bottom: Point3d[Float] do return new Point3d[Float](position.x + width / 2.0, position.y - height, 0.0)
+
+ # Center of the left border of the screen, at z = 0
+ fun left: Point3d[Float] do return new Point3d[Float](position.x, position.y - height / 2.0, 0.0)
+
+ # Center of the right border of the screen, at z = 0
+ fun right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y - height / 2.0, 0.0)
+
+ # Top left corner of the screen, at z = 0
fun top_left: Point3d[Float] do return new Point3d[Float](position.x, position.y, 0.0)
- # Anchor in the top right corner of the screen, at z = 0
+ # Top right corner of the screen, at z = 0
fun top_right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y, 0.0)
- # Anchor in the bottom left corner of the screen, at z = 0
+ # Bottom left corner of the screen, at z = 0
fun bottom_left: Point3d[Float] do return new Point3d[Float](position.x, position.y - height, 0.0)
- # Anchor in the bottom right corner of the screen, at z = 0
+ # Bottom right corner of the screen, at z = 0
fun bottom_right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y - height, 0.0)
- # TODO cache the anchors and the matrix
+ # TODO cache the anchors
redef fun mvp_matrix
do