accept_scroll_and_zoom
gamnit :: camera_control $ EulerCamera
Simple camera with perspective oriented with Euler angles (pitch, yaw, roll
)
gamnit :: camera_control $ EulerCamera
Simple camera with perspective oriented with Euler angles (pitch, yaw, roll
)
Serializable::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 structuregamnit :: camera_control_android
Two fingers camera manipulation, pinch to zoom and slide to scrollgamnit :: camera_control_linux
Mouse wheel and middle mouse button to control cameraEulerCamera
and App::frame_core_draw
to get a stereoscopic view
# Simple camera control for user, as the method `accept_scroll_and_zoom`
module camera_control
import gamnit
import cameras
import camera_control_linux is conditional(linux)
import camera_control_android is conditional(android)
redef class EulerCamera
# Zoom and scroll this camera from user input
#
# Scrolling is accomplished by moving the camera on the XY plane and
# zooming by moving it on the Z axis.
#
# This method has distinct implementations per platform.
# On desktop computers, the mouse wheel changes the zoom level, and
# holding down the middle mouse button scrolls the camera.
# On Android, a two finger pinch and slide gesture zoom and scroll.
#
# Returns `true` if the event is used.
#
# Should be called from `App::accept_event` before accepting pointer events:
#
# ~~~nitish
# redef class App
# redef fun accept_event(event)
# do
# if world_camera.accept_scroll_and_zoom(event) then return true
#
# # Handle other events...
# return false
# end
# end
# ~~~
fun accept_scroll_and_zoom(event: InputEvent): Bool do return false
end
lib/gamnit/camera_control.nit:15,1--51,3