#pragma once #include #include #include #include #include "gfx/txt_renderer.h" #include "client_network.h" #include "ui/text_buffer.h" #include "ui/text_view.h" #include "ui/i_window_content.h" #include "ui/window_action.h" class Terminal : public IWindowContent { public: Terminal(ClientNetwork* network); ~Terminal(void); void update(void) override; void handle_input(SDL_Event* event) override; void render(TextRenderer* renderer, int x, int y, int width, int height, bool show_cursor) override; void scroll(int amount, int content_height) override; void add_history(const std::string& line); void set_prompt(const std::string& prompt); bool should_close(void) override; WindowAction get_pending_action(void) override; private: void _on_ret_press(void); bool _should_close; std::vector _history; int _scroll_offset; std::string _prompt; ClientNetwork* _network; TextBuffer _input_buffer; WindowAction _pending_action; std::unique_ptr _input_view; };