CabinGame/Luxe/blocks/ui/box.wren
2020-10-04 18:35:12 +02:00

28 lines
No EOL
772 B
Text

import "luxe: ui/control" for Control
import "luxe: world" for UI, World, UIEvent
import "luxe: draw" for PathStyle
import "luxe: assets" for Assets
import "luxe: render" for Image
import "luxe: math" for Math
import "globals" for Globals
import "math/rect" for AABB
import "math/math" for M
import "blocks/debug" for DrawDebug
class UiBox{
static create(ent){
var box = Control.create(ent)
var style = PathStyle.new()
style.color = [1,1,1,1]
style.thickness = 1
Control.set_state_data(box, {"style": style})
Control.set_render(box) {|control, state, x, y, w, h|
var depth = UI.draw_depth_of(control, 0)
UI.draw_rect(control, x+0.5, y+0.5, depth, w-1, h-1, 0, state["style"])
}
return box
}
}