Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
Loading...
Searching...
No Matches
AssetBrowserRegistry.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <string>
3
#include <vector>
4
#include <functional>
5
#include <filesystem>
6
#include "
core/EngineAPI.hpp
"
7
8
namespace
Engine
{
9
14
class
ENGINE_API
AssetBrowserRegistry
{
15
public
:
16
using
ContextMenuCallback
= std::function<void(
const
std::filesystem::path&)>;
17
18
struct
Option
{
19
std::string
labelPath
;
// e.g. "Create/Custom Component"
20
ContextMenuCallback
callback
;
21
};
22
28
static
void
registerOption
(
const
std::string& labelPath,
ContextMenuCallback
callback) {
29
getOptions
().push_back({ labelPath, callback });
30
}
31
35
static
std::vector<Option>&
getOptions
() {
36
static
std::vector<Option> s_options;
37
return
s_options;
38
}
39
};
40
41
}
EngineAPI.hpp
ENGINE_API
#define ENGINE_API
Definition
EngineAPI.hpp:10
Engine::AssetBrowserRegistry
Registry for adding custom options and submenu items to the Asset Browser's right-click context menu.
Definition
AssetBrowserRegistry.hpp:14
Engine::AssetBrowserRegistry::registerOption
static void registerOption(const std::string &labelPath, ContextMenuCallback callback)
Registers a custom context menu item.
Definition
AssetBrowserRegistry.hpp:28
Engine::AssetBrowserRegistry::ContextMenuCallback
std::function< void(const std::filesystem::path &)> ContextMenuCallback
Definition
AssetBrowserRegistry.hpp:16
Engine::AssetBrowserRegistry::getOptions
static std::vector< Option > & getOptions()
Retrieves all registered custom menu options.
Definition
AssetBrowserRegistry.hpp:35
Engine
Definition
Application.hpp:16
Engine::AssetBrowserRegistry::Option
Definition
AssetBrowserRegistry.hpp:18
Engine::AssetBrowserRegistry::Option::labelPath
std::string labelPath
Definition
AssetBrowserRegistry.hpp:19
Engine::AssetBrowserRegistry::Option::callback
ContextMenuCallback callback
Definition
AssetBrowserRegistry.hpp:20
engine
include
editor
AssetBrowserRegistry.hpp
Generated by
1.17.0