mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-09 18:58:10 +00:00
Implement UnhandledExceptionFilter and revert "set intro scene background to white"
Also use g_iScreenWidth and g_iScreenHeight in RMLManager
This commit is contained in:
@@ -926,6 +926,7 @@ void UIScene_LoadCreateJoinMenu::tick()
|
||||
if (rmlCtx && bHasFocus)
|
||||
{
|
||||
rmlCtx->ProcessMouseMove(g_KBMInput.GetMouseX(), g_KBMInput.GetMouseY(), 0);
|
||||
|
||||
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT))
|
||||
rmlCtx->ProcessMouseButtonDown(0, 0);
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT))
|
||||
@@ -934,6 +935,7 @@ void UIScene_LoadCreateJoinMenu::tick()
|
||||
rmlCtx->ProcessMouseButtonDown(1, 0);
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_RIGHT))
|
||||
rmlCtx->ProcessMouseButtonUp(1, 0);
|
||||
|
||||
int wheelDelta = g_KBMInput.GetMouseWheel();
|
||||
if (wheelDelta != 0)
|
||||
rmlCtx->ProcessMouseWheel(wheelDelta / -120, 0);
|
||||
|
||||
@@ -143,10 +143,6 @@ void UIScene_MessageBox::reloadMovie(bool force)
|
||||
{
|
||||
}
|
||||
|
||||
//GabsPuN: When Iggy is completely replaced, some functions should be moved to UIScene.cpp.
|
||||
//This way, the tick() function won't be repeated in every UIScene_ cpp file.
|
||||
//Also, since iggy no longer exists, we can take liberties with optimization or code
|
||||
//that is easier to work with.
|
||||
void UIScene_MessageBox::tick()
|
||||
{
|
||||
m_hasTickedOnce = true;
|
||||
|
||||
@@ -112,6 +112,10 @@ void UIScene_PauseMenu::reloadMovie(bool force)
|
||||
{
|
||||
}
|
||||
|
||||
//GabsPuN: When Iggy is completely replaced, some functions should be moved to UIScene.cpp.
|
||||
//This way, the tick() function won't be repeated in every UIScene_ cpp file.
|
||||
//Also, since iggy no longer exists, we can take liberties with optimization or code
|
||||
//that is easier to work with.
|
||||
void UIScene_PauseMenu::tick()
|
||||
{
|
||||
// Signal the base class that we've ticked once, so it sets m_bCanHandleInput
|
||||
@@ -124,6 +128,19 @@ void UIScene_PauseMenu::tick()
|
||||
if (!ctx || !bHasFocus)
|
||||
return;
|
||||
|
||||
//GabsPuN: Once the above comment is made, we can do something like this to increase performance.
|
||||
/*
|
||||
int currentX = g_KBMInput.GetMouseX();
|
||||
int currentY = g_KBMInput.GetMouseY();
|
||||
|
||||
if (currentX != m_lastMouseX || currentY != m_lastMouseY)
|
||||
{
|
||||
ctx->ProcessMouseMove(currentX, currentY, 0);
|
||||
m_lastMouseX = currentX;
|
||||
m_lastMouseY = currentY;
|
||||
}
|
||||
*/
|
||||
|
||||
// Forward mouse position (for hover effects and correct click targeting)
|
||||
ctx->ProcessMouseMove(g_KBMInput.GetMouseX(), g_KBMInput.GetMouseY(), 0);
|
||||
|
||||
@@ -174,25 +191,29 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed
|
||||
{
|
||||
case ACTION_MENU_UP:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_UP, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_DOWN:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_DOWN, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_OK:
|
||||
// Only forward as keyboard Enter if actually coming from keyboard,
|
||||
// not from mouse click (mouse is handled in tick()).
|
||||
if (g_KBMInput.IsKeyPressed(VK_RETURN))
|
||||
{
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_RETURN, 0);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_CANCEL:
|
||||
case ACTION_MENU_PAUSEMENU:
|
||||
navigateBack();
|
||||
handled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::ProcessEvent(Rml::Event& event)
|
||||
|
||||
@@ -182,24 +182,28 @@ void UIScene_SettingsMenu::handleInput(int iPad, int key, bool repeat, bool pres
|
||||
{
|
||||
case ACTION_MENU_UP:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_UP, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_DOWN:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_DOWN, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_OK:
|
||||
if (g_KBMInput.IsKeyPressed(VK_RETURN))
|
||||
{
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_RETURN, 0);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_CANCEL:
|
||||
case ACTION_MENU_PAUSEMENU:
|
||||
app.CheckGameSettingsChanged(true, iPad);
|
||||
navigateBack();
|
||||
handled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void UIScene_SettingsMenu::ProcessEvent(Rml::Event& event)
|
||||
|
||||
@@ -17,6 +17,9 @@ extern ID3D11Device* g_pd3dDevice;
|
||||
extern ID3D11DeviceContext* g_pImmediateContext;
|
||||
extern ID3D11RenderTargetView* g_pRenderTargetView;
|
||||
|
||||
extern int g_iScreenWidth;
|
||||
extern int g_iScreenHeight;
|
||||
|
||||
RmlManager& RmlManager::Get()
|
||||
{
|
||||
static RmlManager instance;
|
||||
@@ -26,8 +29,6 @@ RmlManager& RmlManager::Get()
|
||||
RmlManager::RmlManager()
|
||||
: m_initialised(false)
|
||||
, m_context(nullptr)
|
||||
, m_viewport_width(0)
|
||||
, m_viewport_height(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ RmlManager::~RmlManager()
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
bool RmlManager::Init(int viewport_width, int viewport_height)
|
||||
bool RmlManager::Init()
|
||||
{
|
||||
if (m_initialised)
|
||||
return true;
|
||||
@@ -65,22 +66,13 @@ bool RmlManager::Init(int viewport_width, int viewport_height)
|
||||
return false;
|
||||
}
|
||||
|
||||
// GabsPuN: Hardcoded. Is this really needed?
|
||||
/*
|
||||
// Load default fonts
|
||||
Rml::LoadFontFace("C:/Windows/Fonts/segoeui.ttf", false);
|
||||
Rml::LoadFontFace("C:/Windows/Fonts/segoeuib.ttf", false);
|
||||
Rml::LoadFontFace("C:/Windows/Fonts/segoeuii.ttf", false);
|
||||
Rml::LoadFontFace("C:/Windows/Fonts/segoeuiz.ttf", false);
|
||||
*/
|
||||
|
||||
// Minecraft's UI fonts (from tryashtar/minecraft-ttf)
|
||||
if (!Rml::LoadFontFace(assetPath + "/fonts/Mojangles.ttf", "Minecraft Default", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Normal, false))
|
||||
app.DebugPrintf("[RmlManager] FAILED loading Mojangles.ttf\n");
|
||||
if (!Rml::LoadFontFace(assetPath + "/fonts/MinecraftTen.ttf", "Minecraft Default", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Bold, true))
|
||||
app.DebugPrintf("[RmlManager] FAILED loading MinecraftTen.ttf\n");
|
||||
|
||||
m_context = Rml::CreateContext("main", Rml::Vector2i(viewport_width, viewport_height));
|
||||
m_context = Rml::CreateContext("main", Rml::Vector2i(g_iScreenWidth, g_iScreenHeight));
|
||||
if (!m_context)
|
||||
{
|
||||
app.DebugPrintf("[RmlManager] Failed to create RmlUi context\n");
|
||||
@@ -88,17 +80,14 @@ bool RmlManager::Init(int viewport_width, int viewport_height)
|
||||
return false;
|
||||
}
|
||||
|
||||
app.DebugPrintf("[RmlManager] Context created (%dx%d)\n", viewport_width, viewport_height);
|
||||
app.DebugPrintf("[RmlManager] Context created (%dx%d)\n", g_iScreenWidth, g_iScreenHeight);
|
||||
|
||||
m_viewport_width = viewport_width;
|
||||
m_viewport_height = viewport_height;
|
||||
|
||||
m_renderer->SetViewport(viewport_width, viewport_height);
|
||||
m_renderer->SetViewport(g_iScreenWidth, g_iScreenHeight);
|
||||
m_initialised = true;
|
||||
|
||||
app.DebugPrintf("[RmlManager] Initialised (%dx%d)\n", viewport_width, viewport_height);
|
||||
app.DebugPrintf("[RmlManager] Initialised (%dx%d)\n", g_iScreenWidth, g_iScreenHeight);
|
||||
|
||||
UpdateDpRatio(m_viewport_width, m_viewport_height);
|
||||
UpdateDpRatio();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -175,24 +164,22 @@ void RmlManager::OnResize(int width, int height)
|
||||
{
|
||||
if (!m_initialised || !m_context)
|
||||
return;
|
||||
m_viewport_width = width;
|
||||
m_viewport_height = height;
|
||||
|
||||
m_context->SetDimensions(Rml::Vector2i(width, height));
|
||||
m_renderer->SetViewport(width, height);
|
||||
UpdateDpRatio(width, height);
|
||||
}
|
||||
|
||||
void RmlManager::UpdateDpRatio(int viewport_width, int viewport_height)
|
||||
void RmlManager::UpdateDpRatio()
|
||||
{
|
||||
if (!m_context)
|
||||
return;
|
||||
|
||||
float scale_x = static_cast<float>(viewport_width) / 1920;
|
||||
float scale_y = static_cast<float>(viewport_height) / 1080;
|
||||
float scale_x = static_cast<float>(g_iScreenWidth) / 1920;
|
||||
float scale_y = static_cast<float>(g_iScreenHeight) / 1080;
|
||||
float base_ratio = (scale_x < scale_y) ? scale_x : scale_y;
|
||||
|
||||
float auto_dp = base_ratio;
|
||||
float viewport_cap = 0.88f * static_cast<float>(viewport_height) / 850.0f;
|
||||
float viewport_cap = 0.88f * static_cast<float>(g_iScreenHeight) / 850.0f;
|
||||
if (auto_dp > viewport_cap)
|
||||
auto_dp = viewport_cap;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class RmlManager
|
||||
public:
|
||||
static RmlManager& Get();
|
||||
|
||||
bool Init(int viewport_width, int viewport_height);
|
||||
bool Init();
|
||||
void Shutdown();
|
||||
|
||||
void Update();
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
RenderInterface_D3D11* GetRenderInterface() const { return m_renderer.get(); }
|
||||
|
||||
void OnResize(int width, int height);
|
||||
void UpdateDpRatio(int viewport_width, int viewport_height);
|
||||
void UpdateDpRatio();
|
||||
|
||||
void OnLanguageChanged();
|
||||
|
||||
@@ -48,9 +48,6 @@ private:
|
||||
std::unique_ptr<FileInterface_Game> m_file_interface;
|
||||
|
||||
Rml::Context* m_context;
|
||||
|
||||
int m_viewport_width;
|
||||
int m_viewport_height;
|
||||
};
|
||||
|
||||
#pragma pop_macro("GetFirstChild")
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
#include "..\..\Minecraft.Client\MinecraftServer.h"
|
||||
#include "..\..\Minecraft.World\LevelSettings.h"
|
||||
|
||||
#include <DbgHelp.h>
|
||||
#pragma comment(lib, "DbgHelp.lib")
|
||||
#include <Shlwapi.h>
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
||||
|
||||
CConsoleMinecraftApp app;
|
||||
|
||||
CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp()
|
||||
@@ -29,7 +34,6 @@ void CConsoleMinecraftApp::FatalLoadError()
|
||||
ExitGame();
|
||||
}
|
||||
|
||||
/*
|
||||
LONG WINAPI CConsoleMinecraftApp::UnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
@@ -113,9 +117,7 @@ LONG WINAPI CConsoleMinecraftApp::UnhandledExceptionFilter(EXCEPTION_POINTERS* p
|
||||
sprintf_s(msg, "%s has run into a fatal error and must be closed.\n\nException: 0x%08X (%s)\nAddress: 0x%p\n\nA crash dump and log file have been written.", exeName, code, ExceptionName(code), addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf_s(msg, "%s has run into a fatal error and must be closed.\n\nNo exception information was available.\n", exeName);
|
||||
}
|
||||
|
||||
char title[1024];
|
||||
sprintf_s(title, "%s - Fatal Error", exeName);
|
||||
@@ -123,7 +125,7 @@ LONG WINAPI CConsoleMinecraftApp::UnhandledExceptionFilter(EXCEPTION_POINTERS* p
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
*/
|
||||
|
||||
void CConsoleMinecraftApp::CaptureSaveThumbnail()
|
||||
{
|
||||
RenderManager.CaptureThumbnail(&m_ThumbnailBuffer);
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
virtual void StoreLaunchData();
|
||||
virtual void ExitGame();
|
||||
virtual void FatalLoadError();
|
||||
// static LONG WINAPI UnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo);
|
||||
static LONG WINAPI UnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo);
|
||||
|
||||
virtual void CaptureSaveThumbnail();
|
||||
virtual void GetSaveThumbnail(PBYTE*,DWORD*);
|
||||
|
||||
@@ -249,8 +249,6 @@ IDXGISwapChain* g_pSwapChain = nullptr;
|
||||
ID3D11RenderTargetView* g_pRenderTargetView = nullptr;
|
||||
ID3D11DepthStencilView* g_pDepthStencilView = nullptr;
|
||||
ID3D11Texture2D* g_pDepthStencilBuffer = nullptr;
|
||||
static const float kClearColorWhite[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
static const float kClearColorBlack[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
@@ -363,9 +361,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
vk = (lParam & (1 << 24)) ? VK_RCONTROL : VK_LCONTROL;
|
||||
else if (vk == VK_MENU)
|
||||
vk = (lParam & (1 << 24)) ? VK_RMENU : VK_LMENU;
|
||||
|
||||
g_KBMInput.OnKeyDown(vk);
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
if (message == WM_SYSKEYDOWN)
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
{
|
||||
@@ -376,7 +380,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
vk = (lParam & (1 << 24)) ? VK_RCONTROL : VK_LCONTROL;
|
||||
else if (vk == VK_MENU)
|
||||
vk = (lParam & (1 << 24)) ? VK_RMENU : VK_LMENU;
|
||||
|
||||
g_KBMInput.OnKeyUp(vk);
|
||||
|
||||
if (message == WM_SYSKEYUP)
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -400,7 +409,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
g_KBMInput.OnMouseMove(LOWORD(lParam), HIWORD(lParam));
|
||||
g_KBMInput.OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
@@ -413,18 +422,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER));
|
||||
if (dwSize > 0 && dwSize <= 256)
|
||||
{
|
||||
BYTE rawBuffer[256];
|
||||
alignas(RAWINPUT) BYTE rawBuffer[256];
|
||||
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawBuffer, &dwSize, sizeof(RAWINPUTHEADER)) == dwSize)
|
||||
{
|
||||
const RAWINPUT* raw = (RAWINPUT*)rawBuffer;
|
||||
if (raw->header.dwType == RIM_TYPEMOUSE)
|
||||
{
|
||||
g_KBMInput.OnRawMouseDelta(raw->data.mouse.lLastX, raw->data.mouse.lLastY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ENTERSIZEMOVE:
|
||||
g_bInSizeMove = true;
|
||||
break;
|
||||
@@ -442,6 +450,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
if (wParam == SIZE_MINIMIZED)
|
||||
{
|
||||
TrimMem();
|
||||
break;
|
||||
}
|
||||
|
||||
int newW = LOWORD(lParam);
|
||||
int newH = HIWORD(lParam);
|
||||
if (newW > 0 && newH > 0)
|
||||
@@ -459,8 +473,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
ResizeD3D(newW, newH);
|
||||
}
|
||||
}
|
||||
if (wParam == SIZE_MINIMIZED)
|
||||
TrimMem();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -621,6 +633,8 @@ HRESULT InitDevice()
|
||||
hr = dxgiFactory->CreateSwapChainForHwnd(g_pd3dDevice, g_hWnd, &sd, nullptr, nullptr, &pNewSwapChain);
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
dxgiFactory->MakeWindowAssociation(g_hWnd, DXGI_MWA_NO_ALT_ENTER);
|
||||
|
||||
g_pSwapChain = pNewSwapChain;
|
||||
|
||||
// Create a render target view
|
||||
@@ -810,6 +824,8 @@ static bool ResizeD3D(int newW, int newH)
|
||||
goto postReset;
|
||||
}
|
||||
|
||||
dxgiFactory->MakeWindowAssociation(g_hWnd, DXGI_MWA_NO_ALT_ENTER);
|
||||
|
||||
// New swap chain created successfully — NOW destroy the old one.
|
||||
// The Renderer's internal RTV/SRV still reference the old backbuffer —
|
||||
// those COM objects become orphaned (tiny leak, harmless). We DON'T
|
||||
@@ -1114,33 +1130,30 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_ int nCmdShow)
|
||||
{
|
||||
// Init our exception handler
|
||||
//SetUnhandledExceptionFilter(CConsoleMinecraftApp::UnhandledExceptionFilter);
|
||||
SetUnhandledExceptionFilter(CConsoleMinecraftApp::UnhandledExceptionFilter);
|
||||
|
||||
// 4J-Win64: set CWD to exe dir so asset paths resolve correctly
|
||||
{
|
||||
char szExeDir[MAX_PATH] = {};
|
||||
GetModuleFileNameA(nullptr, szExeDir, MAX_PATH);
|
||||
char *pSlash = strrchr(szExeDir, '\\');
|
||||
if (pSlash) { *(pSlash + 1) = '\0'; SetCurrentDirectoryA(szExeDir); }
|
||||
}
|
||||
{
|
||||
char szExeDir[MAX_PATH] = {};
|
||||
GetModuleFileNameA(nullptr, szExeDir, MAX_PATH);
|
||||
char *pSlash = strrchr(szExeDir, '\\');
|
||||
if (pSlash)
|
||||
{
|
||||
*(pSlash + 1) = '\0';
|
||||
SetCurrentDirectoryA(szExeDir);
|
||||
}
|
||||
}
|
||||
|
||||
// Declare DPI awareness so GetSystemMetrics returns physical pixels
|
||||
SetProcessDPIAware();
|
||||
|
||||
// Use the native monitor resolution for the window and swap chain
|
||||
g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
g_iScreenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
// Load username from username.txt
|
||||
char exePath[MAX_PATH] = {};
|
||||
GetModuleFileNameA(nullptr, exePath, MAX_PATH);
|
||||
char *lastSlash = strrchr(exePath, '\\');
|
||||
if (lastSlash)
|
||||
{
|
||||
*(lastSlash + 1) = '\0';
|
||||
}
|
||||
|
||||
char filePath[MAX_PATH] = {};
|
||||
_snprintf_s(filePath, sizeof(filePath), _TRUNCATE, "%susername.txt", exePath);
|
||||
_snprintf_s(filePath, sizeof(filePath), _TRUNCATE, "%susername.txt", utils.GetExeDir().c_str());
|
||||
|
||||
FILE *f = nullptr;
|
||||
if (fopen_s(&f, filePath, "r") == 0 && f)
|
||||
@@ -1150,14 +1163,10 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
{
|
||||
int len = static_cast<int>(strlen(buf));
|
||||
while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r' || buf[len - 1] == ' '))
|
||||
{
|
||||
buf[--len] = '\0';
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
strncpy_s(g_Win64Username, sizeof(g_Win64Username), buf, _TRUNCATE);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
@@ -1245,9 +1254,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
// Perform application initialization:
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hMyInst=hInstance;
|
||||
|
||||
@@ -1362,18 +1369,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// to avoid pegging the GPU at 100% presenting to a non-visible swap chain.
|
||||
if (IsIconic(g_hWnd))
|
||||
{
|
||||
Sleep(100);
|
||||
Sleep(16);
|
||||
continue;
|
||||
}
|
||||
|
||||
const float* clearColor = app.GetGameStarted() ? kClearColorBlack : kClearColorWhite;
|
||||
RenderManager.SetClearColour(clearColor);
|
||||
RenderManager.StartFrame();
|
||||
if (!app.GetGameStarted())
|
||||
{
|
||||
RenderManager.SetClearColour(kClearColorWhite); // set intro scene background to white
|
||||
RenderManager.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
#if 0
|
||||
if(pMinecraft->soundEngine->isStreamingWavebankReady() &&
|
||||
!pMinecraft->soundEngine->isPlayingStreamingGameMusic() &&
|
||||
@@ -1410,9 +1410,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
g_KBMInput.SetKBMActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_KBMInput.SetKBMActive(true);
|
||||
}
|
||||
|
||||
if (!g_KBMInput.IsMouseGrabbed())
|
||||
{
|
||||
@@ -1646,9 +1644,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
DisableFullscreen();
|
||||
|
||||
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_FULLSCREEN))
|
||||
{
|
||||
app.SetGameSettings(primaryPad, eGameSetting_Fullscreen, fullscreen ? 0 : 1);
|
||||
}
|
||||
|
||||
// Open chat
|
||||
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CHAT) && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == nullptr)
|
||||
|
||||
@@ -63,7 +63,7 @@ void ConsoleUIController::init(ID3D11Device *dev, ID3D11DeviceContext *ctx, ID3D
|
||||
postInit();
|
||||
|
||||
// Initialise RmlUi (menus)
|
||||
if (!RmlManager::Get().Init(w, h))
|
||||
if (!RmlManager::Get().Init())
|
||||
app.DebugPrintf("ConsoleUIController::init - RmlManager::Init failed\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ bool RmlManager::Init(int viewport_width, int viewport_height)
|
||||
void RmlManager::Shutdown() {}
|
||||
void RmlManager::Update() {}
|
||||
void RmlManager::Render() {}
|
||||
void RmlManager::OnResize(int width, int height) {}
|
||||
void RmlManager::UpdateDpRatio(int, int) {}
|
||||
void RmlManager::OnResize() {}
|
||||
void RmlManager::UpdateDpRatio() {}
|
||||
void RmlManager::OnLanguageChanged() {}
|
||||
Reference in New Issue
Block a user