56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <map>
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include "gfx/types.h"
|
|
#include "ui/ui_window.h"
|
|
#include "ui/taskbar.h"
|
|
#include "ui/launcher.h"
|
|
#include "ui/ui_renderer.h"
|
|
|
|
class GameState;
|
|
|
|
/* 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, GameState* game_state);
|
|
~Desktop(void);
|
|
|
|
void add_window(std::unique_ptr<UIWindow> 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);
|
|
|
|
void register_session(uint32_t session_id, UIWindow* window);
|
|
UIWindow* get_window_by_session_id(uint32_t session_id);
|
|
UIWindow* get_focused_window(void);
|
|
UIWindow* get_window_awaiting_session_id(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<std::unique_ptr<UIWindow>> _windows;
|
|
std::unique_ptr<Taskbar> _taskbar;
|
|
std::unique_ptr<Launcher> _launcher;
|
|
UIWindow* _focused_window;
|
|
UIWindow* _window_awaiting_session_id;
|
|
std::map<uint32_t, UIWindow*> _session_windows;
|
|
GameState* _game_state;
|
|
std::vector<ScrollingText> _background_text;
|
|
std::vector<std::string> _snippets;
|
|
bool _launcher_is_open;
|
|
};
|