Skip to content

Commit

Permalink
Fix Quit: allow quitting when app lacks focus.
Browse files Browse the repository at this point in the history
Add check to `while window_paused[]; poll; end` loop to also keep an eye
out for QUIT events. Also throw a QuitException if a QUIT event occurs
while the window is paused. Before, these would be ignored, the same as
any of the other events.

Bumped version number to v.1.0.2
  • Loading branch information
NHDaly committed Apr 24, 2018
1 parent 67b6052 commit bbfc2d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Binary file removed assets/music-old.wav
Binary file not shown.
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
APPNAME="Paddle Battle"
jl_main="main"
dist_certificate="Developer ID Application: nhdalyMadeThis, LLC" # outside App Store
appstore_certificate="3rd Party Mac Developer Application: nhdalyMadeThis, LLC" # outside App Store

# Build for distribution
julia ~/src/build-jl-app-bundle/build_app.jl -v \
-R assets -L "libs/*" --bundle_identifier "com.nhdalyMadeThis.Paddle-Battle" --icns "icns.icns" \
--certificate "$dist_certificate" --entitlements "./entitlements.entitlements" \
--app_version=1.0 "$jl_main.jl" "$APPNAME"
-R assets -L "libs/*" --icns "icns.icns" \
--bundle_identifier "com.nhdalyMadeThis.Paddle-Battle" \
--app_version=1.0.2 "$jl_main.jl" "$APPNAME"

6 changes: 5 additions & 1 deletion main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ function runSceneGameLoop(scene, renderer, win, inSceneVar::Ref{Bool})
while (inSceneVar[])
# Don't run if game is paused by system (resizing, lost focus, etc)
while window_paused[] != 0 # Note that this will be fixed by windowEventWatcher
_ = pollEvent!()
e,_ = pollEvent!()
t = getEventType(e)
if t == SDL2.QUIT
throw(QuitException())
end
sleep(0.1)
end
# Reload config for debug
Expand Down

0 comments on commit bbfc2d9

Please sign in to comment.