2026-03-01 12:16:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
#include "Screen.h"
|
2026-03-06 09:52:28 -06:00
|
|
|
#include <vector>
|
2026-03-01 12:16:08 +08:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
class ChatScreen : public Screen
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
wstring message;
|
2026-03-06 09:52:28 -06:00
|
|
|
int cursorIndex;
|
|
|
|
|
void applyHistoryMessage();
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
private:
|
|
|
|
|
int frame;
|
2026-03-06 09:52:28 -06:00
|
|
|
static const size_t CHAT_HISTORY_MAX = 100;
|
|
|
|
|
static std::vector<wstring> s_chatHistory;
|
|
|
|
|
static int s_historyIndex;
|
|
|
|
|
static wstring s_historyDraft;
|
|
|
|
|
static const wstring allowedChars;
|
|
|
|
|
static bool isAllowedChatChar(wchar_t c);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
public:
|
2026-03-06 09:52:28 -06:00
|
|
|
ChatScreen();
|
2026-03-01 12:16:08 +08:00
|
|
|
virtual void init();
|
2026-03-06 09:52:28 -06:00
|
|
|
virtual void removed();
|
|
|
|
|
virtual void tick();
|
|
|
|
|
virtual void handlePasteRequest();
|
|
|
|
|
virtual void handleHistoryUp();
|
|
|
|
|
virtual void handleHistoryDown();
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
protected:
|
|
|
|
|
void keyPressed(wchar_t ch, int eventKey);
|
|
|
|
|
public:
|
|
|
|
|
void render(int xm, int ym, float a);
|
|
|
|
|
protected:
|
|
|
|
|
void mouseClicked(int x, int y, int buttonNum);
|
|
|
|
|
};
|