added buttons to main state
This commit is contained in:
35
src/states/OptionsState.h
Normal file
35
src/states/OptionsState.h
Normal file
@ -0,0 +1,35 @@
|
||||
#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 {
|
||||
PlayerName = 0,
|
||||
Fullscreen = 1,
|
||||
Back = 2
|
||||
};
|
||||
|
||||
static constexpr int MAX_NAME_LENGTH = 12;
|
||||
Field m_selectedField = Field::PlayerName;
|
||||
double m_cursorTimer = 0.0;
|
||||
bool m_cursorVisible = true;
|
||||
|
||||
void moveSelection(int delta);
|
||||
void activateSelection();
|
||||
void handleNameInput(const SDL_Event& e);
|
||||
void addCharacter(char c);
|
||||
void removeCharacter();
|
||||
void toggleFullscreen();
|
||||
void exitToMenu();
|
||||
const std::string& playerName() const;
|
||||
bool isFullscreen() const;
|
||||
};
|
||||
Reference in New Issue
Block a user