hotloading!!

This commit is contained in:
Asuro
2025-02-07 03:03:23 +01:00
parent 3be734ae2f
commit 60640a708f
7 changed files with 172 additions and 72 deletions

View File

@@ -1,10 +1,14 @@
#include "Log.h"
#include <cstdio>
#include <bx/string.h>
namespace Game
namespace
{
void Log(const char* text)
{
printf("%s\n", text);
}
char LineBuffer[1024]{0};
}
void Log(const char *format, ...)
{
va_list args;
bx::snprintf(LineBuffer, sizeof(LineBuffer), "%s\n", format);
bx::printf(LineBuffer, args);
}

View File

@@ -1,6 +1,3 @@
#pragma once
namespace Game
{
void Log(const char* text);
}
void Log(const char *format, ...);

View File

@@ -4,22 +4,19 @@
namespace Game
{
int32_t FrameCounter = 0;
void Setup(void* window)
{
Log("Setup");
bgfx::Init init;
init.type = bgfx::RendererType::Direct3D12;
init.platformData.nwh = (void*)window;
init.platformData.ndt = nullptr;
init.platformData.type = bgfx::NativeWindowHandleType::Default;
init.resolution.width = 1920;
init.resolution.height = 1080;
init.resolution.reset = BGFX_RESET_VSYNC;
bgfx::init(init);
Log("Game Setup Start!");
}
void Update()
{
Log("Update");
}
++FrameCounter;
if (FrameCounter % 1000000 == 0)
{
Log("Frame!");
}
}
}