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