35 std::function<bool(
VK_Window &window,
const std::vector<std::string> &args, std::ostream &output)>;
40 void attach(
VK_Window &window,
const std::string &fontPath,
int fontSize = 18);
43 void setFont(
const std::string &fontPath,
int fontSize);
56 void printLine(
const std::string &line, SDL_Color color = SDL_Color{255, 255, 255, 255});
65 void setPrompt(
const std::string &prompt);
80 [[nodiscard]]
bool isVisible() const noexcept;
95 [[nodiscard]]
const std::string &
inputBuffer() const noexcept;
103 void pushOutputLine(std::string line);
104 void pushOutputLine(std::string line, SDL_Color color);
105 void trimOutputToLimits();
109 void scrollUp(std::size_t amount = 1);
110 void scrollDown(std::size_t amount = 1);
111 void ensurePanelSprite();
112 void ensureCursorSprite();
113 void ensureScrollSprites();
114 void updatePanelLayout();
115 void refreshVisibleLineCount();
116 void updateScrollbarGeometry();
117 void invalidateWrappedCache();
118 void ensureWrappedCache(
int maxWidth)
const;
119 [[nodiscard]]
int measureTextWidth(
const std::string &text)
const;
120 [[nodiscard]]
int usableTextWidth()
const;
121 [[nodiscard]] std::vector<std::string> wrapTextToWidth(
const std::string &text,
int maxWidth)
const;
122 [[nodiscard]]
bool isPointInScrollbar(
int x,
int y)
const noexcept;
123 [[nodiscard]]
bool isPointInScrollbarThumb(
int x,
int y)
const noexcept;
124 void updateScrollFromThumbY(
int thumbY);
125 [[nodiscard]] std::size_t effectiveVisibleLineCount() const noexcept;
126 [[nodiscard]] std::
size_t maxScrollOffset() const noexcept;
127 [[nodiscard]] static std::vector<std::
string> tokenize(const std::
string &line);
128 [[nodiscard]]
bool handleDefaultCommand(const std::vector<std::
string> &args, std::ostream &output);
130 VK_Window *windowPtr =
nullptr;
131 VK_Sprite *panel_sprite =
nullptr;
132 VK_Sprite *cursor_sprite =
nullptr;
133 VK_Sprite *scroll_track_sprite =
nullptr;
134 VK_Sprite *scroll_thumb_sprite =
nullptr;
135 bool visible = false;
136 bool fade_active = false;
137 float fade_alpha = 0.0f;
138 float fade_start_alpha = 0.0f;
139 float fade_target_alpha = 0.0f;
140 Uint64 fade_start_ns = 0;
141 Uint64 fade_duration_ns = 220000000ULL;
142 bool cursor_visible = true;
143 Uint64 last_cursor_toggle_ns = 0;
144 std::
size_t cursor_pos = 0;
149 int content_top_y = 0;
150 int content_bottom_y = 0;
153 int scrollbar_w = 10;
155 int scrollbar_thumb_y = 0;
156 int scrollbar_thumb_h = 0;
157 bool scrollbar_dragging = false;
158 bool sprite_y_origin_top_left = false;
159 int scrollbar_drag_offset = 0;
160 std::
size_t scroll_offset = 0;
161 std::
size_t last_visible_line_count = 16;
162 bool follow_tail = true;
163 std::
string promptText =
"> ";
165 std::deque<OutputLine> lines{};
166 std::size_t total_line_chars = 0;
167 mutable bool wrapped_cache_dirty =
true;
168 mutable int wrapped_cache_width = -1;
169 mutable std::vector<OutputLine> wrapped_cache{};
170 mutable std::size_t wrapped_cache_line_count = 0;
171 std::vector<std::string> history{};
172 int history_index = -1;
173 std::size_t max_lines = 1200;
174 std::size_t max_total_chars = 128 * 1024;
175 std::size_t max_visible_lines = std::numeric_limits<std::size_t>::max();
176 SDL_Color text_color{220, 235, 255, 255};
177 SDL_Color prompt_color{120, 220, 160, 255};
178 SDL_Color info_color{170, 170, 210, 255};
Vulkan SDL_ttf text renderer.