refactor main game loop
This commit is contained in:
1720
src/app/TetrisApp.cpp
Normal file
1720
src/app/TetrisApp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
29
src/app/TetrisApp.h
Normal file
29
src/app/TetrisApp.h
Normal file
@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
// TetrisApp is the top-level application orchestrator.
|
||||
//
|
||||
// Responsibilities:
|
||||
// - SDL/TTF init + shutdown
|
||||
// - Asset/music loading + loading screen
|
||||
// - Main loop + state transitions
|
||||
//
|
||||
// It uses a PIMPL to keep `TetrisApp.h` light (faster builds) and to avoid leaking
|
||||
// SDL-heavy includes into every translation unit.
|
||||
class TetrisApp {
|
||||
public:
|
||||
TetrisApp();
|
||||
~TetrisApp();
|
||||
|
||||
TetrisApp(const TetrisApp&) = delete;
|
||||
TetrisApp& operator=(const TetrisApp&) = delete;
|
||||
|
||||
// Runs the application until exit is requested.
|
||||
// Returns a non-zero exit code on initialization failure.
|
||||
int run();
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
Reference in New Issue
Block a user