You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
|
4 years ago
|
/******************************************************************************
|
||
|
4 years ago
|
* File - asset_browser.h
|
||
|
4 years ago
|
* Author - Joey Pollack
|
||
|
|
* Date - 2021/11/10 (y/m/d)
|
||
|
|
* Mod Date - 2021/11/10 (y/m/d)
|
||
|
|
* Description - Browse and manage project assets
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
#ifndef ASSET_BROWSER_H_
|
||
|
|
#define ASSET_BROWSER_H_
|
||
|
|
|
||
|
4 years ago
|
#include <gui/panel.h>
|
||
|
4 years ago
|
|
||
|
|
#include <filesystem>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
namespace lunarium
|
||
|
4 years ago
|
{
|
||
|
|
namespace editor
|
||
|
4 years ago
|
{
|
||
|
4 years ago
|
class AssetBrowser : public gui::Panel
|
||
|
4 years ago
|
{
|
||
|
|
public:
|
||
|
|
AssetBrowser(std::filesystem::path dir);
|
||
|
|
|
||
|
|
void SetAssetDirectory(std::filesystem::path dir);
|
||
|
|
|
||
|
|
bool DoFrame();
|
||
|
|
|
||
|
4 years ago
|
std::filesystem::path GetSelectedDirectory();
|
||
|
|
|
||
|
4 years ago
|
private:
|
||
|
|
struct Node
|
||
|
|
{
|
||
|
|
std::filesystem::path Myself;
|
||
|
|
std::vector<Node*> Children;
|
||
|
|
std::vector<std::filesystem::path> Files;
|
||
|
|
};
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::filesystem::path mAssetDirectory;
|
||
|
|
std::filesystem::path mSelectedDir;
|
||
|
|
Node* mTreeRoot;
|
||
|
|
Node* mSelectedNode;
|
||
|
|
|
||
|
|
private:
|
||
|
|
Node* ReloadAssets(std::filesystem::path dir);
|
||
|
|
Node* FindNodeAt(std::filesystem::path dir);
|
||
|
|
|
||
|
|
void DoDirTree(std::filesystem::path dir);
|
||
|
|
};
|
||
|
|
}
|
||
|
4 years ago
|
}
|
||
|
4 years ago
|
|
||
|
|
#endif // ASSET_BROWSER_H_
|