/**********************************************************************************************
*
* raylibExtras * Utilities and Shared Components for Raylib
*
* rlImGui * basic ImGui integration
*
* LICENSE: ZLIB
*
* Copyright (c) 2023 Jeffery Myers
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
**********************************************************************************************/
#pragma once
#include "raylib.h"
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
#define NO_FONT_AWESOME
#ifndef NO_FONT_AWESOME
#include "extras/IconsFontAwesome6.h"
#define FONT_AWESOME_ICON_SIZE 11
#endif
#ifdef __cplusplus
extern "C" {
#endif
// High level API. This API is designed in the style of raylib and meant to work with reaylib code.
// It will manage it's own ImGui context and call common ImGui functions (like NewFrame and Render) for you
// for a lower level API that matches the other ImGui platforms, please see imgui_impl_raylib.h
///
/// Sets up ImGui, loads fonts and themes
/// Calls ImGui_ImplRaylib_Init and sets the theme. Will install Font awesome by default
///
/// when true(default) the dark theme is used, when false the light theme is used
void rlImGuiSetup(bool darkTheme);
///
/// Starts a new ImGui Frame
/// Calls ImGui_ImplRaylib_NewFrame, ImGui_ImplRaylib_ProcessEvents, and ImGui::NewFrame together
///
void rlImGuiBegin();
///
/// Ends an ImGui frame and submits all ImGui drawing to raylib for processing.
/// Calls ImGui:Render, an d ImGui_ImplRaylib_RenderDrawData to draw to the current raylib render target
///
void rlImGuiEnd();
///
/// Cleanup ImGui and unload font atlas
/// Calls ImGui_ImplRaylib_Shutdown
///
void rlImGuiShutdown();
// Advanced StartupAPI
///
/// Custom initialization. Not needed if you call rlImGuiSetup. Only needed if you want to add custom setup code.
/// must be followed by rlImGuiEndInitImGui
/// Called by ImGui_ImplRaylib_Init, and does the first part of setup, before fonts are rendered
///
void rlImGuiBeginInitImGui();
///
/// End Custom initialization. Not needed if you call rlImGuiSetup. Only needed if you want to add custom setup code.
/// must be proceeded by rlImGuiBeginInitImGui
/// Called by ImGui_ImplRaylib_Init and does the second part of setup, and renders fonts.
///
void rlImGuiEndInitImGui();
///
/// Forces the font texture atlas to be recomputed and re-cached
///
void rlImGuiReloadFonts();
// Advanced Update API
///
/// Starts a new ImGui Frame with a specified delta time
///
/// delta time, any value < 0 will use raylib GetFrameTime
void rlImGuiBeginDelta(float deltaTime);
// ImGui Image API extensions
// Purely for convenience in working with raylib textures as images.
// If you want to call ImGui image functions directly, simply pass them the pointer to the texture.
///
/// Draw a texture as an image in an ImGui Context
/// Uses the current ImGui Cursor position and the full texture size.
///
/// The raylib texture to draw
void rlImGuiImage(const Texture *image);
///
/// Draw a texture as an image in an ImGui Context at a specific size
/// Uses the current ImGui Cursor position and the specified width and height
/// The image will be scaled up or down to fit as needed
///
/// The raylib texture to draw
/// The width of the drawn image
/// The height of the drawn image
void rlImGuiImageSize(const Texture *image, int width, int height);
///
/// Draw a texture as an image in an ImGui Context at a specific size
/// Uses the current ImGui Cursor position and the specified size
/// The image will be scaled up or down to fit as needed
///
/// The raylib texture to draw
/// The size of drawn image
void rlImGuiImageSizeV(const Texture* image, Vector2 size);
///
/// Draw a portion texture as an image in an ImGui Context at a defined size
/// Uses the current ImGui Cursor position and the specified size
/// The image will be scaled up or down to fit as needed
///
/// The raylib texture to draw
/// The width of the drawn image
/// The height of the drawn image
/// The portion of the texture to draw as an image. Negative values for the width and height will flip the image
void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);
///
/// Draws a render texture as an image an ImGui Context, automatically flipping the Y axis so it will show correctly on screen
///
/// The render texture to draw
void rlImGuiImageRenderTexture(const RenderTexture* image);
///
/// Draws a render texture as an image an ImGui Context, automatically flipping the Y axis so it will show correctly on screen
/// Fits the render texture to the available content area
///
/// The render texture to draw
/// When true the image will be centered in the content area
void rlImGuiImageRenderTextureFit(const RenderTexture* image, bool center);
///
/// Draws a texture as an image button in an ImGui context. Uses the current ImGui cursor position and the full size of the texture
///
/// The display name and ImGui ID for the button
/// The texture to draw
/// True if the button was clicked
bool rlImGuiImageButton(const char* name, const Texture* image);
///
/// Draws a texture as an image button in an ImGui context. Uses the current ImGui cursor position and the specified size.
///
/// The display name and ImGui ID for the button
/// The texture to draw
/// The size of the button/param>
/// True if the button was clicked
bool rlImGuiImageButtonSize(const char* name, const Texture* image, ImVec2 size);
#ifdef __cplusplus
}
#endif