File browser now using the internal data manager for all ui images

Gui_Panel_Refactor
Joeyrp 4 years ago
parent bd07e17b12
commit 8ad6eb2880

5
.gitignore vendored

@ -56,4 +56,7 @@ CTestTestfile.cmake
_deps _deps
######################## BUILD IGNORES ######################## BUILD IGNORES
build/ build/
######################## ASSET IGNORES
ui_files/

@ -33,15 +33,17 @@ namespace lunarium
// mpFolderIcon->FreeRawData(); // mpFolderIcon->FreeRawData();
mpFolderIcon = DataManager::mFolderIcon; mpFolderIcon = DataManager::mFolderIcon;
unsigned char* pData = stbi_load("new_dir_icon.png", &x, &y, &n, 0); // unsigned char* pData = stbi_load("new_dir_icon.png", &x, &y, &n, 0);
mpNewFolderIcon = new Image(pData, x, y, ImageFormat::RGBA); // mpNewFolderIcon = new Image(pData, x, y, ImageFormat::RGBA);
Core::Graphics().RegisterImage(*mpNewFolderIcon); // Core::Graphics().RegisterImage(*mpNewFolderIcon);
mpNewFolderIcon->FreeRawData(); // mpNewFolderIcon->FreeRawData();
mpNewFolderIcon = DataManager::mNewFolderIcon;
pData = stbi_load("up_arrow_icon.png", &x, &y, &n, 0);
mpUpFolderIcon = new Image(pData, x, y, ImageFormat::RGBA); // pData = stbi_load("up_arrow_icon.png", &x, &y, &n, 0);
Core::Graphics().RegisterImage(*mpUpFolderIcon); // mpUpFolderIcon = new Image(pData, x, y, ImageFormat::RGBA);
mpUpFolderIcon->FreeRawData(); // Core::Graphics().RegisterImage(*mpUpFolderIcon);
// mpUpFolderIcon->FreeRawData();
mpUpFolderIcon = DataManager::mUpArrowIcon;
} }
/// If the given path does not exist this will default to the /// If the given path does not exist this will default to the

@ -15,11 +15,15 @@
// ASSETS // ASSETS
#include "data_headers/folder16.h" #include "data_headers/folder16.h"
#include "data_headers/new_dir_icon.h"
#include "data_headers/up_arrow_icon.h"
namespace lunarium namespace lunarium
{ {
// Init asset pointers // Init asset pointers
Image* DataManager::mFolderIcon = nullptr; Image* DataManager::mFolderIcon = nullptr;
Image* DataManager::mNewFolderIcon = nullptr;
Image* DataManager::mUpArrowIcon = nullptr;
void DataManager::Initialize() void DataManager::Initialize()
{ {
@ -36,10 +40,40 @@ namespace lunarium
Core::Graphics().RegisterImage(*mFolderIcon); Core::Graphics().RegisterImage(*mFolderIcon);
mFolderIcon->FreeRawData(); mFolderIcon->FreeRawData();
////////////////////////////////////////// //////////////////////////////////////////
/////////////////////////////////////////
// new_dir_icon
format = ImageFormat::RGB;
if (lunarium_data_newdir::new_dir_iconDataNumChannels == 4)
{
format = ImageFormat::RGBA;
}
pData = new unsigned char[lunarium_data_newdir::new_dir_iconDataSize];
memcpy(pData, lunarium_data_newdir::new_dir_iconData, lunarium_data_newdir::new_dir_iconDataSize);
mNewFolderIcon = new Image(pData, lunarium_data_newdir::new_dir_iconDataWidth, lunarium_data_newdir::new_dir_iconDataHeight, format);
Core::Graphics().RegisterImage(*mNewFolderIcon);
mNewFolderIcon->FreeRawData();
//////////////////////////////////////////
/////////////////////////////////////////
// up_arrow_icon
format = ImageFormat::RGB;
if (lunarium_data_uparrow::up_arrow_iconDataNumChannels == 4)
{
format = ImageFormat::RGBA;
}
pData = new unsigned char[lunarium_data_uparrow::up_arrow_iconDataSize];
memcpy(pData, lunarium_data_uparrow::up_arrow_iconData, lunarium_data_uparrow::up_arrow_iconDataSize);
mUpArrowIcon = new Image(pData, lunarium_data_uparrow::up_arrow_iconDataWidth, lunarium_data_uparrow::up_arrow_iconDataHeight, format);
Core::Graphics().RegisterImage(*mUpArrowIcon);
mUpArrowIcon->FreeRawData();
//////////////////////////////////////////
} }
void DataManager::Shutdown() void DataManager::Shutdown()
{ {
delete mUpArrowIcon;
delete mNewFolderIcon;
delete mFolderIcon; delete mFolderIcon;
} }
} }

@ -21,9 +21,11 @@ namespace lunarium
static void Initialize(); static void Initialize();
static void Shutdown(); static void Shutdown();
// DATA wrapped in asset types // DATA wrapped in asset types
static Image* mFolderIcon; static Image* mFolderIcon;
static Image* mNewFolderIcon;
static Image* mUpArrowIcon;
}; };
} }

@ -0,0 +1,26 @@
/******************************************************************************
* new_dir_icon.h
* This file was automatically genereated from the source file: build\Debug\new_dir_icon.png
* Generated by data2c version 0.1.1
******************************************************************************/
namespace lunarium_data_newdir
{
const unsigned int new_dir_iconDataSize = 896;
const unsigned int new_dir_iconDataWidth = 16;
const unsigned int new_dir_iconDataHeight = 14;
const unsigned int new_dir_iconDataNumChannels = 4;
const unsigned char new_dir_iconData[] = { 101, 101, 101, 43, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 97, 97, 97, 18, 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, 0, 0, 0, 0, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 35, 89, 89, 89, 34, 89,
89, 89, 34, 89, 89, 89, 34, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 35, 89, 89, 89, 20, 89, 89, 89, 22, 89, 89, 89, 22, 89, 89, 89, 17, 89, 89, 89, 17, 89, 89, 89, 22, 89, 89, 89, 29, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 255, 89, 89, 89, 255, 89,
89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 254, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 77, 89, 89, 89, 87, 89, 89, 89, 96, 89, 89, 89, 65, 89, 89, 89, 79, 89, 89, 89, 120, 89, 89, 89, 67, 89, 89, 89, 46, 89, 89, 89, 62, 89, 89, 89, 67, 89,
89, 89, 100, 89, 89, 89, 91, 89, 89, 89, 91, 89, 89, 89, 254, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 253, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89,
89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 18, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 46, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 9, 89, 89, 89, 255, 89, 89, 89, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 35, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 11, 89, 89, 89, 255, 89,
89, 89, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 39, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 89, 89, 89, 9, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 39, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 89, 89, 89, 13, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 39, 89, 89, 89, 255, 89,
89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 12, 89, 89, 89, 255, 89, 89, 89, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 39, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 16, 89, 89, 89, 255, 89, 89, 89, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 89, 39, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 35, 89, 89, 89, 34, 89, 89, 89, 34, 89, 89, 89, 28, 89, 89, 89, 21, 89, 89, 89, 21, 89,
89, 89, 14, 89, 89, 89, 30, 89, 89, 89, 34, 89, 89, 89, 34, 89, 89, 89, 34, 89, 89, 89, 34, 89, 89, 89, 68, 89, 89, 89, 255, 89, 89, 89, 63, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89,
89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 255, 89, 89, 89, 47
};
}

@ -0,0 +1,27 @@
/******************************************************************************
* up_arrow_icon.h
* This file was automatically genereated from the source file: build\Debug\up_arrow_icon.png
* Generated by data2c version 0.1.1
******************************************************************************/
namespace lunarium_data_uparrow
{
const unsigned int up_arrow_iconDataSize = 1024;
const unsigned int up_arrow_iconDataWidth = 16;
const unsigned int up_arrow_iconDataHeight = 16;
const unsigned int up_arrow_iconDataNumChannels = 4;
const unsigned char up_arrow_iconData[] = { 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, 226, 226, 226, 60, 226, 226, 226, 68, 1, 1, 1, 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, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1,
1, 1, 0, 0, 0, 0, 0, 229, 229, 229, 20, 228, 228, 228, 183, 225, 225, 225, 199, 224, 224, 224, 24, 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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 231, 231, 231, 108, 229, 229, 229, 247, 225,
225, 225, 251, 224, 224, 224, 120, 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, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 233, 233, 233, 36, 231, 231, 231, 215, 229, 229, 229, 255, 226, 226, 226, 255, 223, 223, 223, 223, 220, 220, 220, 48, 1, 1, 1, 0, 1,
1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 235, 235, 235, 8, 234, 234, 234, 143, 232, 232, 232, 251, 228, 228, 228, 255, 226, 226, 226, 255, 222, 222, 222, 255, 220, 220, 220, 163, 218, 218, 218, 8, 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, 235, 235, 235, 68, 234, 234, 234, 231, 231, 231, 231, 255, 228, 228, 228, 255, 225, 225, 225, 255, 222, 222, 222, 255, 218, 218, 218, 243, 216, 216, 216, 88, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 236, 236, 236, 20, 235,
235, 235, 183, 233, 233, 233, 255, 231, 231, 231, 255, 228, 228, 228, 255, 224, 224, 224, 255, 221, 221, 221, 255, 217, 217, 217, 255, 215, 215, 215, 199, 213, 213, 213, 24, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 236, 236, 104, 235, 235, 235, 247, 232, 232, 232, 255, 229, 229, 229, 255, 227, 227, 227, 255, 223,
223, 223, 255, 221, 221, 221, 255, 217, 217, 217, 255, 214, 214, 214, 251, 211, 211, 211, 120, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 236, 236, 236, 36, 235, 235, 235, 211, 234, 234, 234, 255, 231, 231, 231, 255, 228, 228, 228, 255, 226, 226, 226, 255, 222, 222, 222, 255, 219, 219, 219, 255, 216, 216, 216, 255, 212, 212, 212, 255, 210,
210, 210, 219, 207, 207, 207, 48, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 236, 236, 60, 235, 235, 235, 135, 233, 233, 233, 139, 230, 230, 230, 147, 227, 227, 227, 227, 224, 224, 224, 255, 222, 222, 222, 255, 218, 218, 218, 231, 215, 215, 215, 143, 212, 212, 212, 139, 208, 208, 208, 139, 205, 205, 205, 76, 0, 0, 0, 0, 1, 1, 1, 0, 1,
1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 225, 225, 225, 12, 225, 225, 225, 195, 223, 223, 223, 255, 219, 219, 219, 255, 217, 217, 217, 207, 216, 216, 216, 16, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 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, 223, 223, 223, 12, 223, 223, 223, 195, 221, 221, 221, 255, 218, 218, 218, 255, 215, 215, 215, 207, 214, 214, 214, 16, 1, 1, 1, 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, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 221, 221, 221, 12, 221, 221, 221, 195, 219, 219, 219, 255, 216,
216, 216, 255, 214, 214, 214, 207, 213, 213, 213, 16, 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, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 220, 220, 220, 12, 220, 220, 220, 195, 217, 217, 217, 255, 214, 214, 214, 255, 212, 212, 212, 207, 210, 210, 210, 16, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 0, 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, 217, 217, 217, 12, 217, 217, 217, 195, 215, 215, 215, 255, 212, 212, 212, 255, 209, 209, 209, 207, 208, 208, 208, 16, 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, 1, 1, 1, 0, 214, 214, 214, 12, 215, 215, 215, 163, 213, 213, 213, 215, 209, 209, 209, 215, 207, 207, 207, 171, 206, 206, 206, 16, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0
};
}
Loading…
Cancel
Save