module FelECS::Order
Sets the priority of a list of Systems
or Scenes
for you in the order you pass them to this class.
Public Class Methods
sort(*sortables)
click to toggle source
Sets the priority of all items passed into this method according to the order they were passed. If an array is one of the elements then it will give all of those elements in the array the same priority. @param sortables [(Systems
and Array<Systems>) or (Scenes
and Array<Scenes>)] @return [Boolean] true
.
# File lib/felecs/order.rb, line 11 def self.sort(*sortables) sortables.each_with_index do |sorted, index| if sorted.respond_to? :priority sorted.priority = index else sorted.each do |item| item.priority = index end end end true end