Skip to content

Commit

Permalink
feat: enable set platform on enable
Browse files Browse the repository at this point in the history
fix: event after properties
refactor: platform initialize pass configuration
  • Loading branch information
Rofli Sanches committed May 15, 2021
1 parent 55e413a commit 82d7802
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Source/UImGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ namespace UImGui
// TODO: Check Multithread run.
public class UImGui : MonoBehaviour
{
// TODO: Implement.
public event System.Action Layout; // Layout event for *this* ImGui instance.
[SerializeField]
private bool _doGlobalLayout = true; // Do global/default Layout event too.

private Context _context;
private IRenderer _renderer;
private IPlatform _platform;
Expand Down Expand Up @@ -78,6 +73,12 @@ public class UImGui : MonoBehaviour
[SerializeField]
private CursorShapesAsset _cursorShapes = null;

[SerializeField]
private bool _doGlobalLayout = true; // Do global/default Layout event too.

// TODO: Implement.
public event System.Action Layout; // Layout event for *this* ImGui instance.

private void Awake()
{
_context = UImGuiUtility.CreateContext();
Expand Down Expand Up @@ -128,7 +129,7 @@ void Fail(string reason)
_context.TextureManager.BuildFontAtlas(io, _fontAtlasConfiguration);
_context.TextureManager.Initialize(io);

//SetPlatform(Platform.Create(_platformType, _cursorShapes, _iniSettings), io);
SetPlatform(PlatformUtility.Create(_platformType, _cursorShapes, _iniSettings), io);
if (_platform == null)
{
Fail(nameof(_platform));
Expand Down Expand Up @@ -217,7 +218,7 @@ private void SetPlatform(IPlatform platform, ImGuiIOPtr io)
{
_platform?.Shutdown(io);
_platform = platform;
_platform?.Initialize(io);
_platform?.Initialize(io, _initialConfiguration);
}
}
}

0 comments on commit 82d7802

Please sign in to comment.