SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
UI.cpp File Reference
#include <UI/UI.hpp>
#include <imgui.h>
#include <misc/cpp/imgui_stdlib.h>
#include "../../include/private/Graphics/Common/ResourceManager.hpp"
#include "../../include/private/Graphics/Common/Renderer.hpp"
#include <Core/Application.hpp>
#include <Runtime/Texture.hpp>
#include <stb_image.h>
#include <cstdarg>
#include <unordered_map>

Go to the source code of this file.

Namespaces

namespace  Sleak
 Root namespace for everything the engine exposes.
namespace  Sleak::UI
 Immediate-mode UI calls available to game code.

Functions

ENGINE_API void Sleak::UI::BeginChild (const char *name)
ENGINE_API void Sleak::UI::BeginChildSized (const char *name, float width, float height=0.0f)
ENGINE_API void Sleak::UI::BeginGroup ()
ENGINE_API bool Sleak::UI::BeginListBox (const char *label, float width, float height)
ENGINE_API void Sleak::UI::BeginPanel (const char *name, float x, float y, float bgAlpha=0.4f, int flags=PanelFlags_NoTitleBar|PanelFlags_AutoResize|PanelFlags_NoMove|PanelFlags_NoInput|PanelFlags_NoFocusOnAppear)
 Opens a floating overlay window at (x, y); pair with EndPanel.
ENGINE_API bool Sleak::UI::Button (const char *label)
ENGINE_API bool Sleak::UI::ButtonSized (const char *label, float width, float height=0.0f)
ENGINE_API bool Sleak::UI::Checkbox (const char *label, bool *value)
ENGINE_API bool Sleak::UI::Combo (const char *label, int *current, const char *const items[], int count)
ENGINE_API Sleak::TextureSleak::UI::CreateTextureFromPixels (uint32_t width, uint32_t height, const void *rgbaPixels, uint32_t maxMipLevels=0)
 Create a texture from raw RGBA pixel data (for runtime atlas building etc.).
ENGINE_API bool Sleak::UI::DragFloat (const char *label, float *value, float speed=1.0f, float min=0.0f, float max=0.0f)
ENGINE_API void Sleak::UI::DrawFilledRect (float x, float y, float w, float h, float r, float g, float b, float a=1.0f, float rounding=0.0f)
ENGINE_API void Sleak::UI::DrawImage (uint64_t textureID, float x, float y, float width, float height)
ENGINE_API void Sleak::UI::DrawLine (float x1, float y1, float x2, float y2, float r, float g, float b, float a=1.0f, float thickness=1.0f)
ENGINE_API void Sleak::UI::DrawRect (float x, float y, float w, float h, float r, float g, float b, float a=1.0f, float thickness=1.0f, float rounding=0.0f)
ENGINE_API void Sleak::UI::DrawText (const char *text, float x, float y, float r, float g, float b, float a=1.0f)
ENGINE_API void Sleak::UI::Dummy (float width, float height)
ENGINE_API void Sleak::UI::EndChild ()
ENGINE_API void Sleak::UI::EndGroup ()
ENGINE_API void Sleak::UI::EndListBox ()
ENGINE_API void Sleak::UI::EndPanel ()
ENGINE_API void Sleak::UI::FreeImagePixels (unsigned char *pixels)
ENGINE_API float Sleak::UI::GetContentRegionAvailWidth ()
ENGINE_API float Sleak::UI::GetCursorPosY ()
ENGINE_API float Sleak::UI::GetViewportHeight ()
ENGINE_API float Sleak::UI::GetViewportWidth ()
ENGINE_API void Sleak::UI::Image (uint64_t textureID, float width, float height)
ENGINE_API bool Sleak::UI::InputText (const char *label, char *buf, size_t bufSize)
ENGINE_API bool Sleak::UI::InputTextString (const char *label, std::string *str)
ENGINE_API unsigned char * Sleak::UI::LoadImagePixels (const char *path, int *w, int *h)
 Load image file into RGBA pixels (caller must free with FreeImagePixels).
ENGINE_API uint64_t Sleak::UI::LoadTextureForUI (const std::string &filePath, float *outWidth=nullptr, float *outHeight=nullptr)
 Loads an image file and caches it as a UI-bindable texture id, reusing the cache on repeat calls for the same path.
ENGINE_API void Sleak::UI::PopStyleColor (int count=1)
ENGINE_API void Sleak::UI::PopStyleVar (int count=1)
ENGINE_API void Sleak::UI::ProgressBar (float fraction, float width=-1.0f, float height=0.0f, const char *overlay=nullptr)
ENGINE_API void Sleak::UI::PushStyleColor (int idx, float r, float g, float b, float a)
ENGINE_API void Sleak::UI::PushStyleVar (int idx, float val)
ENGINE_API void Sleak::UI::PushStyleVarVec (int idx, float x, float y)
ENGINE_API void Sleak::UI::SameLine ()
ENGINE_API bool Sleak::UI::Selectable (const char *label, bool selected)
ENGINE_API void Sleak::UI::Separator ()
ENGINE_API void Sleak::UI::SetCursorPosX (float x)
ENGINE_API void Sleak::UI::SetCursorPosY (float y)
ENGINE_API void Sleak::UI::SetNextItemWidth (float width)
ENGINE_API void Sleak::UI::SetNextWindowPos (float x, float y, bool always=false)
ENGINE_API void Sleak::UI::SetNextWindowSize (float w, float h, bool always=false)
ENGINE_API void Sleak::UI::ShutdownTextureCache ()
ENGINE_API void Sleak::UI::Spacing ()
ENGINE_API void Sleak::UI::Text (const char *fmt,...)
ENGINE_API void Sleak::UI::TextColored (float r, float g, float b, float a, const char *fmt,...)
ENGINE_API void Sleak::UI::TextDisabled (const char *fmt,...)
ENGINE_API void Sleak::UI::TextWrapped (const char *fmt,...)

Variables

static std::unordered_map< std::string, Sleak::Texture * > Sleak::UI::s_uiTextures