class Fox::FXGLGroup
A group of OpenGL objects
Constants
- FLT_MAX
- FLT_MIN
Public Class Methods
Source
# File lib/fox16/glgroup.rb, line 20 def initialize super @list = [] end
Returns an initialized FXGLGroup instance
Fox::FXGLObject::new
Public Instance Methods
Source
# File lib/fox16/glgroup.rb, line 35 def [](pos) @list[pos] end
Return child at position pos.
Source
# File lib/fox16/glgroup.rb, line 42 def []=(pos, obj) @list[pos] = obj end
Set child at position pos to obj.
Source
# File lib/fox16/glgroup.rb, line 130 def append(obj) @list << obj end
Append child object
Source
# File lib/fox16/glgroup.rb, line 59 def bounds box = nil if @list.empty? box = FXRangef.new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0) else box = FXRangef.new(FLT_MAX, -FLT_MAX, FLT_MAX, -FLT_MAX, FLT_MAX, -FLT_MAX) @list.each { |obj| box.include!(obj.bounds) } end box end
Return bounding box for this group (an FXRangef instance)
Source
# File lib/fox16/glgroup.rb, line 101 def canDrag true end
Return true if group can be dragged.
Source
# File lib/fox16/glgroup.rb, line 161 def clear @list.clear end
Remove all children from this group.
Source
# File lib/fox16/glgroup.rb, line 109 def drag(viewer, fx, fy, tx, ty) @list.each { |obj| obj.drag(viewer, fx, fy, tx, ty) } end
Drag group object around in viewer (an FXGLViewer instance), from (fx, fy) to (tx, ty).
Source
# File lib/fox16/glgroup.rb, line 73 def draw(viewer) @list.each { |obj| obj.draw(viewer) } end
Draw this group into viewer (an FXGLViewer instance).
Source
# File lib/fox16/glgroup.rb, line 49 def each_child # :yields: childObject @list.each { |child| yield child } self end
Iterate over child objects
Source
# File lib/fox16/glgroup.rb, line 80 def hit(viewer) # GL.PushName(0xffffffff) GL.PushName(1000000) @list.each_with_index do |obj, i| GL.LoadName(i) obj.hit(viewer) end GL.PopName end
Perform hit test in viewer (an FXGLViewer instance).
Source
# File lib/fox16/glgroup.rb, line 93 def identify(path) objIndex = path.shift @list[objIndex].identify(path) end
Identify object by means of path.
Source
# File lib/fox16/glgroup.rb, line 116 def insert(pos, obj) raise NotImplementedError end
Insert child object (obj) at position pos.
Source
# File lib/fox16/glgroup.rb, line 123 def prepend(obj) @list.unshift(obj) end
Prepend child object (obj).
Source
# File lib/fox16/glgroup.rb, line 148 def remove(obj) if obj.is_a? FXGLObject @list.delete(obj) else @list.delete_at(obj) end end
If obj is a reference to an FXGLObject in this group, remove the child object from the list. If obj is an integer, remove the child object at that position from the list.
Source
# File lib/fox16/glgroup.rb, line 139 def replace(pos, obj) @list[pos] = obj end
Replace child object at position pos with obj.
Source
# File lib/fox16/glgroup.rb, line 28 def size @list.size end
Return number of objects in this group.