SpriteContextgamnit $ SpriteSet :: remove_all
Remove all occurrences ofitem
			core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionserialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
			serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]= to dynamically choose the appropriate method according
			core :: Object :: class_factory
Implementation used byget_class to create the specific class.
			core :: Collection :: combinations
Allr-length combinations on self (in same order) without repeated elements.
			core :: Collection :: combinations_with_replacement
Allr-length combination on self (in same order) with repeated elements.
			serialization :: Serializable :: core_serialize_to
Actual serialization ofself to serializer
			core :: Set :: defaultinit
core :: SimpleCollection :: defaultinit
core :: Object :: defaultinit
core :: HashSet :: defaultinit
gamnit :: SpriteSet :: defaultinit
core :: Collection :: defaultinit
core :: Cloneable :: defaultinit
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
			core :: Collection :: has_all
Does the collection contain at least each element ofother?
			core :: Collection :: has_any
Does the collection contain at least one element ofother?
			core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother?
			core :: Set :: intersection
Returns the intersection of this set with theother set
			core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr-length permutations on self (all possible ordering) without repeated elements.
			core :: Collection :: product
Cartesian product, overr times self.
			core :: RemovableCollection :: remove
Remove an occurrence ofitem
			core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
			serialization :: Serializable :: serialize_msgpack
Serializeself to MessagePack bytes
			serialization :: Serializable :: serialize_to
Serializeself to serializer
			serialization :: Serializable :: serialize_to_json
Serializeself to JSON
			core :: Collection :: to_concurrent
Wrapsself in a thread-safe collection
			core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListserialization :: Serializable :: to_pretty_json
Serializeself to plain pretty JSON
			core :: Collection :: to_shuffle
Return a new array made of elements in a random order.Serializer::serialize
			
# Set of sprites sorting them into different `SpriteContext`
class SpriteSet
	super HashSet[Sprite]
	# Animation speed multiplier (0.0 to pause, 1.0 for normal speed, etc.)
	var time_mod = 1.0 is writable
	# Seconds elapsed since the launch of the program, in world time responding to `time_mod`
	var time = 0.0
	# Map texture then static vs dynamic to a `SpriteContext`
	private var contexts_map = new HashMap4[RootTexture, nullable RootTexture, Bool, Int, Array[SpriteContext]]
	# Contexts in `contexts_map`, sorted by draw order
	private var contexts_items = new Array[SpriteContext]
	# Sprites needing resorting in `contexts_map`
	private var sprites_to_remap = new Array[Sprite]
	# Add a sprite to the appropriate context
	private fun map_sprite(sprite: Sprite)
	do
		assert sprite.context == null else print_error "Sprite {sprite} belongs to another SpriteSet"
		# Sort by texture and animation texture
		var texture = sprite.texture.root
		var animation = sprite.animation
		var animation_texture = if animation != null then
			animation.frames.first.root else null
		var draw_order = sprite.draw_order
		var contexts = contexts_map[texture, animation_texture, sprite.static, draw_order]
		var context = null
		if contexts != null then
			for c in contexts.reverse_iterator do
				var size = c.sprites.length + 1
				if size * 4 <= 0xffff then
					context = c
					break
				end
			end
		end
		if context == null then
			var usage = if sprite.static then gl_STATIC_DRAW else gl_DYNAMIC_DRAW
			context = new SpriteContext(texture, animation_texture, usage, draw_order)
			if contexts == null then
				contexts = new Array[SpriteContext]
				contexts_map[texture, animation_texture, sprite.static, draw_order] = contexts
			end
			contexts.add context
			contexts_items.add context
			sprite_draw_order_sorter.sort(contexts_items)
		end
		context.sprites.add sprite
		context.sprites_to_update.add sprite
		context.last_sprite_to_update = sprite
		sprite.context = context
		sprite.sprite_set = self
		if animation != null and sprite.animation_start == -1.0 then
			# Start animation
			sprite.animation_start = time
		end
	end
	# Remove a sprite from its context
	private fun unmap_sprite(sprite: Sprite)
	do
		var context = sprite.context
		assert context != null
		context.sprites.remove sprite
		sprite.context = null
		sprite.sprite_set = null
	end
	# Draw all sprites by all contexts
	private fun draw
	do
		# Remap sprites that may need to change context
		for sprite in sprites_to_remap do
			# Skip if it was removed from this set after being modified
			if sprite.sprite_set != self then continue
			unmap_sprite sprite
			map_sprite sprite
		end
		sprites_to_remap.clear
		# Sort by draw order
		for context in contexts_items do context.draw
	end
	redef fun add(e)
	do
		if contexts_items.has(e.context) then return
		map_sprite e
		super
	end
	redef fun remove(e)
	do
		super
		if e isa Sprite then unmap_sprite e
	end
	redef fun remove_all(e)
	do
		if not has(e) then return
		remove e
	end
	redef fun clear
	do
		for sprite in self do
			sprite.context = null
			sprite.sprite_set = null
		end
		super
		for c in contexts_items do c.destroy
		contexts_map.clear
		contexts_items.clear
		sprites_to_remap.clear
	end
	private fun reset
	do
		for sprite in self do
			sprite.context = null
		end
		for c in contexts_items do c.destroy
		contexts_map.clear
		contexts_items.clear
		sprites_to_remap.clear
		for sprite in self do
			map_sprite sprite
		end
	end
end
					lib/gamnit/flat/flat_core.nit:891,1--1038,3