class Gosu::TexChunk
Public Class Methods
new(graphics, queues, texture, x, y, w, h, padding)
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 6 def initialize(graphics, queues, texture, x, y, w, h, padding) @graphics = graphics @queues = queues @texture = texture #Define object destructor ObjectSpace.define_finalizer(self, Proc.new{@texture.finalize}) @x = x @y = y @w = w @h = h @padding = padding @info = GLTexInfo.new @info.tex_name = @texture.tex_name #Force float division @info.left = @x.to_f / @texture.size @info.top = @y.to_f / @texture.size @info.right = (@x.to_f + @w) / @texture.size @info.bottom = (@y.to_f + @h) / @texture.size end
Public Instance Methods
draw( x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode)
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 38 def draw( x1, y1, c1, x2, y2, c2, x3, y3, c3, x4, y4, c4, z, mode) op = @queues.op_pool.newDrawOp op.render_state.tex_name = @info.tex_name op.render_state.mode = mode if Gosu::reorder_coordinates_if_necessary(x1, y1, x2, y2, x3, y3, c3, x4, y4, c4) x3, y3, c3, x4, y4, c4 = x4, y4,c4, x3, y3, c3 end op.vertices_or_block_index = 4 op.vertices[0].set(x1, y1, c1) op.vertices[1].set(x2, y2, c2) op.vertices[2].set(x3, y3, c3) op.vertices[3].set(x4, y4, c4) op.left = @info.left op.top = @info.top op.right = @info.right op.bottom = @info.bottom op.z = z @queues.schedule_draw_op(op) end
finalize()
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 26 def finalize @texture.free(@x - @padding, @y - @padding) end
glTexInfo()
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 61 def glTexInfo @info end
height()
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 34 def height @h end
to_bitmap()
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 65 def to_bitmap; end
width()
click to toggle source
# File lib/gosu_android/graphics/texChunk.rb, line 30 def width @w end