44 void onEvent(
const SDL_Event& event)
override;
46 void update(
unsigned int delta)
override;
50 static constexpr std::string_view kDefaultPlayerName =
"Player";
51 static constexpr std::string_view kDefaultHost =
"127.0.0.1";
54 enum class FocusField : uint8_t
67 void tryStartConnect();
75 void setConnectStatus(std::string_view message, SDL_Color color);
79 std::string_view effectivePlayerName()
const;
82 std::string_view effectiveHost()
const;
84 void restoreIdleStatusAfterHostEdit();
89 void refreshFieldPresentation();
91 void cycleFocus(
int direction);
93 void appendSanitizedFieldText(std::string& target, std::string_view chunk,
bool isHostField);
97 int measureTextWidth(std::string_view text)
const;
99 bool fitsFieldWidth(std::string_view text,
bool isHostField)
const;
103 static bool isValidHost(std::string_view host);
106 void recenterFieldValues();
110 std::shared_ptr<Text> titleText_ =
nullptr;
111 std::shared_ptr<Text> playerNameLabelText_ =
nullptr;
112 std::shared_ptr<Text> playerNameValueText_ =
nullptr;
113 std::shared_ptr<Text> hostLabelText_ =
nullptr;
114 std::shared_ptr<Text> hostValueText_ =
nullptr;
115 std::shared_ptr<Text> portValueText_ =
nullptr;
116 std::shared_ptr<Text> connectButtonText_ =
nullptr;
117 std::shared_ptr<Text> statusText_ =
nullptr;
121 FocusField focusedField_ = FocusField::PlayerName;
122 std::string playerName_;
124 bool playerNameTouched_ =
false;
125 bool hostTouched_ =
false;
127 bool transitionedToLobby_ =
false;
132 int playerNameFieldX_ = 0;
133 int playerNameFieldY_ = 0;
134 int playerNameFieldW_ = 0;
void update(unsigned int delta) override
Polls NetClient connection state and updates status/scene flow.
Definition ConnectScene.cpp:235
void onEvent(const SDL_Event &event) override
Handles field editing, connect submission, and local leave/cancel input.
Definition ConnectScene.cpp:137