Minetest  5.4.0
GUIChatConsole Class Reference

#include <guiChatConsole.h>

+ Inheritance diagram for GUIChatConsole:
+ Collaboration diagram for GUIChatConsole:

Public Member Functions

 GUIChatConsole (gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, ChatBackend *backend, Client *client, IMenuManager *menumgr)
 
virtual ~GUIChatConsole ()
 
void openConsole (f32 scale)
 
bool isOpen () const
 
bool isOpenInhibited () const
 
void closeConsole ()
 
void closeConsoleAtOnce ()
 
void setCloseOnEnter (bool close)
 
void replaceAndAddToHistory (const std::wstring &line)
 
void setCursor (bool visible, bool blinking=false, f32 blink_speed=1.0, f32 relative_height=1.0)
 
virtual void draw ()
 
virtual bool OnEvent (const SEvent &event)
 
virtual void setVisible (bool visible)
 

Private Member Functions

void reformatConsole ()
 
void recalculateConsolePosition ()
 
void animate (u32 msec)
 
void drawBackground ()
 
void drawText ()
 
void drawPrompt ()
 

Private Attributes

ChatBackendm_chat_backend
 
Clientm_client
 
IMenuManagerm_menumgr
 
v2u32 m_screensize
 
u64 m_animate_time_old
 
bool m_open = false
 
bool m_close_on_enter = false
 
s32 m_height = 0
 
f32 m_desired_height = 0.0f
 
f32 m_desired_height_fraction = 0.0f
 
f32 m_height_speed = 5.0f
 
u32 m_open_inhibited = 0
 
u32 m_cursor_blink = 0
 
f32 m_cursor_blink_speed = 0.0f
 
f32 m_cursor_height = 0.0f
 
video::ITexture * m_background = nullptr
 
video::SColor m_background_color = video::SColor(255, 0, 0, 0)
 
gui::IGUIFont * m_font = nullptr
 
v2u32 m_fontsize
 

Constructor & Destructor Documentation

◆ GUIChatConsole()

GUIChatConsole::GUIChatConsole ( gui::IGUIEnvironment *  env,
gui::IGUIElement *  parent,
s32  id,
ChatBackend backend,
Client client,
IMenuManager menumgr 
)

References clamp_u8(), errorstream, FM_Mono, FONT_SIZE_UNSPECIFIED, g_fontengine, g_settings, FontEngine::getFont(), Settings::getS32(), ITextureSource::getTexture(), Settings::getU16(), Settings::getV3F(), ITextureSource::isKnownSourceImage(), m_background, m_background_color, m_font, m_fontsize, MYMAX, myround(), and setCursor().

+ Here is the call graph for this function:

◆ ~GUIChatConsole()

GUIChatConsole::~GUIChatConsole ( )
virtual

References m_font.

Member Function Documentation

◆ animate()

void GUIChatConsole::animate ( u32  msec)
private

References m_cursor_blink, m_cursor_blink_speed, m_desired_height, m_height, m_height_speed, m_open, m_open_inhibited, m_screensize, and recalculateConsolePosition().

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeConsole()

void GUIChatConsole::closeConsole ( )

References IMenuManager::deletingMenu(), m_menumgr, and m_open.

Referenced by closeConsoleAtOnce(), and OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeConsoleAtOnce()

void GUIChatConsole::closeConsoleAtOnce ( )

References closeConsole(), m_height, and recalculateConsolePosition().

Referenced by OnEvent(), and Game::processUserInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw()

void GUIChatConsole::draw ( )
virtual

References animate(), drawBackground(), drawPrompt(), drawText(), porting::getTimeMs(), m_animate_time_old, m_desired_height, m_desired_height_fraction, m_height, m_screensize, and reformatConsole().

+ Here is the call graph for this function:

◆ drawBackground()

void GUIChatConsole::drawBackground ( )
private

References m_background, m_background_color, m_height, and m_screensize.

Referenced by draw().

+ Here is the caller graph for this function:

◆ drawPrompt()

void GUIChatConsole::drawPrompt ( )
private

References ChatBackend::getConsoleBuffer(), ChatPrompt::getCursorLength(), ChatBackend::getPrompt(), ChatBuffer::getRows(), ChatPrompt::getVisibleCursorPosition(), ChatPrompt::getVisiblePortion(), m_chat_backend, m_cursor_blink, m_cursor_height, m_desired_height, m_font, m_fontsize, m_height, and MYMAX.

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawText()

void GUIChatConsole::drawText ( )
private

References EnrichedString::c_str(), ChatFormattedFragment::column, irr::gui::CGUITTFont::draw(), ChatFormattedLine::fragments, ChatBackend::getConsoleBuffer(), ChatBuffer::getFormattedLine(), ChatBuffer::getRows(), m_chat_backend, m_desired_height, m_font, m_fontsize, m_height, EnrichedString::size(), and ChatFormattedFragment::text.

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOpen()

bool GUIChatConsole::isOpen ( ) const

References m_open.

Referenced by Game::processUserInput().

+ Here is the caller graph for this function:

◆ isOpenInhibited()

bool GUIChatConsole::isOpenInhibited ( ) const

References m_open_inhibited.

Referenced by Game::openConsole(), and Game::processKeyInput().

+ Here is the caller graph for this function:

◆ OnEvent()

◆ openConsole()

void GUIChatConsole::openConsole ( f32  scale)

References IMenuManager::createdMenu(), porting::getTimeMs(), m_animate_time_old, m_desired_height, m_desired_height_fraction, m_menumgr, m_open, m_screensize, and reformatConsole().

Referenced by Game::openConsole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recalculateConsolePosition()

void GUIChatConsole::recalculateConsolePosition ( )
private

References m_height, and m_screensize.

Referenced by animate(), closeConsoleAtOnce(), reformatConsole(), and setVisible().

+ Here is the caller graph for this function:

◆ reformatConsole()

void GUIChatConsole::reformatConsole ( )
private

References m_chat_backend, m_desired_height, m_fontsize, m_screensize, recalculateConsolePosition(), and ChatBackend::reformat().

Referenced by draw(), and openConsole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replaceAndAddToHistory()

void GUIChatConsole::replaceAndAddToHistory ( const std::wstring &  line)

References ChatPrompt::addToHistory(), ChatPrompt::getLine(), ChatBackend::getPrompt(), m_chat_backend, and ChatPrompt::replace().

Referenced by Game::openConsole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCloseOnEnter()

void GUIChatConsole::setCloseOnEnter ( bool  close)
inline

References m_close_on_enter.

Referenced by Game::openConsole().

+ Here is the caller graph for this function:

◆ setCursor()

void GUIChatConsole::setCursor ( bool  visible,
bool  blinking = false,
f32  blink_speed = 1.0,
f32  relative_height = 1.0 
)

References m_cursor_blink, m_cursor_blink_speed, and m_cursor_height.

Referenced by GUIChatConsole().

+ Here is the caller graph for this function:

◆ setVisible()

void GUIChatConsole::setVisible ( bool  visible)
virtual

References m_height, m_open, and recalculateConsolePosition().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_animate_time_old

u64 GUIChatConsole::m_animate_time_old
private

Referenced by draw(), and openConsole().

◆ m_background

video::ITexture* GUIChatConsole::m_background = nullptr
private

Referenced by GUIChatConsole(), and drawBackground().

◆ m_background_color

video::SColor GUIChatConsole::m_background_color = video::SColor(255, 0, 0, 0)
private

Referenced by GUIChatConsole(), and drawBackground().

◆ m_chat_backend

ChatBackend* GUIChatConsole::m_chat_backend
private

◆ m_client

Client* GUIChatConsole::m_client
private

Referenced by OnEvent().

◆ m_close_on_enter

bool GUIChatConsole::m_close_on_enter = false
private

Referenced by OnEvent(), and setCloseOnEnter().

◆ m_cursor_blink

u32 GUIChatConsole::m_cursor_blink = 0
private

Referenced by animate(), drawPrompt(), and setCursor().

◆ m_cursor_blink_speed

f32 GUIChatConsole::m_cursor_blink_speed = 0.0f
private

Referenced by animate(), and setCursor().

◆ m_cursor_height

f32 GUIChatConsole::m_cursor_height = 0.0f
private

Referenced by drawPrompt(), and setCursor().

◆ m_desired_height

f32 GUIChatConsole::m_desired_height = 0.0f
private

◆ m_desired_height_fraction

f32 GUIChatConsole::m_desired_height_fraction = 0.0f
private

Referenced by draw(), and openConsole().

◆ m_font

gui::IGUIFont* GUIChatConsole::m_font = nullptr
private

◆ m_fontsize

v2u32 GUIChatConsole::m_fontsize
private

◆ m_height

s32 GUIChatConsole::m_height = 0
private

◆ m_height_speed

f32 GUIChatConsole::m_height_speed = 5.0f
private

Referenced by animate().

◆ m_menumgr

IMenuManager* GUIChatConsole::m_menumgr
private

Referenced by closeConsole(), and openConsole().

◆ m_open

bool GUIChatConsole::m_open = false
private

◆ m_open_inhibited

u32 GUIChatConsole::m_open_inhibited = 0
private

Referenced by animate(), isOpenInhibited(), and OnEvent().

◆ m_screensize

v2u32 GUIChatConsole::m_screensize
private

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