summaryrefslogtreecommitdiffhomepage
path: root/app/systems/init_title_screen.rb
blob: 5ec56a8a7af22e1a6e3344e2333a076b2f28270c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FF::Sys.new('InitTitleScreen', priority: 1) do
  FF::Stg.remove(
    FF::Scn::BoidRules,
    FF::Scn::Camera,
    FF::Scn::Cleanup,
  )
  bg_sprite = FF::Cmp::Sprite.new
  bg_sprite.props.merge!({
    x: 0,
    y: 0,
    w: 1280,
    h: 720,
    path: 'sprites/title/titlebackground.png'
  })
  title_sprite = FF::Cmp::Sprite.new
  title_sprite.props.merge!({
    x: 1280/2 - 993/2,
    y: 500,
    w: 993,
    h: 89,
    path: 'sprites/title/title.png'
  })
  btn_sprite = FF::Cmp::Sprite.new
  btn_w = 190
  btn_h = 49
  btn_x = 1280/2 - btn_w/2
  btn_y = 200
  btn_sprite.props.merge!({
    x: btn_x,
    y: btn_y,
    w: btn_w,
    h: btn_h,
  })
  FF::Ent.new(
    bg_sprite,
    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,
    FF::Cmp::SingletonTitle[0]
  )
  FF::Ent.new(
    title_sprite,
    FF::Cmp::SingletonTitle[0]
  )

end