Class: Gosu::DrawOpQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/gosu_android/graphics/drawOpQueue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gl) ⇒ DrawOpQueue

Returns a new instance of DrawOpQueue.



6
7
8
9
10
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 6

def initialize(gl)
  @ops = []
  @gl = gl
  @op_pool = DrawOpPool.new(@gl, 50)
end

Instance Attribute Details

#op_poolObject (readonly)

Returns the value of attribute op_pool.



5
6
7
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 5

def op_pool
  @op_pool
end

Instance Method Details

#clear_queueObject



33
34
35
36
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 33

def clear_queue
  @ops.clear
  @op_pool.clearPool
end

#gl=(gl) ⇒ Object



12
13
14
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 12

def gl= gl
  @gl = gl
end

#perform_draw_ops_and_codeObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 21

def perform_draw_ops_and_code
  #Sort by z
  @ops.sort!
  manager = RenderStateManager.new(@gl)
  @ops.each do |op|
      manager.render_state = op.render_state
      op.perform(nil) if op.vertices_or_block_index >= 0
  end
  @op_pool.clearPool
end

#schedule_draw_op(op) ⇒ Object



16
17
18
19
# File 'lib/gosu_android/graphics/drawOpQueue.rb', line 16

def schedule_draw_op(op)
  #TODO Should do more stuff, check original code
  @ops.push op
end