-
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
Showing
136 changed files
with
42,727 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Properties> | ||
<MonoDevelop.Ide.Workbench> | ||
<Pads> | ||
<Pad Id="ProjectPad"> | ||
<State name="__root__"> | ||
<Node name="MonoGame.ImGui" expanded="True" selected="True"> | ||
<Node name="MonoGame.ImGui" expanded="True" /> | ||
</Node> | ||
</State> | ||
</Pad> | ||
</Pads> | ||
</MonoDevelop.Ide.Workbench> | ||
<MonoDevelop.Ide.DebuggingService.PinnedWatches /> | ||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> | ||
<MonoDevelop.Ide.DebuggingService.Breakpoints> | ||
<BreakpointStore /> | ||
</MonoDevelop.Ide.DebuggingService.Breakpoints> | ||
<MultiItemStartupConfigurations /> | ||
</Properties> |
1 change: 1 addition & 0 deletions
1
MonoGame.ImGui/.vs/MonoGame.ImGui/xs/project-cache/MonoGame.ImGui-Debug.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Format":1,"ProjectReferences":[],"MetadataReferences":[{"FilePath":"/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/packages/MonoGame.Framework.DesktopGL.3.7.1.189/lib/net45/MonoGame.Framework.dll","Aliases":[]},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/4.6.2-api/mscorlib.dll","Aliases":[]},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/4.6.2-api/System.Core.dll","Aliases":[]},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/4.6.2-api/System.Numerics.dll","Aliases":[]},{"FilePath":"/Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/4.6.2-api/System.Numerics.Vectors.dll","Aliases":[]}],"Files":["/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/packages.config","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Data/IndexData.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Data/InputData.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Data/TextureData.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Data/VertexData.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/DrawText.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/DrawVertDecleration.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Exceptions/MissingLoadedTextureKeyException.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Extensions/DataConvertExtensions.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/ImGUIRenderer.cs","/Users/dovydas/Documents/GitHub/Monogame.ImGui/MonoGame.ImGui/Utilities/GenerateRasterizerState.cs"],"BuildActions":["None","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile","Compile"],"Analyzers":[]} |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Collections.Generic; | ||
using ImGuiNET; | ||
using Microsoft.Xna.Framework; | ||
using Microsoft.Xna.Framework.Graphics; | ||
using Microsoft.Xna.Framework.Input; | ||
|
||
namespace MonoGame.ImGui.Data | ||
{ | ||
/// <summary> | ||
/// Contains the GUIRenderer's input data elements. | ||
/// </summary> | ||
public class InputData | ||
{ | ||
public int Scrollwheel; | ||
public List<int> KeyMap; | ||
|
||
public void Update(GraphicsDevice device) | ||
{ | ||
var io = ImGuiNET.ImGui.GetIO(); | ||
var mouse = Mouse.GetState(); | ||
var keyboard = Keyboard.GetState(); | ||
|
||
for (int i = 0; i < KeyMap.Count; i++) | ||
io.KeysDown[KeyMap[i]] = keyboard.IsKeyDown((Keys) KeyMap[i]); | ||
|
||
io.KeyShift = keyboard.IsKeyDown(Keys.LeftShift) || keyboard.IsKeyDown(Keys.RightShift); | ||
io.KeyCtrl = keyboard.IsKeyDown(Keys.LeftControl) || keyboard.IsKeyDown(Keys.RightControl); | ||
io.KeyAlt = keyboard.IsKeyDown(Keys.LeftAlt) || keyboard.IsKeyDown(Keys.RightAlt); | ||
io.KeySuper = keyboard.IsKeyDown(Keys.LeftWindows) || keyboard.IsKeyDown(Keys.RightWindows); | ||
|
||
io.DisplaySize = new System.Numerics.Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight); | ||
io.DisplayFramebufferScale = new System.Numerics.Vector2(1f, 1f); | ||
|
||
io.MousePos = new System.Numerics.Vector2(mouse.X, mouse.Y); | ||
|
||
io.MouseDown[0] = mouse.LeftButton == ButtonState.Pressed; | ||
io.MouseDown[1] = mouse.RightButton == ButtonState.Pressed; | ||
io.MouseDown[2] = mouse.MiddleButton == ButtonState.Pressed; | ||
|
||
var scrollDelta = mouse.ScrollWheelValue - Scrollwheel; | ||
io.MouseWheel = scrollDelta > 0 ? 1 : scrollDelta < 0 ? -1 : 0; | ||
Scrollwheel = mouse.ScrollWheelValue; | ||
} | ||
|
||
public InputData Initialize(Game game) | ||
{ | ||
var io = ImGuiNET.ImGui.GetIO(); | ||
|
||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Tab] = (int) Keys.Tab); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.LeftArrow] = (int) Keys.Left); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.RightArrow] = (int) Keys.Right); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.UpArrow] = (int) Keys.Up); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.DownArrow] = (int) Keys.Down); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.PageUp] = (int) Keys.PageUp); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.PageDown] = (int) Keys.PageDown); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Home] = (int) Keys.Home); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.End] = (int) Keys.End); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Delete] = (int) Keys.Delete); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Backspace] = (int) Keys.Back); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Enter] = (int) Keys.Enter); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Escape] = (int) Keys.Escape); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.A] = (int) Keys.A); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.C] = (int) Keys.C); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.V] = (int) Keys.V); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.X] = (int) Keys.X); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Y] = (int) Keys.Y); | ||
KeyMap.Add(io.KeyMap[(int) ImGuiKey.Z] = (int) Keys.Z); | ||
|
||
game.Window.TextInput += (sender, args) => | ||
{ | ||
if (args.Character != '\t') | ||
io.AddInputCharacter(args.Character); | ||
}; | ||
|
||
io.Fonts.AddFontDefault(); | ||
return this; | ||
} | ||
|
||
public InputData() | ||
{ | ||
Scrollwheel = 0; | ||
KeyMap = new List<int>(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
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; | ||
|
||
public int GetTextureID() | ||
{ | ||
return TextureID++; | ||
} | ||
|
||
public TextureData() | ||
{ | ||
Loaded = new Dictionary<IntPtr, Texture2D>(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using ImGuiNET; | ||
using Microsoft.Xna.Framework.Graphics; | ||
|
||
namespace MonoGame.ImGui | ||
{ | ||
public static class DrawVertDeclaration | ||
{ | ||
public static readonly int Size; | ||
public static readonly VertexDeclaration Declaration; | ||
|
||
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); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
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); } | ||
} | ||
|
||
public MissingLoadedTextureKeyException(IntPtr texture_id) | ||
{ | ||
_texture_id = texture_id; | ||
} | ||
|
||
private readonly IntPtr _texture_id; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using NumVector2 = System.Numerics.Vector2; | ||
using NumVector3 = System.Numerics.Vector3; | ||
using XnaVector2 = Microsoft.Xna.Framework.Vector2; | ||
using XnaVector3 = Microsoft.Xna.Framework.Vector3; | ||
|
||
namespace MonoGame.ImGui.Extensions | ||
{ | ||
/// <summary> | ||
/// Extends different monogame data containers with numeric-based conversions. | ||
/// </summary> | ||
public static class DataConvertExtensions | ||
{ | ||
public static XnaVector3 ToXnaVector3(this NumVector3 value) | ||
{ | ||
return new XnaVector3(value.X, value.Y, value.Z); | ||
} | ||
|
||
public static XnaVector2 ToXnaVector2(this NumVector2 value) | ||
{ | ||
return new XnaVector2(value.X, value.Y); | ||
} | ||
|
||
public static NumVector3 ToNumericVector3(this XnaVector3 value) | ||
{ | ||
return new NumVector3(value.X, value.Y, value.Z); | ||
} | ||
|
||
public static NumVector2 ToNumericVector2(this XnaVector2 value) | ||
{ | ||
return new NumVector2(value.X, value.Y); | ||
} | ||
} | ||
} |
Oops, something went wrong.