#pragma once #include #include #include #include "client_network.h" #include "gfx/types.h" #include "ui/ui_window.h" #include "ui/taskbar.h" #include "ui/launcher.h" #include "ui/ui_renderer.h" /* Animated background stuff. */ struct ScrollingText { std::string text; float x; float y_precise; /* sub-pixel animation. */ float speed; int render_y; /* For pixel-perfect rendering. */ }; class Desktop { public: Desktop(int screen_width, int screen_height, ClientNetwork* network); ~Desktop(void); void add_window(std::unique_ptr window); void handle_event(SDL_Event* event, int screen_width, int screen_height); void update(float dt, int screen_width, int screen_height); void render(const RenderContext& context); UIWindow* get_focused_window(void); private: void _set_focused_window(UIWindow* window); void _render_wallpaper(UIRenderer* ui_renderer); void _update_wallpaper(float dt, int screen_width, int screen_height); std::vector> _windows; std::unique_ptr _taskbar; std::unique_ptr _launcher; UIWindow* _focused_window; ClientNetwork* _network; std::vector _background_text; std::vector _snippets; bool _launcher_is_open; };