CameraTools.updateScrollWheelZoom
This commit is contained in:
@@ -83,11 +83,7 @@
|
||||
(method &override :Void update [:Float elapsed]
|
||||
(super.update elapsed)
|
||||
// scroll to zoom:
|
||||
#{
|
||||
if (FlxG.mouse.wheel != 0) {
|
||||
FlxG.camera.zoom += (FlxG.mouse.wheel / 10);
|
||||
}
|
||||
}#
|
||||
(worldCamera.updateScrollWheelZoom elapsed 1)
|
||||
// F1 to toggle fullscreen:
|
||||
(when FlxG.keys.justPressed.F1
|
||||
(set FlxG.fullscreen !FlxG.fullscreen))
|
||||
|
@@ -73,4 +73,11 @@
|
||||
(<= top mPos.y (+ top margin)))
|
||||
->(if (= bottom FlxG.height)
|
||||
(<= (- bottom margin) mPos.y)
|
||||
(<= (- bottom margin) mPos.y bottom)))))
|
||||
(<= (- bottom margin) mPos.y bottom)))))
|
||||
|
||||
(function updateScrollWheelZoom [:FlxCamera camera :Float elapsed :Float speed]
|
||||
#{
|
||||
if (FlxG.mouse.wheel != 0) {
|
||||
camera.zoom += (FlxG.mouse.wheel * elapsed * speed);
|
||||
}
|
||||
}#)
|
@@ -128,6 +128,9 @@
|
||||
->{FlxG.keys.pressed.UP}
|
||||
->{FlxG.keys.pressed.DOWN})
|
||||
(FlxG.camera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.15)
|
||||
|
||||
(FlxG.camera.updateScrollWheelZoom elapsed 1)
|
||||
|
||||
// don't move the ui camera before ui has been placed -- new UI elements could appear offscreen
|
||||
(when (> uiGroup.length 0)
|
||||
(unless (and textInput textInput.hasFocus)
|
||||
|
Reference in New Issue
Block a user