From 52a2f5b69eaf3430623ef2ebeeca0c50a3b8217c Mon Sep 17 00:00:00 2001 From: Nic Gaffney Date: Fri, 6 Sep 2024 22:29:38 -0500 Subject: Quickfix: rlimgui bindings added to vendor/ --- .../examples/asset_browser/asset_browser.h | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 vendor/rlImGui-main/examples/asset_browser/asset_browser.h (limited to 'vendor/rlImGui-main/examples/asset_browser/asset_browser.h') diff --git a/vendor/rlImGui-main/examples/asset_browser/asset_browser.h b/vendor/rlImGui-main/examples/asset_browser/asset_browser.h new file mode 100644 index 0000000..206e699 --- /dev/null +++ b/vendor/rlImGui-main/examples/asset_browser/asset_browser.h @@ -0,0 +1,95 @@ +/******************************************************************************************* +* +* raylib-extras [ImGui] example - asset browser +* +* This is a more complex ImGui Integration +* It shows how to build windows on top of 2d and 3d views using a render texture +* +* Copyright (c) 2024 Jeffery Myers +* +********************************************************************************************/ + +#pragma once + +#include "item_view.h" +#include "raylib.h" + +#include +#include +#include + +class AssetBrowserPanel +{ +public: + AssetBrowserPanel(); + + void Show(); + +private: + std::string AssetRoot; + + class AssetItemInfo : public ViewableItem + { + protected: + bool File = false; + + public: + AssetItemInfo(bool file) : File(file) {} + bool IsFile() const { return File; } + }; + + class FileInfo : public AssetItemInfo + { + public: + FileInfo() : AssetItemInfo(true) {} + + std::string FullPath; + }; + + class FolderInfo : public AssetItemInfo + { + public: + FolderInfo() : AssetItemInfo(false) {} + + std::string FullPath; + FolderInfo* Parent = nullptr; + std::list Children; + + bool ForceOpenNextFrame = false; + + void PopulateChildren(); + }; + + FolderInfo FolderRoot; + + class AssetContainer : public ViewableItemContainer + { + public: + ViewableItem* Reset() override; + size_t Count() override; + ViewableItem* Next() override; + + FolderInfo* Folder = nullptr; + std::vector Files; + + std::vector::iterator FileItr; + std::list::iterator FolderItr; + }; + + AssetContainer CurrentFolderContents; + + ListItemView ListView; + + ItemView* CurrentView = nullptr; + + void RebuildFolderTree(); + + void SetCurrentFolder(FolderInfo* folder); + + bool ShowFolderTreeNode(FolderInfo& folder); + void ShowFolderTree(); + void ShowFilePane(); + void ShowHeader(); + + const char* GetFileIcon(const char* filename); +}; \ No newline at end of file -- cgit v1.2.3