Made an about window in the MonoGame version.

This commit is contained in:
feyris-tan 2025-08-12 19:30:40 +02:00
parent 554d41ca1e
commit 97e71a8e3c
26 changed files with 175 additions and 88 deletions

View File

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public class BaseGame : Game
{

View File

@ -1,6 +1,7 @@
using ImGuiNET;
using Microsoft.Xna.Framework.Graphics;
namespace ImGuiNET.SampleProgram.XNA
namespace skyscraper8.UI.MonoGame.Bridge
{
public static class DrawVertDeclaration
{

View File

@ -1,9 +1,8 @@
using ImGuiNET;
using ImGuiNET.SampleProgram.XNA;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MgExample.Bridges;
namespace skyscraper8.UI.MonoGame.Bridge;
public class FpsCounterWindow : ImGuiRenderable, GameObject
{

View File

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public interface GameObject
{

View File

@ -1,4 +1,4 @@
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public interface ImGuiRenderable : IDisposable
{

View File

@ -1,11 +1,10 @@
using System.Runtime.InteropServices;
using ImGuiNET;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace ImGuiNET.SampleProgram.XNA
namespace skyscraper8.UI.MonoGame.Bridge
{
/// <summary>
/// ImGui renderer for use with XNA-likes (FNA & MonoGame)

View File

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public class IqWindow : TextureDisplayWindow
{

View File

@ -1,4 +1,4 @@
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public static class RandomExtension
{

View File

@ -3,7 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
using ScottPlot;
using SkiaSharp;
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public class ScottPlotWindow : TextureDisplayWindow
{

View File

@ -1,8 +1,8 @@
using System.Numerics;
using ImGuiNET;
using Microsoft.Xna.Framework.Graphics;
using ScottPlot.Plottables;
namespace ImGuiNET.SampleProgram.XNA;
namespace skyscraper8.UI.MonoGame.Bridge;
public class TextureDisplayWindow : ImGuiRenderable
{

View File

@ -1,9 +1,12 @@
namespace ConsoleApp1.Math;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace skyscraper8.UI.MonoGame.Bridge;
//This one is heavily inspired from https://github.com/colgreen/Redzen/blob/main/Redzen/Numerics/Distributions/Double/ZigguratGaussian.cs
//To understand how this algorithm works, please read those Github comments.
using System.Diagnostics;
using System.Runtime.CompilerServices;
public class Ziggurat
{
const int __blockCount = 128;

View File

@ -1,7 +1,6 @@
using System.Diagnostics;
using ConsoleApp1.Math;
namespace ConsoleApp1.IO;
namespace skyscraper8.UI.MonoGame.Bridge;
public class ZigguratStream : Stream
{

View File

@ -0,0 +1,75 @@
using ImGuiNET;
using Microsoft.Xna.Framework;
using skyscraper8.UI.MonoGame.Bridge;
using System;
using System.Reflection;
namespace skyscraper8.UI.MonoGame.Forms
{
internal class AboutWindow : ImGuiRenderable
{
public AboutWindow()
{
open = true;
if (version == null)
{
Type gameType = typeof(Game);
Assembly assembly = gameType.Assembly;
object[] attributes = assembly.GetCustomAttributes(false);
foreach (object attribute in attributes)
{
if (attribute.GetType() == typeof(AssemblyFileVersionAttribute))
{
AssemblyFileVersionAttribute ava = (AssemblyFileVersionAttribute)attribute;
version = Version.Parse((ReadOnlySpan<char>)ava.Version);
}
}
}
typeof(AboutWindow).Module.GetPEKind(out peKind, out machine);
}
private PortableExecutableKinds peKind;
private ImageFileMachine machine;
private bool open;
private static Version version;
public void Dispose()
{
}
public void Update()
{
}
public void Render()
{
ImGui.Begin("About skyscraper8", ref open, ImGuiWindowFlags.AlwaysVerticalScrollbar);
ImGui.Text("skyscraper8, written by Feyris-Tan");
ImGui.Spacing();
ImGui.Text(String.Format("Using MonoGame {0}", version.ToString()));
ImGui.Text(String.Format("Using Dear ImGUI {0}", ImGui.GetVersion()));
ImGui.Text(String.Format("Using StreamReader.dll by crazycat69"));
ImGui.Spacing();
ImGui.Text(String.Format("The currently executing image file is for {0} processors.", machine.ToString()));
ImGui.Text(String.Format("You are running an {0}-bit operating system.", Environment.Is64BitOperatingSystem ? 64 : 32));
ImGui.Text(String.Format("This is a {0}-bit process.", Environment.Is64BitProcess ? 64 : 32));
if (Environment.Is64BitProcess)
{
ImGui.Text(String.Format("Please remember that StreamReader.dll requires a 32-bit context."));
ImGui.Text("Consider using Remote Stream Reader");
}
if (ImGui.Button("OK"))
open = false;
ImGui.End();
}
public bool WasClosed()
{
return !open;
}
}
}

View File

@ -1,6 +1,4 @@
using skyscraper8.UI.ImGui.MonoGame;
namespace moe.yo3explorer.skyscraper8.UI.MonoGame
namespace skyscraper8.UI.MonoGame
{
class Program
{

View File

@ -1,14 +1,9 @@
using Microsoft.Xna.Framework;
using System.ComponentModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Skyscraper.Plugins;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
[PluginPriority(0)]
[DisplayName("Blank")]

View File

@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
using ImGuiNET.SampleProgram.XNA;
using System.ComponentModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.UI.MonoGame.Bridge;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
[PluginPriority(1)]
[DisplayName("Your Waifu")]

View File

@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using skyscraper5.Skyscraper.Plugins;
using Color = System.Drawing.Color;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
[PluginPriority(2)]
[DisplayName("Substrate")]

View File

@ -1,12 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
internal interface IScreenhack : IDisposable
{

View File

@ -1,12 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
internal abstract class Processing
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
public class ScreenhackException : Exception
{

View File

@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using ImGuiNET.SampleProgram.XNA;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.UI.MonoGame.Bridge;
namespace skyscraper8.UI.ImGui.MonoGame.Screenhacks
namespace skyscraper8.UI.MonoGame.Screenhacks
{
internal class ScreenhackManager : GameObject
{

View File

@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ImGuiNET;
using ImGuiNET.SampleProgram.XNA;
using ImGuiNET;
using Microsoft.Xna.Framework;
using skyscraper8.UI.ImGui.MonoGame.Screenhacks;
using skyscraper8.UI.MonoGame.Bridge;
using skyscraper8.UI.MonoGame.Forms;
using skyscraper8.UI.MonoGame.Screenhacks;
namespace moe.yo3explorer.skyscraper8.UI.MonoGame
namespace skyscraper8.UI.MonoGame
{
internal class SkyscraperGame : BaseGame
{
@ -28,8 +24,50 @@ namespace moe.yo3explorer.skyscraper8.UI.MonoGame
base.Draw(gameTime);
}
private void EnqueueUpdateJob(Action a)
{
if (updateJobs == null)
updateJobs = new Queue<Action>();
updateJobs.Enqueue(a);
}
private Queue<Action> updateJobs;
protected override void Update(GameTime gameTime)
{
if (updateJobs != null)
{
while (updateJobs.Count > 0)
{
Action action = updateJobs.Dequeue();
action();
}
}
base.Update(gameTime);
}
private bool MenuTest(int opcode)
{
switch (opcode)
{
case 1:
if (aboutWindow != null)
{
if (!aboutWindow.WasClosed())
return false;
}
return true;
default:
Console.WriteLine("MenuTest Opcode {0} not implemented!");
return false;
}
}
private AboutWindow aboutWindow;
protected override void ImGuiLayout()
{
ImGui.BeginMainMenuBar();
if (ImGui.BeginMenu("Jobs"))
{
@ -48,6 +86,19 @@ namespace moe.yo3explorer.skyscraper8.UI.MonoGame
}
ImGui.EndMenu();
}
if (ImGui.BeginMenu("Help"))
{
if (ImGui.MenuItem("About",MenuTest(1)))
{
EnqueueUpdateJob(() =>
{
aboutWindow = new AboutWindow();
_imGuiRenderables.Add(aboutWindow);
});
}
ImGui.EndMenu();
}
ImGui.EndMainMenuBar();
base.ImGuiLayout();

View File

@ -9,7 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\skyscraper8\skyscraper8.csproj" />
<ProjectReference Include="..\skyscraper8.UI.ImGui.MonoGame.Bridge\skyscraper8.UI.ImGui.MonoGame.Bridge.csproj" />
<ProjectReference Include="..\skyscraper8.UI.ImGui.MonoGame.Bridge\skyscraper8.UI.MonoGame.Bridge.csproj" />
</ItemGroup>
</Project>

View File

@ -57,15 +57,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UIs", "UIs", "{E23457C5-3A3
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper5.UI.WindowsForms", "GUIs\skyscraper5.UI\skyscraper5.UI.WindowsForms.csproj", "{46CACA1C-F9B2-2FE0-2068-716F381325E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.ImGui.SDL2", "GUIs\skyscraper8.UI.ImGui\skyscraper8.UI.ImGui.SDL2.csproj", "{BDBDB7A9-D0A4-9B89-0801-2935B2066551}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.SDL2", "GUIs\skyscraper8.UI.ImGui\skyscraper8.UI.SDL2.csproj", "{BDBDB7A9-D0A4-9B89-0801-2935B2066551}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.EPGCollectorPort", "PrivateDataSpecifiers\skyscraper8.EPGCollectorPort\skyscraper8.EPGCollectorPort.csproj", "{CF21D250-9804-4191-89F5-95821E3AF39D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.AnagramViewer", "GUIs\skyscraper8.AnagramViewer\skyscraper8.AnagramViewer.csproj", "{EBB6B1CF-2597-4962-AA31-2B42B4C28C7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.ImGui.MonoGame", "GUIs\skyscraper8.UI.ImGui.MonoGame\skyscraper8.UI.ImGui.MonoGame.csproj", "{839C3783-020F-77D6-C22C-D50DCC97CDD6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.MonoGame", "GUIs\skyscraper8.UI.ImGui.MonoGame\skyscraper8.UI.MonoGame.csproj", "{839C3783-020F-77D6-C22C-D50DCC97CDD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.ImGui.MonoGame.Bridge", "GUIs\skyscraper8.UI.ImGui.MonoGame.Bridge\skyscraper8.UI.ImGui.MonoGame.Bridge.csproj", "{1A29F6E6-4B6A-DCCD-1DF1-AA8D020E17D2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skyscraper8.UI.MonoGame.Bridge", "GUIs\skyscraper8.UI.ImGui.MonoGame.Bridge\skyscraper8.UI.MonoGame.Bridge.csproj", "{1A29F6E6-4B6A-DCCD-1DF1-AA8D020E17D2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution