Skip to content

Commit 8297dac

Browse files
[Rendering] Minor tweaks;
1 parent e4e9fe1 commit 8297dac

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Engine/Core/Rendering/Vertex/IndexBuffer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Staple;
88
/// <summary>
99
/// Index Buffer resource
1010
/// </summary>
11-
public class IndexBuffer
11+
public sealed class IndexBuffer
1212
{
1313
private static IndexBuffer transientBuffer;
1414

Engine/Core/Rendering/Vertex/VertexBuffer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Staple;
88
/// <summary>
99
/// Vertex Buffer resource
1010
/// </summary>
11-
public class VertexBuffer
11+
public sealed class VertexBuffer
1212
{
1313
private static VertexBuffer transientBuffer;
1414

Engine/Editor/ImGuiProxy.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ internal class ImGuiProxy
2727
public ImFontPtr editorFont;
2828

2929
private bool frameBegun = false;
30+
private bool destroyed = false;
3031

3132
private readonly KeyCode[] keyCodes = Enum.GetValues<KeyCode>();
3233

@@ -116,7 +117,14 @@ public bool Initialize()
116117

117118
public void Destroy()
118119
{
119-
if(textureUniform.Valid)
120+
if(destroyed)
121+
{
122+
return;
123+
}
124+
125+
destroyed = true;
126+
127+
if (textureUniform.Valid)
120128
{
121129
bgfx.destroy_uniform(textureUniform);
122130
}
@@ -231,6 +239,11 @@ public ImGuiKey GetKey(KeyCode key)
231239

232240
public void BeginFrame()
233241
{
242+
if(destroyed)
243+
{
244+
return;
245+
}
246+
234247
var io = ImGui.GetIO();
235248

236249
io.DeltaTime = Time.unscaledDeltaTime;
@@ -279,6 +292,11 @@ public void BeginFrame()
279292

280293
public void EndFrame()
281294
{
295+
if (destroyed)
296+
{
297+
return;
298+
}
299+
282300
if (frameBegun)
283301
{
284302
frameBegun = false;
@@ -293,6 +311,11 @@ public void EndFrame()
293311

294312
private void Render(ImDrawDataPtr drawData)
295313
{
314+
if (destroyed)
315+
{
316+
return;
317+
}
318+
296319
unsafe
297320
{
298321
var fbWidth = drawData.DisplaySize.X * drawData.FramebufferScale.X;

0 commit comments

Comments
 (0)