fix formatting

main
cosmonaut 2022-03-03 17:42:00 -08:00
parent b2abdb4a55
commit 4e4746dd4c
4 changed files with 67 additions and 53 deletions

14
.editorconfig Normal file
View File

@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.cs]
csharp_space_after_cast = true
charset = utf-8-bom
max_line_length = 100

View File

@ -1,4 +1,4 @@
using MoonWorks.Graphics;
using MoonWorks.Graphics;
using MoonWorks;
using ImGuiNET;
using System.Runtime.InteropServices;
@ -9,15 +9,15 @@ using System.Collections.Generic;
namespace MoonWorksImGuiExample
{
class MoonWorksImGuiExampleGame : Game
{
class MoonWorksImGuiExampleGame : Game
{
private string ContentPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Content");
private ImFontPtr DefaultFontPtr;
private int TextureID;
private System.IntPtr? FontTexturePtr;
private Dictionary<System.IntPtr, Texture> LoadedTextures = new Dictionary<System.IntPtr, Texture>();
private Dictionary<Texture, System.IntPtr> TextureHandles = new Dictionary<Texture, System.IntPtr>();
private Dictionary<Texture, System.IntPtr> TextureHandles = new Dictionary<Texture, System.IntPtr>();
private uint VertexCount = 0;
private uint IndexCount = 0;
@ -28,12 +28,12 @@ namespace MoonWorksImGuiExample
private ShaderModule ImGuiFragmentShader;
private Sampler ImGuiSampler;
public MoonWorksImGuiExampleGame(
WindowCreateInfo windowCreateInfo,
PresentMode presentMode,
bool debugMode
) : base(windowCreateInfo, presentMode, 60, debugMode)
{
public MoonWorksImGuiExampleGame(
WindowCreateInfo windowCreateInfo,
PresentMode presentMode,
bool debugMode
) : base(windowCreateInfo, presentMode, 60, debugMode)
{
var context = ImGui.CreateContext();
ImGui.SetCurrentContext(context);
@ -78,12 +78,12 @@ namespace MoonWorksImGuiExample
MultisampleState = MultisampleState.None
}
);
}
}
protected override void Update(System.TimeSpan dt)
{
// Insert your game update logic here.
}
protected override void Update(System.TimeSpan dt)
{
// Insert your game update logic here.
}
private System.IntPtr BindTexture(Texture texture)
{
@ -196,23 +196,23 @@ namespace MoonWorksImGuiExample
GraphicsDevice.Submit(commandBuffer);
}
protected override void Draw(System.TimeSpan dt, double alpha)
{
// Replace this with your own drawing code.
protected override void Draw(System.TimeSpan dt, double alpha)
{
// Replace this with your own drawing code.
var io = ImGui.GetIO();
io.KeyShift = Inputs.Keyboard.IsDown(Keycode.LeftShift) || Inputs.Keyboard.IsDown(Keycode.RightShift);
io.KeyCtrl = Inputs.Keyboard.IsDown(Keycode.LeftControl) || Inputs.Keyboard.IsDown(Keycode.RightControl);
io.KeyAlt = Inputs.Keyboard.IsDown(Keycode.LeftAlt) || Inputs.Keyboard.IsDown(Keycode.RightAlt);
io.KeySuper = Inputs.Keyboard.IsDown(Keycode.LeftMeta) || Inputs.Keyboard.IsDown(Keycode.RightMeta);
io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keycode.Backspace;
io.KeyCtrl = Inputs.Keyboard.IsDown(Keycode.LeftControl) || Inputs.Keyboard.IsDown(Keycode.RightControl);
io.KeyAlt = Inputs.Keyboard.IsDown(Keycode.LeftAlt) || Inputs.Keyboard.IsDown(Keycode.RightAlt);
io.KeySuper = Inputs.Keyboard.IsDown(Keycode.LeftMeta) || Inputs.Keyboard.IsDown(Keycode.RightMeta);
io.KeyMap[(int) ImGuiKey.Backspace] = (int) Keycode.Backspace;
io.MousePos = new System.Numerics.Vector2(Inputs.Mouse.X, Inputs.Mouse.Y);
io.MouseDown[0] = Inputs.Mouse.LeftButton.IsDown;
io.MouseDown[1] = Inputs.Mouse.RightButton.IsDown;
io.MouseDown[2] = Inputs.Mouse.MiddleButton.IsDown;
io.MouseWheel = Inputs.Mouse.Wheel > 0 ? 1 : Inputs.Mouse.Wheel < 0 ? -1 : 0;
io.MousePos = new System.Numerics.Vector2(Inputs.Mouse.X, Inputs.Mouse.Y);
io.MouseDown[0] = Inputs.Mouse.LeftButton.IsDown;
io.MouseDown[1] = Inputs.Mouse.RightButton.IsDown;
io.MouseDown[2] = Inputs.Mouse.MiddleButton.IsDown;
io.MouseWheel = Inputs.Mouse.Wheel > 0 ? 1 : Inputs.Mouse.Wheel < 0 ? -1 : 0;
ImGui.NewFrame();
@ -300,11 +300,11 @@ namespace MoonWorksImGuiExample
}
GraphicsDevice.Submit(commandBuffer);
}
}
protected override void OnDestroy()
{
}
}
}
}

View File

@ -1,34 +1,34 @@
using System;
using System;
using System.IO;
using System.Runtime.InteropServices;
using MoonWorks;
namespace MoonWorksImGuiExample
{
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetDllDirectory(string lpPathName);
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetDllDirectory(string lpPathName);
static void Main(string[] args)
{
WindowCreateInfo windowCreateInfo = new WindowCreateInfo
{
WindowWidth = 1280,
WindowHeight = 720,
WindowTitle = "MoonWorksImGuiExample",
ScreenMode = ScreenMode.Windowed
};
static void Main(string[] args)
{
WindowCreateInfo windowCreateInfo = new WindowCreateInfo
{
WindowWidth = 1280,
WindowHeight = 720,
WindowTitle = "MoonWorksImGuiExample",
ScreenMode = ScreenMode.Windowed
};
MoonWorksImGuiExampleGame game = new MoonWorksImGuiExampleGame(
windowCreateInfo,
MoonWorks.Graphics.PresentMode.FIFORelaxed,
true
);
MoonWorksImGuiExampleGame game = new MoonWorksImGuiExampleGame(
windowCreateInfo,
MoonWorks.Graphics.PresentMode.FIFORelaxed,
true
);
game.Run();
}
}
game.Run();
}
}
}

View File

@ -1,4 +1,4 @@
using MoonWorks.Graphics;
using MoonWorks.Graphics;
using MoonWorks.Math;
namespace MoonWorksImGuiExample