Class: Burn::Fuel::Telnet::Scene
Constant Summary
collapse
- BG =
40
- TEXT =
background palette (0x00-0x0f)
30
- WHITE =
7
- LIGHTBLUE =
4
- BLUE =
4
- PURPLE =
5
- PINK =
5
- RED =
1
- DEEPRED =
1
- ORANGE =
3
- LIGHTORANGE =
3
- DARKGREEN =
2
- GREEN =
2
- LIGHTGREEN =
6
- BLUEGREEN =
6
- GRAY =
7
- BLACK =
0
- DARKEST =
60
- DARKER =
60
- LIGHTER =
0
- LIGHTEST =
0
Instance Method Summary
collapse
Methods included from Debug
#log
Constructor Details
#initialize(resource_name, context) ⇒ Scene
Returns a new instance of Scene.
33
34
35
|
# File 'lib/burn/fuel/telnet/scene.rb', line 33
def initialize(resource_name, context)
super(resource_name, context)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *args, &block) ⇒ Object
45
46
47
|
# File 'lib/burn/fuel/telnet/scene.rb', line 45
def method_missing(method_symbol, *args, &block)
end
|
Instance Method Details
#color(palette, color, lightness = :lighter) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/burn/fuel/telnet/scene.rb', line 53
def color(palette, color, lightness=:lighter)
target = palette==:bg ? "bg" : "fg"
palette=Scene.const_get(palette.upcase)
color=Scene.const_get(color.upcase)
lightness=Scene.const_get(lightness.upcase)
@context.instance_exec { @opcodes << "@screen.#{target}_color = #{palette+color+lightness}" }
end
|
#goto(scene_name) ⇒ Object
49
50
51
|
# File 'lib/burn/fuel/telnet/scene.rb', line 49
def goto(scene_name)
@context.instance_exec { @opcodes << "@screen.flush_screen && @pc = @opcodes.index(\"##{scene_name}\")" }
end
|
#label(string, x = 0, y = 1) ⇒ Object
37
38
39
|
# File 'lib/burn/fuel/telnet/scene.rb', line 37
def label(string, x=0, y=1)
@context.instance_exec { @opcodes << "@screen.display[#{y}][#{x},#{string.length}] = \"#{string.upcase}\"" }
end
|
#main_loop(rrb_source = nil) ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/burn/fuel/telnet/scene.rb', line 61
def main_loop(rrb_source=nil)
@context.instance_exec(@context,@resource_name) do |c, resource|
p=Pxes::CrubyTranspiler.new(Ripper.sexp(rrb_source),c,resource)
start_label = "##{resource}-main_loop:" + @opcodes.count.to_s
@opcodes << start_label
@opcodes << "@user_input.init_for_next_loop"
@opcodes.concat p.to_rb.split("\n")
@opcodes << "@pc = @opcodes.index(\"#{start_label}\")"
end
end
|
#sprite(resource) ⇒ Object
72
73
74
|
# File 'lib/burn/fuel/telnet/scene.rb', line 72
def sprite(resource)
@context.instance_exec { @opcodes << "@screen.activated_sprite_objects << @___#{resource} if @screen.activated_sprite_objects.index(@___#{resource}).nil?" }
end
|
#wait(interval) ⇒ Object
41
42
43
|
# File 'lib/burn/fuel/telnet/scene.rb', line 41
def wait(interval)
@context.instance_exec { @opcodes << "@wait = #{interval}" }
end
|