A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/804e33130 below:

FPS camera now works even when mouse buttons are pressed, closes… · AlmasB/FXGL@804e331 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+7

-3

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+7

-3

lines changed Original file line number Diff line number Diff line change

@@ -23,6 +23,7 @@ import com.almasb.fxgl.ui.UI

23 23

import javafx.beans.property.SimpleIntegerProperty

24 24

import javafx.beans.value.ChangeListener

25 25

import javafx.collections.ObservableList

26 +

import javafx.event.EventHandler

26 27

import javafx.scene.Group

27 28

import javafx.scene.Node

28 29

import javafx.scene.SceneAntialiasing

@@ -120,19 +121,19 @@ internal constructor(width: Int, height: Int,

120 121

)

121 122 122 123

if (is3D) {

123 -

input.addEventHandler(MouseEvent.MOUSE_MOVED) {

124 +

val mouse3DHandler = EventHandler<MouseEvent> {

124 125

if (isMouseGrabbed) {

125 126

// ignore warp mouse events

126 127

if (it.screenX.toInt() == mouseWarper.warpScreenX.toInt() && it.screenY.toInt() == mouseWarper.warpScreenY.toInt()) {

127 128

lastMouseX = it.screenX - window.x

128 129

lastMouseY = it.screenY - window.y

129 130 130 -

return@addEventHandler

131 +

return@EventHandler

131 132

}

132 133

}

133 134 134 135

if (!isFPSCamera)

135 -

return@addEventHandler

136 +

return@EventHandler

136 137 137 138

val mouseX = it.screenX - window.x

138 139

val mouseY = it.screenY - window.y

@@ -175,6 +176,9 @@ internal constructor(width: Int, height: Int,

175 176

lastMouseX = mouseX

176 177

lastMouseY = mouseY

177 178

}

179 + 180 +

input.addEventHandler(MouseEvent.MOUSE_MOVED, mouse3DHandler)

181 +

input.addEventHandler(MouseEvent.MOUSE_DRAGGED, mouse3DHandler)

178 182

}

179 183 180 184

initViewport(width.toDouble(), height.toDouble())

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4