PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
Loading...
Searching...
No Matches
PureUiManagerImpl Class Reference

Detailed Description

Definition at line 53 of file PureUiManager.cpp.

+ Inheritance diagram for PureUiManagerImpl:

Public Member Functions

virtual ~PureUiManagerImpl ()
 
void Initialize (HWND wnd_handle, HDC wnd_dc) override
 Sets members to real values within the singleton instance.
 
void Deinitialize () override
 This deletes all UI elements and allocated resources, Initialize() can be called again later.
 
TPureBool isInitialized () const override
 Gets whether we are initialized.
 
const std::function< void()> & getGuiDrawCallback () const override
 Returns the previously set GUI callback function.
 
void setGuiDrawCallback (const std::function< void()> &cb) override
 Sets the given GUI draw callback function to be invoked by the renderer in every frame.
 
PureUiTexttextPermanentLegacy (const std::string &txt, int x, int y, const std::string &fontface, int height, bool bold, bool italic, bool underline, bool strikeout) override
 Adds permanent text to the UI.
 
PureUiTexttextPermanentLegacy (const std::string &txt, int x, int y) override
 Adds permanent text to the UI with default properties.
 
void removeTextPermanentLegacy (const std::string &text, int x, int y, int height) override
 Deletes permanent text from the UI that was previously added by textPermanentLegacy().
 
void removeAllTextPermanentLegacy () override
 Deletes all permanent texts from the UI that were previously added by textPermanentLegacy().
 
PureUiTexttextTemporalLegacy (const std::string &txt, int x, int y, const std::string &fontface, int height, bool bold, bool italic, bool underline, bool strikeout) override
 Adds temporary text to the UI.
 
PureUiTexttextTemporalLegacy (const std::string &txt, int x, int y) override
 Adds temporary text to the UI.
 
const std::string & getDefaultFontFaceLegacy () const override
 Gets the default font face used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontFaceLegacy (const std::string &face) override
 Sets the default font face used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
int getDefaultFontSizeLegacy () const override
 Gets the default font size used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontSizeLegacy (int size) override
 Sets the default font size used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
bool getDefaultFontBoldLegacy () const override
 Gets the default font bold property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontBoldLegacy (bool bold) override
 Sets the default font bold property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
bool getDefaultFontItalicLegacy () const override
 Gets the default font italic property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontItalicLegacy (bool italic) override
 Sets the default font italic property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
bool getDefaultFontUnderlineLegacy () const override
 Gets the default font underlined property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontUnderlineLegacy (bool underline) override
 Sets the default font underlined property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
bool getDefaultFontStrikeoutLegacy () const override
 Gets the default font strikeout property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
void setDefaultFontStrikeoutLegacy (bool strikeout) override
 Sets the default font strikeout property used by legacy functions textPermanentLegacy() and textTemporalLegacy().
 
const PureColorgetDefaultColorLegacy () const override
 Returns reference to default color used by legacy functions textPermanentLegacy() and textTemporalLegacy() This default color is black by default.
 
PureColorgetDefaultColorLegacy () override
 Returns reference to default color used by legacy functions textPermanentLegacy() and textTemporalLegacy() This default color is black by default.
 
void render () override
 
- Public Member Functions inherited from PureUiManager
CConsole & getConsole () const
 Returns access to console preset with logger module name as this class.
 

Private Member Functions

 PureUiManagerImpl ()
 This is the only usable ctor, this is used by the static createAndGet().
 
 PureUiManagerImpl (const PureUiManagerImpl &)
 
PureUiManagerImploperator= (const PureUiManagerImpl &)
 

Private Attributes

bool bInitialized
 
HDC hDC
 
ImGuiContext * pImGuiCtx
 Dear ImGui context that we share with user application so it can use OUR ImGui instance.
 
GLfloat mat4x4Identity [4][4]
 
std::map< unsigned long, PureUiTextmTexts
 
std::vector< PureUiFontWin * > vFonts
 
std::function< void()> pfGuiCallback
 
std::string sDefaultFont
 
int nDefaultFontSize
 
bool bDefaultFontBold
 
bool bDefaultFontItalic
 
bool bDefaultFontUnderline
 
bool bDefaultFontStrikeout
 
PureColor clrDefault
 

Friends

class PureUiManager
 

Additional Inherited Members

- Static Public Member Functions inherited from PureUiManager
static PureUiManagercreateAndGet ()
 Creates and gets the singleton instance.
 
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Constructor & Destructor Documentation

◆ ~PureUiManagerImpl()

PureUiManagerImpl::~PureUiManagerImpl ( )
virtual

Definition at line 149 of file PureUiManager.cpp.

◆ PureUiManagerImpl() [1/2]

PureUiManagerImpl::PureUiManagerImpl ( )
private

This is the only usable ctor, this is used by the static createAndGet().

Definition at line 531 of file PureUiManager.cpp.

◆ PureUiManagerImpl() [2/2]

PureUiManagerImpl::PureUiManagerImpl ( const PureUiManagerImpl & )
private

Definition at line 544 of file PureUiManager.cpp.

Member Function Documentation

◆ Deinitialize()

void PureUiManagerImpl::Deinitialize ( )
overridevirtual

This deletes all UI elements and allocated resources, Initialize() can be called again later.

Application doesn't need to call this, PURE shutdown takes care of this.

Implements PureUiManager.

Definition at line 234 of file PureUiManager.cpp.

◆ getDefaultColorLegacy() [1/2]

const PureColor & PureUiManagerImpl::getDefaultColorLegacy ( ) const
overridevirtual

Returns reference to default color used by legacy functions textPermanentLegacy() and textTemporalLegacy() This default color is black by default.

Implements PureUiManager.

Definition at line 453 of file PureUiManager.cpp.

◆ getDefaultColorLegacy() [2/2]

PureColor & PureUiManagerImpl::getDefaultColorLegacy ( )
overridevirtual

Returns reference to default color used by legacy functions textPermanentLegacy() and textTemporalLegacy() This default color is black by default.

Implements PureUiManager.

Definition at line 458 of file PureUiManager.cpp.

◆ getDefaultFontBoldLegacy()

bool PureUiManagerImpl::getDefaultFontBoldLegacy ( ) const
overridevirtual

Gets the default font bold property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 413 of file PureUiManager.cpp.

◆ getDefaultFontFaceLegacy()

const std::string & PureUiManagerImpl::getDefaultFontFaceLegacy ( ) const
overridevirtual

Gets the default font face used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 393 of file PureUiManager.cpp.

◆ getDefaultFontItalicLegacy()

bool PureUiManagerImpl::getDefaultFontItalicLegacy ( ) const
overridevirtual

Gets the default font italic property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 423 of file PureUiManager.cpp.

◆ getDefaultFontSizeLegacy()

int PureUiManagerImpl::getDefaultFontSizeLegacy ( ) const
overridevirtual

Gets the default font size used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 403 of file PureUiManager.cpp.

◆ getDefaultFontStrikeoutLegacy()

bool PureUiManagerImpl::getDefaultFontStrikeoutLegacy ( ) const
overridevirtual

Gets the default font strikeout property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 443 of file PureUiManager.cpp.

◆ getDefaultFontUnderlineLegacy()

bool PureUiManagerImpl::getDefaultFontUnderlineLegacy ( ) const
overridevirtual

Gets the default font underlined property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 433 of file PureUiManager.cpp.

◆ getGuiDrawCallback()

const std::function< void()> & PureUiManagerImpl::getGuiDrawCallback ( ) const
overridevirtual

Returns the previously set GUI callback function.

Implements PureUiManager.

Definition at line 282 of file PureUiManager.cpp.

◆ Initialize()

void PureUiManagerImpl::Initialize ( HWND wnd_handle,
HDC wnd_dc )
overridevirtual

Sets members to real values within the singleton instance.

Does nothing if wnd_handle or wnd_dc is NULL.

Application doesn't need to call this, PURE initialization takes care of this.

Implements PureUiManager.

Definition at line 155 of file PureUiManager.cpp.

◆ isInitialized()

TPureBool PureUiManagerImpl::isInitialized ( ) const
overridevirtual

Gets whether we are initialized.

Implements PureUiManager.

Definition at line 276 of file PureUiManager.cpp.

◆ operator=()

PureUiManagerImpl & PureUiManagerImpl::operator= ( const PureUiManagerImpl & )
private

Definition at line 550 of file PureUiManager.cpp.

◆ removeAllTextPermanentLegacy()

void PureUiManagerImpl::removeAllTextPermanentLegacy ( )
overridevirtual

Deletes all permanent texts from the UI that were previously added by textPermanentLegacy().

This command is not needed to be used on temporary texts added by textTemporalLegacy().

Implements PureUiManager.

Definition at line 368 of file PureUiManager.cpp.

◆ removeTextPermanentLegacy()

void PureUiManagerImpl::removeTextPermanentLegacy ( const std::string & text,
int x,
int y,
int height )
overridevirtual

Deletes permanent text from the UI that was previously added by textPermanentLegacy().

This command is not needed to be used on temporary texts added by textTemporalLegacy().

Implements PureUiManager.

Definition at line 361 of file PureUiManager.cpp.

◆ render()

void PureUiManagerImpl::render ( )
overridevirtual

Implements PureUiManager.

Definition at line 463 of file PureUiManager.cpp.

◆ setDefaultFontBoldLegacy()

void PureUiManagerImpl::setDefaultFontBoldLegacy ( bool bold)
overridevirtual

Sets the default font bold property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 418 of file PureUiManager.cpp.

◆ setDefaultFontFaceLegacy()

void PureUiManagerImpl::setDefaultFontFaceLegacy ( const std::string & face)
overridevirtual

Sets the default font face used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 398 of file PureUiManager.cpp.

◆ setDefaultFontItalicLegacy()

void PureUiManagerImpl::setDefaultFontItalicLegacy ( bool italic)
overridevirtual

Sets the default font italic property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 428 of file PureUiManager.cpp.

◆ setDefaultFontSizeLegacy()

void PureUiManagerImpl::setDefaultFontSizeLegacy ( int size)
overridevirtual

Sets the default font size used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 408 of file PureUiManager.cpp.

◆ setDefaultFontStrikeoutLegacy()

void PureUiManagerImpl::setDefaultFontStrikeoutLegacy ( bool strikeout)
overridevirtual

Sets the default font strikeout property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 448 of file PureUiManager.cpp.

◆ setDefaultFontUnderlineLegacy()

void PureUiManagerImpl::setDefaultFontUnderlineLegacy ( bool underline)
overridevirtual

Sets the default font underlined property used by legacy functions textPermanentLegacy() and textTemporalLegacy().

Implements PureUiManager.

Definition at line 438 of file PureUiManager.cpp.

◆ setGuiDrawCallback()

void PureUiManagerImpl::setGuiDrawCallback ( const std::function< void()> & cb)
overridevirtual

Sets the given GUI draw callback function to be invoked by the renderer in every frame.

This callback should invoke Dear ImGui (https://github.com/ocornut/imgui) functions to draw GUI. The caller is not responsible for compiling or initializing Dear ImGui, PURE is in charge for that. PURE is already built with Dear ImGui code. Only the platform-agnostic, actual GUI drawing functions should be invoked that are listed in imgui.h. This header file is in the external include directory of PURE. None of these should be called either:

For an example on how to use this function, see a real-life game project: https://github.com/proof88/PRooFPS-dd .

Note: this function is invoked every frame, AFTER rendering the 2D sticked-to-screen objects (PureObject3D::SetStickedToScreen()). Thus, if you also do calculations in the specified callback function that have effect on those PURE sticked-to-screen objects, the visible effects will be delayed to the next frame. So in general it is highly recommended to do ONLY Dear ImGui-specific stuff in the specified callback function.

Implements PureUiManager.

Definition at line 288 of file PureUiManager.cpp.

◆ textPermanentLegacy() [1/2]

PureUiText * PureUiManagerImpl::textPermanentLegacy ( const std::string & txt,
int x,
int y )
overridevirtual

Adds permanent text to the UI with default properties.

Basically this has the same effect as calling the other textPermanentLegacy() with default font properties.

Implements PureUiManager.

Definition at line 355 of file PureUiManager.cpp.

◆ textPermanentLegacy() [2/2]

PureUiText * PureUiManagerImpl::textPermanentLegacy ( const std::string & txt,
int x,
int y,
const std::string & fontface,
int height,
bool bold,
bool italic,
bool underline,
bool strikeout )
overridevirtual

Adds permanent text to the UI.

Permanent texts live until explicit deletion. This means that after you add a permanent text to the UI, it will be displayed in all next rendered frames.

This function is considered as legacy now because it uses an old technique to render text, however it is still being used here and there (including the original PR00FPS thru the gfxcore2 wrapper library) thus I'm not planning to delete it soon. It depends on the platform-specific PureUiFontWin class and I'm not planning to create something similar for Linux, so multiplatform support is not possible now with this legacy way.

Another way of text rendering can be done using Dear ImGui text-rendering functions that you can invoke in your own function that you pass to PURE using setGuiDrawCallback().

This function has nothing to do with Dear ImGui. You can add text using this function or with Dear ImGui API, they can be rendered on-screen at the same time too.

Implements PureUiManager.

Definition at line 314 of file PureUiManager.cpp.

◆ textTemporalLegacy() [1/2]

PureUiText * PureUiManagerImpl::textTemporalLegacy ( const std::string & txt,
int x,
int y )
overridevirtual

Adds temporary text to the UI.

Basically this has the same effect as calling the other textTemporalLegacy() with default font properties.

Implements PureUiManager.

Definition at line 388 of file PureUiManager.cpp.

◆ textTemporalLegacy() [2/2]

PureUiText * PureUiManagerImpl::textTemporalLegacy ( const std::string & txt,
int x,
int y,
const std::string & fontface,
int height,
bool bold,
bool italic,
bool underline,
bool strikeout )
overridevirtual

Adds temporary text to the UI.

Temporary texts live only in the next rendered frame. This means that in order to display the same temporary text for more than 1 frame, you have to issue this command before rendering every single frame.

If you want to display the same text in multiple frame, from performance perspective it is better to add permanent text using textPermanentLegacy() instead.

This function is considered as legacy now because it uses an old technique to render text, however it is still being used here and there (including the original PR00FPS thru the gfxcore2 wrapper library) thus I'm not planning to delete it soon. It depends on the platform-specific PureUiFontWin class and I'm not planning to create something similar for Linux, so multiplatform support is not possible now with this legacy way.

Another way of text rendering can be done using Dear ImGui text-rendering functions that you can invoke in your own function that you pass to PURE using setGuiDrawCallback().

This function has nothing to do with Dear ImGui. You can add text using this function or with Dear ImGui API, they can be rendered on-screen at the same time too.

Implements PureUiManager.

Definition at line 379 of file PureUiManager.cpp.

Friends And Related Symbol Documentation

◆ PureUiManager

friend class PureUiManager
friend

Definition at line 141 of file PureUiManager.cpp.

Member Data Documentation

◆ bDefaultFontBold

bool PureUiManagerImpl::bDefaultFontBold
private

Definition at line 126 of file PureUiManager.cpp.

◆ bDefaultFontItalic

bool PureUiManagerImpl::bDefaultFontItalic
private

Definition at line 127 of file PureUiManager.cpp.

◆ bDefaultFontStrikeout

bool PureUiManagerImpl::bDefaultFontStrikeout
private

Definition at line 129 of file PureUiManager.cpp.

◆ bDefaultFontUnderline

bool PureUiManagerImpl::bDefaultFontUnderline
private

Definition at line 128 of file PureUiManager.cpp.

◆ bInitialized

bool PureUiManagerImpl::bInitialized
private

Definition at line 114 of file PureUiManager.cpp.

◆ clrDefault

PureColor PureUiManagerImpl::clrDefault
private

Definition at line 131 of file PureUiManager.cpp.

◆ hDC

HDC PureUiManagerImpl::hDC
private

Definition at line 115 of file PureUiManager.cpp.

◆ mat4x4Identity

GLfloat PureUiManagerImpl::mat4x4Identity[4][4]
private

Definition at line 117 of file PureUiManager.cpp.

◆ mTexts

std::map<unsigned long, PureUiText> PureUiManagerImpl::mTexts
private

Definition at line 118 of file PureUiManager.cpp.

◆ nDefaultFontSize

int PureUiManagerImpl::nDefaultFontSize
private

Definition at line 125 of file PureUiManager.cpp.

◆ pfGuiCallback

std::function<void()> PureUiManagerImpl::pfGuiCallback
private

Definition at line 121 of file PureUiManager.cpp.

◆ pImGuiCtx

ImGuiContext* PureUiManagerImpl::pImGuiCtx
private

Dear ImGui context that we share with user application so it can use OUR ImGui instance.

Definition at line 116 of file PureUiManager.cpp.

◆ sDefaultFont

std::string PureUiManagerImpl::sDefaultFont
private

Definition at line 124 of file PureUiManager.cpp.

◆ vFonts

std::vector<PureUiFontWin*> PureUiManagerImpl::vFonts
private

Definition at line 119 of file PureUiManager.cpp.


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