Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
inspector.hpp
Go to the documentation of this file.
1// Inspector — an overlay over the screen showing the view tree, the focus
2// chain, the yoga box and the theme values of a view, and the frame's timings.
3// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
4#pragma once
5
6#include <nanovg.h>
7
8#include <string>
9#include <utility>
10#include <vector>
11
12namespace aurore
13{
14
15class View;
16class FrameContext;
17class InputManager;
18struct ControllerState;
19
35{
36 public:
37 enum class Mode
38 {
39 CLOSED,
40 LIVE,
41 BROWSE,
42 };
43
44 static void setEnabled(bool enabled);
45 static bool isEnabled() { return enabled; }
46
47 static void setMode(Mode mode);
48 static Mode getMode() { return mode; }
49 static bool isOpen() { return mode != Mode::CLOSED; }
50
55 static void processInput(InputManager* input, ControllerState* state);
56
57 // In Application::frame(), when open. The timings shown are the
58 // Profiler's, which measures while the inspector is open.
59 static void beginFrame();
60 static void draw(FrameContext* ctx);
61
62 static void forgetView(View* view);
63
64 // Hooks of View, ThemeValues and StyleValues. `recordTarget` is the
65 // selected view while the inspector is open (nullptr otherwise), and
66 // `recording` is true while that view itself (not its children) draws.
67 inline static View* recordTarget = nullptr;
68 inline static bool recording = false;
69 static void recordColor(const std::string& name, NVGcolor color);
70 static void recordMetric(const std::string& name, float value);
71
72 private:
73 inline static bool enabled = false;
74 inline static Mode mode = Mode::CLOSED;
75};
76
77} // namespace aurore
Definition frame_context.hpp:30
Definition input.hpp:334
Definition inspector.hpp:35
static bool isEnabled()
Definition inspector.hpp:45
static void forgetView(View *view)
Mode
Definition inspector.hpp:38
static void draw(FrameContext *ctx)
static void setEnabled(bool enabled)
static void processInput(InputManager *input, ControllerState *state)
static void recordMetric(const std::string &name, float value)
static void setMode(Mode mode)
static bool isOpen()
Definition inspector.hpp:49
static void beginFrame()
static bool recording
Definition inspector.hpp:68
static void recordColor(const std::string &name, NVGcolor color)
static View * recordTarget
Definition inspector.hpp:67
static Mode getMode()
Definition inspector.hpp:48
Definition view.hpp:232
Definition actions.hpp:25
Definition input.hpp:251