55f4b4d933
- Add pool struct for data pools
21 lines
474 B
Ruby
21 lines
474 B
Ruby
app = App.new 400, 400, title: "Button Test"
|
|
|
|
main_scene = Scene.new
|
|
|
|
default_font = Font.new "assets/DejaVuSans.ttf", 24, italic: true
|
|
|
|
text = ElementText.new "Click me!", font: default_font, position: {x: 50, y: 50}, z: 1, click_through: true
|
|
|
|
rect = ElementRect.new {x: 50, y: 50, w: 100, h: 25}, color: 0xFF0000, z: 0
|
|
|
|
rect.on_click do
|
|
rect.color = rect.color == 0xFF0000 ?
|
|
0x00FF00
|
|
:
|
|
0xFF0000
|
|
end
|
|
|
|
main_scene << text
|
|
main_scene << rect
|
|
|
|
app.start main_scene |