temp debug messages

This commit is contained in:
UnknownShadow200 2020-11-03 11:42:11 +11:00
parent a3f32279f6
commit 20cfaba0ac
3 changed files with 35 additions and 0 deletions

View File

@ -590,6 +590,14 @@ void Chat_Send(const cc_string* text, cc_bool logUsage) {
Event_RaiseChat(&ChatEvents.ChatSending, text, 0);
if (logUsage) StringsBuffer_Add(&Chat_InputLog, text);
#ifdef CC_BUILD_WEB
if (String_CaselessEqualsConst(text, "/client debug")) {
Chat_AddRaw("DEBUG CANNON ENGAGED");
extern int Window_Debug;
Window_Debug = true;
}
#endif
if (Commands_IsCommandPrefix(text)) {
Commands_Execute(text);
} else {

View File

@ -795,6 +795,7 @@ static cc_bool ChatScreen_ChatUpdateFont(struct ChatScreen* s) {
Math_Clamp(size, 8, 60);
/* don't recreate font if possible */
/* TODO: Add function for this, don't use Display_ScaleY (Drawer2D_SameFontSize ??) */
if (Display_ScaleY(size) == s->chatFont.size) return false;
ChatScreen_FreeChatFonts(s);
Drawer2D_MakeFont(&s->chatFont, size, FONT_FLAGS_NONE);

View File

@ -3520,7 +3520,33 @@ void Window_Close(void) {
UnhookEvents();
}
#include "Chat.h"
static void LogStuff(void) {
char buffer[256]; cc_string str = String_FromArray(buffer);
int width, height;
double css_width, css_height;
width = GetCanvasWidth();
height = GetCanvasHeight();
String_Format2(&str, "Size: %ix%i", &width, &height);
Chat_AddOf(&str, MSG_TYPE_STATUS_1);
str.length = 0;
width = EM_ASM_INT_V({ return window.innerHeight; });
height = EM_ASM_INT_V({ return window.outerHeight; });
String_Format2(&str, "I:%i O:%i", &width, &height);
Chat_AddOf(&str, MSG_TYPE_STATUS_2);
str.length = 0;
width = GetScreenWidth();
height = GetScreenHeight();
String_Format2(&str, "Dims: %ix%i", &width, &height);
Chat_AddOf(&str, MSG_TYPE_STATUS_3);
}
int Window_Debug;
void Window_ProcessEvents(void) {
if (Window_Debug) LogStuff();
if (!needResize) return;
needResize = false;