Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pinball
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Leon Grothus
Pinball
Commits
c4410e66
Commit
c4410e66
authored
1 year ago
by
Leon Grothus
Browse files
Options
Downloads
Patches
Plain Diff
changed main layout
parent
eba98b76
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/data.png
+0
-0
0 additions, 0 deletions
data/data.png
main.py
+36
-27
36 additions, 27 deletions
main.py
with
36 additions
and
27 deletions
data/data.png
0 → 100644
+
0
−
0
View file @
c4410e66
92 B
This diff is collapsed.
Click to expand it.
main.py
+
36
−
27
View file @
c4410e66
...
...
@@ -10,30 +10,39 @@ This is the main file of the game. It initializes PyGame and creates the screen
The main event loop is also located here.
"""
# Initialize PyGame
pygame
.
init
()
options
=
OptionsManager
()
# Load options
screen
=
pygame
.
display
.
set_mode
(
options
.
resolution
)
# Create the screen
clock
=
pygame
.
time
.
Clock
()
# Create clock
sound_manager
=
SoundManager
()
# Create sound manager
sound_manager
.
set_options
(
options
)
# Set options
sound_manager
.
load_music
()
# Load music
sound_manager
.
play_music
()
# Play music
scene_manager
=
SceneManager
(
screen
,
"
main_menu
"
)
# Create scene manager and set default scene to main_menu
# Main event loop
while
True
:
events
=
pygame
.
event
.
get
()
# Get all events
sound_manager
.
update
(
events
)
# Update sound manager
for
event
in
events
:
if
event
.
type
==
pygame
.
QUIT
:
pygame
.
quit
()
sys
.
exit
()
scene_manager
.
active_scene
.
update
(
constants
.
DELTA_TIME
,
events
)
# Update the scene
pygame
.
display
.
flip
()
# Update the display
clock
.
tick
(
constants
.
FRAMERATE
)
# Limit the framerate
\ No newline at end of file
def
main
():
"""
The main function of the game. It initializes PyGame and creates the screen and clock. It also creates the sound manager and scene manager.
The main event loop is also located here.
"""
# Initialize PyGame
pygame
.
init
()
options
=
OptionsManager
()
# Load options
screen
=
pygame
.
display
.
set_mode
(
options
.
resolution
)
# Create the screen
clock
=
pygame
.
time
.
Clock
()
# Create clock
sound_manager
=
SoundManager
()
# Create sound manager
sound_manager
.
set_options
(
options
)
# Set options
sound_manager
.
load_music
()
# Load music
sound_manager
.
play_music
()
# Play music
scene_manager
=
SceneManager
(
screen
,
"
main_menu
"
)
# Create scene manager and set default scene to main_menu
# Main event loop
while
True
:
events
=
pygame
.
event
.
get
()
# Get all events
sound_manager
.
update
(
events
)
# Update sound manager
for
event
in
events
:
if
event
.
type
==
pygame
.
QUIT
:
pygame
.
quit
()
sys
.
exit
()
scene_manager
.
active_scene
.
update
(
constants
.
DELTA_TIME
,
events
)
# Update the scene
pygame
.
display
.
flip
()
# Update the display
clock
.
tick
(
constants
.
FRAMERATE
)
# Limit the framerate
if
__name__
==
"
__main__
"
:
main
()
# Run the main function
\ No newline at end of file
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