samples/03_rendering_sprites/04_color_and_rotation/app/main.rb
# Creates sprite by setting values inside of a hash
Creates sprite by setting values inside of a hash
Creates sprite by setting values inside of a hash
def create_sprite path, options = {}
  options = {
    x: 0,
    y: 0,
    w: 100,
    h: 100,
    angle: 0,
    rotation_anchor_x: 0.5,
    rotation_anchor_y: 0.5,
    r: 255,
    g: 255,
    b: 255,
    a: 255,
    source_x: 0,
    source_y: 0,
    source_w: -1,
    source_h: -1,
    flip_h: false,
    flip_v: false,
  }.merge options
  [
    options[:x], options[:y], options[:w], options[:h], 
    path,
    options[:angle], options[:a], options[:r], options[:g], options[:b], 
    options[:source_x], options[:source_y], options[:source_w], options[:source_h], 
    options[:flip_h], options[:flip_v], 
    options[:rotation_anchor_x], options[:rotation_anchor_y], 
  ] 
end
def create_sprite path , options = { } options = { x : 0 , y : 0 , w : 100 , h : 100 , angle : 0 , rotation_anchor_x : 0.5 , rotation_anchor_y : 0.5 , r : 255 , g : 255 , b : 255 , a : 255 , source_x : 0 , source_y : 0 , source_w : - 1 , source_h : - 1 , flip_h : false , flip_v : false , } . merge options [ options [ :x ] , options [ :y ] , options [ :w ] , options [ :h ] , path , options [ :angle ] , options [ :a ] , options [ :r ] , options [ :g ] , options [ :b ] , options [ :source_x ] , options [ :source_y ] , options [ :source_w ] , options [ :source_h ] , options [ :flip_h ] , options [ :flip_v ] , options [ :rotation_anchor_x ] , options [ :rotation_anchor_y ] , ] end
Creates sprite by setting values inside of a hash
Creates sprite by setting values inside of a hash
# dest x, y, w, h # angle, rotation # color saturation (red, green, blue), transparency # source x, y, width, height # flip horiztonally, flip vertically # dest rect keys # angle, color, alpha # source rect keys # flip # rotation anchor # hash keys contain corresponding values
path
options