Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
97c7ef0c
Commit
97c7ef0c
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Program should exit better now. Catches KeyboardInterrupt in pygame_gui.py and quits properly
parent
103df462
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!15
Resolve "Better exiting the programm and all threads"
Pipeline
#42223
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
overcooked_simulator/pygame_gui/pygame_gui.py
+17
-10
17 additions, 10 deletions
overcooked_simulator/pygame_gui/pygame_gui.py
with
17 additions
and
10 deletions
overcooked_simulator/pygame_gui/pygame_gui.py
+
17
−
10
View file @
97c7ef0c
import
colorsys
import
math
import
sys
import
numpy
as
np
import
numpy.typing
as
npt
...
...
@@ -401,15 +402,21 @@ class PyGameGUI:
# Game loop
running
=
True
while
running
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
running
=
False
if
event
.
type
in
[
pygame
.
KEYDOWN
,
pygame
.
KEYUP
]:
self
.
handle_key_event
(
event
)
self
.
handle_keys
()
clock
.
tick
(
self
.
FPS
)
state
=
self
.
simulator
.
get_state
()
self
.
draw
(
state
)
try
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
running
=
False
if
event
.
type
in
[
pygame
.
KEYDOWN
,
pygame
.
KEYUP
]:
self
.
handle_key_event
(
event
)
self
.
handle_keys
()
clock
.
tick
(
self
.
FPS
)
state
=
self
.
simulator
.
get_state
()
self
.
draw
(
state
)
except
KeyboardInterrupt
:
pygame
.
quit
()
self
.
simulator
.
stop
()
sys
.
exit
()
pygame
.
quit
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment