aboutsummaryrefslogtreecommitdiff
path: root/src/ui/workspace.h
blob: 16dff2a7de3d6271a62142f6f4e32526dd76857c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "rendering/export_config.h"
#include <string>

namespace Donut
{
    class Scene;

    // App-level actions the UI can request (window/device changes it can't do
    // itself). The Application implements this — it owns the window and device.
    struct AppActions
    {
        virtual ~AppActions() = default;
        virtual auto set_resolution(int w, int h) -> void = 0;
        virtual auto set_fullscreen(bool on) -> void = 0;
        virtual auto set_vsync(bool on) -> void = 0;
        virtual auto set_ui_scale(float scale) -> void = 0;
        virtual auto get_window_size(int& w, int& h) const -> void = 0;
        virtual auto is_fullscreen() const -> bool = 0;
        // Renders the requested channels off-screen and writes files; returns the
        // number written (0 on failure).
        virtual auto export_frame(const ExportConfig& cfg) -> int = 0;
    };

    // What the UI panels get each frame. `scene` is mutable — panels edit the
    // document through it; `actions` performs app-level changes.
    struct UIContext
    {
        Scene&      scene;
        std::string device_name;
        AppActions& actions;
    };
}