mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-15 17:46:03 +03:00
feat(console): initialize console screen
This commit is contained in:
parent
0003d5bd4b
commit
6b4c5e9179
@ -4,6 +4,7 @@
|
||||
#include "console/CVar.hpp"
|
||||
#include "console/Client.hpp"
|
||||
#include "console/Device.hpp"
|
||||
#include "console/Screen.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "glue/CGlueMgr.hpp"
|
||||
#include "gx/Screen.hpp"
|
||||
@ -72,7 +73,7 @@ int32_t InitializeEngineCallback(const void* a1, void* a2) {
|
||||
// }
|
||||
|
||||
ScrnInitialize(0);
|
||||
// ConsoleScreenInitialize(a2);
|
||||
ConsoleScreenInitialize(nullptr); // TODO argument
|
||||
|
||||
// s_cvarTextureFilteringMode = CVar::Register(
|
||||
// "textureFilteringMode",
|
||||
|
@ -14,6 +14,7 @@ target_include_directories(console
|
||||
target_link_libraries(console
|
||||
PUBLIC
|
||||
common
|
||||
gx
|
||||
storm
|
||||
PRIVATE
|
||||
client
|
||||
|
55
src/console/Screen.cpp
Normal file
55
src/console/Screen.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "console/Screen.hpp"
|
||||
#include "gx/Coordinate.hpp"
|
||||
#include "gx/Font.hpp"
|
||||
#include "gx/Gx.hpp"
|
||||
#include "gx/Screen.hpp"
|
||||
#include <storm/String.hpp>
|
||||
#include <tempest/Rect.hpp>
|
||||
|
||||
static CGxStringBatch* s_batch;
|
||||
static float s_caretpixwidth;
|
||||
static float s_caretpixheight;
|
||||
static float s_fontHeight = 0.02f;
|
||||
static char s_fontName[STORM_MAX_PATH];
|
||||
static HLAYER s_layerBackground;
|
||||
static HLAYER s_layerText;
|
||||
static RECTF s_rect = { 0.0f, 1.0f, 1.0f, 1.0f };
|
||||
static HTEXTFONT s_textFont;
|
||||
|
||||
void PaintBackground(void* param, const RECTF* rect, const RECTF* visible, float elapsedSec) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void PaintText(void* param, const RECTF* rect, const RECTF* visible, float elapsedSec) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void RegisterHandlers() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void ConsoleScreenInitialize(const char* title) {
|
||||
CRect windowSize;
|
||||
GxCapsWindowSize(windowSize);
|
||||
|
||||
auto width = windowSize.maxX - windowSize.minX;
|
||||
auto height = windowSize.maxY - windowSize.minY;
|
||||
s_caretpixwidth = width == 0.0f ? 1.0f : 1.0f / width;
|
||||
s_caretpixheight = height == 0.0f ? 1.0f : 1.0f / height;
|
||||
|
||||
SStrCopy(s_fontName, "Fonts\\ARIALN.ttf", sizeof(s_fontName));
|
||||
s_textFont = TextBlockGenerateFont(s_fontName, 0, NDCToDDCHeight(s_fontHeight));
|
||||
|
||||
ScrnLayerCreate(&s_rect, 6.0f, 0x1 | 0x2, nullptr, PaintBackground, &s_layerBackground);
|
||||
ScrnLayerCreate(&s_rect, 7.0f, 0x1 | 0x2, nullptr, PaintText, &s_layerText);
|
||||
|
||||
RegisterHandlers();
|
||||
|
||||
// TODO register commands
|
||||
|
||||
// TODO EventSetConfirmCloseCallback(EventCloseCallback, 0);
|
||||
|
||||
// TODO ConsoleCommandExecute("ver", 1);
|
||||
|
||||
s_batch = GxuFontCreateBatch(false, false);
|
||||
}
|
6
src/console/Screen.hpp
Normal file
6
src/console/Screen.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef CONSOLE_SCREEN_HPP
|
||||
#define CONSOLE_SCREEN_HPP
|
||||
|
||||
void ConsoleScreenInitialize(const char* title);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user