A class used to manipulate developer utilities.
This class is used to display an overlay on top of the app which lists dev widgets. Each widget controls a single debug utility.
The method used to activate the dev panel depends on the platform on which the app runs:
Note that some platforms support multiple activation methods.
The dev panel is typically only available for Debug builds. However, it can be made available on Release builds by calling the CYIApp::InitializeDevPanel function.
The following describes the various components that make up the dev panel system:
#include <debug/YiDevPanel.h>
Public Types | |
enum | InsertPosition { InsertPosition::Top, InsertPosition::Bottom } |
Public Member Functions | |
CYIDevPanel (CYISceneManager *pSceneManager, CYIApp *pApp) | |
~CYIDevPanel () | |
void | Open () |
void | Close () |
void | ToggleVisibility () |
bool | IsActive () const |
bool | IsVisible () const |
bool | IsConfigurationSubpanelOpen () const |
void | AddWidget (std::unique_ptr< CYIDevWidget > pWidget, InsertPosition insertPosition=InsertPosition::Top) |
void | UpdateWidget (size_t indexInPanel) |
template<class T > | |
T * | GetWidget () const |
std::vector< CYIDevWidget * > | GetWidgets () const |
CYIApp * | GetApp () const |
CYISceneManager * | GetSceneManager () const |
CYISceneView * | GetWidgetsContainer () const |
void | SimulatePanelItemClicked (size_t index) |
void | SimulateConfigurationItemClicked (size_t widgetIndex, size_t itemIndex) |
void | OpenConfigurationSubpanel (CYIDevWidget *pWidget, const std::vector< std::pair< CYIString, CYIString >> &items) |
void | CloseConfigurationSubpanel () |
void | ReconfigureConfigurationSubpanel (CYIDevWidget *pWidget) |
bool | Update (bool *pSkipUpdate=nullptr) |
void | Draw () |
![]() | |
CYISignalHandler () | |
CYISignalHandler (const CYISignalHandler &rSignalHandler) | |
virtual | ~CYISignalHandler () |
CYISignalHandler & | operator= (const CYISignalHandler &rSignalHandler) |
void | MoveToThread (CYIThread *pThread) |
This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More... | |
CYIThreadHandle | GetThreadAffinity () const |
void | SetThreadAffinity (const CYIThreadHandle &rThreadAffinity) |
virtual bool | IsConnected () const |
virtual bool | IsConnected (const CYISignalBase &rSignal) const |
void | Disconnect (CYISignalBase &rSignal) |
void | DisconnectFromAllSignals () |
![]() | |
Listener () | |
virtual | ~Listener () |
virtual void | OnThreadStarted (CYIThread *) |
virtual void | OnThreadTerminated (CYIThread *) |
virtual void | OnThreadFinished (CYIThread *) |
![]() | |
CYIEventFilter () | |
CYIEventFilter (const CYIEventFilter &other) | |
virtual | ~CYIEventFilter () |
CYIEventFilter & | operator= (const CYIEventFilter &other) |
Public Attributes | |
CYISignal | UserActivated |
CYISignal | UserDeactivated |
Static Public Attributes | |
static const CYIString | DEV_PANEL_ASSETS_PREFIX |
|
strong |
CYIDevPanel::CYIDevPanel | ( | CYISceneManager * | pSceneManager, |
CYIApp * | pApp | ||
) |
CYIDevPanel::~CYIDevPanel | ( | ) |
void CYIDevPanel::AddWidget | ( | std::unique_ptr< CYIDevWidget > | pWidget, |
InsertPosition | insertPosition = InsertPosition::Top |
||
) |
Adds dev widget pWidget to the dev panel. The insert position can be controlled using the insertPosition parameter. A value of CYIDevPanel::InsertPosition::Top will insert the widget at the top of the widgets list, and a value of CYIDevPanel::InsertPosition::Bottom will insert the widget at the end of the widgets list.
void CYIDevPanel::Close | ( | ) |
Closes the dev panel if it isn't closed already.
void CYIDevPanel::CloseConfigurationSubpanel | ( | ) |
Closes the configuration subpanel, if it is open.
void CYIDevPanel::Draw | ( | ) |
Draws the panel (if active) and any currently-active widgets.
CYIApp* CYIDevPanel::GetApp | ( | ) | const |
Returns a pointer to the app.
CYISceneManager* CYIDevPanel::GetSceneManager | ( | ) | const |
Returns a pointer to the scene manager.
T* CYIDevPanel::GetWidget | ( | ) | const |
Finds and returns the first widget that matches type T.
std::vector<CYIDevWidget *> CYIDevPanel::GetWidgets | ( | ) | const |
Returns a collection of all of the widgets in the dev panel.
CYISceneView* CYIDevPanel::GetWidgetsContainer | ( | ) | const |
Returns a pointer to the widgets container. This is the view containing the widgets' content.
bool CYIDevPanel::IsActive | ( | ) | const |
Returns true if the dev panel is currently active (e.g. if the user has triggered the activation method.)
bool CYIDevPanel::IsConfigurationSubpanelOpen | ( | ) | const |
Returns true if the dev panel is active and if a configuration subpanel is currently open.
bool CYIDevPanel::IsVisible | ( | ) | const |
Returns true if the dev panel is currently visible. This differs from IsActive() in that it also returns true if the dev panel is animating in or out.
void CYIDevPanel::Open | ( | ) |
Opens the dev panel if it isn't open already.
void CYIDevPanel::OpenConfigurationSubpanel | ( | CYIDevWidget * | pWidget, |
const std::vector< std::pair< CYIString, CYIString >> & | items | ||
) |
Opens the configuration subpanel for widget pWidget, and configures it with configuration items items.
void CYIDevPanel::ReconfigureConfigurationSubpanel | ( | CYIDevWidget * | pWidget | ) |
Reconfigures the configuration subpanel for pWidget.
Simulates clicking a widget's configuration item.
void CYIDevPanel::SimulatePanelItemClicked | ( | size_t | index | ) |
Simulates clicking a dev panel item.
void CYIDevPanel::ToggleVisibility | ( | ) |
Toggles the visibility of the dev panel.
bool CYIDevPanel::Update | ( | bool * | pSkipUpdate = nullptr | ) |
Updates the internal state of the panel and the widgets. Returns true if a render is required. If pSkipUpdate is non-null, widgets can set it to true to indicate that the app update should be skipped.
void CYIDevPanel::UpdateWidget | ( | size_t | indexInPanel | ) |
Update the title, the subtitle, and the on/off indicator of the widget located at indexInPanel on the panel.
|
static |
A prefix added on dev panel-specific assets. This is used to exclude these assets from dev widgets. The prefix is also used as prefix on the name of scene nodes created by dev widgets.
CYISignal CYIDevPanel::UserActivated |
A signal called when the User Signal widget is activated. If nothing is connected to this signal, the User Signal widget will be disabled in the dev panel.
CYISignal CYIDevPanel::UserDeactivated |
A signal called when the User Signal widget is deactivated. If nothing is connected to this signal, the CYIDevPanel::UserActivated signal is called instead.