Skip to content

Instantly share code, notes, and snippets.

View jeffmcfadden's full-sized avatar

Jeff McFadden jeffmcfadden

View GitHub Profile
@jeffmcfadden
jeffmcfadden / dr_nine_slice.rb
Last active December 30, 2023 20:11
Dragon Ruby Nine Slice Function
# License: MIT
#
# Slice a sprite into 9 pieces, and render them to the output area, scaled to fit.
#
# @note Slice coordinates are from the TOP LEFT of the sprite. Output coordinates are from the normal Bottom Left.
#
# @param args [Hash] The args hash
# @param path [String] The path to the sprite
# @param x1 [Integer] The X coordinate of the first vertical slice
# @param x2 [Integer] The X coordinate of the second vertical slice