menu
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace Game {
|
||||
class Input {
|
||||
@@ -16,13 +20,23 @@ namespace Game {
|
||||
static bool isMouseButtonJustReleased(Uint8 button);
|
||||
static float getMouseX();
|
||||
static float getMouseY();
|
||||
|
||||
// Text input from SDL text-input events (pushed by window thread, consumed by game thread)
|
||||
static void pushText(const std::string& utf8);
|
||||
static void consumeText(std::vector<std::string>& out);
|
||||
|
||||
private:
|
||||
static const bool* mCurrentKeyStates;
|
||||
static const bool* mPreviousKeyStates;
|
||||
static std::vector<Uint8> mPreviousKeyStates;
|
||||
static int mNumKeys;
|
||||
static int mPrevNumKeys;
|
||||
static SDL_MouseButtonFlags mCurrentMouseButtonStates;
|
||||
static SDL_MouseButtonFlags mPreviousMouseButtonStates;
|
||||
static float mMouseX;
|
||||
static float mMouseY;
|
||||
|
||||
// Text input queue and mutex (window thread writes via pushText, game thread reads via consumeText)
|
||||
static std::mutex mTextMutex;
|
||||
static std::vector<std::string> mPendingText;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user