diff options
| author | arngo <[email protected]> | 2022-01-29 00:21:25 -0500 |
|---|---|---|
| committer | arngo <[email protected]> | 2022-01-29 00:23:19 -0500 |
| commit | fe619e4f748ab38a128d80adaa013854d78e4a2f (patch) | |
| tree | 23f40811323aa92809c5e4ac5ac89670d461af4e /src/menu.rb | |
| parent | 99712a57accbb26fa6ad1b62deac035348b2818c (diff) | |
| download | orc-arena-of-time-fe619e4f748ab38a128d80adaa013854d78e4a2f.tar.gz orc-arena-of-time-fe619e4f748ab38a128d80adaa013854d78e4a2f.zip | |
main menu
Diffstat (limited to 'src/menu.rb')
| -rw-r--r-- | src/menu.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/menu.rb b/src/menu.rb new file mode 100644 index 0000000..e822d50 --- /dev/null +++ b/src/menu.rb @@ -0,0 +1,41 @@ +FECS::Cmp.new('Button', + :unpressed_texture, + :pressed_texture, + clicked: false) + +FECS::Sys.new('ConstructTitleScreen') do + ent = FECS::Ent.new( + FECS::Cmp::Button.new( + unpressed_texture: Rl::Texture.new('./assets/start-button.png'), + pressed_texture: Rl::Texture.new('./assets/start-button-pressed.png') + ), + FECS::Cmp::Hitbox.new( + rec: Rl::Rectangle.new(0,0,204,42), + ), + FECS::Cmp::Sprite.new( + source_rec: Rl::Rectangle.new(0,0,102,21), + dest_rec: Rl::Rectangle.new(0,0,204,42), + ), + FECS::Cmp::Position.new(x: 450-102, y: 340) + ) + MapTexture.texture = Rl::Texture.new('./assets/menu-bg.png') + MapTexture.source_rec = Rl::Rectangle.new(0,0,125,125) + MapTexture.dest_rec = Rl::Rectangle.new(325,212,250,250) +end + +FECS::Sys.new('DestroyTitleScreen') do + FECS::Cmp::Button.reverse_each do |btn| + btn_ent = btn.entity + btn_ent.components.each do |mgr, arry| + arry.reverse_each do |cmp| + puts cmp + cmp.delete + end + end + btn_ent.delete + end + FECS::Stg.remove(FECS::Scn::Menu) + FECS::Stg.add(FECS::Scn::Play) + CurrentLevel.level = 0 +end + |
