Class: Reight::Runner

Inherits:
App
  • Object
show all
Includes:
Xot::Inspectable
Defined in:
lib/reight/app/runner.rb

Constant Summary collapse

ROOT_CONTEXT =
Reight::CONTEXT__
TEMPORARY_HASH =
{}

Constants inherited from App

App::BUTTON_SIZE, App::CHIPS_WIDTH, App::INDEX_SIZE, App::NAVIGATOR_HEIGHT, App::PALETTE_COLORS, App::SCREEN_HEIGHT, App::SCREEN_WIDTH, App::SPACE

Instance Attribute Summary

Attributes inherited from App

#project

Instance Method Summary collapse

Methods inherited from App

#active?, #flash, #group, #history, #icon, #initialize, #inspect, #pressing?, #sprites

Constructor Details

This class inherits a constructor from Reight::App

Instance Method Details

#activatedObject



15
16
17
18
19
# File 'lib/reight/app/runner.rb', line 15

def activated()
  run force: true
  @context.call_activated__ {|&b| call_event(ignore_pause: true, &b)}
  super
end

#control_changeObject



119
120
121
122
# File 'lib/reight/app/runner.rb', line 119

def control_change()
  super
  call_event {@context.control_change}
end

#deactivatedObject



21
22
23
24
25
26
# File 'lib/reight/app/runner.rb', line 21

def deactivated()
  super
  @context.call_deactivated__ {|&b| call_event(ignore_pause: true, &b)}
  pause
  cleanup
end

#double_clickedObject



84
85
86
87
# File 'lib/reight/app/runner.rb', line 84

def double_clicked()
  super
  call_event {@context.double_clicked}
end

#drawObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/reight/app/runner.rb', line 28

def draw()
  return unless @context
  @initial_resize ||= true.tap do
    call_event {@context.size ROOT_CONTEXT.width, ROOT_CONTEXT.height}
  end
  @context.call_draw__ {|push: true, &b| call_event(push: push, &b)}
  if canvasFrame = @context.canvasFrame__
    ROOT_CONTEXT.background 0
    ROOT_CONTEXT.image @context, *canvasFrame
  else
    ROOT_CONTEXT.image @context, 0, 0
  end
  super
end

#key_pressedObject



43
44
45
46
# File 'lib/reight/app/runner.rb', line 43

def key_pressed()
  super
  call_event {@context.key_pressed}
end

#key_releasedObject



48
49
50
51
# File 'lib/reight/app/runner.rb', line 48

def key_released()
  super
  call_event {@context.key_released}
end

#key_typedObject



53
54
55
56
# File 'lib/reight/app/runner.rb', line 53

def key_typed()
  super
  call_event {@context.key_typed}
end

#labelObject



9
# File 'lib/reight/app/runner.rb', line 9

def label = 'Run'

#mouse_clickedObject



79
80
81
82
# File 'lib/reight/app/runner.rb', line 79

def mouse_clicked()
  super
  call_event {@context.mouse_clicked}
end

#mouse_draggedObject



74
75
76
77
# File 'lib/reight/app/runner.rb', line 74

def mouse_dragged()
  super
  call_event {@context.mouse_dragged}
end

#mouse_movedObject



68
69
70
71
72
# File 'lib/reight/app/runner.rb', line 68

def mouse_moved()
  super
  navigator.visible = ROOT_CONTEXT.mouse_y < NAVIGATOR_HEIGHT if r8.edit?
  call_event {@context.mouse_moved}
end

#mouse_pressedObject



58
59
60
61
# File 'lib/reight/app/runner.rb', line 58

def mouse_pressed()
  super
  call_event {@context.mouse_pressed}
end

#mouse_releasedObject



63
64
65
66
# File 'lib/reight/app/runner.rb', line 63

def mouse_released()
  super
  call_event {@context.mouse_released}
end

#mouse_wheelObject



89
90
91
92
# File 'lib/reight/app/runner.rb', line 89

def mouse_wheel()
  super
  call_event {@context.mouse_wheel}
end

#note_pressedObject



109
110
111
112
# File 'lib/reight/app/runner.rb', line 109

def note_pressed()
  super
  call_event {@context.note_pressed}
end

#note_releasedObject



114
115
116
117
# File 'lib/reight/app/runner.rb', line 114

def note_released()
  super
  call_event {@context.note_released}
end

#setupObject



11
12
13
# File 'lib/reight/app/runner.rb', line 11

def setup()
  navigator.visible = false
end

#touch_endedObject



99
100
101
102
# File 'lib/reight/app/runner.rb', line 99

def touch_ended()
  super
  call_event {@context.touch_ended}
end

#touch_movedObject



104
105
106
107
# File 'lib/reight/app/runner.rb', line 104

def touch_moved()
  super
  call_event {@context.touch_moved}
end

#touch_startedObject



94
95
96
97
# File 'lib/reight/app/runner.rb', line 94

def touch_started()
  super
  call_event {@context.touch_started}
end

#window_movedObject



124
125
126
127
# File 'lib/reight/app/runner.rb', line 124

def window_moved()
  super
  call_event(ignore_pause: true) {@context.window_moved}
end

#window_resizedObject



129
130
131
132
# File 'lib/reight/app/runner.rb', line 129

def window_resized()
  super
  call_event(ignore_pause: true) {@context.window_resized}
end