-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cda9332
commit f2f2b98
Showing
11 changed files
with
329 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace MonoGame.ImGui.Data | ||
{ | ||
/// <summary> | ||
/// Contains information regarding the index buffer used by the GUIRenderer. | ||
/// </summary> | ||
public class IndexData | ||
{ | ||
public byte[] Data; | ||
public int BufferSize; | ||
public IndexBuffer Buffer; | ||
} | ||
} | ||
namespace MonoGame.ImGui.Data; | ||
|
||
/// <summary> | ||
/// Contains information regarding the index buffer used by the GUIRenderer. | ||
/// </summary> | ||
public class IndexData { | ||
public IndexBuffer Buffer; | ||
public int BufferSize; | ||
public byte[] Data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Xna.Framework.Graphics; | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace MonoGame.ImGui.Data | ||
{ | ||
/// <summary> | ||
/// Contains the GUIRenderer's texture data element. | ||
/// </summary> | ||
public class TextureData | ||
{ | ||
public int TextureID; | ||
public IntPtr? FontTextureID; | ||
public Dictionary<IntPtr, Texture2D> Loaded; | ||
namespace MonoGame.ImGui.Data; | ||
|
||
public int GetTextureID() | ||
{ | ||
return TextureID++; | ||
} | ||
/// <summary> | ||
/// Contains the GUIRenderer's texture data element. | ||
/// </summary> | ||
public class TextureData { | ||
public IntPtr? FontTextureID; | ||
public Dictionary<IntPtr, Texture2D> Loaded; | ||
public int TextureID; | ||
|
||
public TextureData() | ||
{ | ||
Loaded = new Dictionary<IntPtr, Texture2D>(); | ||
} | ||
public TextureData() { | ||
Loaded = new Dictionary<IntPtr, Texture2D>(); | ||
} | ||
} | ||
|
||
public int GetNextTextureId() { | ||
return TextureID++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace MonoGame.ImGui.Data | ||
{ | ||
/// <summary> | ||
/// Contains information regarding the vertex buffer used by the GUIRenderer. | ||
/// </summary> | ||
public class VertexData | ||
{ | ||
public byte[] Data; | ||
public int BufferSize; | ||
public VertexBuffer Buffer; | ||
} | ||
} | ||
namespace MonoGame.ImGui.Data; | ||
|
||
/// <summary> | ||
/// Contains information regarding the vertex buffer used by the GUIRenderer. | ||
/// </summary> | ||
public class VertexData { | ||
public VertexBuffer Buffer; | ||
public int BufferSize; | ||
public byte[] Data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
namespace MonoGame.ImGui | ||
{ | ||
public static class DrawText | ||
{ | ||
public static void Perform(string text) | ||
{ | ||
ImGuiNET.ImGui.Text(text); | ||
} | ||
namespace MonoGame.ImGui; | ||
|
||
public static class DrawText { | ||
public static void Perform(string text) { | ||
ImGuiNET.ImGui.Text(text); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
using ImGuiNET; | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace MonoGame.ImGui | ||
{ | ||
public static class DrawVertDeclaration | ||
{ | ||
public static readonly int Size; | ||
public static readonly VertexDeclaration Declaration; | ||
namespace MonoGame.ImGui; | ||
|
||
static DrawVertDeclaration() | ||
{ | ||
unsafe { Size = sizeof(ImDrawVert); } | ||
public static class DrawVertDeclaration { | ||
public static readonly int Size; | ||
public static readonly VertexDeclaration Declaration; | ||
|
||
var position = new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0); | ||
var uv = new VertexElement(8, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); | ||
var color = new VertexElement(16, VertexElementFormat.Color, VertexElementUsage.Color, 0); | ||
Declaration = new VertexDeclaration(Size, position, uv, color); | ||
static DrawVertDeclaration() { | ||
unsafe { | ||
Size = sizeof(ImDrawVert); | ||
} | ||
|
||
var position = new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0); | ||
var uv = new VertexElement(8, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); | ||
var color = new VertexElement(16, VertexElementFormat.Color, VertexElementUsage.Color, 0); | ||
Declaration = new VertexDeclaration(Size, position, uv, color); | ||
} | ||
} |
23 changes: 8 additions & 15 deletions
23
MonoGame.ImGui/Exceptions/MissingLoadedTextureKeyException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
namespace MonoGame.ImGui.Exceptions | ||
{ | ||
public class MissingLoadedTextureKeyException | ||
: InvalidOperationException | ||
{ | ||
public override string Message | ||
{ | ||
get { return string.Format("Could not find a texture with id {0}, please check your bindings", _texture_id); } | ||
} | ||
namespace MonoGame.ImGui.Exceptions; | ||
|
||
public MissingLoadedTextureKeyException(IntPtr texture_id) | ||
{ | ||
_texture_id = texture_id; | ||
} | ||
public class MissingLoadedTextureKeyException : InvalidOperationException { | ||
private readonly IntPtr _textureId; | ||
|
||
private readonly IntPtr _texture_id; | ||
public MissingLoadedTextureKeyException(IntPtr textureId) { | ||
_textureId = textureId; | ||
} | ||
} | ||
|
||
public override string Message => $"Could not find a texture with id {_textureId}, please check your bindings"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.