# Juliet\include\Core\ImGui\ImGuiService

## Source Files
- Header: `Juliet\include\Core\ImGui\ImGuiService.h`
- Source: `Juliet\src\Core\ImGui\ImGuiService.cpp`

## AI Description
The `ImGuIService` class in the Juliet project is designed to integrate and manage the functionality of the ImGui library within a game engine. This component provides a high-level interface for rendering user interfaces (UI) directly on the graphics device, allowing developers to create interactive applications with minimal overhead.

### Main Purpose:
- **Integration**: The `ImGuIService` class facilitates the integration of ImGui into the Juliet project, enabling developers to use ImGui's UI components within their game logic.
- **Performance**: By using a dedicated Paged Arena for ImGui, the service ensures efficient memory management and reduces the overhead associated with creating and destroying ImGui elements.
- **Platform Compatibility**: The implementation supports Windows-specific features through the `Win32Window` class, ensuring compatibility across different platforms.

### Design:
1. **Initialization**:
   - Initializes the ImGui context using an Engine Pool for memory allocation.
   - Sets up allocator functions to manage memory allocations and deallocations.
   - Configures ImGui with keyboard controls enabled.

2. **Shutdown**:
   - Cleans up resources by shutting down ImGui, destroying the context, and releasing the arena.

3. **New Frame**:
   - Prepares the environment for a new frame by calling `ImGui_ImplWin32_NewFrame` and `ImGui::NewFrame`.

4. **Render**:
   - Renders the UI elements using `ImGui::Render`.

5. **Initialization Check**:
   - Checks if the service is initialized before performing any operations.

6. **Context Access**:
   - Provides a method to access the current ImGui context for advanced customization or debugging purposes.

7. **Unit Tests**:
   - Contains a function to run internal unit tests, ensuring the service functions as expected.

This component is crucial for creating interactive user interfaces in games, enhancing the user experience by providing a flexible and powerful UI framework.

## Symbols

### Namespace `Juliet::ImGuiService`

#### Functions & Methods
- `JULIET_API void Initialize(NonNullPtr<Window> window)`
- `JULIET_API void Shutdown()`
- `JULIET_API void NewFrame()`
- `JULIET_API void Render()`
- `JULIET_API bool IsInitialized()`
- `JULIET_API ImGuiContext* GetContext()`
- `// Run internal unit tests
        JULIET_API void RunTests()`

