How petar812/space-invaders works
This is a C++ Space Invaders game. The principal workflow runs through the main loop: read input, update game state, check collisions, and render the current screen. Gameplay covers player movement and lives, alien movement and deaths, bullets, scoring, and menu/game-over states; sprite animation and font rendering support presentation. The excerpts show the loop and game logic, but omit some main-loop code, so unverified connections are left out.
Main entry points: main.cpp Game loop · game.cpp Game state · renderer.cpp Framebuffer renderer · input.cpp Keyboard input
Components 11
Game loop
- Game loop
src/main.cpp
Gameplay
- Game state
src/game.cpp
Rendering
- Framebuffer renderer
src/renderer.cpp - Sprites and animation
src/sprite.cpp - Bitmap font
src/font.cpp
Input
- Keyboard input
src/input.cpp
Other components
- Player
- GLFW window
Connections 13
- Game loop → Game state: controls states
src/main.cpp - Game loop → Keyboard input: reads controls
src/main.cpp - Game loop → Framebuffer renderer: draws screens
src/main.cpp - Game loop → Sprites and animation: creates animations
src/main.cpp - Game loop → Bitmap font: draws text
src/main.cpp - Keyboard input → GLFW window: registers callbacks
- Player → Keyboard input: presses keys
- Game loop → Player: moves player
src/main.cpp - Game state → Player: tracks player
src/game.cpp - Game state → Alien: creates and updates
src/game.cpp - Game state → Bullet: creates and updates
src/game.cpp - Framebuffer renderer → Sprites and animation: draws sprites
- Framebuffer renderer → Bitmap font: draws text