()
| 353 | } |
| 354 | |
| 355 | func handleEvents() { |
| 356 | |
| 357 | globals.Mouse.wheel = 0 |
| 358 | globals.Mouse.prevPosition = globals.Mouse.screenPosition |
| 359 | |
| 360 | baseEvent := sdl.Event{} |
| 361 | |
| 362 | for sdl.PollEvent(&baseEvent) { |
| 363 | |
| 364 | switch baseEvent.Type { |
| 365 | |
| 366 | case sdl.EVENT_DROP_FILE: |
| 367 | globals.Project.CurrentPage.HandleDroppedFiles(baseEvent.DropEvent().Data) |
| 368 | |
| 369 | case sdl.EVENT_QUIT: |
| 370 | confirmQuit := globals.MenuSystem.Get("confirm quit") |
| 371 | if confirmQuit.Opened { |
| 372 | quit = true |
| 373 | } |
| 374 | confirmQuit.Center() |
| 375 | confirmQuit.Open() |
| 376 | |
| 377 | case sdl.EVENT_KEY_DOWN: |
| 378 | fallthrough |
| 379 | case sdl.EVENT_KEY_UP: |
| 380 | |
| 381 | event := baseEvent.KeyboardEvent() |
| 382 | |
| 383 | key := globals.Keyboard.Key(event.Key) |
| 384 | |
| 385 | if event.Down { |
| 386 | key.Mods = sdl.Keymod(event.Mod) |
| 387 | key.SetState(true) |
| 388 | } else { |
| 389 | key.Mods = 0 |
| 390 | key.SetState(false) |
| 391 | } |
| 392 | |
| 393 | case sdl.EVENT_WINDOW_MOUSE_ENTER: |
| 394 | globals.Mouse.InsideWindow = true |
| 395 | globals.Mouse.Dummy.InsideWindow = true |
| 396 | |
| 397 | case sdl.EVENT_WINDOW_MOUSE_LEAVE: |
| 398 | globals.Mouse.InsideWindow = false |
| 399 | globals.Mouse.Dummy.InsideWindow = false |
| 400 | |
| 401 | case sdl.EVENT_MOUSE_MOTION: |
| 402 | |
| 403 | event := baseEvent.MouseMotionEvent() |
| 404 | |
| 405 | globals.Mouse.screenPosition.X = float32(event.X) |
| 406 | globals.Mouse.screenPosition.Y = float32(event.Y) |
| 407 | |
| 408 | case sdl.EVENT_MOUSE_BUTTON_DOWN: |
| 409 | fallthrough |
| 410 | case sdl.EVENT_MOUSE_BUTTON_UP: |
| 411 | |
| 412 | event := baseEvent.MouseButtonEvent() |
no test coverage detected