-
Notifications
You must be signed in to change notification settings - Fork 5
rect.um
Marek Maskarinec edited this page Oct 9, 2022
·
2 revisions
type Rect* = struct {
x, y, w, h: th.fu
}
A set of points representing a rectangle.
fn mk*(x, y, w, h: th.fu): Rect {
fn (r: ^rect.Rect) toWorld*(p: th.Vf2): th.Vf2 {
translates screen coordinates to world coordinates with cam r
fn (r: ^rect.Rect) toScreen*(p: th.Vf2): th.Vf2 {
translates world coordinates to screen coordinates with cam r
fn (r: ^rect.Rect) getPos*(): th.Vf2 {
fn (r: ^rect.Rect) getDims*(): th.Vf2 {
fn (r: ^rect.Rect) getEnd*(): th.Vf2 {
returns where the second point of the rectangle lies.
fn (r: ^rect.Rect) transformed*(t: th.Transform): th.Quad {
Transforms a rect into a quad. Order: 1. scale 2. rotation 3. position