Skip to content

Commit e5e3db4

Browse files
committed
5.16
1 parent d1f861e commit e5e3db4

File tree

231 files changed

+5716
-2907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+5716
-2907
lines changed

docs/changelog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
* 5.16
2+
** [Support] Increased precision of the percentage and raw values returned by controller left/right analog sticks.
3+
** [Support] ~args.inputs.left_right~ consults WASD scancodes as opposed to keycodes.
4+
More scancode values will be supported in the future. Docs have been updated to enumerate new scancode properties
5+
and behavior.
6+
** [Support] Web builds will automatically mute if the game doesn't have focus.
7+
** [Samples] Added sample app that shows how to create a repeating texture.
8+
Sample app location: =samples/07_advanced_rendering/02_render_targets_repeating_texture=
9+
** [Samples] Sample apps will include preview videos over time to mirror https://samples.dragonruby.org (be sure to check out the website).
10+
The preview videos are fairly small (trying to keep them to less than 500KB each).
11+
** [Bugfix] Fixed the letter "S" glyph in lowrez.ttf.
12+
** [Bugfix] Added polyfill for renamed/normalized keyboard properties for backwards compatability with keyboard libraries.
13+
** [Bugfix] ~$gtk.set_window_scale~ invalidates font textures so they can be redrawn at the new window size.
114
* 5.15
215
** [Pro] [iOS] [Bugfix] Fixed issue where game would crash after tomb-stoned for an extended period of time.
316
** [Pro] [iOS] [Bugfix] Fixed remote hotloading to device when app is signed with developer provisioning profile.

docs/index.html

Lines changed: 886 additions & 618 deletions
Large diffs are not rendered by default.

docs/index.txt

Lines changed: 861 additions & 622 deletions
Large diffs are not rendered by default.

docs/oss.txt

Lines changed: 131 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,15 @@ Follows is a source code listing for all files that have been open sourced. This
872872
class AudioHash < Hash
873873
def volume
874874
@volume ||= 1.0
875-
@volume
875+
if $args.gtk.production &&
876+
$args.state.tick_count != 0 &&
877+
$args.inputs.keyboard.has_focus
878+
@volume
879+
elsif !$args.gtk.production
880+
@volume
881+
else
882+
0.0
883+
end
876884
end
877885

878886
def volume= value
@@ -1731,7 +1739,7 @@ Follows is a source code listing for all files that have been open sourced. This
17311739

17321740
def inputs_scroll_up_half? args
17331741
return false if @disabled
1734-
args.inputs.keyboard.ctrl_u
1742+
args.inputs.keyboard.ctrl_u || args.inputs.keyboard.ctrl_b
17351743
end
17361744

17371745
def scroll_up_half
@@ -1752,7 +1760,7 @@ Follows is a source code listing for all files that have been open sourced. This
17521760

17531761
def inputs_scroll_down_half? args
17541762
return false if @disabled
1755-
args.inputs.keyboard.ctrl_d
1763+
args.inputs.keyboard.ctrl_d || args.inputs.keyboard.ctrl_f
17561764
end
17571765

17581766
def inputs_clear_command? args
@@ -3452,6 +3460,11 @@ Follows is a source code listing for all files that have been open sourced. This
34523460
attr label
34533461
end
34543462

3463+
alias_method :dpad_up, :directional_up
3464+
alias_method :dpad_down, :directional_down
3465+
alias_method :dpad_left, :directional_left
3466+
alias_method :dpad_right, :directional_right
3467+
34553468
def back
34563469
@select
34573470
end
@@ -4681,6 +4694,16 @@ Follows is a source code listing for all files that have been open sourced. This
46814694
class KeyboardKeys
46824695
include Serialize
46834696

4697+
def self.alias_method from, to
4698+
@aliases ||= {}
4699+
@aliases[from] = to
4700+
super from, to
4701+
end
4702+
4703+
def self.aliases
4704+
@aliases
4705+
end
4706+
46844707
attr_accessor :tilde, :underscore, :double_quotation_mark,
46854708
:exclamation_point, :at, :hash, :dollar,
46864709
:percent, :caret, :ampersand, :asterisk,
@@ -4715,6 +4738,8 @@ Follows is a source code listing for all files that have been open sourced. This
47154738
:left_arrow, :right_arrow, :up_arrow, :down_arrow, :page_up, :page_down,
47164739
:forward_slash, :back_slash
47174740

4741+
attr_accessor :w_scancode, :a_scancode, :s_scancode, :d_scancode
4742+
47184743
alias_method :section_sign, :section
47194744
alias_method :equal_sign, :equal
47204745
alias_method :dollar_sign, :dollar
@@ -4893,6 +4918,15 @@ Follows is a source code listing for all files that have been open sourced. This
48934918
}
48944919
end
48954920

4921+
def self.scancode_to_method_hash
4922+
@scancode_to_method ||= {
4923+
26 => :w_scancode,
4924+
4 => :a_scancode,
4925+
22 => :s_scancode,
4926+
7 => :d_scancode
4927+
}
4928+
end
4929+
48964930
def self.sdl_to_key raw_key, modifier
48974931
return nil unless (raw_key >= 0 && raw_key <= 255) ||
48984932
raw_key == 1073741903 ||
@@ -5140,12 +5174,13 @@ Follows is a source code listing for all files that have been open sourced. This
51405174
def get collection
51415175
return [] if collection.length == 0
51425176
collection.map do |m|
5143-
if m.end_with_bang?
5177+
resolved_m = KeyboardKeys.aliases[m] || m
5178+
if resolved_m.end_with_bang?
51445179
clear_after_return = true
51455180
end
51465181

5147-
value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)
5148-
clear_key m if clear_after_return
5182+
value = self.instance_variable_get("@#{resolved_m.without_ending_bang}".to_sym)
5183+
clear_key resolved_m if clear_after_return
51495184
[m.without_ending_bang, value]
51505185
end
51515186
end
@@ -5155,7 +5190,8 @@ Follows is a source code listing for all files that have been open sourced. This
51555190
@scrubbed_ivars = nil
51565191

51575192
collection.each do |m|
5158-
m_to_s = m.to_s
5193+
resolved_m = KeyboardKeys.aliases[m] || m
5194+
m_to_s = resolved_m.to_s
51595195
self.instance_variable_set("@#{m_to_s}".to_sym, value) if m_to_s.strip.length > 0
51605196
rescue Exception => e
51615197
raise e, <<-S
@@ -5245,7 +5281,7 @@ Follows is a source code listing for all files that have been open sourced. This
52455281
#
52465282
# @return [Boolean]
52475283
def left
5248-
@key_up.left || @key_held.left || a || false
5284+
@key_up.left || @key_held.left || a_scancode || false
52495285
end
52505286

52515287
def left_arrow
@@ -5256,7 +5292,7 @@ Follows is a source code listing for all files that have been open sourced. This
52565292
#
52575293
# @return [Boolean]
52585294
def right
5259-
@key_up.right || @key_held.right || d || false
5295+
@key_up.right || @key_held.right || d_scancode || false
52605296
end
52615297

52625298
def right_arrow
@@ -5267,7 +5303,7 @@ Follows is a source code listing for all files that have been open sourced. This
52675303
#
52685304
# @return [Boolean]
52695305
def up
5270-
@key_up.up || @key_held.up || w || false
5306+
@key_up.up || @key_held.up || w_scancode || false
52715307
end
52725308

52735309
def up_arrow
@@ -5278,7 +5314,7 @@ Follows is a source code listing for all files that have been open sourced. This
52785314
#
52795315
# @return [Boolean]
52805316
def down
5281-
@key_up.down || @key_held.down || s || false
5317+
@key_up.down || @key_held.down || s_scancode || false
52825318
end
52835319

52845320
def down_arrow
@@ -5639,18 +5675,26 @@ Follows is a source code listing for all files that have been open sourced. This
56395675
keyboard.up || (controller_one && controller_one.up)
56405676
end
56415677

5678+
alias_method :up_with_wasd, :up
5679+
56425680
def down
56435681
keyboard.down || (controller_one && controller_one.down)
56445682
end
56455683

5684+
alias_method :down_with_wasd, :down
5685+
56465686
def left
56475687
keyboard.left || (controller_one && controller_one.left)
56485688
end
56495689

5690+
alias_method :left_with_wasd, :left
5691+
56505692
def right
56515693
keyboard.right || (controller_one && controller_one.right)
56525694
end
56535695

5696+
alias_method :right_with_wasd, :right
5697+
56545698
def directional_vector
56555699
keyboard.directional_vector ||
56565700
(controller_one && controller_one.directional_vector)
@@ -5666,6 +5710,8 @@ Follows is a source code listing for all files that have been open sourced. This
56665710
return 0
56675711
end
56685712

5713+
alias_method :left_right_with_wasd, :left_right
5714+
56695715
def left_right_arrow
56705716
return -1 if keyboard.left_arrow || (controller_one && controller_one.directional_left)
56715717
return 1 if keyboard.right_arrow || (controller_one && controller_one.directional_right)
@@ -5674,12 +5720,32 @@ Follows is a source code listing for all files that have been open sourced. This
56745720

56755721
alias_method :left_right_directional, :left_right_arrow
56765722

5723+
def left_right_perc
5724+
if controller_one && controller_one.left_analog_x_perc != 0
5725+
controller_one.left_analog_x_perc
5726+
else
5727+
left_right
5728+
end
5729+
end
5730+
5731+
alias_method :left_right_perc_with_wasd, :left_right_perc
5732+
5733+
def left_right_directional_perc
5734+
if controller_one && controller_one.left_analog_x_perc != 0
5735+
controller_one.left_analog_x_perc
5736+
else
5737+
left_right_directional
5738+
end
5739+
end
5740+
56775741
def up_down
56785742
return 1 if self.up
56795743
return -1 if self.down
56805744
return 0
56815745
end
56825746

5747+
alias_method :up_down_with_wasd, :up_down
5748+
56835749
def up_down_arrow
56845750
return 1 if keyboard.up_arrow || (controller_one && controller_one.directional_up)
56855751
return -1 if keyboard.down_arrow || (controller_one && controller_one.directional_down)
@@ -5688,6 +5754,14 @@ Follows is a source code listing for all files that have been open sourced. This
56885754

56895755
alias_method :up_down_directional, :up_down_arrow
56905756

5757+
def up_down_perc
5758+
if controller_one && controller_one.left_analog_y_perc != 0
5759+
controller_one.left_analog_y_perc
5760+
else
5761+
up_down_directional
5762+
end
5763+
end
5764+
56915765
def click
56925766
return nil unless @mouse.click
56935767
return @mouse.click.point
@@ -8907,7 +8981,7 @@ Follows is a source code listing for all files that have been open sourced. This
89078981
if @last_recorded_input_was_ignored
89088982
stopped_at -= stopped_at - @last_recorded_input_was_ignored_at
89098983
end
8910-
text = "replay_version 2.0\n"
8984+
text = "replay_version 2.1\n"
89118985
text << "stopped_at #{stopped_at}\n"
89128986
text << "seed #{@seed_number}\n"
89138987
text << "recorded_at #{Time.now.to_s}\n"
@@ -8969,7 +9043,9 @@ Follows is a source code listing for all files that have been open sourced. This
89699043
text = @runtime.read_file file_name
89709044
return false unless text
89719045

8972-
if text.each_line.first.strip != "replay_version 2.0"
9046+
replay_version = text.each_line.first.strip.gsub("replay_version ", "")
9047+
9048+
if replay_version != "2.0" && replay_version != "2.1"
89739049
raise "The replay file #{file_name} is not compatible with this version of DragonRuby Game Toolkit. Please recreate the replay (sorry)."
89749050
end
89759051

@@ -9052,6 +9128,7 @@ Follows is a source code listing for all files that have been open sourced. This
90529128
value_2 = __parse_replay_value__ value_2
90539129
value_3 = __parse_replay_value__ value_3
90549130

9131+
90559132
# create a dictionary entry for the input
90569133
$replay_data[:input_history][tick_count.to_i] ||= []
90579134
$replay_data[:input_history][tick_count.to_i] << {
@@ -9062,6 +9139,42 @@ Follows is a source code listing for all files that have been open sourced. This
90629139
value_3: value_3,
90639140
value_count: value_count.to_i
90649141
}
9142+
9143+
# added scancodes and changed args.inputs.left_right's implementation to look for
9144+
# (w|a|s|d)_scancode instead of (w|a|s|d). because of this replay versions 2.0 need to insert
9145+
# a scancode entry for key_(down|up)_raw wasd
9146+
if replay_version == "2.0"
9147+
if name == :key_down_raw || name == :key_up_raw
9148+
scancode_name = if name == :key_down_raw
9149+
:scancode_down_raw
9150+
else
9151+
:scancode_up_raw
9152+
end
9153+
9154+
scancode_value_1 = if value_1 == 119 # ascii w
9155+
26
9156+
elsif value_1 == 97 # ascii a
9157+
4
9158+
elsif value_1 == 115 # ascii s
9159+
22
9160+
elsif value_1 == 100 # ascii d
9161+
7
9162+
else
9163+
nil
9164+
end
9165+
9166+
if scancode_value_1
9167+
$replay_data[:input_history][tick_count.to_i] << {
9168+
id: id.to_i,
9169+
name: scancode_name,
9170+
value_1: scancode_value_1,
9171+
value_2: value_2,
9172+
value_3: value_3,
9173+
value_count: value_count.to_i
9174+
}
9175+
end
9176+
end
9177+
end
90659178
else
90669179
raise "Replay data seems corrupt. I don't know how to parse #{l}."
90679180
end
@@ -10760,6 +10873,7 @@ Follows is a source code listing for all files that have been open sourced. This
1076010873
core_files_to_reload + @required_files
1076110874
else
1076210875
[
10876+
'dragon/cvar.rb',
1076310877
'dragon/docs.rb',
1076410878
'dragon/help.rb',
1076510879
'dragon/kernel_docs.rb',
@@ -11109,6 +11223,10 @@ Follows is a source code listing for all files that have been open sourced. This
1110911223
@simulation_speed = @simulation_speed.abs
1111011224
@simulation_speed = 1 if @simulation_speed == 0
1111111225

11226+
if cli_arguments.keys.include? :scale
11227+
set_window_scale cli_arguments[:scale].to_f
11228+
end
11229+
1111211230
if cli_arguments.keys.include? :record
1111311231
@argsv_processed = true
1111411232
seed = cli_arguments[:seed] || 100

docs/samples.html

Lines changed: 756 additions & 602 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)