aboutsummaryrefslogtreecommitdiff
path: root/vendor/rlImGui-main/examples/asset_browser/item_views.cpp
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2024-09-06 22:29:38 -0500
committerNic Gaffney <gaffney_nic@protonmail.com>2024-09-06 22:29:38 -0500
commit52a2f5b69eaf3430623ef2ebeeca0c50a3b8217c (patch)
tree0fc74f5b192d74452ad74f22ad512b8b663d2139 /vendor/rlImGui-main/examples/asset_browser/item_views.cpp
parentad6d55aeaa7c87a4008e56a5a3922d2608c73239 (diff)
downloadparticle-sim-52a2f5b69eaf3430623ef2ebeeca0c50a3b8217c.tar.gz
Quickfix: rlimgui bindings added to vendor/
Diffstat (limited to 'vendor/rlImGui-main/examples/asset_browser/item_views.cpp')
-rw-r--r--vendor/rlImGui-main/examples/asset_browser/item_views.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/rlImGui-main/examples/asset_browser/item_views.cpp b/vendor/rlImGui-main/examples/asset_browser/item_views.cpp
new file mode 100644
index 0000000..0c66a57
--- /dev/null
+++ b/vendor/rlImGui-main/examples/asset_browser/item_views.cpp
@@ -0,0 +1,53 @@
+/*******************************************************************************************
+*
+* 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
+*
+********************************************************************************************/
+
+#include "item_view.h"
+
+#include "imgui.h"
+#include "imgui_utils.h"
+#include "rlImGuiColors.h"
+#include "raylib.h"
+
+extern ImFont* IconFont;
+
+ViewableItem* ListItemView::Show(ViewableItemContainer& container)
+{
+ ViewableItem* item = container.Reset();
+
+ ViewableItem* selected = nullptr;
+ while (item)
+ {
+ float x = ImGui::GetCursorPosX();
+
+ const char* name = TextFormat("###%s", item->Name.c_str());
+ if (item->Tint.a > 0)
+ ImGui::TextColored(rlImGuiColors::Convert(item->Tint), " %s", item->Icon.c_str());
+ else
+ ImGui::Text(" %s", item->Icon.c_str());
+
+ ImGui::SameLine(0, 0);
+ ImGui::Text(" %s", item->Name.c_str());
+ ImGui::SameLine(0, 0);
+
+ ImGui::SetCursorPosX(x);
+ //ImGui::SetItemAllowOverlap();
+
+ ImGui::Selectable(name);
+ if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
+ {
+ selected = item;
+ }
+
+ item = container.Next();
+ }
+
+ return selected;
+} \ No newline at end of file