You.i Engine
CYIDevPanel Class Reference

Detailed Description

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:

  • Desktop: F3, F13 or CTRL+` (CTRL + Back Tick)
  • Touch devices: triple-tap one of the corners of the screen
  • Consoles: Click the right thumbstick on the gamepad
  • 10-foot:
    • These keys in sequence: up, up, down, down, left, right, left, right, select (modified Konami code)
    • These keys in sequence: up, down, left, right, select (simplified Konami code)
    • These keys in sequence: volume up, volume down, volume up, volume down
    • The four standard TV remote color keys in sequence: red, green, yellow, blue
    • Triple-click the Play/Pause button
    • Double click the record button on the remote

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:

  • The dev panel instance holds the dev widgets, and is owned by the CYIApp instance
  • The dev widget instance represents a single debug utility, and is owned by the dev panel instasnce
  • The dev panel view is the rendered portion of the dev panel
  • Each dev widget inserts a dev widget item in the dev panel (e.g. a button)
  • Dev widgets can optionally display a widget view to the user when activated
  • Dev widgets can optionally display a configuration button in the dev panel to trigger displaying configuration options
  • Dev widgets which provide configuration options can either make use of the default configuration subpanel in the dev panel, or implement their own configuration view
This header is part of the debug-tools optional module.
See also

#include <debug/YiDevPanel.h>

Inheritance diagram for CYIDevPanel:

Public Types

enum  InsertPosition {

Public Member Functions

 CYIDevPanel (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
CYIAppGetApp () const
CYIRenderingSurfaceInfoGetRenderingSurfaceInfo () const
CYISceneManagerGetSceneManager () const
CYISceneViewGetWidgetsContainer () 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)
virtual bool Update (bool *pSkipUpdate=nullptr) override
virtual void Draw () override
- Public Member Functions inherited from CYIDevPanelBase
virtual ~CYIDevPanelBase ()=default
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 CYISignalHandler (const CYISignalHandler &signalHandler)
virtual ~CYISignalHandler ()
CYISignalHandleroperator= (const CYISignalHandler &signalHandler)
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 &threadAffinity)
virtual bool IsConnected () const
virtual bool IsConnected (const CYISignalBase &signal) const
void Disconnect (CYISignalBase &signal)
void DisconnectFromAllSignals ()
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
virtual ~Listener ()
virtual void OnThreadStarted (CYIThread *)
virtual void OnThreadTerminated (CYIThread *)
virtual void OnThreadFinished (CYIThread *)
- Public Member Functions inherited from CYIEventFilter
 CYIEventFilter ()
 CYIEventFilter (const CYIEventFilter &other)
virtual ~CYIEventFilter ()
CYIEventFilteroperator= (const CYIEventFilter &other)

Public Attributes

CYISignal UserActivated
CYISignal UserDeactivated

Additional Inherited Members

- Static Public Attributes inherited from CYIDevPanelBase
- Protected Member Functions inherited from CYIDevPanelBase
 CYIDevPanelBase ()=default

Member Enumeration Documentation

◆ InsertPosition


Insert at the top of the widgets list.


Insert at the bottom of the widgets list.

Constructor & Destructor Documentation

◆ CYIDevPanel()

CYIDevPanel::CYIDevPanel ( CYIApp pApp)

◆ ~CYIDevPanel()

CYIDevPanel::~CYIDevPanel ( )

Member Function Documentation

◆ AddWidget()

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.

It is typically safe to retain a pointer to the widget as the dev panel's life cycle is tied to the app.

◆ Close()

void CYIDevPanel::Close ( )

Closes the dev panel if it isn't closed already.

◆ CloseConfigurationSubpanel()

void CYIDevPanel::CloseConfigurationSubpanel ( )

Closes the configuration subpanel, if it is open.

◆ Draw()

virtual void CYIDevPanel::Draw ( )

Draws the panel (if active) and any currently-active widgets. 

Reimplemented from CYIDevPanelBase.

◆ GetApp()

CYIApp* CYIDevPanel::GetApp ( ) const

Returns a pointer to the app.

◆ GetRenderingSurfaceInfo()

CYIRenderingSurfaceInfo* CYIDevPanel::GetRenderingSurfaceInfo ( ) const

Returns a pointer to the rendering surface info.

◆ GetSceneManager()

CYISceneManager* CYIDevPanel::GetSceneManager ( ) const

Returns a pointer to the scene manager.

This is the scene manager used by the app, and calling this function is equivalent to calling

◆ GetWidget()

template<class T >
T* CYIDevPanel::GetWidget ( ) const

Finds and returns the first widget that matches type T.

This function runs in O(n) time.

◆ GetWidgets()

std::vector<CYIDevWidget *> CYIDevPanel::GetWidgets ( ) const

Returns a collection of all of the widgets in the dev panel.

◆ GetWidgetsContainer()

CYISceneView* CYIDevPanel::GetWidgetsContainer ( ) const

Returns a pointer to the widgets container. This is the view containing the widgets' content.

◆ IsActive()

bool CYIDevPanel::IsActive ( ) const

Returns true if the dev panel is currently active (e.g. if the user has triggered the activation method.)

This function returns true if the dev panel is currently animating in, and returns false if the dev panel is currently animating out.

◆ IsConfigurationSubpanelOpen()

bool CYIDevPanel::IsConfigurationSubpanelOpen ( ) const

Returns true if the dev panel is active and if a configuration subpanel is currently open.

◆ IsVisible()

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.

◆ Open()

void CYIDevPanel::Open ( )

Opens the dev panel if it isn't open already.

◆ OpenConfigurationSubpanel()

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.

This is typically called from the base dev widget class only. The default implementation of the CYIDevWidget::OnConfigureButtonClicked calls this function to trigger the opening of the default configuration subpanel. Custom widgets may, however, wish to display a custom configuration panel and thus would not be calling this function.

◆ ReconfigureConfigurationSubpanel()

void CYIDevPanel::ReconfigureConfigurationSubpanel ( CYIDevWidget pWidget)

Reconfigures the configuration subpanel for pWidget.

This is typically called by dev widgets when the user has selected a configuration option and the configuration subpanel's state has to be updated. For example, the items in the configuration subpanel may need to have their title updated after the user has made a selection.

◆ SimulateConfigurationItemClicked()

void CYIDevPanel::SimulateConfigurationItemClicked ( size_t  widgetIndex,
size_t  itemIndex 

Simulates clicking a widget's configuration item.

See also

◆ SimulatePanelItemClicked()

void CYIDevPanel::SimulatePanelItemClicked ( size_t  index)

Simulates clicking a dev panel item.

This is typically called from the base dev widget class only. For example, a dev widget could call this function to 'activate' itself when the user selects a configuration option while the dev widget is inactive.

◆ ToggleVisibility()

void CYIDevPanel::ToggleVisibility ( )

Toggles the visibility of the dev panel.

◆ Update()

virtual 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.

Reimplemented from CYIDevPanelBase.

◆ UpdateWidget()

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.

Member Data Documentation

◆ UserActivated

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.

See also

◆ UserDeactivated

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.

The User Signal widget is disabled in the dev panel if there is no connection made to the CYIDevPanel::UserActivated signal, even if a connection is made to the CYIDevPanel::UserDeactivated signal.
See also

The documentation for this class was generated from the following file: