This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MarshalWriteBuffer | |
attr_reader :object, :data | |
def initialize(object) | |
@object = object | |
@data = "\x04\b" # '4.8' (version) | |
end | |
def write(current_object = object) | |
case current_object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./dragonruby mygame --eval bootstrap.rb | |
class GTK::Console | |
def eval_the_set_command | |
cmd = current_input_str.strip | |
if cmd == "1" | |
puts "hi" | |
prompt.clear | |
return | |
elsif cmd == "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tick args | |
easing_perc = (args.state.tick_count % 600) / 600 | |
offset_1 = 0 + easing_perc * 800 | |
offset_2 = -800 + easing_perc * 800 | |
# two sprites scrolling horizontally and vertically | |
args.outputs.background_color = [0, 0, 0] | |
args.outputs[:scene].background_color = [0, 0, 0, 0] | |
args.outputs[:scene].w = 800 | |
args.outputs[:scene].h = 800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShopScene | |
attr_gtk | |
def activate | |
state.module_selected = nil | |
state.available_modules = state.modules.shuffle.take(3) | |
state.available_module_1 = state.available_modules[0] | |
state.available_module_2 = state.available_modules[1] | |
state.available_module_3 = state.available_modules[2] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WebWrapperView < UIView | |
URL = NSBundle.mainBundle.URLForResource("index", withExtension: "html") | |
FALLBACK_USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/602.1.38 (KHTML, like Gecko) Version/10.0 Mobile/14A300 Safari/602.1' | |
def initWithFrame(frame) | |
super | |
create_web_view | |
load_url | |
self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'app/lowrez.rb' | |
class Game | |
attr_gtk | |
def request_action name, at: nil | |
at ||= state.tick_count | |
state.player.requested_action = name | |
state.player.requested_action_at = at | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tick args | |
defaults args | |
input_player args | |
spawn_bullets args | |
calc_bullets args | |
render args | |
end | |
def defaults args | |
args.state.player ||= { x: 100, y: 100 + rand(520), w: 32, h: 32, path: "sprites/square/blue.png", hp: 10 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RITE0200 £MATZ0000IREP I0300 & |