summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-02-09 18:22:56 -0600
committerGitHub <[email protected]>2020-02-09 18:22:56 -0600
commit053919bbcb2a94054f243dc9fe5754f9daa595b3 (patch)
tree8aa77fa1ba26d2dbfb909506ebb0ff1396f19183
parent7ea38b527ec69a65d3bccca4cfd8d044cb00d4e6 (diff)
downloaddragonruby-game-toolkit-contrib-053919bbcb2a94054f243dc9fe5754f9daa595b3.tar.gz
dragonruby-game-toolkit-contrib-053919bbcb2a94054f243dc9fe5754f9daa595b3.zip
Create attr_sprite.rb
-rw-r--r--dragon/attr_sprite.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/dragon/attr_sprite.rb b/dragon/attr_sprite.rb
new file mode 100644
index 0000000..7865293
--- /dev/null
+++ b/dragon/attr_sprite.rb
@@ -0,0 +1,51 @@
+# Copyright 2019 DragonRuby LLC
+# MIT License
+# attr_sprite.rb has been released under MIT (*only this file*).
+
+module AttrSprite
+ include GTK::Geometry
+
+ attr_accessor :x, :y, :w, :h, :path, :angle, :a, :r, :g, :b, :tile_x,
+ :tile_y, :tile_w, :tile_h, :flip_horizontally,
+ :flip_vertically, :angle_anchor_x, :angle_anchor_y, :id
+
+ def primitive_marker
+ :sprite
+ end
+
+ def left
+ @x
+ end
+
+ def right
+ @x + @w
+ end
+
+ def bottom
+ @y
+ end
+
+ def top
+ @y + @h
+ end
+
+ def sprite
+ self
+ end
+
+ def x1
+ @x
+ end
+
+ def x1= value
+ @x = value
+ end
+
+ def y1
+ @y
+ end
+
+ def y1= value
+ @y = value
+ end
+end