Skip to content

Commit

Permalink
🐛 Fix SDL event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thara committed Jan 13, 2024
1 parent a981db5 commit 49905f3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/SwiftNESMain/Emulator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ final class Emulator {
}

while isRunning {
SDL_PollEvent(&event)

let startTicks = SDL_GetTicks()
let startPerf = SDL_GetPerformanceCounter()

let eventType = SDL_EventType(rawValue: event.type)

while SDL_PollEvent(&event) != 0 {
switch eventType {
case SDL_QUIT, SDL_APP_TERMINATING:
isRunning = false
default:
break
}
switch eventType {
case SDL_QUIT, SDL_APP_TERMINATING:
isRunning = false
default:
break
}

controller.update(keys: currentKeys)
Expand Down

0 comments on commit 49905f3

Please sign in to comment.