Internal data manager working
parent
fda2264251
commit
bd07e17b12
@ -0,0 +1,45 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - dataManager.cpp
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2021/12/01 (y/m/d)
|
||||||
|
* Mod Date - 2021/12/01 (y/m/d)
|
||||||
|
* Description - Manage the raw internal asset data, like icons images
|
||||||
|
* UI sounds etc..
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "dataManager.h"
|
||||||
|
|
||||||
|
#include <core/core.h>
|
||||||
|
#include <graphics/igraphics.h>
|
||||||
|
#include <assets/types/image.h>
|
||||||
|
|
||||||
|
// ASSETS
|
||||||
|
#include "data_headers/folder16.h"
|
||||||
|
|
||||||
|
namespace lunarium
|
||||||
|
{
|
||||||
|
// Init asset pointers
|
||||||
|
Image* DataManager::mFolderIcon = nullptr;
|
||||||
|
|
||||||
|
void DataManager::Initialize()
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////
|
||||||
|
// Folder16
|
||||||
|
ImageFormat format = ImageFormat::RGB;
|
||||||
|
if (lunarium_data_folder16::folder16DataNumChannels == 4)
|
||||||
|
{
|
||||||
|
format = ImageFormat::RGBA;
|
||||||
|
}
|
||||||
|
unsigned char* pData = new unsigned char[lunarium_data_folder16::folder16DataSize];
|
||||||
|
memcpy(pData, lunarium_data_folder16::folder16Data, lunarium_data_folder16::folder16DataSize);
|
||||||
|
mFolderIcon = new Image(pData, lunarium_data_folder16::folder16DataWidth, lunarium_data_folder16::folder16DataHeight, format);
|
||||||
|
Core::Graphics().RegisterImage(*mFolderIcon);
|
||||||
|
mFolderIcon->FreeRawData();
|
||||||
|
//////////////////////////////////////////
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataManager::Shutdown()
|
||||||
|
{
|
||||||
|
delete mFolderIcon;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - dataManager.h
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2021/12/01 (y/m/d)
|
||||||
|
* Mod Date - 2021/12/01 (y/m/d)
|
||||||
|
* Description - Manage the raw internal asset data, like icons images
|
||||||
|
* UI sounds etc..
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DATA_MANAGER_H_
|
||||||
|
#define DATA_MANAGER_H_
|
||||||
|
|
||||||
|
|
||||||
|
namespace lunarium
|
||||||
|
{
|
||||||
|
class Image;
|
||||||
|
class DataManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
static void Initialize();
|
||||||
|
static void Shutdown();
|
||||||
|
|
||||||
|
|
||||||
|
// DATA wrapped in asset types
|
||||||
|
static Image* mFolderIcon;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DATA_MANAGER_H_
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* folder16.h
|
||||||
|
* This file was automatically genereated from the source file: folder16.png
|
||||||
|
* Generated by data2c version 0.1.1
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
namespace lunarium_data_folder16
|
||||||
|
{
|
||||||
|
const unsigned int folder16DataSize = 1024;
|
||||||
|
const unsigned int folder16DataWidth = 16;
|
||||||
|
const unsigned int folder16DataHeight = 16;
|
||||||
|
const unsigned int folder16DataNumChannels = 4;
|
||||||
|
const unsigned char folder16Data[] = { 0, 22, 0, 72, 1, 71, 1, 115, 1, 75, 0, 115, 1, 79, 0, 115, 2, 80, 1, 113, 0, 10, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 8, 109, 0, 155, 36, 165, 0, 252, 40, 170, 0, 252, 43, 174, 1, 252, 44,
|
||||||
|
176, 0, 252, 19, 141, 0, 171, 0, 0, 0, 10, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 11, 121, 0, 157, 44, 176, 0, 255, 48, 180, 0, 255, 51, 183, 0, 255, 53, 186, 0, 255, 48, 181, 0, 237, 8, 115, 0, 125, 3, 87, 1, 99, 1,
|
||||||
|
84, 0, 99, 2, 83, 1, 99, 1, 78, 1, 99, 0, 72, 0, 99, 0, 66, 0, 99, 0, 60, 0, 99, 1, 54, 1, 99, 0, 9, 0, 59, 15, 132, 1, 157, 52, 184, 1, 255, 56, 188, 1, 255, 59, 191, 0, 255, 63, 195, 1, 255, 63, 195, 0, 255, 61, 193, 1, 252, 60, 193, 1, 251, 58, 191, 0, 251, 56, 189, 1, 251, 52, 185, 0, 251, 49, 182, 0, 251, 45,
|
||||||
|
177, 1, 251, 40, 171, 1, 251, 34, 163, 0, 250, 6, 102, 0, 150, 19, 142, 1, 157, 58, 191, 0, 255, 64, 196, 1, 255, 67, 198, 0, 255, 71, 201, 1, 255, 64, 196, 1, 255, 22, 141, 1, 255, 17, 129, 0, 255, 17, 129, 1, 255, 16, 125, 1, 255, 15, 122, 0, 255, 14, 119, 1, 255, 12, 113, 0, 255, 9, 105, 0, 255, 8, 98, 0, 254, 0, 41, 0, 153, 22,
|
||||||
|
149, 0, 157, 65, 196, 0, 255, 69, 200, 0, 255, 75, 204, 0, 255, 76, 205, 0, 255, 26, 148, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 1, 1, 1, 255, 1, 1, 1, 255, 1, 1, 1, 254, 0, 0, 0, 153, 17, 137, 1, 157, 56, 188, 0, 255, 61, 193, 1, 255, 63, 195, 0, 255, 52,
|
||||||
|
185, 0, 255, 2, 61, 1, 255, 112, 225, 1, 255, 144, 237, 1, 255, 140, 236, 0, 255, 134, 234, 0, 255, 123, 230, 0, 255, 112, 226, 1, 255, 99, 219, 1, 255, 84, 211, 1, 255, 68, 199, 0, 254, 19, 143, 0, 153, 1, 49, 1, 157, 10, 108, 0, 255, 13, 117, 0, 255, 16, 126, 1, 255, 19, 132, 1, 255, 80, 208, 1, 255, 177, 246, 0, 255, 184, 248, 1, 255, 180,
|
||||||
|
247, 0, 255, 176, 246, 1, 255, 169, 245, 1, 255, 159, 242, 1, 255, 147, 239, 1, 255, 133, 234, 1, 255, 117, 227, 0, 254, 51, 190, 0, 153, 78, 211, 1, 157, 142, 237, 0, 255, 154, 240, 0, 255, 163, 243, 0, 255, 170, 245, 1, 255, 169, 244, 0, 255, 171, 245, 0, 255, 174, 246, 0, 255, 171, 245, 0, 255, 166, 244, 1, 255, 159, 242, 1, 255, 148, 239, 0, 255, 137,
|
||||||
|
235, 0, 255, 124, 230, 0, 255, 108, 223, 0, 254, 44, 183, 0, 153, 72, 207, 0, 157, 136, 234, 0, 255, 147, 238, 0, 255, 156, 241, 0, 255, 162, 243, 0, 255, 157, 241, 0, 255, 158, 242, 0, 255, 160, 242, 0, 255, 158, 242, 1, 255, 152, 240, 0, 255, 145, 237, 0, 255, 136, 235, 1, 255, 124, 230, 0, 255, 111, 225, 1, 255, 97, 218, 0, 254, 37, 174, 1, 153, 56,
|
||||||
|
194, 0, 157, 118, 228, 1, 255, 128, 232, 1, 255, 137, 235, 0, 255, 142, 237, 0, 255, 138, 235, 0, 255, 142, 237, 0, 255, 144, 238, 0, 255, 141, 236, 0, 255, 136, 235, 0, 255, 129, 232, 0, 255, 120, 228, 0, 255, 110, 224, 1, 255, 97, 218, 0, 255, 85, 211, 1, 254, 30, 163, 1, 153, 42, 179, 1, 157, 97, 218, 0, 255, 108, 223, 1, 255, 115, 226, 0, 255, 120,
|
||||||
|
228, 0, 255, 117, 227, 0, 255, 124, 230, 0, 255, 126, 231, 1, 255, 123, 230, 0, 255, 118, 228, 0, 255, 111, 225, 0, 255, 104, 221, 1, 255, 93, 215, 0, 255, 83, 210, 1, 255, 71, 201, 0, 254, 22, 149, 1, 153, 29, 161, 0, 157, 78, 206, 0, 255, 86, 212, 0, 255, 94, 216, 1, 255, 98, 218, 0, 255, 96, 217, 0, 255, 105, 222, 0, 255, 106, 223, 1, 255, 104,
|
||||||
|
221, 1, 255, 100, 220, 1, 255, 94, 216, 1, 255, 86, 211, 0, 255, 78, 206, 1, 255, 68, 199, 1, 255, 58, 190, 0, 254, 16, 134, 1, 153, 18, 141, 0, 157, 60, 192, 1, 255, 66, 198, 0, 255, 72, 202, 0, 255, 76, 205, 1, 255, 76, 205, 0, 255, 86, 212, 1, 255, 87, 212, 1, 255, 84, 211, 1, 255, 81, 209, 1, 255, 75, 204, 0, 255, 69, 199, 0, 255, 61,
|
||||||
|
193, 0, 255, 55, 187, 1, 255, 46, 178, 1, 254, 10, 117, 0, 153, 11, 119, 0, 157, 44, 175, 1, 255, 48, 181, 0, 255, 53, 186, 0, 255, 56, 189, 0, 255, 58, 190, 1, 255, 67, 198, 0, 255, 68, 199, 1, 255, 66, 198, 1, 255, 63, 195, 1, 255, 58, 191, 0, 255, 54, 186, 1, 255, 47, 180, 0, 255, 41, 172, 0, 255, 35, 163, 0, 254, 6, 101, 0, 153, 0,
|
||||||
|
59, 0, 110, 13, 123, 1, 179, 15, 130, 1, 179, 17, 135, 0, 179, 19, 140, 1, 179, 20, 143, 0, 179, 27, 155, 1, 179, 26, 155, 1, 179, 25, 153, 0, 179, 24, 150, 1, 179, 21, 145, 0, 179, 19, 139, 0, 179, 16, 132, 1, 179, 13, 123, 1, 179, 10, 113, 1, 178, 1, 49, 1, 109
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* folder32.h
|
||||||
|
* This file was automatically genereated from the source file: folder32.png
|
||||||
|
* Generated by data2c version 0.1.0
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
namespace lunarium_data_folder32
|
||||||
|
{
|
||||||
|
const unsigned int folder32DataSize = 4096;
|
||||||
|
const unsigned int folder32DataWidth = 32;
|
||||||
|
const unsigned int folder32DataHeight = 32;
|
||||||
|
const unsigned int folder32DataNumChannels = 4;
|
||||||
|
const unsigned char folder32Data[] = { 106, 135, 58, 31, 106, 135, 58, 103, 106, 135, 58, 103, 108, 137, 59, 99, 110, 139, 61, 95, 110, 139, 61, 91, 110, 139, 61, 87, 111, 140, 61, 82, 112, 141, 62, 78, 112, 141, 62, 73, 113, 142, 62, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 106, 135, 58, 70, 107, 136, 59, 243, 108, 137, 60, 252, 109, 138, 60, 251, 109, 138, 60, 250, 111, 140, 61, 250, 111, 140, 62, 249, 112, 141, 62, 248, 113,
|
||||||
|
142, 63, 248, 114, 143, 63, 246, 114, 144, 64, 201, 115, 144, 64, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||||
|
0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 108, 137, 59, 71, 108, 137, 59, 246, 110, 139, 61, 255, 110, 139, 61, 255, 111, 140, 62, 255, 112, 141, 62, 255, 113, 142, 63, 255, 114, 143, 64, 255, 115, 144, 64, 255, 115, 145, 65, 255, 115, 145, 65, 250, 117, 146, 66, 110, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1,
|
||||||
|
1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 109, 138, 60, 71, 109, 138, 60, 246, 110, 139, 61, 255, 111, 141, 62, 255, 112,
|
||||||
|
141, 62, 255, 113, 142, 63, 255, 114, 144, 64, 255, 115, 144, 64, 255, 116, 145, 65, 255, 116, 146, 65, 255, 117, 146, 66, 255, 118, 147, 66, 207, 118, 147, 66, 28, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 139, 61, 71, 110, 139, 61, 246, 112, 141, 62, 255, 113, 142, 63, 255, 113, 143, 63, 255, 115, 144, 64, 255, 115, 144, 64, 255, 117, 146, 66, 255, 117, 146, 66, 255, 118, 147, 66, 255, 119, 148, 67, 255, 119, 148, 67, 250, 120,
|
||||||
|
149, 68, 158, 119, 148, 67, 115, 120, 149, 68, 115, 120, 149, 68, 115, 120, 149, 68, 115, 119, 149, 67, 115, 120, 149, 68, 115, 119, 148, 67, 115, 120, 149, 68, 115, 119, 148, 67, 115, 119, 148, 67, 115, 118, 147, 67, 115, 118, 147, 66, 115, 117, 146, 65, 115, 116, 145, 65, 115, 116, 145, 65, 115, 115, 144, 64, 115, 114, 143, 64, 115, 113, 142, 63, 110, 112, 141, 62, 30, 111,
|
||||||
|
140, 61, 71, 111, 140, 62, 246, 113, 142, 63, 255, 114, 143, 64, 255, 115, 144, 64, 255, 116, 145, 65, 255, 117, 146, 65, 255, 118, 147, 66, 255, 118, 147, 67, 255, 120, 149, 68, 255, 120, 149, 67, 255, 120, 150, 68, 255, 120, 149, 68, 253, 121, 150, 69, 252, 121, 150, 69, 252, 121, 150, 69, 252, 120, 149, 68, 252, 121, 150, 69, 252, 121, 150, 69, 252, 120, 149, 68, 252, 120,
|
||||||
|
150, 68, 252, 120, 149, 68, 252, 119, 148, 67, 252, 119, 148, 67, 252, 118, 147, 66, 252, 118, 147, 67, 252, 117, 146, 66, 252, 116, 145, 65, 252, 115, 145, 65, 252, 115, 144, 64, 252, 113, 142, 63, 242, 113, 142, 62, 67, 112, 142, 62, 71, 113, 142, 63, 246, 114, 143, 63, 255, 115, 144, 64, 255, 116, 145, 65, 255, 117, 146, 66, 255, 118, 147, 66, 255, 119, 148, 67, 255, 120,
|
||||||
|
149, 68, 255, 120, 149, 68, 255, 121, 150, 69, 255, 122, 151, 69, 255, 122, 151, 70, 255, 122, 151, 69, 255, 122, 151, 70, 255, 122, 152, 70, 255, 122, 151, 69, 255, 122, 151, 69, 255, 122, 151, 69, 255, 121, 150, 69, 255, 122, 152, 70, 255, 122, 151, 69, 255, 121, 150, 69, 255, 120, 150, 68, 255, 119, 148, 67, 255, 119, 149, 68, 255, 118, 147, 67, 255, 117, 147, 66, 255, 116,
|
||||||
|
145, 65, 255, 116, 145, 65, 255, 115, 144, 65, 245, 114, 143, 64, 68, 114, 143, 64, 71, 114, 143, 64, 246, 116, 145, 65, 255, 117, 146, 66, 255, 117, 147, 66, 255, 118, 148, 67, 255, 119, 149, 67, 255, 121, 150, 69, 255, 122, 151, 69, 255, 122, 151, 69, 255, 120, 149, 67, 255, 116, 146, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 117, 146, 66, 255, 117,
|
||||||
|
146, 65, 255, 116, 145, 65, 255, 116, 146, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 115, 144, 65, 255, 113, 143, 63, 255, 114, 143, 63, 255, 112, 141, 62, 255, 112, 141, 62, 255, 111, 140, 62, 255, 110, 139, 61, 245, 109, 138, 60, 68, 114, 143, 63, 71, 115, 144, 64, 246, 116, 145, 65, 255, 117, 147, 66, 255, 118,
|
||||||
|
148, 67, 255, 120, 149, 68, 255, 121, 150, 68, 255, 121, 150, 69, 255, 122, 151, 69, 255, 120, 150, 68, 255, 84, 111, 43, 255, 57, 79, 28, 255, 55, 76, 26, 255, 54, 75, 26, 255, 54, 75, 26, 255, 55, 77, 27, 255, 55, 77, 26, 255, 56, 77, 27, 255, 55, 76, 26, 255, 55, 77, 26, 255, 56, 78, 27, 255, 55, 77, 26, 255, 56, 77, 27, 255, 55, 77, 26, 255, 56,
|
||||||
|
77, 27, 255, 55, 76, 26, 255, 55, 77, 27, 255, 56, 77, 27, 255, 55, 77, 26, 255, 55, 76, 26, 255, 56, 77, 27, 245, 56, 77, 27, 68, 116, 145, 65, 71, 116, 145, 65, 246, 117, 146, 66, 255, 118, 147, 66, 255, 120, 149, 68, 255, 120, 149, 68, 255, 121, 151, 69, 255, 122, 152, 70, 255, 123, 152, 70, 255, 106, 135, 58, 255, 49, 68, 23, 255, 40, 57, 19, 255, 40,
|
||||||
|
57, 19, 255, 40, 57, 18, 255, 40, 57, 18, 255, 40, 57, 18, 255, 40, 57, 19, 255, 40, 57, 18, 255, 40, 57, 19, 255, 40, 57, 18, 255, 40, 57, 18, 255, 39, 56, 18, 255, 40, 57, 19, 255, 40, 57, 18, 255, 40, 57, 18, 255, 40, 57, 19, 255, 39, 56, 18, 255, 40, 56, 18, 255, 40, 57, 18, 255, 40, 57, 18, 255, 40, 57, 18, 245, 40, 57, 18, 68, 116,
|
||||||
|
145, 65, 71, 117, 146, 66, 246, 118, 147, 67, 255, 119, 149, 67, 255, 120, 150, 68, 255, 122, 151, 69, 255, 122, 151, 69, 255, 123, 153, 70, 255, 118, 147, 66, 255, 68, 93, 34, 255, 40, 57, 18, 255, 41, 57, 19, 255, 57, 79, 27, 255, 74, 99, 37, 255, 75, 100, 38, 255, 73, 98, 36, 255, 73, 99, 37, 255, 72, 97, 36, 255, 72, 97, 36, 255, 73, 97, 36, 255, 71,
|
||||||
|
96, 35, 255, 70, 95, 35, 255, 70, 95, 35, 255, 69, 93, 34, 255, 67, 91, 33, 255, 66, 90, 33, 255, 65, 89, 32, 255, 64, 88, 32, 255, 63, 86, 31, 255, 63, 86, 31, 255, 61, 84, 30, 245, 61, 84, 30, 68, 117, 146, 66, 71, 117, 146, 66, 246, 119, 148, 67, 255, 120, 149, 68, 255, 121, 150, 68, 255, 122, 151, 69, 255, 123, 153, 70, 255, 123, 152, 70, 255, 95,
|
||||||
|
123, 50, 255, 44, 62, 20, 255, 40, 57, 18, 255, 54, 75, 26, 255, 133, 162, 78, 255, 155, 183, 97, 255, 155, 183, 98, 255, 156, 183, 98, 255, 156, 184, 98, 255, 156, 184, 99, 255, 156, 183, 98, 255, 156, 184, 98, 255, 155, 182, 97, 255, 154, 182, 96, 255, 152, 180, 95, 255, 151, 179, 94, 255, 150, 178, 93, 255, 148, 177, 91, 255, 147, 175, 90, 255, 145, 173, 88, 255, 142,
|
||||||
|
171, 86, 255, 141, 169, 85, 255, 138, 166, 82, 245, 136, 164, 81, 68, 102, 130, 55, 71, 103, 132, 56, 246, 104, 133, 56, 255, 105, 134, 57, 255, 106, 135, 58, 255, 107, 136, 59, 255, 108, 136, 59, 255, 102, 131, 55, 255, 57, 79, 27, 255, 40, 57, 18, 255, 42, 60, 20, 255, 107, 136, 59, 255, 156, 184, 99, 255, 160, 187, 102, 255, 160, 187, 103, 255, 162, 189, 104, 255, 162,
|
||||||
|
189, 104, 255, 162, 189, 104, 255, 161, 188, 103, 255, 161, 188, 103, 255, 160, 187, 102, 255, 160, 187, 102, 255, 159, 187, 102, 255, 157, 184, 99, 255, 156, 184, 99, 255, 155, 183, 97, 255, 153, 181, 95, 255, 151, 179, 94, 255, 148, 176, 91, 255, 148, 176, 91, 255, 145, 173, 88, 245, 144, 172, 88, 68, 54, 75, 26, 71, 57, 79, 28, 246, 57, 79, 27, 255, 58, 80, 28, 255, 60,
|
||||||
|
82, 29, 255, 61, 83, 30, 255, 60, 83, 29, 255, 61, 84, 30, 255, 58, 80, 28, 255, 59, 81, 29, 255, 80, 106, 41, 255, 148, 176, 91, 255, 158, 186, 101, 255, 158, 186, 101, 255, 160, 187, 102, 255, 160, 187, 102, 255, 160, 187, 102, 255, 160, 187, 102, 255, 160, 187, 102, 255, 160, 187, 102, 255, 159, 186, 101, 255, 158, 186, 101, 255, 158, 185, 100, 255, 156, 184, 99, 255, 155,
|
||||||
|
183, 98, 255, 154, 182, 97, 255, 152, 180, 95, 255, 150, 178, 93, 255, 148, 176, 91, 255, 146, 174, 89, 255, 143, 172, 87, 245, 142, 171, 86, 68, 127, 156, 74, 71, 129, 158, 75, 246, 131, 160, 77, 255, 133, 162, 79, 255, 136, 165, 81, 255, 138, 167, 83, 255, 141, 169, 85, 255, 142, 171, 86, 255, 144, 173, 88, 255, 146, 174, 89, 255, 151, 179, 94, 255, 156, 184, 99, 255, 156,
|
||||||
|
184, 99, 255, 157, 184, 99, 255, 158, 186, 101, 255, 158, 185, 100, 255, 159, 186, 101, 255, 158, 186, 100, 255, 158, 185, 100, 255, 158, 185, 100, 255, 158, 185, 100, 255, 157, 184, 99, 255, 156, 184, 98, 255, 155, 182, 97, 255, 153, 181, 95, 255, 152, 180, 95, 255, 150, 178, 93, 255, 149, 177, 92, 255, 147, 175, 90, 255, 145, 173, 88, 255, 143, 171, 87, 245, 141, 170, 85, 68, 137,
|
||||||
|
165, 82, 71, 138, 167, 83, 246, 140, 168, 84, 255, 143, 171, 87, 255, 144, 173, 88, 255, 147, 175, 90, 255, 149, 177, 93, 255, 150, 178, 93, 255, 153, 181, 96, 255, 154, 182, 97, 255, 156, 184, 99, 255, 155, 182, 97, 255, 154, 182, 97, 255, 155, 183, 98, 255, 156, 183, 98, 255, 156, 183, 98, 255, 156, 184, 99, 255, 156, 183, 98, 255, 157, 184, 99, 255, 156, 183, 98, 255, 156,
|
||||||
|
183, 98, 255, 155, 183, 98, 255, 154, 182, 97, 255, 152, 180, 95, 255, 152, 180, 95, 255, 150, 178, 93, 255, 149, 177, 92, 255, 147, 175, 90, 255, 145, 173, 88, 255, 143, 171, 87, 255, 141, 169, 85, 245, 140, 168, 84, 68, 135, 164, 80, 71, 136, 164, 81, 246, 138, 166, 82, 255, 140, 169, 84, 255, 143, 171, 87, 255, 145, 174, 89, 255, 146, 175, 90, 255, 148, 176, 91, 255, 150,
|
||||||
|
178, 93, 255, 152, 180, 95, 255, 153, 181, 96, 255, 153, 181, 96, 255, 153, 180, 95, 255, 153, 181, 96, 255, 154, 182, 97, 255, 154, 182, 97, 255, 155, 182, 97, 255, 155, 182, 97, 255, 154, 182, 97, 255, 154, 182, 97, 255, 154, 181, 96, 255, 153, 180, 95, 255, 152, 180, 95, 255, 151, 179, 94, 255, 149, 177, 92, 255, 148, 176, 91, 255, 147, 175, 90, 255, 145, 174, 89, 255, 143,
|
||||||
|
172, 87, 255, 141, 170, 85, 255, 140, 168, 84, 245, 138, 167, 83, 68, 133, 162, 78, 71, 134, 162, 79, 246, 136, 165, 81, 255, 138, 167, 83, 255, 140, 169, 85, 255, 143, 171, 87, 255, 144, 172, 88, 255, 147, 175, 90, 255, 148, 176, 91, 255, 149, 177, 92, 255, 150, 178, 93, 255, 150, 178, 93, 255, 150, 178, 93, 255, 151, 179, 94, 255, 152, 180, 94, 255, 152, 180, 95, 255, 152,
|
||||||
|
180, 95, 255, 152, 180, 95, 255, 152, 180, 95, 255, 151, 179, 94, 255, 152, 179, 94, 255, 150, 178, 93, 255, 149, 177, 92, 255, 149, 177, 92, 255, 147, 176, 91, 255, 146, 174, 89, 255, 145, 173, 88, 255, 142, 171, 86, 255, 141, 170, 85, 255, 139, 168, 84, 255, 137, 166, 82, 245, 136, 165, 81, 68, 131, 160, 77, 71, 132, 160, 77, 246, 134, 162, 79, 255, 136, 165, 81, 255, 138,
|
||||||
|
167, 83, 255, 140, 168, 84, 255, 142, 171, 86, 255, 143, 171, 87, 255, 145, 174, 89, 255, 146, 175, 90, 255, 148, 176, 91, 255, 148, 176, 91, 255, 148, 176, 91, 255, 149, 177, 92, 255, 149, 177, 92, 255, 149, 178, 92, 255, 150, 178, 93, 255, 150, 178, 93, 255, 150, 178, 93, 255, 149, 177, 92, 255, 149, 177, 92, 255, 149, 177, 92, 255, 147, 176, 91, 255, 146, 174, 89, 255, 146,
|
||||||
|
174, 89, 255, 144, 173, 88, 255, 143, 171, 86, 255, 141, 170, 85, 255, 139, 168, 84, 255, 137, 166, 82, 255, 136, 165, 81, 245, 134, 163, 80, 68, 128, 157, 75, 71, 129, 158, 75, 246, 131, 160, 77, 255, 133, 162, 79, 255, 135, 164, 80, 255, 137, 166, 82, 255, 139, 168, 84, 255, 141, 170, 85, 255, 142, 171, 86, 255, 144, 172, 88, 255, 145, 173, 89, 255, 145, 173, 88, 255, 145,
|
||||||
|
174, 89, 255, 147, 175, 90, 255, 146, 175, 90, 255, 147, 175, 90, 255, 148, 176, 91, 255, 147, 176, 91, 255, 147, 175, 90, 255, 147, 175, 90, 255, 146, 174, 89, 255, 146, 174, 89, 255, 145, 174, 89, 255, 144, 172, 87, 255, 143, 171, 87, 255, 141, 170, 85, 255, 140, 169, 85, 255, 138, 167, 83, 255, 137, 166, 82, 255, 135, 164, 80, 255, 134, 163, 79, 245, 133, 162, 78, 68, 127,
|
||||||
|
156, 74, 71, 127, 156, 74, 246, 129, 158, 75, 255, 131, 160, 77, 255, 133, 162, 78, 255, 135, 163, 80, 255, 136, 165, 81, 255, 138, 167, 83, 255, 140, 168, 84, 255, 140, 169, 85, 255, 143, 172, 87, 255, 142, 171, 86, 255, 143, 172, 87, 255, 143, 172, 87, 255, 144, 173, 88, 255, 145, 173, 89, 255, 144, 173, 88, 255, 145, 174, 89, 255, 145, 173, 88, 255, 145, 173, 88, 255, 144,
|
||||||
|
172, 88, 255, 143, 172, 87, 255, 142, 170, 86, 255, 141, 170, 85, 255, 140, 169, 85, 255, 140, 168, 84, 255, 138, 166, 82, 255, 136, 165, 81, 255, 135, 163, 80, 255, 134, 163, 79, 255, 132, 161, 78, 245, 131, 160, 77, 68, 124, 153, 71, 71, 125, 154, 72, 246, 127, 156, 74, 255, 129, 158, 75, 255, 131, 160, 77, 255, 132, 161, 78, 255, 134, 163, 79, 255, 135, 164, 80, 255, 136,
|
||||||
|
165, 81, 255, 138, 167, 83, 255, 139, 168, 84, 255, 139, 167, 83, 255, 140, 169, 84, 255, 141, 170, 85, 255, 142, 170, 86, 255, 142, 170, 86, 255, 142, 170, 86, 255, 141, 170, 85, 255, 142, 170, 86, 255, 142, 170, 86, 255, 141, 170, 85, 255, 140, 169, 84, 255, 140, 168, 84, 255, 140, 168, 84, 255, 138, 167, 83, 255, 136, 165, 81, 255, 135, 164, 80, 255, 134, 163, 79, 255, 133,
|
||||||
|
162, 79, 255, 131, 160, 76, 255, 130, 159, 76, 245, 129, 158, 75, 68, 121, 150, 70, 71, 122, 151, 70, 246, 124, 153, 71, 255, 126, 155, 73, 255, 127, 156, 74, 255, 129, 158, 75, 255, 130, 159, 76, 255, 132, 161, 78, 255, 134, 162, 79, 255, 135, 164, 80, 255, 136, 165, 81, 255, 136, 165, 81, 255, 138, 167, 83, 255, 139, 167, 83, 255, 139, 168, 83, 255, 139, 167, 83, 255, 140,
|
||||||
|
168, 84, 255, 139, 168, 84, 255, 139, 168, 83, 255, 139, 167, 83, 255, 139, 167, 83, 255, 138, 166, 82, 255, 138, 166, 82, 255, 137, 166, 82, 255, 135, 164, 80, 255, 134, 163, 80, 255, 132, 161, 78, 255, 131, 160, 77, 255, 130, 159, 76, 255, 128, 157, 75, 255, 127, 156, 74, 245, 126, 155, 73, 68, 119, 148, 68, 71, 120, 149, 68, 246, 121, 150, 69, 255, 123, 152, 71, 255, 125,
|
||||||
|
154, 72, 255, 127, 156, 74, 255, 128, 157, 74, 255, 130, 158, 76, 255, 130, 159, 76, 255, 132, 161, 78, 255, 133, 162, 79, 255, 133, 162, 79, 255, 135, 163, 80, 255, 136, 165, 81, 255, 136, 165, 81, 255, 136, 165, 81, 255, 136, 165, 81, 255, 137, 166, 82, 255, 136, 165, 81, 255, 136, 165, 81, 255, 135, 164, 80, 255, 135, 164, 81, 255, 135, 163, 80, 255, 134, 163, 79, 255, 132,
|
||||||
|
161, 78, 255, 131, 160, 77, 255, 130, 159, 76, 255, 129, 158, 75, 255, 128, 157, 74, 255, 126, 155, 73, 255, 125, 154, 72, 245, 124, 153, 71, 68, 116, 145, 66, 71, 117, 146, 66, 246, 120, 149, 68, 255, 120, 149, 68, 255, 122, 151, 70, 255, 124, 153, 71, 255, 125, 154, 72, 255, 126, 155, 73, 255, 127, 156, 74, 255, 129, 158, 75, 255, 130, 159, 76, 255, 131, 159, 77, 255, 132,
|
||||||
|
161, 78, 255, 132, 161, 78, 255, 133, 162, 79, 255, 133, 162, 79, 255, 134, 163, 79, 255, 134, 163, 79, 255, 133, 162, 79, 255, 134, 163, 79, 255, 133, 162, 78, 255, 132, 161, 78, 255, 131, 160, 77, 255, 131, 160, 77, 255, 129, 158, 75, 255, 128, 157, 75, 255, 128, 157, 74, 255, 127, 156, 73, 255, 125, 154, 72, 255, 123, 152, 71, 255, 122, 151, 70, 245, 122, 151, 70, 68, 114,
|
||||||
|
143, 64, 71, 115, 144, 65, 246, 116, 145, 66, 255, 118, 147, 67, 255, 119, 149, 68, 255, 121, 150, 69, 255, 123, 152, 71, 255, 123, 152, 71, 255, 124, 153, 72, 255, 126, 155, 73, 255, 127, 156, 74, 255, 128, 157, 75, 255, 129, 158, 75, 255, 131, 160, 77, 255, 130, 159, 76, 255, 130, 159, 76, 255, 131, 160, 77, 255, 131, 160, 77, 255, 131, 160, 77, 255, 130, 159, 76, 255, 130,
|
||||||
|
159, 76, 255, 129, 158, 75, 255, 129, 158, 75, 255, 128, 157, 74, 255, 127, 156, 74, 255, 127, 156, 74, 255, 125, 154, 73, 255, 124, 153, 71, 255, 122, 151, 70, 255, 121, 151, 69, 255, 120, 149, 68, 245, 120, 149, 68, 68, 112, 141, 62, 71, 113, 142, 63, 246, 114, 143, 64, 255, 116, 145, 65, 255, 116, 145, 65, 255, 118, 147, 67, 255, 119, 148, 68, 255, 120, 150, 69, 255, 122,
|
||||||
|
151, 70, 255, 123, 152, 70, 255, 124, 153, 71, 255, 125, 154, 73, 255, 127, 156, 73, 255, 127, 156, 74, 255, 127, 156, 74, 255, 128, 157, 74, 255, 128, 157, 75, 255, 128, 157, 74, 255, 128, 157, 74, 255, 127, 156, 74, 255, 127, 156, 74, 255, 126, 155, 73, 255, 126, 155, 73, 255, 125, 154, 72, 255, 124, 153, 71, 255, 124, 153, 71, 255, 122, 151, 70, 255, 121, 150, 69, 255, 120,
|
||||||
|
149, 69, 255, 119, 148, 67, 255, 118, 147, 67, 245, 117, 146, 67, 68, 109, 138, 60, 71, 111, 139, 62, 246, 111, 140, 62, 255, 113, 142, 63, 255, 114, 143, 64, 255, 115, 144, 65, 255, 116, 145, 66, 255, 118, 147, 67, 255, 119, 148, 68, 255, 119, 148, 68, 255, 121, 150, 69, 255, 122, 151, 70, 255, 124, 153, 71, 255, 124, 153, 71, 255, 125, 154, 72, 255, 125, 154, 72, 255, 125,
|
||||||
|
154, 72, 255, 125, 154, 73, 255, 125, 154, 73, 255, 125, 154, 72, 255, 124, 153, 71, 255, 123, 152, 71, 255, 123, 152, 70, 255, 122, 151, 70, 255, 121, 150, 69, 255, 121, 150, 69, 255, 120, 149, 69, 255, 118, 147, 67, 255, 118, 147, 67, 255, 116, 145, 65, 255, 115, 144, 64, 245, 115, 144, 65, 68, 107, 136, 59, 71, 108, 136, 60, 246, 108, 137, 60, 255, 110, 139, 61, 255, 111,
|
||||||
|
140, 61, 255, 113, 142, 63, 255, 113, 142, 63, 255, 115, 144, 65, 255, 116, 145, 65, 255, 117, 146, 66, 255, 117, 146, 66, 255, 119, 148, 68, 255, 121, 150, 69, 255, 122, 151, 70, 255, 121, 150, 69, 255, 122, 151, 70, 255, 122, 151, 70, 255, 121, 151, 69, 255, 122, 151, 70, 255, 121, 150, 69, 255, 121, 150, 69, 255, 121, 150, 69, 255, 120, 149, 68, 255, 120, 149, 68, 255, 119,
|
||||||
|
148, 67, 255, 118, 148, 67, 255, 117, 146, 66, 255, 116, 145, 65, 255, 115, 144, 65, 255, 114, 143, 64, 255, 112, 141, 63, 245, 113, 142, 63, 68, 104, 133, 57, 71, 105, 133, 57, 246, 106, 135, 59, 255, 108, 136, 60, 255, 108, 137, 60, 255, 110, 139, 62, 255, 111, 139, 62, 255, 112, 141, 62, 255, 113, 142, 63, 255, 113, 142, 63, 255, 115, 144, 65, 255, 117, 146, 66, 255, 118,
|
||||||
|
147, 67, 255, 118, 147, 67, 255, 119, 148, 67, 255, 119, 149, 68, 255, 119, 148, 68, 255, 119, 148, 68, 255, 119, 148, 68, 255, 119, 148, 68, 255, 118, 147, 67, 255, 118, 147, 67, 255, 118, 147, 67, 255, 116, 145, 65, 255, 116, 145, 65, 255, 115, 144, 64, 255, 114, 143, 64, 255, 113, 142, 63, 255, 112, 141, 63, 255, 111, 140, 62, 255, 110, 139, 61, 245, 110, 138, 61, 68, 102,
|
||||||
|
131, 56, 71, 102, 131, 56, 246, 104, 132, 57, 255, 106, 134, 58, 255, 106, 134, 58, 255, 107, 136, 59, 255, 108, 137, 60, 255, 109, 138, 60, 255, 110, 139, 61, 255, 111, 140, 62, 255, 112, 141, 62, 255, 114, 143, 64, 255, 115, 144, 65, 255, 116, 145, 65, 255, 115, 144, 64, 255, 116, 145, 65, 255, 116, 145, 66, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116, 145, 65, 255, 116,
|
||||||
|
145, 65, 255, 115, 144, 65, 255, 114, 143, 64, 255, 113, 142, 63, 255, 113, 142, 63, 255, 113, 142, 63, 255, 112, 141, 63, 255, 111, 140, 62, 255, 110, 139, 61, 255, 109, 138, 61, 255, 108, 137, 60, 245, 107, 136, 59, 68, 99, 128, 53, 53, 100, 128, 54, 187, 102, 130, 56, 194, 102, 131, 56, 194, 104, 133, 57, 194, 104, 133, 57, 194, 106, 134, 58, 194, 106, 135, 59, 194, 108,
|
||||||
|
137, 60, 194, 109, 138, 60, 194, 109, 138, 61, 194, 111, 140, 62, 194, 113, 142, 63, 194, 113, 142, 63, 194, 113, 142, 64, 194, 114, 143, 64, 194, 113, 142, 63, 194, 113, 142, 63, 194, 114, 143, 64, 194, 113, 142, 63, 194, 113, 142, 63, 194, 112, 141, 63, 194, 112, 141, 63, 194, 111, 140, 62, 194, 111, 140, 62, 194, 110, 139, 61, 194, 110, 139, 61, 194, 109, 138, 61, 194, 108,
|
||||||
|
137, 60, 194, 107, 136, 59, 194, 106, 135, 58, 187, 106, 134, 58, 52
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - assetBrowser.cpp
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2021/11/10 (y/m/d)
|
||||||
|
* Mod Date - 2021/11/10 (y/m/d)
|
||||||
|
* Description - Browse and manage project assets
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "assetBrowser.h"
|
||||||
|
#include <dearimgui/imgui.h>
|
||||||
|
|
||||||
|
namespace lunarium
|
||||||
|
{
|
||||||
|
AssetBrowser::AssetBrowser(std::filesystem::path dir)
|
||||||
|
: Panel(PanelType::PT_ASSET_BROWSER, true), mAssetDirectory(dir), mTreeRoot(nullptr), mSelectedNode(nullptr)
|
||||||
|
{
|
||||||
|
mTreeRoot = ReloadAssets(mAssetDirectory);
|
||||||
|
mSelectedNode = mTreeRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetBrowser::SetAssetDirectory(std::filesystem::path dir)
|
||||||
|
{
|
||||||
|
mAssetDirectory = dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AssetBrowser::DoFrame()
|
||||||
|
{
|
||||||
|
if (!mIsOpen)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!ImGui::Begin("Asset Browser", &mIsOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar))
|
||||||
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Directory tree
|
||||||
|
// TODO: Figure out a better way to size stuff other
|
||||||
|
// than using this guess-work magic numbers
|
||||||
|
float row_height = ImGui::GetFrameHeightWithSpacing() + 2.0f;
|
||||||
|
ImVec2 wind_size = ImGui::GetWindowSize();
|
||||||
|
wind_size.y -= (row_height + 8.0f);
|
||||||
|
wind_size.x -= 15.0f;
|
||||||
|
ImGui::SetCursorPosY(row_height);
|
||||||
|
if (ImGui::BeginChild("Directory Tree", ImVec2(wind_size.x * 0.15f, wind_size.y), true, ImGuiWindowFlags_NoCollapse))
|
||||||
|
{
|
||||||
|
DoDirTree(mAssetDirectory);
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
ImGui::SetCursorPosY(row_height);
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + wind_size.x * 0.15f);
|
||||||
|
|
||||||
|
// Contents
|
||||||
|
if (ImGui::BeginChild("Contents", ImVec2(wind_size.x * 0.85f, wind_size.y), true, ImGuiWindowFlags_NoCollapse))
|
||||||
|
{
|
||||||
|
if (std::filesystem::exists(mSelectedDir))
|
||||||
|
{
|
||||||
|
float yPos = ImGui::GetCursorPosY();
|
||||||
|
float xPos = ImGui::GetCursorPosX();
|
||||||
|
float left = xPos;
|
||||||
|
|
||||||
|
// NOTE: Magic - file icon window size
|
||||||
|
float icon_width = 125.0f;
|
||||||
|
float icon_height = 80.0f;
|
||||||
|
|
||||||
|
// Display each file in a row
|
||||||
|
for(auto const& dir_entry: std::filesystem::directory_iterator{mSelectedDir})
|
||||||
|
{
|
||||||
|
if (!std::filesystem::is_directory(dir_entry))
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(icon_width, icon_height));
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(xPos, yPos));
|
||||||
|
|
||||||
|
// NOTE: BeginChild here is returning false for some reason
|
||||||
|
// ImGui::BeginChild("file", ImVec2(icon_width, icon_height), false, ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
|
// TODO: Add file icon, make selection system
|
||||||
|
ImGui::TextWrapped(dir_entry.path().filename().string().c_str());
|
||||||
|
|
||||||
|
// ImGui::EndChild();
|
||||||
|
|
||||||
|
// Move to the next space or down a line and back to the left side
|
||||||
|
xPos += icon_width + 10;
|
||||||
|
if (xPos > wind_size.x * 0.85f)
|
||||||
|
{
|
||||||
|
xPos = left;
|
||||||
|
yPos += icon_height + 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetBrowser::DoDirTree(std::filesystem::path dir)
|
||||||
|
{
|
||||||
|
if ("" == dir)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!std::filesystem::is_directory(dir))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ImGui::TreeNode(dir.filename().string().c_str()))
|
||||||
|
{
|
||||||
|
mSelectedDir = dir;
|
||||||
|
for(auto const& dir_entry: std::filesystem::directory_iterator{dir})
|
||||||
|
{
|
||||||
|
DoDirTree(dir_entry);
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetBrowser::Node* AssetBrowser::ReloadAssets(std::filesystem::path dir)
|
||||||
|
{
|
||||||
|
if ("" == dir)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
Node* pNode = new Node;
|
||||||
|
pNode->Myself = dir;
|
||||||
|
for(auto const& dir_entry: std::filesystem::directory_iterator{dir})
|
||||||
|
{
|
||||||
|
if (std::filesystem::is_directory(dir_entry))
|
||||||
|
{
|
||||||
|
pNode->Children.push_back(ReloadAssets(dir_entry));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pNode->Files.push_back(dir_entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void treeChildren(ImGuiTreeNodeFlags node_flags, bool isOpen, int index)
|
||||||
|
// {
|
||||||
|
// if (isOpen)
|
||||||
|
// {
|
||||||
|
// for (int p = 0; p < meshList[index].children.size(); p++)
|
||||||
|
// {
|
||||||
|
// if (meshList[index].children[p].children.empty())
|
||||||
|
// {
|
||||||
|
// node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet
|
||||||
|
// ImGui::TreeNodeEx((void *)(intptr_t)p, node_flags, meshList[index].children[p].name.c_str());
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// bool o = ImGui::TreeNodeEx((void *)(intptr_t)p, node_flags, meshList[index].children[p].name.c_str());
|
||||||
|
// ImGui::TreePop();
|
||||||
|
// treeChildren(node_flags, o, p);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ImGui::TreePop();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - assetBrowser.h
|
||||||
|
* 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_
|
||||||
|
|
||||||
|
#include "iPanel.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace lunarium
|
||||||
|
{
|
||||||
|
class AssetBrowser : public Panel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AssetBrowser(std::filesystem::path dir);
|
||||||
|
|
||||||
|
void SetAssetDirectory(std::filesystem::path dir);
|
||||||
|
|
||||||
|
bool DoFrame();
|
||||||
|
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ASSET_BROWSER_H_
|
||||||
Loading…
Reference in New Issue