Made console scale to window height
This commit is contained in:
parent
17e5a81dde
commit
e8e22197a8
|
@ -2,6 +2,7 @@
|
|||
#include <string.h>
|
||||
#include "djui.h"
|
||||
#include "djui_console.h"
|
||||
#include "pc/pc_main.h"
|
||||
|
||||
#define MAX_CONSOLE_MESSAGES 500
|
||||
|
||||
|
@ -27,6 +28,12 @@ void djui_console_toggle(void) {
|
|||
gDjuiConsoleFocus = !gDjuiConsoleFocus;
|
||||
djui_base_set_visible(&gDjuiConsole->base, gDjuiConsoleFocus);
|
||||
|
||||
u32 windowWidth, windowHeight;
|
||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||
f32 scaledHeight = (windowHeight * 0.6f) / djui_gfx_get_scale();
|
||||
|
||||
djui_base_set_size(&gDjuiConsole->base, 1, MIN(scaledHeight, 1000));
|
||||
|
||||
if (gDjuiConsoleFocus) {
|
||||
if (gDjuiChatBoxFocus) { djui_chat_box_toggle(); }
|
||||
djui_interactable_set_input_focus(&gDjuiConsole->base);
|
||||
|
@ -116,7 +123,7 @@ struct DjuiConsole* djui_console_create(void) {
|
|||
|
||||
djui_base_init(NULL, base, djui_console_render, djui_console_destroy);
|
||||
djui_base_set_size_type(base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(base, gDjuiRoot->base.width.value, gDjuiRoot->base.height.value * 0.6f);
|
||||
djui_base_set_size(base, gDjuiRoot->base.width.value, 1000);
|
||||
djui_base_set_alignment(base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
djui_base_set_color(base, 0, 0, 0, 220);
|
||||
djui_base_set_padding(base, 0, 8, 8, 8);
|
||||
|
|
Loading…
Reference in New Issue