mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Release build fixes + ImGui build flag
Fonts still not working
This commit is contained in:
@@ -15,7 +15,7 @@ PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
|
|||||||
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
|
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
|
||||||
|
|
||||||
[Configs.Release.Win64]
|
[Configs.Release.Win64]
|
||||||
PreprocessorMacros = ["RELEASE", "GE_PROFILE"]
|
PreprocessorMacros = ["IMGUI", "RELEASE", "GE_PROFILE"]
|
||||||
|
|
||||||
[Configs.Test.Win32]
|
[Configs.Test.Win32]
|
||||||
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
||||||
@@ -24,4 +24,4 @@ PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
|||||||
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
||||||
|
|
||||||
[Configs.Debug.Win64]
|
[Configs.Debug.Win64]
|
||||||
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES"]
|
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "IMGUI"]
|
||||||
|
|||||||
@@ -10,18 +10,20 @@ namespace GlitchyEngine
|
|||||||
{
|
{
|
||||||
static Application s_Instance = null;
|
static Application s_Instance = null;
|
||||||
|
|
||||||
private Window _window ~ delete _;
|
private Window _window;
|
||||||
private RendererAPI _rendererApi ~ delete _;
|
private RendererAPI _rendererApi;
|
||||||
private EffectLibrary _effectLibrary ~ delete _;
|
private EffectLibrary _effectLibrary;
|
||||||
|
|
||||||
private bool _running = true;
|
private bool _running = true;
|
||||||
private bool _isMinimized = false;
|
private bool _isMinimized = false;
|
||||||
|
|
||||||
private LayerStack _layerStack = new LayerStack();
|
private LayerStack _layerStack;
|
||||||
|
|
||||||
|
#if IMGUI
|
||||||
private ImGuiLayer _imGuiLayer;
|
private ImGuiLayer _imGuiLayer;
|
||||||
|
#endif
|
||||||
|
|
||||||
private GameTime _gameTime = new GameTime(true);
|
private GameTime _gameTime;
|
||||||
|
|
||||||
public bool IsRunning => _running;
|
public bool IsRunning => _running;
|
||||||
public Window Window => _window;
|
public Window Window => _window;
|
||||||
@@ -40,6 +42,9 @@ namespace GlitchyEngine
|
|||||||
Log.EngineLogger.Assert(s_Instance == null, "Tried to create a second application.");
|
Log.EngineLogger.Assert(s_Instance == null, "Tried to create a second application.");
|
||||||
s_Instance = this;
|
s_Instance = this;
|
||||||
|
|
||||||
|
_layerStack = new LayerStack();
|
||||||
|
_gameTime = new GameTime(true);
|
||||||
|
|
||||||
_window = new Window(.Default);
|
_window = new Window(.Default);
|
||||||
_window.EventCallback = new => OnEvent;
|
_window.EventCallback = new => OnEvent;
|
||||||
|
|
||||||
@@ -54,18 +59,25 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
Renderer.Init(_window.Context, _effectLibrary);
|
Renderer.Init(_window.Context, _effectLibrary);
|
||||||
|
|
||||||
|
#if IMGUI
|
||||||
_imGuiLayer = new ImGuiLayer();
|
_imGuiLayer = new ImGuiLayer();
|
||||||
PushOverlay(_imGuiLayer);
|
PushOverlay(_imGuiLayer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public ~this()
|
public ~this()
|
||||||
{
|
{
|
||||||
Profiler.ProfileFunction!();
|
Profiler.ProfileFunction!();
|
||||||
|
|
||||||
delete _layerStack;
|
|
||||||
SamplerStateManager.Uninit();
|
SamplerStateManager.Uninit();
|
||||||
Renderer.Deinit();
|
Renderer.Deinit();
|
||||||
|
|
||||||
|
delete _effectLibrary;
|
||||||
|
delete _rendererApi;
|
||||||
|
delete _window;
|
||||||
|
|
||||||
delete _gameTime;
|
delete _gameTime;
|
||||||
|
delete _layerStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEvent(Event e)
|
public void OnEvent(Event e)
|
||||||
@@ -131,7 +143,9 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
if(allowFrame)
|
if(allowFrame)
|
||||||
{
|
{
|
||||||
|
#if IMGUI
|
||||||
_imGuiLayer.ImGuiRender();
|
_imGuiLayer.ImGuiRender();
|
||||||
|
#endif
|
||||||
|
|
||||||
_window.Context.SwapChain.Present();
|
_window.Context.SwapChain.Present();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,10 @@ namespace GlitchyEngine.ImGui
|
|||||||
io.DisplaySize = .(window.Width, window.Height);
|
io.DisplaySize = .(window.Width, window.Height);
|
||||||
|
|
||||||
ImGui.Render();
|
ImGui.Render();
|
||||||
|
|
||||||
|
#if GE_GRAPHICS_DX11
|
||||||
ImGuiImplDX11.RenderDrawData(ImGui.GetDrawData());
|
ImGuiImplDX11.RenderDrawData(ImGui.GetDrawData());
|
||||||
|
#endif
|
||||||
|
|
||||||
ImGui.CleanupFrame();
|
ImGui.CleanupFrame();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ namespace GlitchyEngine.Platform.DX11
|
|||||||
protected internal static ID3D11Device* NativeDevice;
|
protected internal static ID3D11Device* NativeDevice;
|
||||||
protected internal static ID3D11DeviceContext* NativeContext;
|
protected internal static ID3D11DeviceContext* NativeContext;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
protected internal static ID3D11Debug* DebugDevice;
|
protected internal static ID3D11Debug* DebugDevice;
|
||||||
|
#endif
|
||||||
|
|
||||||
internal static void Dx11Init()
|
internal static void Dx11Init()
|
||||||
{
|
{
|
||||||
@@ -68,7 +70,9 @@ namespace GlitchyEngine.Platform.DX11
|
|||||||
// We created a second GraphicsContext (for some reason?) just increment references.
|
// We created a second GraphicsContext (for some reason?) just increment references.
|
||||||
NativeDevice.AddRef();
|
NativeDevice.AddRef();
|
||||||
NativeContext.AddRef();
|
NativeContext.AddRef();
|
||||||
|
#if DEBUG
|
||||||
DebugDevice.AddRef();
|
DebugDevice.AddRef();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,8 +82,10 @@ namespace GlitchyEngine.Platform.DX11
|
|||||||
|
|
||||||
NativeDevice.Release();
|
NativeDevice.Release();
|
||||||
NativeContext.Release();
|
NativeContext.Release();
|
||||||
|
#if DEBUG
|
||||||
DebugDevice.ReportLiveDeviceObjects(.Detail);
|
DebugDevice.ReportLiveDeviceObjects(.Detail);
|
||||||
DebugDevice.Release();
|
DebugDevice.Release();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
Log.EngineLogger.Info("Application uninitialized.");
|
Log.EngineLogger.Info("Application uninitialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Profiler.EndProfiling();
|
Debug.Profiler.EndProfiling();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -27,10 +27,13 @@ namespace Sandbox
|
|||||||
|
|
||||||
OrthographicCameraController cameraController ~ delete _;
|
OrthographicCameraController cameraController ~ delete _;
|
||||||
|
|
||||||
Font fonty ~ _.ReleaseRef();
|
// Font fonty ~ _.ReleaseRef();
|
||||||
|
|
||||||
ColorRGBA _squareColor0 = ColorRGBA.CornflowerBlue;
|
ColorRGBA _squareColor0 = ColorRGBA.CornflowerBlue;
|
||||||
ColorRGBA _squareColor1;
|
ColorRGBA _squareColor1 = {
|
||||||
|
ColorRGBA color = ColorRGBA.White - _squareColor0;
|
||||||
|
color.A = _squareColor0.A;
|
||||||
|
color};
|
||||||
|
|
||||||
DepthStencilState _depthStencilState ~ _.ReleaseRef();
|
DepthStencilState _depthStencilState ~ _.ReleaseRef();
|
||||||
|
|
||||||
@@ -61,7 +64,7 @@ namespace Sandbox
|
|||||||
blendDesc.RenderTarget[0] = .(true, .SourceAlpha, .InvertedSourceAlpha, .Add, .SourceAlpha, .InvertedSourceAlpha, .Add, .All);
|
blendDesc.RenderTarget[0] = .(true, .SourceAlpha, .InvertedSourceAlpha, .Add, .SourceAlpha, .InvertedSourceAlpha, .Add, .All);
|
||||||
_alphaBlendState = new BlendState(blendDesc);
|
_alphaBlendState = new BlendState(blendDesc);
|
||||||
|
|
||||||
fonty = new Font("C:\\Windows\\Fonts\\arial.ttf", 64, true, 'A', 16);
|
/*fonty = new Font("C:\\Windows\\Fonts\\arial.ttf", 64, true, 'A', 16);
|
||||||
var japanese = new Font("C:\\Windows\\Fonts\\YuGothM.ttc", 64, true, '\0', 1);
|
var japanese = new Font("C:\\Windows\\Fonts\\YuGothM.ttc", 64, true, '\0', 1);
|
||||||
var emojis = new Font("C:\\Windows\\Fonts\\seguiemj.ttf", 64, true, '😂' - 10, 1);
|
var emojis = new Font("C:\\Windows\\Fonts\\seguiemj.ttf", 64, true, '😂' - 10, 1);
|
||||||
var mathstuff = new Font("C:\\Windows\\Fonts\\cambria.ttc", 64, true, 'α', 1);
|
var mathstuff = new Font("C:\\Windows\\Fonts\\cambria.ttc", 64, true, 'α', 1);
|
||||||
@@ -69,7 +72,7 @@ namespace Sandbox
|
|||||||
fonty.Fallback = japanese..ReleaseRefNoDelete();
|
fonty.Fallback = japanese..ReleaseRefNoDelete();
|
||||||
japanese.Fallback = emojis..ReleaseRefNoDelete();
|
japanese.Fallback = emojis..ReleaseRefNoDelete();
|
||||||
emojis.Fallback = mathstuff..ReleaseRefNoDelete();
|
emojis.Fallback = mathstuff..ReleaseRefNoDelete();
|
||||||
mathstuff.Fallback = cascadiaCode..ReleaseRefNoDelete();
|
mathstuff.Fallback = cascadiaCode..ReleaseRefNoDelete();*/
|
||||||
|
|
||||||
_textureViewer = new TextureViewer();
|
_textureViewer = new TextureViewer();
|
||||||
|
|
||||||
@@ -133,9 +136,9 @@ namespace Sandbox
|
|||||||
Renderer2D.DrawQuad(Vector3(2 * x, 2 * y, 0.5f), Vector2(1.5f, 1), MathHelper.PiOverFour, (i == 0) ? _squareColor0 : _squareColor1);
|
Renderer2D.DrawQuad(Vector3(2 * x, 2 * y, 0.5f), Vector2(1.5f, 1), MathHelper.PiOverFour, (i == 0) ? _squareColor0 : _squareColor1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var prepared = FontRenderer.PrepareText(fonty, text, 64, .White, .White);
|
//var prepared = FontRenderer.PrepareText(fonty, text, 64, .White, .White);
|
||||||
FontRenderer.DrawText(prepared, 0, 0);
|
//FontRenderer.DrawText(prepared, 0, 0);
|
||||||
prepared.ReleaseRef();
|
//prepared.ReleaseRef();
|
||||||
|
|
||||||
Renderer2D.EndScene();
|
Renderer2D.EndScene();
|
||||||
}
|
}
|
||||||
@@ -181,7 +184,7 @@ namespace Sandbox
|
|||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
|
||||||
//_textureViewer.ViewTexture(fonty.Fallback.Fallback.Fallback.Fallback.[Friend]_atlas);
|
//_textureViewer.ViewTexture(fonty.Fallback.Fallback.Fallback.Fallback.[Friend]_atlas);
|
||||||
_textureViewer.ViewTexture(fonty.[Friend]_atlas);
|
//_textureViewer.ViewTexture(fonty.[Friend]_atlas);
|
||||||
|
|
||||||
_context.SetRenderTarget(null);
|
_context.SetRenderTarget(null);
|
||||||
_context.SetDepthStencilTarget(_depthTarget);
|
_context.SetDepthStencilTarget(_depthTarget);
|
||||||
|
|||||||
Reference in New Issue
Block a user