26 MutatrisWindow(
const std::string &path,
int width,
int height,
bool fullscreen,
bool enableVsync,
bool enableCrt);
28 void event(SDL_Event &e)
override;
38 std::string assetRoot;
40 std::string shaderRoot;
42 std::array<mxvk::VK_Sprite *, 8> blocks{};
43 std::array<mxvk::VK_Sprite *, 11> backgrounds{};
44 std::vector<std::string> effectShaders;
58 std::unique_ptr<PuzzleGame> game;
62 Uint32 startupStartTick = 0;
64 int introFontSize = 0;
65 Uint32 lastDropTick = 0;
66 Uint32 lastInputTick = 0;
67 Uint32 lastKeyboardInputTick = 0;
68 Uint32 lastClearAnimationTick = 0;
73 std::mt19937 shaderRandom{std::random_device{}()};
76 int backgroundIndex = -1;
77 bool crtEnabled =
false;
78#if defined(MXVK_WITH_MIXER) || defined(WITH_MIXER)
79 std::unique_ptr<mxvk::VK_Mixer> soundEffects{};
85 void configureConsole();
86 void logMutatris(
const std::string &message);
87 [[nodiscard]]
const char *screenName(
Screen value)
const;
88 [[nodiscard]]
const char *focusName(
int value)
const;
89 void setScreen(
Screen nextScreen,
const std::string &reason);
91 void loadEffectShaders();
92 void loadSoundEffects();
93 void playSound(
int soundId);
94 void ensureMusicPlaying();
95 void handleKey(SDL_Keycode key);
96 void handleGamepad(Uint8 button);
97 void handleGamepadDpad(Uint8 button);
99 [[nodiscard]]
bool isStartupTitleFullyVisible()
const;
100 void pollKeyboardInput();
101 void handleDirectionalKey(SDL_Keycode key);
102 void softDropActivePiece();
103 [[nodiscard]]
bool activePiecePlacementBlocked()
const;
104 void triggerGameOver(
const std::string &reason);
105 bool openController();
106 void syncControllerConnection();
113 void drawTitleWithAlpha(
float alphaValue);
114 void drawDifficulty();
115 void updatePlaying();
116 void updateBackgroundShaderForLevel();
117 std::string switchBackgroundShader(
bool force);
118 void selectRandomBackground();
120 [[nodiscard]]
static std::string backgroundName(
int index);
122 void twistClearedBlocks();
123 void drawGrid(
int gridIndex);
124 [[nodiscard]] BoardLayout boardLayout(
int gridIndex)
const;
125 void drawGridFrame(
const BoardLayout &layout,
bool selected);
126 void drawCell(
const BoardLayout &layout,
int cellX,
int cellY,
int color);
127 [[nodiscard]]
float layoutScale()
const;
129 void ensureIntroFonts();
130 void resetScaledFont(
mxvk::Font &font,
int designSize,
float scale);
131 void drawTextCentered(
const std::string &text,
int y, SDL_Color color);
132 void drawTextCenteredInRect(
const std::string &text,
int x,
int y,
int w,
int h, SDL_Color color,
const mxvk::Font &font);
133 void printScaledText(
const std::string &text,
int x,
int y, SDL_Color color);
134 void printScaledText(
const std::string &text,
int x,
int y, SDL_Color color,
const mxvk::Font &font);
135 [[nodiscard]]
int scaleX(
int value)
const;
136 [[nodiscard]]
int scaleY(
int value)
const;