diff options
| author | arngo <[email protected]> | 2021-12-18 22:10:28 -0500 |
|---|---|---|
| committer | arngo <[email protected]> | 2021-12-18 22:10:28 -0500 |
| commit | 43a07949acca8a11a3aee6ea915a9a3e00b373ab (patch) | |
| tree | 8f6e1bba2e025dd11bffda46bd46b29535580be9 /app/systems/title_screen.rb | |
| parent | b04f361c9430a3a3c29ef63a43884db0d168a808 (diff) | |
| download | SteelWings-43a07949acca8a11a3aee6ea915a9a3e00b373ab.tar.gz SteelWings-43a07949acca8a11a3aee6ea915a9a3e00b373ab.zip | |
implement button components and title screen
Diffstat (limited to 'app/systems/title_screen.rb')
| -rw-r--r-- | app/systems/title_screen.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/systems/title_screen.rb b/app/systems/title_screen.rb new file mode 100644 index 0000000..0229720 --- /dev/null +++ b/app/systems/title_screen.rb @@ -0,0 +1,26 @@ +FF::Scn::TitleScreen.add( + FF::Sys.new('TitleScreen', priority: 50) do + FF::Cmp::Title[0].entities.each do |entity| + next unless entity.components.key?(FF::Cmp::Button) + + btn = entity.components[FF::Cmp::Button][0] + sprite = entity.components[FF::Cmp::Sprite][0] + hitbox = entity.components[FF::Cmp::Hitbox][0] + mouse = $gtk.args.inputs.mouse + + if mouse.x > hitbox.x and mouse.x < hitbox.x + hitbox.w and mouse.y > hitbox.y and mouse.y < hitbox.y + hitbox.h + if $gtk.args.inputs.mouse.down + btn.clicked = true + #sprite.props[:path] = '' + else + btn.clicked = false + #sprite.props[:path] = '' + end + if $gtk.args.inputs.mouse.click + btn.action.call + puts 'click' + end + end + end + end +) |
