cocoa :: foundation
The Foundation Kit provides basic Objective-C classes and structuresSerializable::inspect
to show more useful information
more_collections :: more_collections
Highly specific, but useful, collections-related classes.serialization :: serialization_core
Abstract services to serialize Nit objects to different formatscore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Gamnit event support for iOS
module input_ios
intrude import ios::glkit
import display_ios
import gamnit_ios
# Pointer/touch event on iOS
class GamnitIOSPointerEvent
super PointerEvent
private var native: UIEvent
private var native_touch: UITouch
private var content_scale_factor: Float
redef fun x do return native_touch.x * content_scale_factor
redef fun y do return native_touch.y * content_scale_factor
redef var pressed
redef var is_move
redef var pointer_id = native_touch.to_i is lazy
end
redef class NitGLKView
redef var content_scale_factor = super is lazy
redef fun touches_began(touches, event)
do app.accept_event(new GamnitIOSPointerEvent(event, touches.any_object, content_scale_factor, true, false))
redef fun touches_moved(touches, event)
do app.accept_event(new GamnitIOSPointerEvent(event, touches.any_object, content_scale_factor, true, true))
redef fun touches_ended(touches, event)
do app.accept_event(new GamnitIOSPointerEvent(event, touches.any_object, content_scale_factor, false, false))
# TODO handle cancel
#redef fun touches_cancelled(touches_event) do
#do app.accept_event(new GamnitIOSPointerEvent(event, false, false))
end
lib/gamnit/input_ios.nit:15,1--59,3