From 503e505273ef0f48bb929d79bd79b68757622290 Mon Sep 17 00:00:00 2001 From: Lucas Haley Date: Sat, 15 Jun 2024 17:11:46 -0700 Subject: [PATCH 1/4] Added Action:: Example as written doesn't work, needs the Action:: in there --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2c6e16..463016a 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,7 @@ A Sequence is a series of `Zif::Actions::Action` to be run in order. Behaves li **Example usage:** ```ruby @dragon.run_action( - Zif::Sequence.new( + Zif::Actions::Sequence.new( [ # Move from starting position to 1000x over 1 second, starting slowly, # then flip the sprite at the end From b36bff6786604d12251fa04a58986bd1aaf5433c Mon Sep 17 00:00:00 2001 From: Lucas Haley Date: Mon, 17 Jun 2024 10:17:39 -0700 Subject: [PATCH 2/4] Added blendmode_enum= alias Added a convenience alias to align with default DragonRuby naming --- lib/zif/sprite.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/zif/sprite.rb b/lib/zif/sprite.rb index 19443c3..4599e57 100644 --- a/lib/zif/sprite.rb +++ b/lib/zif/sprite.rb @@ -173,6 +173,8 @@ def blend=(new_blendmode) @blendmode = BLENDMODE.fetch(new_blendmode, new_blendmode) end + alias blendmode_enum= blend= + # @return [Integer] The integer value for the specified blend mode. See {BLENDMODE} # @example This always returns an integer, even if you set it using a symbol # mysprite.blend = :alpha # => 1 From d7d4799750b9871f5c3f7be1b80d250fd563c8fd Mon Sep 17 00:00:00 2001 From: Lucas Haley Date: Wed, 19 Jun 2024 12:26:57 -0700 Subject: [PATCH 3/4] Fixed linebreak continuation Changed "/" to "\" --- lib/zif/services/action_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zif/services/action_service.rb b/lib/zif/services/action_service.rb index 999d201..5e6be95 100644 --- a/lib/zif/services/action_service.rb +++ b/lib/zif/services/action_service.rb @@ -27,7 +27,7 @@ def reset_actionables # @param [Zif::Actions::Actionable] actionable def register_actionable(actionable) unless actionable.is_a?(Zif::Actions::Actionable) - raise ArgumentError, 'Zif::Services::ActionService#register_actionable:' / + raise ArgumentError, 'Zif::Services::ActionService#register_actionable:' \ " #{actionable} is not a Zif::Actions::Actionable" end From 3502a0a5a467106f7a78de2bccfe2a5aaa1a63cd Mon Sep 17 00:00:00 2001 From: Lucas Haley Date: Fri, 30 Aug 2024 12:21:34 -0700 Subject: [PATCH 4/4] Fix for DR v6 The blendmode_enum aliases stopped working in v6, so this is a simple fix to remove the intermediary `blendmode` attribute and `blend=` method. --- lib/zif/sprite.rb | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/zif/sprite.rb b/lib/zif/sprite.rb index 4599e57..adc8c5f 100644 --- a/lib/zif/sprite.rb +++ b/lib/zif/sprite.rb @@ -156,7 +156,7 @@ def initialize(name=Zif.unique_name('sprite')) @g = 255 @b = 255 @angle = 0 - self.blend = :alpha + self.blendmode_enum = :alpha end # @param [Hash] sprite A hash of key-values to mass assign to a copy of this sprite. @@ -169,22 +169,10 @@ def dup_and_assign(sprite) # Set blend mode using either symbol names or the enum integer values. # @param [Symbol, Integer] new_blendmode {blend} +:none+, +:alpha+, +:add+, +:mod+, +:multiply+ or +0+, +1+, +2+, +3+, +4+. See {BLENDMODE} # @return [Integer] The integer value for the specified blend mode - def blend=(new_blendmode) - @blendmode = BLENDMODE.fetch(new_blendmode, new_blendmode) + def blendmode_enum=(new_blendmode) + @blendmode_enum = BLENDMODE.fetch(new_blendmode, new_blendmode) end - alias blendmode_enum= blend= - - # @return [Integer] The integer value for the specified blend mode. See {BLENDMODE} - # @example This always returns an integer, even if you set it using a symbol - # mysprite.blend = :alpha # => 1 - # mysprite.blend # => 1 - def blend - @blendmode - end - - alias blendmode_enum blend - # Sets {a} alpha to 255 (fully opaque) def show @a = 255