update syntax plans
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
window = Window.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
|
||||
|
||||
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.add_element text
|
||||
main_scene.add_element rect
|
||||
|
||||
window.add_scene :main_scene, main_scene
|
||||
|
||||
window.start :main_scene
|
||||
Reference in New Issue
Block a user