summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorarngo <[email protected]>2021-12-22 17:03:17 -0500
committerarngo <[email protected]>2021-12-22 17:03:17 -0500
commitb567c7ceb887a8da73a8e2c1015a7638ca1f8fad (patch)
tree0d4a4539460e4cd5b4e294e7c1f58989e0b4d92e
parent51fa40d59c7face1a7bf21ebc83e8df0f18ac09b (diff)
downloadSteelWings-b567c7ceb887a8da73a8e2c1015a7638ca1f8fad.tar.gz
SteelWings-b567c7ceb887a8da73a8e2c1015a7638ca1f8fad.zip
rename title component to singleton and set it up in the right place
-rw-r--r--app/components/singleton_title.rb2
-rw-r--r--app/main.rb1
-rw-r--r--app/systems/init_title_screen.rb7
-rw-r--r--app/systems/start_game.rb4
-rw-r--r--app/systems/title_screen.rb2
5 files changed, 9 insertions, 7 deletions
diff --git a/app/components/singleton_title.rb b/app/components/singleton_title.rb
new file mode 100644
index 0000000..c2fd410
--- /dev/null
+++ b/app/components/singleton_title.rb
@@ -0,0 +1,2 @@
+FF::Cmp.new('SingletonTitle', singleton: true)
+FF::Cmp::SingletonTitle.new
diff --git a/app/main.rb b/app/main.rb
index 8a447d9..20d0e8c 100644
--- a/app/main.rb
+++ b/app/main.rb
@@ -23,6 +23,7 @@ require 'app/components/teams/singleton_player_team.rb'
require 'app/components/teams/singleton_enemy_team.rb'
require 'app/components/weapon.rb'
require 'app/components/teams/team.rb'
+require 'app/components/singleton_title.rb'
require 'app/systems/init_title_screen.rb'
diff --git a/app/systems/init_title_screen.rb b/app/systems/init_title_screen.rb
index 13022ae..7f966c2 100644
--- a/app/systems/init_title_screen.rb
+++ b/app/systems/init_title_screen.rb
@@ -4,7 +4,6 @@ FF::Sys.new('InitTitleScreen', priority: 1) do
btn_x = 1280/2 - btn_w/2
btn_y = 200
- title_cmp = FF::Cmp.new('Title').new
bg_sprite = FF::Cmp::Sprite.new
title_sprite = FF::Cmp::Sprite.new
btn_sprite = FF::Cmp::Sprite.new
@@ -24,17 +23,17 @@ FF::Sys.new('InitTitleScreen', priority: 1) do
btn_sprite.props[:h] = btn_h
FF::Ent.new(
bg_sprite,
- title_cmp
+ FF::Cmp::SingletonTitle[0]
)
FF::Ent.new(
FF::Cmp::Button.new(action: FF::Sys::StartGame, pressed_sprite_path: 'sprites/title/start_pressed.png', unpressed_sprite_path: 'sprites/title/start.png'),
FF::Cmp::Hitbox.new(x: btn_x, y: btn_y, w: btn_w, h: btn_h),
btn_sprite,
- title_cmp
+ FF::Cmp::SingletonTitle[0]
)
FF::Ent.new(
title_sprite,
- title_cmp
+ FF::Cmp::SingletonTitle[0]
)
end
diff --git a/app/systems/start_game.rb b/app/systems/start_game.rb
index 96332a2..fd45a14 100644
--- a/app/systems/start_game.rb
+++ b/app/systems/start_game.rb
@@ -1,5 +1,5 @@
FF::Sys.new('StartGame', priority: 50 ) do
- thing = FF::Cmp::Title[0].entities.clone
+ thing = FF::Cmp::SingletonTitle[0].entities.clone
thing.each do |entity|
entity.components[FF::Cmp::Sprite][0].delete
if (!entity.components[FF::Cmp::Button].nil? && !entity.components[FF::Cmp::Hitbox].nil?)
@@ -9,7 +9,7 @@ FF::Sys.new('StartGame', priority: 50 ) do
entity.delete
end
- FF::Cmp::Title[0].delete
+ FF::Cmp::SingletonTitle[0].delete
FF::Stg.remove FF::Scn::TitleScreen
debug_arrow = FF::Cmp::SingletonDebugVectorArrow.new(length: 5)
diff --git a/app/systems/title_screen.rb b/app/systems/title_screen.rb
index 0fa0a81..3f16a26 100644
--- a/app/systems/title_screen.rb
+++ b/app/systems/title_screen.rb
@@ -1,6 +1,6 @@
FF::Scn::TitleScreen.add(
FF::Sys.new('TitleScreen', priority: 50) do
- FF::Cmp::Title[0].entities.each do |entity|
+ FF::Cmp::SingletonTitle[0].entities.each do |entity|
next unless entity.components.key?(FF::Cmp::Button)
btn = entity.components[FF::Cmp::Button][0]