summaryrefslogtreecommitdiffhomepage
path: root/samples/09_performance
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2021-08-07 00:13:33 -0500
committerAmir Rajan <[email protected]>2021-08-07 00:13:33 -0500
commita503afe87619ff82201c0a43818fa1c3f070a548 (patch)
tree0b228a6456d17f6d0c6ea54c9ecd6a045ddbdf59 /samples/09_performance
parentbea150381f495630f92f89d23d5f3445ec289b2d (diff)
downloaddragonruby-game-toolkit-contrib-a503afe87619ff82201c0a43818fa1c3f070a548.tar.gz
dragonruby-game-toolkit-contrib-a503afe87619ff82201c0a43818fa1c3f070a548.zip
Samples folder synced.
Diffstat (limited to 'samples/09_performance')
-rw-r--r--samples/09_performance/01_sprites_as_hash/app/main.rb6
-rw-r--r--samples/09_performance/02_sprites_as_entities/app/main.rb8
-rw-r--r--samples/09_performance/03_sprites_as_strict_entities/app/main.rb6
-rw-r--r--samples/09_performance/04_sprites_as_classes/app/main.rb7
-rw-r--r--samples/09_performance/05_static_sprites_as_classes/app/main.rb9
-rw-r--r--samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb20
-rw-r--r--samples/09_performance/07_collision_limits/app/main.rb2
7 files changed, 49 insertions, 9 deletions
diff --git a/samples/09_performance/01_sprites_as_hash/app/main.rb b/samples/09_performance/01_sprites_as_hash/app/main.rb
index 6bbb295..d032900 100644
--- a/samples/09_performance/01_sprites_as_hash/app/main.rb
+++ b/samples/09_performance/01_sprites_as_hash/app/main.rb
@@ -39,7 +39,11 @@ def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
- puts "* INFO - Please specify the number of sprites to render."
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Sprites, Hashes"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
diff --git a/samples/09_performance/02_sprites_as_entities/app/main.rb b/samples/09_performance/02_sprites_as_entities/app/main.rb
index 203dbe0..dba02ae 100644
--- a/samples/09_performance/02_sprites_as_entities/app/main.rb
+++ b/samples/09_performance/02_sprites_as_entities/app/main.rb
@@ -1,5 +1,5 @@
# Sprites represented as Entities using the queue ~args.outputs.sprites~
-# yields nicer access apis over Hashes, but requires a bit more code upfront.
+# yields nicer access apis over Hashes, but require a bit more code upfront.
# The hash sample has to use star[:s] to get the speed of the star, but
# an entity can use .s instead.
def random_x args
@@ -39,7 +39,11 @@ def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
- puts "* INFO - Please specify the number of sprites to render."
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Sprites, Open Entities"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
diff --git a/samples/09_performance/03_sprites_as_strict_entities/app/main.rb b/samples/09_performance/03_sprites_as_strict_entities/app/main.rb
index 376d9a1..a2688c2 100644
--- a/samples/09_performance/03_sprites_as_strict_entities/app/main.rb
+++ b/samples/09_performance/03_sprites_as_strict_entities/app/main.rb
@@ -43,7 +43,11 @@ def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
- puts "* INFO - Please specify the number of sprites to render."
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Sprites, Strict Entities"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
diff --git a/samples/09_performance/04_sprites_as_classes/app/main.rb b/samples/09_performance/04_sprites_as_classes/app/main.rb
index d69dc66..67cde79 100644
--- a/samples/09_performance/04_sprites_as_classes/app/main.rb
+++ b/samples/09_performance/04_sprites_as_classes/app/main.rb
@@ -22,10 +22,15 @@ class Star
end
end
-# calls methods needed for the game to run properly
+# calls methods needed for game to run properly
def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Sprites, Classes"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
diff --git a/samples/09_performance/05_static_sprites_as_classes/app/main.rb b/samples/09_performance/05_static_sprites_as_classes/app/main.rb
index f87b110..db5bf8e 100644
--- a/samples/09_performance/05_static_sprites_as_classes/app/main.rb
+++ b/samples/09_performance/05_static_sprites_as_classes/app/main.rb
@@ -23,23 +23,28 @@ class Star
end
end
-# calls methods needed for the game to run properly
+# calls methods needed for game to run properly
def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Static Sprites, Classes"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
# init
if args.state.tick_count == 0
args.state.stars = args.state.star_count.map { |i| Star.new args.grid }
+ args.outputs.static_sprites << args.state.stars
end
# update
args.state.stars.each(&:move)
# render
- args.outputs.sprites << args.state.stars
args.outputs.background_color = [0, 0, 0]
args.outputs.primitives << args.gtk.current_framerate_primitives
end
diff --git a/samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb b/samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb
index 31f5c9f..3291f5e 100644
--- a/samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb
+++ b/samples/09_performance/06_static_sprites_as_classes_with_custom_drawing/app/main.rb
@@ -39,18 +39,34 @@ class Star
# x, y, w, h,
# path,
# angle,
- # alpha, red_saturation, green_saturation, blue_saturation,
+ # alpha, red_saturation, green_saturation, blue_saturation
# tile_x, tile_y, tile_w, tile_h,
# flip_horizontally, flip_vertically,
# angle_anchor_x, angle_anchor_y,
# source_x, source_y, source_w, source_h
+
+ # The argument order for ffi_draw.draw_sprite_4 is:
+ # x, y, w, h,
+ # path,
+ # angle,
+ # alpha, red_saturation, green_saturation, blue_saturation
+ # tile_x, tile_y, tile_w, tile_h,
+ # flip_horizontally, flip_vertically,
+ # angle_anchor_x, angle_anchor_y,
+ # source_x, source_y, source_w, source_h,
+ # blendmode_enum
end
end
-# calls methods needed for the game to run properly
+# calls methods needed for game to run properly
def tick args
# sets console command when sample app initially opens
if Kernel.global_tick_count == 0
+ puts ""
+ puts ""
+ puts "========================================================="
+ puts "* INFO: Static Sprites, Classes, Draw Override"
+ puts "* INFO: Please specify the number of sprites to render."
args.gtk.console.set_command "reset_with count: 100"
end
diff --git a/samples/09_performance/07_collision_limits/app/main.rb b/samples/09_performance/07_collision_limits/app/main.rb
index 4a7945c..01ad308 100644
--- a/samples/09_performance/07_collision_limits/app/main.rb
+++ b/samples/09_performance/07_collision_limits/app/main.rb
@@ -6,9 +6,11 @@
- args.outputs.solids: An array. The values generate a solid.
The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]
+ For more information about solids, go to mygame/documentation/03-solids-and-borders.md.
- args.outputs.labels: An array. The values generate a label.
The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]
+ For more information about labels, go to mygame/documentation/02-labels.md.
- ARRAY#intersect_rect?: Returns true or false depending on if two rectangles intersect.