40 lines
1018 B
C++
40 lines
1018 B
C++
#pragma once
|
|
|
|
#include "State.h"
|
|
|
|
class OptionsState : public State {
|
|
public:
|
|
explicit OptionsState(StateContext& ctx);
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void handleEvent(const SDL_Event& e) override;
|
|
void update(double frameMs) override;
|
|
void render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logicalVP) override;
|
|
|
|
private:
|
|
enum class Field : int {
|
|
Fullscreen = 0,
|
|
Music = 1,
|
|
SoundFx = 2,
|
|
SmoothScroll = 3,
|
|
Back = 4
|
|
};
|
|
|
|
static constexpr int MAX_NAME_LENGTH = 12;
|
|
Field m_selectedField = Field::Fullscreen;
|
|
double m_cursorTimer = 0.0;
|
|
bool m_cursorVisible = true;
|
|
|
|
void moveSelection(int delta);
|
|
void activateSelection();
|
|
void toggleFullscreen();
|
|
void toggleMusic();
|
|
void toggleSoundFx();
|
|
void toggleSmoothScroll();
|
|
void exitToMenu();
|
|
bool isFullscreen() const;
|
|
bool isMusicEnabled() const;
|
|
bool isSoundFxEnabled() const;
|
|
bool isSmoothScrollEnabled() const;
|
|
};
|