CabinGame/Luxe/blocks/debug.wren

49 lines
No EOL
934 B
Text

import "luxe: world" for World
import "luxe: draw" for Draw, PathStyle
import "luxe: io" for IO
class DrawDebug{
static Context{ __context }
static setup(world){
__context = Draw.create(World.render_set(world))
}
static commit(){
Draw.commit(__context)
}
static rect(r){
rect(r.x, r.y, r.width, r.height)
}
static rect(r, color){
rect(r.x, r.y, r.width, r.height, color)
}
static rect(x, y, w, h){
rect(x, y, w, h, [1, 0, 0, 1])
}
static rect_centered(x, y, w, h, col){
rect(x - w/2, y - h/2, w, h, col)
}
static rect(x, y, w, h, col){
var style = PathStyle.new()
style.color = col
Draw.rect(__context, x, y, 0, w, h, 0, style)
}
}
class Holder{
static x{
System.print("%(__value) was taken from me")
return __value
}
static x=(val){
System.print("I was given %(val)")
__value = val
}
}