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
12
namespace
aurore
13
{
14
15
class
View;
16
class
FrameContext;
17
class
InputManager;
18
struct
ControllerState;
19
34
class
Inspector
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
aurore::FrameContext
Definition
frame_context.hpp:30
aurore::InputManager
Definition
input.hpp:334
aurore::Inspector
Definition
inspector.hpp:35
aurore::Inspector::isEnabled
static bool isEnabled()
Definition
inspector.hpp:45
aurore::Inspector::forgetView
static void forgetView(View *view)
aurore::Inspector::Mode
Mode
Definition
inspector.hpp:38
aurore::Inspector::Mode::CLOSED
@ CLOSED
aurore::Inspector::Mode::BROWSE
@ BROWSE
aurore::Inspector::Mode::LIVE
@ LIVE
aurore::Inspector::draw
static void draw(FrameContext *ctx)
aurore::Inspector::setEnabled
static void setEnabled(bool enabled)
aurore::Inspector::processInput
static void processInput(InputManager *input, ControllerState *state)
aurore::Inspector::recordMetric
static void recordMetric(const std::string &name, float value)
aurore::Inspector::setMode
static void setMode(Mode mode)
aurore::Inspector::isOpen
static bool isOpen()
Definition
inspector.hpp:49
aurore::Inspector::beginFrame
static void beginFrame()
aurore::Inspector::recording
static bool recording
Definition
inspector.hpp:68
aurore::Inspector::recordColor
static void recordColor(const std::string &name, NVGcolor color)
aurore::Inspector::recordTarget
static View * recordTarget
Definition
inspector.hpp:67
aurore::Inspector::getMode
static Mode getMode()
Definition
inspector.hpp:48
aurore::View
Definition
view.hpp:232
aurore
Definition
actions.hpp:25
aurore::ControllerState
Definition
input.hpp:251
aurore
core
inspector.hpp
Generated by
1.9.8