-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from technologists-team/update-render
Update render
- Loading branch information
Showing
48 changed files
with
1,225 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
using Hypercube.Client.Graphics.Windows; | ||
using Hypercube.Graphics.Windowing; | ||
using Hypercube.Shared.EventBus.Events; | ||
|
||
namespace Hypercube.Client.Graphics.Events; | ||
|
||
public readonly struct MainWindowClosedEvent(WindowRegistration registration) : IEventArgs | ||
public readonly struct MainWindowClosedEvent(WindowHandle handle) : IEventArgs | ||
{ | ||
public readonly WindowRegistration Registration = registration; | ||
public readonly WindowHandle Handle = handle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
using Hypercube.Client.Graphics.Windows; | ||
using Hypercube.Graphics.Windowing; | ||
using Hypercube.Shared.EventBus.Events; | ||
|
||
namespace Hypercube.Client.Graphics.Events; | ||
|
||
public readonly struct WindowClosedEvent(WindowRegistration registration) : IEventArgs | ||
public readonly struct WindowClosedEvent(WindowHandle handle) : IEventArgs | ||
{ | ||
public readonly WindowRegistration Registration = registration; | ||
public readonly WindowHandle Handle = handle; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
using Hypercube.Client.Graphics.Windows; | ||
using Hypercube.Graphics.Windowing; | ||
using Hypercube.Shared.EventBus.Events; | ||
|
||
namespace Hypercube.Client.Graphics.Events; | ||
|
||
public readonly record struct WindowFocusChangedEvent(WindowRegistration Registration, bool Focused) : IEventArgs; | ||
public readonly record struct WindowFocusChangedEvent(WindowHandle Handle, bool Focused) : IEventArgs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using Hypercube.Shared.EventBus.Events; | ||
|
||
namespace Hypercube.Client.Graphics.ImGui.Events; | ||
|
||
public readonly record struct ImGuiRenderEvent(IImGui Instance) : IEventArgs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Hypercube.Client.Graphics.ImGui; | ||
|
||
public interface IImGui | ||
{ | ||
void Begin(string name); | ||
void Text(string label); | ||
bool Button(string label); | ||
void End(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using Hypercube.Client.Graphics.Events; | ||
using Hypercube.Client.Graphics.ImGui.Events; | ||
using Hypercube.Client.Graphics.Rendering; | ||
using Hypercube.ImGui; | ||
using Hypercube.Shared.Dependency; | ||
using Hypercube.Shared.EventBus; | ||
using Hypercube.Shared.Logging; | ||
using Hypercube.Shared.Runtimes.Loop.Event; | ||
using JetBrains.Annotations; | ||
|
||
namespace Hypercube.Client.Graphics.ImGui; | ||
|
||
[PublicAPI] | ||
public sealed class ImGui : IImGui, IEventSubscriber, IPostInject | ||
{ | ||
[Dependency] private readonly IEventBus _eventBus = default!; | ||
[Dependency] private readonly IRenderer _renderer = default!; | ||
|
||
private readonly Logger _logger = LoggingManager.GetLogger("im_gui"); | ||
|
||
private IImGuiController _controller = default!; | ||
|
||
public void PostInject() | ||
{ | ||
_eventBus.Subscribe<GraphicsLibraryInitializedEvent>(this, OnGraphicsInitialized); | ||
_eventBus.Subscribe<UpdateFrameEvent>(this, OnUpdateFrame); | ||
_eventBus.Subscribe<RenderDrawingEvent>(this, OnRenderDrawing); | ||
} | ||
|
||
private void OnGraphicsInitialized(ref GraphicsLibraryInitializedEvent args) | ||
{ | ||
_controller = ImGuiFactory.Create(_renderer.MainWindow); | ||
_controller.OnErrorHandled += message => _logger.Error(message); | ||
|
||
_controller.Initialize(); | ||
} | ||
|
||
private void OnUpdateFrame(ref UpdateFrameEvent args) | ||
{ | ||
_controller.Update(args.DeltaSeconds); | ||
} | ||
|
||
private void OnRenderDrawing(ref RenderDrawingEvent args) | ||
{ | ||
var ev = new ImGuiRenderEvent(this); | ||
_eventBus.Raise(ev); | ||
|
||
_controller.Render(); | ||
} | ||
|
||
public void Begin(string name) | ||
{ | ||
_controller.Begin(name); | ||
} | ||
|
||
public void Text(string label) | ||
{ | ||
_controller.Text(label); | ||
} | ||
|
||
public bool Button(string label) | ||
{ | ||
return _controller.Button(label); | ||
} | ||
|
||
public void End() | ||
{ | ||
_controller.End(); | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
Hypercube.Client/Graphics/Realisation/OpenGL/ArrayObject.cs
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
Hypercube.Client/Graphics/Realisation/OpenGL/BufferObject.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.