summaryrefslogtreecommitdiffhomepage
path: root/dragon
diff options
context:
space:
mode:
Diffstat (limited to 'dragon')
-rw-r--r--dragon/args.rb2
-rw-r--r--dragon/benchmark.rb3
-rw-r--r--dragon/console.rb99
-rw-r--r--dragon/docs.rb2
-rw-r--r--dragon/draw.rb8
-rw-r--r--dragon/easing.rb4
-rw-r--r--dragon/framerate.rb2
-rw-r--r--dragon/geometry.rb34
-rw-r--r--dragon/inputs.rb3
-rw-r--r--dragon/ios_wizard.rb78
-rw-r--r--dragon/numeric.rb104
-rw-r--r--dragon/outputs_docs.rb16
-rw-r--r--dragon/runtime_docs.rb38
-rw-r--r--dragon/tweetcart.rb4
14 files changed, 191 insertions, 206 deletions
diff --git a/dragon/args.rb b/dragon/args.rb
index 5bb0ccf..d13d867 100644
--- a/dragon/args.rb
+++ b/dragon/args.rb
@@ -10,6 +10,7 @@ module GTK
class Args
include ArgsDeprecated
include Serialize
+ attr_accessor :cvars
attr_accessor :inputs
attr_accessor :outputs
attr_accessor :audio
@@ -30,6 +31,7 @@ module GTK
def initialize runtime, recording
@inputs = Inputs.new
@outputs = Outputs.new args: self
+ @cvars = {}
@audio = {}
@passes = []
@state = OpenEntity.new
diff --git a/dragon/benchmark.rb b/dragon/benchmark.rb
index d7e8945..38ea991 100644
--- a/dragon/benchmark.rb
+++ b/dragon/benchmark.rb
@@ -10,14 +10,13 @@ module GTK
log <<-S
** Invoking :#{name}...
S
- time_start = Time.now
idx = 0
r = nil
+ time_start = Time.now
while idx < iterations
r = proc.call
idx += 1
end
-
result = (Time.now - time_start).round 3
{ name: name,
diff --git a/dragon/console.rb b/dragon/console.rb
index 34183ae..6d9733d 100644
--- a/dragon/console.rb
+++ b/dragon/console.rb
@@ -10,14 +10,17 @@ module GTK
class Console
include ConsoleDeprecated
- attr_accessor :show_reason, :log, :logo, :background_color,
- :text_color, :animation_duration,
+ attr_accessor :show_reason, :log, :logo,
+ :animation_duration,
:max_log_lines, :max_history, :log,
- :last_command_errored, :last_command, :error_color, :shown_at,
- :header_color, :archived_log, :last_log_lines, :last_log_lines_count,
+ :last_command_errored, :last_command, :shown_at,
+ :archived_log, :last_log_lines, :last_log_lines_count,
:suppress_left_arrow_behavior, :command_set_at,
:toast_ids, :bottom,
- :font_style, :menu
+ :font_style, :menu,
+ :background_color, :spam_color, :text_color, :warn_color,
+ :error_color, :header_color, :code_color, :comment_color,
+ :debug_color, :unfiltered_color
def initialize
@font_style = FontStyle.new(font: 'font.ttf', size_enum: -1.5, line_height: 1.1)
@@ -35,15 +38,22 @@ module GTK
@command_history_index = -1
@nonhistory_input = ''
@logo = 'console-logo.png'
- @history_fname = 'console_history.txt'
+ @history_fname = 'logs/console_history.txt'
@background_color = Color.new [0, 0, 0, 224]
- @text_color = Color.new [255, 255, 255]
- @error_color = Color.new [200, 50, 50]
@header_color = Color.new [100, 200, 220]
@code_color = Color.new [210, 168, 255]
- @comment_color = Color.new [0, 200, 100]
+ @comment_color = Color.new [0, 200, 100]
@animation_duration = 1.seconds
@shown_at = -1
+
+ # these are the colors for text at various log levels.
+ @spam_color = Color.new [160, 160, 160]
+ @debug_color = Color.new [0, 255, 0]
+ @text_color = Color.new [255, 255, 255]
+ @warn_color = Color.new [255, 255, 0]
+ @error_color = Color.new [200, 50, 50]
+ @unfiltered_color = Color.new [0, 255, 255]
+
load_history
end
@@ -109,7 +119,13 @@ module GTK
nil
end
- def add_text obj
+ def add_text obj, loglevel=-1
+ # loglevel is one of the values of LogLevel in logging.h, or -1 to say "we don't care, colorize it with your special string parsing magic"
+ loglevel = -1 if loglevel < 0
+ loglevel = 5 if loglevel > 5 # 5 == unfiltered (it's 0x7FFFFFFE in C, clamp it down)
+ loglevel = 2 if (loglevel == -1) && obj.start_with?('!c!') # oh well
+ colorstr = (loglevel != -1) ? "!c!#{loglevel}" : nil
+
@last_log_lines_count ||= 1
@log_invocation_count += 1
@@ -118,12 +134,18 @@ module GTK
log_lines = []
str.each_line do |s|
- s.wrapped_lines(self.console_text_width).each do |l|
- log_lines << l
+ if colorstr.nil?
+ s.wrapped_lines(self.console_text_width).each do |l|
+ log_lines << l
+ end
+ else
+ s.wrapped_lines(self.console_text_width).each do |l|
+ log_lines << "#{colorstr}#{l}"
+ end
end
end
- if log_lines == @last_log_lines
+ if log_lines == @last_log_lines && log_lines.length != 0
@last_log_lines_count += 1
new_log_line_with_count = @last_log_lines.last + " (#{@last_log_lines_count})"
if log_lines.length > 1
@@ -398,10 +420,12 @@ S
def mouse_wheel_scroll args
@inertia ||= 0
- if args.inputs.mouse.wheel && args.inputs.mouse.wheel.y > 0
- @inertia = 1
- elsif args.inputs.mouse.wheel && args.inputs.mouse.wheel.y < 0
- @inertia = -1
+ if args.inputs.mouse.wheel
+ if args.inputs.mouse.wheel.y > 0
+ @inertia = 1
+ elsif args.inputs.mouse.wheel.y < 0
+ @inertia = -1
+ end
end
if args.inputs.mouse.click
@@ -410,13 +434,11 @@ S
return if @inertia == 0
- if @inertia != 0
- @inertia = (@inertia * 0.7)
- if @inertia > 0
- @log_offset -= 1
- elsif @inertia < 0
- @log_offset += 1
- end
+ @inertia = (@inertia * 0.7)
+ if @inertia > 0
+ @log_offset += 1
+ elsif @inertia < 0
+ @log_offset -= 1
end
if @inertia.abs < 0.01
@@ -532,7 +554,7 @@ S
def write_line(args, left, y, str, archived: false)
color = color_for_log_entry(str)
color = color.mult_alpha(0.5) if archived
-
+ str = str[4..-1] if str.start_with?('!c!') # chop off loglevel color
args.outputs.reserved << font_style.label(x: left.shift_right(10), y: y, text: str, color: color)
end
@@ -768,7 +790,9 @@ S
return false
end
- def color_for_log_entry(log_entry)
+ def color_for_plain_text log_entry
+ log_entry = log_entry[4..-1] if log_entry.start_with? "!c!"
+
if code? log_entry
@code_color
elsif code_comment? log_entry
@@ -788,6 +812,29 @@ S
end
end
+ def color_for_log_entry(log_entry)
+ if log_entry.start_with?('!c!') # loglevel color specified.
+ return case log_entry[3..3].to_i
+ when 0 # spam
+ @spam_color
+ when 1 # debug
+ @debug_color
+ #when 2 # info (caught by the `else` block.)
+ # @text_color
+ when 3 # warn
+ @warn_color
+ when 4 # error
+ @error_color
+ when 5 # unfiltered
+ @unfiltered_color
+ else
+ color_for_plain_text log_entry
+ end
+ end
+
+ return color_for_plain_text log_entry
+ end
+
def prompt
@prompt ||= Prompt.new(font_style: font_style, text_color: @text_color, console_text_width: console_text_width)
end
diff --git a/dragon/docs.rb b/dragon/docs.rb
index cd39483..17a6e9a 100644
--- a/dragon/docs.rb
+++ b/dragon/docs.rb
@@ -260,7 +260,7 @@ S
<link href="docs.css?ver=#{Time.now.to_i}" rel="stylesheet" type="text/css" media="all">
</head>
<body>
- <div id='toc'>
+ <div id='table-of-contents'>
S
html_toc_end_to_content_start = <<-S
</div>
diff --git a/dragon/draw.rb b/dragon/draw.rb
index 7136994..2963315 100644
--- a/dragon/draw.rb
+++ b/dragon/draw.rb
@@ -24,7 +24,7 @@ module GTK
fn.each_send pass.borders, self, :draw_border
fn.each_send pass.static_borders, self, :draw_border
- if !$gtk.production
+ if !self.production
fn.each_send pass.debug, self, :draw_primitive
fn.each_send pass.static_debug, self, :draw_primitive
end
@@ -41,6 +41,7 @@ module GTK
if s.respond_to? :draw_override
s.draw_override @ffi_draw
else
+ s = s.as_hash if s.is_a? OpenEntity
@ffi_draw.draw_solid_2 s.x, s.y, s.w, s.h,
s.r, s.g, s.b, s.a,
(s.blendmode_enum || 1)
@@ -54,6 +55,7 @@ module GTK
if s.respond_to? :draw_override
s.draw_override @ffi_draw
else
+ s = s.as_hash if s.is_a? OpenEntity
@ffi_draw.draw_sprite_4 s.x, s.y, s.w, s.h,
(s.path || '').to_s,
s.angle,
@@ -73,6 +75,7 @@ module GTK
if s.respond_to? :draw_override
s.draw_override @ffi_draw
else
+ s = s.as_hash if s.is_a? OpenEntity
@ffi_draw.draw_screenshot (s.path || '').to_s,
s.x, s.y, s.w, s.h,
s.angle,
@@ -91,6 +94,7 @@ module GTK
if l.respond_to? :draw_override
l.draw_override @ffi_draw
else
+ l = l.as_hash if l.is_a? OpenEntity
@ffi_draw.draw_label_3 l.x, l.y,
(l.text || '').to_s,
l.size_enum, l.alignment_enum,
@@ -108,6 +112,7 @@ module GTK
if l.respond_to? :draw_override
l.draw_override @ffi_draw
else
+ l = l.as_hash if l.is_a? OpenEntity
if l.x2
@ffi_draw.draw_line_2 l.x, l.y, l.x2, l.y2,
l.r, l.g, l.b, l.a,
@@ -133,6 +138,7 @@ module GTK
if s.respond_to? :draw_override
s.draw_override @ffi_draw
else
+ s = s.as_hash if s.is_a? OpenEntity
@ffi_draw.draw_border_2 s.x, s.y, s.w, s.h,
s.r, s.g, s.b, s.a,
(s.blendmode_enum || 1)
diff --git a/dragon/easing.rb b/dragon/easing.rb
index ef8ca0c..8b41fa6 100644
--- a/dragon/easing.rb
+++ b/dragon/easing.rb
@@ -9,8 +9,8 @@ module GTK
ease_extended start_tick,
current_tick,
start_tick + duration,
- (initial_value *definitions),
- (final_value *definitions),
+ initial_value(*definitions),
+ final_value(*definitions),
*definitions
end
diff --git a/dragon/framerate.rb b/dragon/framerate.rb
index ff2f1c5..478b340 100644
--- a/dragon/framerate.rb
+++ b/dragon/framerate.rb
@@ -34,7 +34,7 @@ module GTK
if @tick_speed_count > 60 * 2
if framerate_below_threshold?
@last_framerate = current_framerate
log framerate_warning_message
end
end
diff --git a/dragon/geometry.rb b/dragon/geometry.rb
index 6bceea8..d7c8ffc 100644
--- a/dragon/geometry.rb
+++ b/dragon/geometry.rb
@@ -6,8 +6,8 @@
module GTK
module Geometry
def self.rotate_point point, angle, around = nil
- s = Math.sin a.to_radians
- c = Math.cos a.to_radians
+ s = Math.sin angle.to_radians
+ c = Math.cos angle.to_radians
px = point.x
py = point.y
cx = 0
@@ -188,8 +188,16 @@ S
end
# @gtk
- def self.line_y_intercept line
- line.y - line_slope(line) * line.x
+ def self.line_y_intercept line, replace_infinity: nil
+ line.y - line_slope(line, replace_infinity: replace_infinity) * line.x
+ rescue Exception => e
+raise <<-S
+* ERROR: ~Geometry::line_y_intercept~
+The following exception was thrown for line: #{line}
+#{e}
+
+Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.
+S
end
# @gtk
@@ -265,14 +273,22 @@ S
end
# @gtk
- def self.line_intersect line_one, line_two
- m1 = line_slope(line_one)
- m2 = line_slope(line_two)
- b1 = line_y_intercept(line_one)
- b2 = line_y_intercept(line_two)
+ def self.line_intersect line_one, line_two, replace_infinity: nil
+ m1 = line_slope(line_one, replace_infinity: replace_infinity)
+ m2 = line_slope(line_two, replace_infinity: replace_infinity)
+ b1 = line_y_intercept(line_one, replace_infinity: replace_infinity)
+ b2 = line_y_intercept(line_two, replace_infinity: replace_infinity)
x = (b1 - b2) / (m2 - m1)
y = (-b2.fdiv(m2) + b1.fdiv(m1)).fdiv(1.fdiv(m1) - 1.fdiv(m2))
[x, y]
+ rescue Exception => e
+raise <<-S
+* ERROR: ~Geometry::line_intersect~
+The following exception was thrown for line_one: #{line_one}, line_two: #{line_two}
+#{e}
+
+Consider passing in ~replace_infinity: VALUE~ to handle for vertical lines.
+S
end
def self.contract_intersect_rect?
diff --git a/dragon/inputs.rb b/dragon/inputs.rb
index 163fc16..8be97f9 100644
--- a/dragon/inputs.rb
+++ b/dragon/inputs.rb
@@ -313,7 +313,8 @@ module GTK
value = Kernel.tick_count if value
collection.each do |m|
- self.instance_variable_set("@#{m.to_s}".to_sym, value)
+ m_to_s = m.to_s
+ self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0
rescue Exception => e
raise e, <<-S
* ERROR:
diff --git a/dragon/ios_wizard.rb b/dragon/ios_wizard.rb
index a64cdc9..c040dea 100644
--- a/dragon/ios_wizard.rb
+++ b/dragon/ios_wizard.rb
@@ -42,6 +42,7 @@ class IOSWizard < Wizard
:check_for_dev_profile,
*app_metadata_retrieval_steps,
+ :determine_devcert,
:clear_tmp_directory,
:stage_app,
@@ -70,6 +71,7 @@ class IOSWizard < Wizard
:determine_app_version,
*app_metadata_retrieval_steps,
+ :determine_prodcert,
:clear_tmp_directory,
:stage_app,
@@ -264,6 +266,10 @@ teamid=
appid=
# appname is the name you want to show up underneath the app icon on the device. Keep it under 10 characters.
appname=
+# devcert is the certificate to use for development/deploying to your local device
+devcert=
+# prodcert is the certificate to use for distribution to the app store
+prodcert=
S
end
@@ -299,7 +305,7 @@ S
def raise_ios_metadata_required
raise WizardException.new(
"* mygame/metadata/ios_metadata.txt needs to be filled out.",
- "You need to update metadata/ios_metadata.txt with a valid teamid, appname, and appid.",
+ "You need to update metadata/ios_metadata.txt with a valid teamid, appname, appid, devcert, and prodcert.",
"Instructions for where the values should come from are within metadata/ios_metadata.txt."
)
end
@@ -339,7 +345,19 @@ S
def determine_app_id
@app_id = ios_metadata.appid
raise_ios_metadata_required if @app_id.strip.length == 0
- log_info "App Identifier is set to : #{@app_id}"
+ log_info "App Identifier is set to: #{@app_id}"
+ end
+
+ def determine_devcert
+ @certificate_name = ios_metadata.devcert
+ raise_ios_metadata_required if @certificate_name.strip.length == 0
+ log_info "Dev Certificate is set to: #{@certificate_name}"
+ end
+
+ def determine_prodcert
+ @certificate_name = ios_metadata.prodcert
+ raise_ios_metadata_required if @certificate_name.strip.length == 0
+ log_info "Production (Distribution) Certificate is set to: #{@certificate_name}"
end
def set_app_name name
@@ -361,12 +379,6 @@ S
sh "rm -rf #{tmp_directory}"
end
- def stage_app
- log_info "Staging."
- sh "mkdir -p #{tmp_directory}"
- sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""
- end
-
def set_app_id id
log_info = "App Id set to: #{id}"
@app_id = id
@@ -397,34 +409,13 @@ S
def check_for_certs
log_info "Attempting to find certificates on your computer."
- if !cli_app_exist?(security_cli_app)
- raise WizardException.new(
- "* It doesn't look like you have #{security_cli_app}.",
- "** 1. Open Disk Utility and run First Aid.",
- { w: 700, h: 148, path: get_reserved_sprite("disk-utility.png") },
- )
- end
-
- if valid_certs.length == 0
- raise WizardException.new(
- "* It doesn't look like you have any valid certs installed.",
- "** 1. Open Xcode.",
- "** 2. Log into your developer account. Xcode -> Preferences -> Accounts.",
- { w: 700, h: 98, path: get_reserved_sprite("login-xcode.png") },
- "** 3. After loggin in, select Manage Certificates...",
- { w: 700, h: 115, path: get_reserved_sprite("manage-certificates.png") },
- "** 4. Add a certificate for Apple Development.",
- { w: 700, h: 217, path: get_reserved_sprite("add-cert.png") },
- )
- raise "You do not have any Apple development certs on this computer."
- end
-
if @production_build
- @certificate_name = valid_certs.find_all { |f| f[:name].include? "Distribution" }.first[:name]
+ @certificate_name = ios_metadata[:prodcert]
else
- @certificate_name = valid_certs.find_all { |f| f[:name].include? "Development" }.first[:name]
+ @certificate_name = ios_metadata[:devcert]
end
- log_info "I will be using Certificate: '#{@certificate_name}'."
+
+ log_info "I will be using certificate: '#{@certificate_name}'."
end
def idevice_id_cli_app
@@ -439,24 +430,6 @@ S
"xcodebuild"
end
- def valid_certs
- certs = sh("#{security_cli_app} -q find-identity -p codesigning -v").each_line.map do |l|
- if l.include?(")") && !l.include?("Developer ID") && (l.include?("Development") || l.include?("Distribution"))
- l.strip
- else
- nil
- end
- end.reject_nil.map do |l|
- number, id, name = l.split(' ', 3)
- name = name.gsub("\"", "") if name
- {
- number: 1,
- id: id,
- name: name
- }
- end
- end
-
def connected_devices
sh("idevice_id -l").strip.each_line.map do |l|
l.strip
@@ -986,6 +959,9 @@ XML
end
def stage_app
+ log_info "Staging."
+ sh "mkdir -p #{tmp_directory}"
+ sh "cp -R #{relative_path}/dragonruby-ios.app \"#{tmp_directory}/#{@app_name}.app\""
sh %Q[cp -r "#{root_folder}/app/" "#{app_path}/app/"]
sh %Q[cp -r "#{root_folder}/sounds/" "#{app_path}/sounds/"]
sh %Q[cp -r "#{root_folder}/sprites/" "#{app_path}/sprites/"]
diff --git a/dragon/numeric.rb b/dragon/numeric.rb
index 27cf02e..52ddf61 100644
--- a/dragon/numeric.rb
+++ b/dragon/numeric.rb
@@ -472,26 +472,6 @@ S
(0..self).to_a
end
- def >= other
- return false if !other
- return gte other
- end
-
- def > other
- return false if !other
- return gt other
- end
-
- def <= other
- return false if !other
- return lte other
- end
-
- def < other
- return false if !other
- return gt other
- end
-
# @gtk
def map
unless block_given?
@@ -577,34 +557,6 @@ The object above is not a Numeric.
S
end
- def - other
- return self unless other
- self - other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :-, e
- end
-
- def + other
- return self unless other
- self + other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :+, e
- end
-
- def * other
- return self unless other
- self * other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :*, e
- end
-
- def / other
- return self unless other
- self / other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :/, e
- end
-
def serialize
self
end
@@ -659,34 +611,6 @@ class Fixnum
return !even?
end
- def + other
- return self unless other
- self + other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :+, e
- end
-
- def * other
- return self unless other
- self * other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :*, e
- end
-
- def / other
- return self unless other
- self / other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :/, e
- end
-
- def - other
- return self unless other
- self - other
- rescue Exception => e
- __raise_arithmetic_exception__ other, :-, e
- end
-
# Returns `-1` if the number is less than `0`. `+1` if the number
# is greater than `0`. Returns `0` if the number is equal to `0`.
#
@@ -742,34 +666,6 @@ class Float
alias_method :__original_multiply__, :* unless Float.instance_methods.include? :__original_multiply__
alias_method :__original_divide__, :- unless Float.instance_methods.include? :__original_divide__
- def - other
- return self unless other
- super
- rescue Exception => e
- __raise_arithmetic_exception__ other, :-, e
- end
-
- def + other
- return self unless other
- super
- rescue Exception => e
- __raise_arithmetic_exception__ other, :+, e
- end
-
- def * other
- return self unless other
- super
- rescue Exception => e
- __raise_arithmetic_exception__ other, :*, e
- end
-
- def / other
- return self unless other
- super
- rescue Exception => e
- __raise_arithmetic_exception__ other, :/, e
- end
-
def serialize
self
end
diff --git a/dragon/outputs_docs.rb b/dragon/outputs_docs.rb
index 776d850..db15989 100644
--- a/dragon/outputs_docs.rb
+++ b/dragon/outputs_docs.rb
@@ -206,21 +206,27 @@ be provided in any order.
end
#+end_src
-** Rendering a sprite using a Class
+** Rendering a solid using a Class
-You can also create a class with sprite properties and render it as a primitive.
+You can also create a class with solid/border properties and render it as a primitive.
+ALL properties must be on the class. *Additionally*, a method called ~primitive_marker~
+must be defined on the class.
Here is an example:
#+begin_src
- # Create type with ALL sprite properties
+ # Create type with ALL sprite properties AND primitive_marker
class Sprite
- attr_sprite
+ attr_accessor :x, :y, :w, :h, :path, :angle, :angle_anchor_x, :angle_anchor_y, :tile_x, :tile_y, :tile_w, :tile_h, :source_x, :source_y, :source_w, :source_h, :flip_horizontally, :flip_vertically, :a, :r, :g, :b
+
+ def primitive_marker
+ :sprite
+ end
end
# Inherit from type
class Circle < Sprite
- # constructor
+ # constructor
def initialize x, y, size, path
self.x = x
self.y = y
diff --git a/dragon/runtime_docs.rb b/dragon/runtime_docs.rb
index 6da72d0..1f4a509 100644
--- a/dragon/runtime_docs.rb
+++ b/dragon/runtime_docs.rb
@@ -12,7 +12,8 @@ module RuntimeDocs
:docs_api_summary,
:docs_reset,
:docs_calcstringbox,
- :docs_write_file
+ :docs_write_file,
+ :docs_benchmark
]
end
@@ -485,6 +486,8 @@ Invalids the texture cache of a sprite.
Shows the mouse cursor.
*** ~.hide_cursor~
Hides the mouse cursor.
+*** ~.set_cursor path, dx, dy~
+Sets the system cursor to a sprite ~path~ with an offset of ~dx~ and ~dy~.
*** ~.cursor_shown?~
Returns ~true~ if the mouse cursor is shown.
*** ~.set_window_fullscreen enabled~
@@ -538,6 +541,39 @@ is currently in the file. Use ~GTK::Runtime#append_file~ to append to the file a
#+end_src
S
end
+
+ def docs_benchmark
+<<-S
+* DOCS: ~GTK::Runtime#benchmark~
+You can use this function to compare the relative performance of methods.
+
+#+begin_src ruby
+ def tick args
+ # press r to run benchmark
+ if args.inputs.keyboard.key_down.r
+ args.gtk.console.show
+ args.gtk.benchmark iterations: 1000, # number of iterations
+ # label for experiment
+ using_numeric_map: -> () {
+ # experiment body
+ v = 100.map do |i|
+ i * 100
+ end
+ },
+ # label for experiment
+ using_numeric_times: -> () {
+ # experiment body
+ v = []
+ 100.times do |i|
+ v << i * 100
+ end
+ }
+ end
+ end
+#+end_src
+S
+ end
+
end
class GTK::Runtime
diff --git a/dragon/tweetcart.rb b/dragon/tweetcart.rb
index 9e278b3..67e950e 100644
--- a/dragon/tweetcart.rb
+++ b/dragon/tweetcart.rb
@@ -26,9 +26,9 @@ def $top_level.TICK &block
def $top_level.slds! *os
if (os.first.is_a? Numeric)
- sld! *os
+ sld!(*os)
else
- os.each { |o| sld! *o }
+ os.each { |o| sld!(*o) }
end
end