summaryrefslogtreecommitdiffhomepage
path: root/ui.rb
blob: 2ddac87ba434278bbb63e13296444893932d98f7 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require 'ruby2d'
require_relative 'ui-tools'

module UI
  def self.load
    UI::Main.load
    UI::Popup.load
  end

  module Main
    class <<self
      attr_reader :objects, :mouse_follow, :history_slots
    end

    def self.height
      120
    end

    def self.load
      @objects = []
      @objects.push UIToolkit::Textbox::StandardTextbox.new(y: Window.height - 120,
                                                            height: height,
                                                            width: Window.width,
                                                            border_width: 12,
                                                            base_color: 'orange',
                                                            z: 99)
      @history_slots = Array.new((((Window.width - 90) / 75) - 1), nil)
      puts @history_slots.length
      (0...@history_slots.length).each do |iterate|
        @history_slots[iterate] = [UIToolkit::Borderbox::StandardBorderbox.new(y: Window.height - 90,
                                                                               x: (75 * (iterate + 1)) - 45,
                                                                               width: 60,
                                                                               height: 60,
                                                                               border_width: 5,
                                                                               base_color: 'green',
                                                                               z: 99), nil]
        @objects.push @history_slots[iterate][0]
      end
      @history_slots[0][0].base_color = 'lime'
      @popup_button = UIToolkit::Textbox::StandardTextbox.new(y: Window.height - 90,
                                                              x: @objects.last.x + 75,
                                                              width: (Window.width - 30) - (@objects.last.x + 75),
                                                              height: 60,
                                                              border_width: 5,
                                                              base_color: 'green',
                                                              z: 99)
      @objects.push @popup_button
      @mouse_follow = UIToolkit::Borderbox::TaperedBorderbox.new(width: 128 + 24,
                                                                 height: 128 + 24,
                                                                 border_width: 24,
                                                                 base_color: 'fuchsia',
                                                                 z: 98)
      @objects.push @mouse_follow
    end
  end
  module Popup
    class <<self
      attr_reader :objects, :menubox
    end

    def self.load
      @objects = []
      @menubox = UIToolkit::Textbox::StandardTextbox.new(x: Window.width * 0.01,
                                                         y: Window.width * 0.01,
                                                         width: Window.width * 0.98,
                                                         height: Window.height - (Window.width * 0.02) - 120,
                                                         border_width: 12,
                                                         base_color: [1.0, 0.52, 0.1, 0.8],
                                                         z:99)
      @objects.push @menubox
    end
  end
end