feat: first interface WIP

This commit is contained in:
goat 2019-12-11 03:11:53 +09:00
parent 0749a98058
commit 6535daade7
6 changed files with 124 additions and 1 deletions

View file

@ -16,6 +16,7 @@ using Dalamud.Game.Command;
using Dalamud.Game.Internal;
using Dalamud.Game.Internal.Gui;
using Dalamud.Game.Network;
using Dalamud.Interface;
using Dalamud.Plugin;
using Serilog;
using XIVLauncher.Dalamud;
@ -49,6 +50,8 @@ namespace Dalamud {
internal readonly WinSockHandlers WinSock2;
public readonly InterfaceManager InterfaceManager;
public Dalamud(DalamudStartInfo info) {
this.StartInfo = info;
this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath);
@ -81,6 +84,9 @@ namespace Dalamud {
this.WinSock2 = new WinSockHandlers();
this.InterfaceManager = new InterfaceManager();
this.InterfaceManager.Start();
try {
this.PluginManager.LoadPlugins();
} catch (Exception ex) {

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Target">
<PlatformTarget>AnyCPU</PlatformTarget>
<TargetFramework>net471</TargetFramework>
<TargetFramework>net472</TargetFramework>
<LangVersion>8.0</LangVersion>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
@ -68,4 +68,9 @@
<ItemGroup>
<Folder Include="Configuration\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\lib\ImGuiScene\deps\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" />
<ProjectReference Include="..\lib\ImGuiScene\deps\SDL2-CS\SDL2-CS.csproj" />
<ProjectReference Include="..\lib\ImGuiScene\ImGuiScene\ImGuiScene.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ImGuiNET;
using ImGuiScene;
using SDL2;
namespace Dalamud.Interface
{
public class InterfaceManager : IDisposable
{
private Task _task;
public void Dispose()
{
_task?.Wait();
_task = null;
}
public void Start()
{
if (_task == null || _task.IsCompleted || _task.IsFaulted || _task.IsCanceled)
{
_task = new Task(Display);
_task.Start();
}
}
private void Display()
{
using (var scene = new SimpleImGuiScene("Debug", fullscreen: true))
{
scene.Window.MakeTransparent(SimpleSDLWindow.CreateColorKey(0, 0, 0));
scene.Window.OnSDLEvent += (ref SDL.SDL_Event sdlEvent) =>
{
if (sdlEvent.type == SDL.SDL_EventType.SDL_KEYDOWN && sdlEvent.key.keysym.scancode == SDL.SDL_Scancode.SDL_SCANCODE_ESCAPE)
{
scene.ShouldQuit = true;
}
return true;
};
scene.OnBuildUI += () =>
{
ImGui.ShowDemoWindow();
};
scene.Run();
}
}
}
}