removed useless stuff
This commit is contained in:
parent
02352caac7
commit
d79572fe6f
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
{
|
||||
"Author": "your name here",
|
||||
"Name": "Sample Plugin",
|
||||
"Punchline": "A short one-liner that shows up in /xlplugins.",
|
||||
"Description": "A description that shows up in /xlplugins. List any major slash-command(s).",
|
||||
"InternalName": "samplePlugin",
|
||||
"ApplicableVersion": "any",
|
||||
"Tags": [
|
||||
"sample",
|
||||
"plugin",
|
||||
"goats"
|
||||
]
|
||||
}
|
BIN
Data/gamesym.ttf
BIN
Data/gamesym.ttf
Binary file not shown.
BIN
Data/goat.png
BIN
Data/goat.png
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.2.0.0</Version>
|
||||
<Version>0.2.2.0</Version>
|
||||
<Description>Currency Alert</Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Lharz/xiv-currency-alert</PackageProjectUrl>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"Author": "Lharz Zobby@Ragnarok",
|
||||
"Author": "Lharz",
|
||||
"Name": "Currency Alert",
|
||||
"Punchline": "Configure alerts thresholds for various currencies.",
|
||||
"Description": "/currencyalert: show the configuration panel.",
|
||||
|
@ -1,10 +0,0 @@
|
||||
using ImGuiScene;
|
||||
using System;
|
||||
|
||||
namespace UIDev
|
||||
{
|
||||
interface IPluginUIMock : IDisposable
|
||||
{
|
||||
void Initialize(SimpleImGuiScene scene);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using static SDL2.SDL;
|
||||
|
||||
namespace UIDev
|
||||
{
|
||||
class UIBootstrap
|
||||
{
|
||||
public static unsafe void Inititalize(IPluginUIMock pluginUI)
|
||||
{
|
||||
// you can edit this if you want more control over things
|
||||
// mainly if you want a regular window instead of transparent overlay
|
||||
// Typically you don't want to change any colors here if you keep the fullscreen overlay
|
||||
using var scene = new SimpleImGuiScene(RendererFactory.RendererBackend.DirectX11, new WindowCreateInfo
|
||||
{
|
||||
Title = "UI Test",
|
||||
Fullscreen = true,
|
||||
TransparentColor = new float[] { 0, 0, 0 },
|
||||
});
|
||||
|
||||
// the background color of your window - typically don't change this for fullscreen overlays
|
||||
scene.Renderer.ClearColor = new Vector4(0, 0, 0, 0);
|
||||
|
||||
// this just makes the application quit if you hit escape
|
||||
scene.Window.OnSDLEvent += (ref SDL_Event sdlEvent) =>
|
||||
{
|
||||
if (sdlEvent.type == SDL_EventType.SDL_KEYDOWN && sdlEvent.key.keysym.scancode == SDL_Scancode.SDL_SCANCODE_ESCAPE)
|
||||
{
|
||||
scene.ShouldQuit = true;
|
||||
}
|
||||
};
|
||||
|
||||
// all of this is taken straight from dalamud
|
||||
|
||||
ImFontConfigPtr fontConfig = ImGuiNative.ImFontConfig_ImFontConfig();
|
||||
fontConfig.MergeMode = true;
|
||||
fontConfig.PixelSnapH = true;
|
||||
|
||||
var fontPathJp = "NotoSansCJKjp-Medium.otf";
|
||||
ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathJp, 17.0f, null, ImGui.GetIO().Fonts.GetGlyphRangesJapanese());
|
||||
|
||||
var fontPathGame = "gamesym.ttf";
|
||||
var rangeHandle = GCHandle.Alloc(new ushort[] { 0xE020, 0xE0DB, 0 }, GCHandleType.Pinned);
|
||||
ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathGame, 17.0f, fontConfig, rangeHandle.AddrOfPinnedObject());
|
||||
|
||||
ImGui.GetIO().Fonts.Build();
|
||||
|
||||
fontConfig.Destroy();
|
||||
rangeHandle.Free();
|
||||
|
||||
|
||||
ImGui.GetStyle().GrabRounding = 3f;
|
||||
ImGui.GetStyle().FrameRounding = 4f;
|
||||
ImGui.GetStyle().WindowRounding = 4f;
|
||||
ImGui.GetStyle().WindowBorderSize = 0f;
|
||||
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Right;
|
||||
ImGui.GetStyle().ScrollbarSize = 16f;
|
||||
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.WindowBg] = new Vector4(0.06f, 0.06f, 0.06f, 0.87f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.FrameBg] = new Vector4(0.29f, 0.29f, 0.29f, 0.54f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.FrameBgHovered] = new Vector4(0.54f, 0.54f, 0.54f, 0.40f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.FrameBgActive] = new Vector4(0.64f, 0.64f, 0.64f, 0.67f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.TitleBgActive] = new Vector4(0.29f, 0.29f, 0.29f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.CheckMark] = new Vector4(0.86f, 0.86f, 0.86f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.SliderGrab] = new Vector4(0.54f, 0.54f, 0.54f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.SliderGrabActive] = new Vector4(0.67f, 0.67f, 0.67f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.Button] = new Vector4(0.71f, 0.71f, 0.71f, 0.40f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.ButtonHovered] = new Vector4(0.47f, 0.47f, 0.47f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.ButtonActive] = new Vector4(0.74f, 0.74f, 0.74f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.Header] = new Vector4(0.59f, 0.59f, 0.59f, 0.31f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.HeaderHovered] = new Vector4(0.50f, 0.50f, 0.50f, 0.80f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.HeaderActive] = new Vector4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.ResizeGrip] = new Vector4(0.79f, 0.79f, 0.79f, 0.25f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.ResizeGripHovered] = new Vector4(0.78f, 0.78f, 0.78f, 0.67f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.ResizeGripActive] = new Vector4(0.88f, 0.88f, 0.88f, 0.95f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.Tab] = new Vector4(0.23f, 0.23f, 0.23f, 0.86f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.TabHovered] = new Vector4(0.71f, 0.71f, 0.71f, 0.80f);
|
||||
ImGui.GetStyle().Colors[(int)ImGuiCol.TabActive] = new Vector4(0.36f, 0.36f, 0.36f, 1.00f);
|
||||
// end dalamud copy
|
||||
|
||||
pluginUI.Initialize(scene);
|
||||
|
||||
scene.Run();
|
||||
|
||||
pluginUI.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<Platforms>x64</Platforms>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ImGui.NET">
|
||||
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ImGuiScene">
|
||||
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SDL2-CS">
|
||||
<HintPath>$(DalamudLibPath)SDL2-CS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\Data\gamesym.ttf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</Content>
|
||||
<Content Include="..\Data\NotoSansCJKjp-Medium.otf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</Content>
|
||||
<Content Include="..\Data\goat.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
121
UIDev/UITest.cs
121
UIDev/UITest.cs
@ -1,121 +0,0 @@
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
using System.Numerics;
|
||||
|
||||
namespace UIDev
|
||||
{
|
||||
class UITest : IPluginUIMock
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
UIBootstrap.Inititalize(new UITest());
|
||||
}
|
||||
|
||||
private TextureWrap? goatImage;
|
||||
private SimpleImGuiScene? scene;
|
||||
|
||||
public void Initialize(SimpleImGuiScene scene)
|
||||
{
|
||||
// scene is a little different from what you have access to in dalamud
|
||||
// but it can accomplish the same things, and is really only used for initial setup here
|
||||
|
||||
// eg, to load an image resource for use with ImGui
|
||||
this.goatImage = scene.LoadImage("goat.png");
|
||||
|
||||
scene.OnBuildUI += Draw;
|
||||
|
||||
this.Visible = true;
|
||||
|
||||
// saving this only so we can kill the test application by closing the window
|
||||
// (instead of just by hitting escape)
|
||||
this.scene = scene;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.goatImage?.Dispose();
|
||||
}
|
||||
|
||||
// You COULD go all out here and make your UI generic and work on interfaces etc, and then
|
||||
// mock dependencies and conceivably use exactly the same class in this testbed and the actual plugin
|
||||
// That is, however, a bit excessive in general - it could easily be done for this sample, but I
|
||||
// don't want to imply that is easy or the best way to go usually, so it's not done here either
|
||||
private void Draw()
|
||||
{
|
||||
DrawMainWindow();
|
||||
DrawSettingsWindow();
|
||||
|
||||
if (!Visible)
|
||||
{
|
||||
this.scene!.ShouldQuit = true;
|
||||
}
|
||||
}
|
||||
|
||||
#region Nearly a copy/paste of PluginUI
|
||||
private bool visible = false;
|
||||
public bool Visible
|
||||
{
|
||||
get { return this.visible; }
|
||||
set { this.visible = value; }
|
||||
}
|
||||
|
||||
private bool settingsVisible = false;
|
||||
public bool SettingsVisible
|
||||
{
|
||||
get { return this.settingsVisible; }
|
||||
set { this.settingsVisible = value; }
|
||||
}
|
||||
|
||||
// this is where you'd have to start mocking objects if you really want to match
|
||||
// but for simple UI creation purposes, just hardcoding values works
|
||||
private bool fakeConfigBool = true;
|
||||
|
||||
public void DrawMainWindow()
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(375, 330), ImGuiCond.FirstUseEver);
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(375, 330), new Vector2(float.MaxValue, float.MaxValue));
|
||||
if (ImGui.Begin("My Amazing Window", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
ImGui.Text($"The random config bool is {this.fakeConfigBool}");
|
||||
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
SettingsVisible = true;
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.Text("Have a goat:");
|
||||
ImGui.Indent(55);
|
||||
ImGui.Image(this.goatImage!.ImGuiHandle, new Vector2(this.goatImage.Width, this.goatImage.Height));
|
||||
ImGui.Unindent(55);
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
public void DrawSettingsWindow()
|
||||
{
|
||||
if (!SettingsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(232, 75), ImGuiCond.Always);
|
||||
if (ImGui.Begin("A Wonderful Configuration Window", ref this.settingsVisible,
|
||||
ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse))
|
||||
{
|
||||
if (ImGui.Checkbox("Random Config Bool", ref this.fakeConfigBool))
|
||||
{
|
||||
// nothing to do in a fake ui!
|
||||
}
|
||||
}
|
||||
ImGui.End();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user