Skip to content

Conversation

@XJMLN
Copy link
Contributor

@XJMLN XJMLN commented Jun 9, 2024

Event: onClientChatboxLayoutChange
Description:
Triggered when the client changes any settings related to the chatbox layout.

Parameters:
chatboxLayout: A table containing all CVars values related to the chatbox settings.

Usage Example:

addEventHandler("onClientChatboxLayoutChange", root,
    function(chatboxLayout)
          iprint(chatboxLayout)
    end
)

Resolves #696

@Dutchman101 Dutchman101 requested a review from Lpsd June 30, 2024 03:20
Copy link
Member

@Lpsd Lpsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, just left one comment.

Comment on lines +3636 to +3637
std::stringstream ss;
ss << std::stof(m_pChatScaleX->GetText()) << " " << std::stof(m_pChatScaleY->GetText());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SString constructor can do printf formatting.

Comment on lines +431 to +432
void SetChatLayoutChanged(bool changed) { m_bChatLayoutChanged = changed; };
bool GetChatLayoutChanged() const { return m_bChatLayoutChanged; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void SetChatLayoutChanged(bool changed) { m_bChatLayoutChanged = changed; };
bool GetChatLayoutChanged() const { return m_bChatLayoutChanged; };
void SetChatLayoutChanged(bool changed) { m_bChatLayoutChanged = changed; }
bool GetChatLayoutChanged() const { return m_bChatLayoutChanged; }

#define ALLOC_STATS_MODULE_NAME "client"
#include "SharedUtil.hpp"
#include <core/CClientCommands.h>
#include <../Client/core/CClientChatboxVariables.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header belongs in Client/sdk/core if you want to interface between core and deathmatch.

int iR, iG, iB, iA;
CLuaArguments chatboxItemList;

for (unsigned int i = 0; i < MAX_CHATBOX_LAYOUT_CVARS; i++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use an array of struct for g_chatboxLayoutCVars, and store the type of value next to the cvar name. For example:

enum class DummyType {
    STRING,
    BOOLEAN,
    FLOAT1,
    FLOAT2,
    FLOAT4,
};

struct Dummy {
    const char* name;
    DummyType   type;
};

@FileEX FileEX added enhancement New feature or request feedback Further information is requested labels Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feedback Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onChatboxLayoutChange event

7 participants