Removed hardcoded stuff & re-enabled addons loading

This commit is contained in:
KiritoDv 2021-05-10 13:05:22 +00:00
parent 0a571a0318
commit d00be377eb
4 changed files with 12 additions and 21 deletions

View File

@ -236,10 +236,10 @@ using namespace std::chrono;
void Moon_InitModEngine( char *exePath, char *gamedir ){
milliseconds start_ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
// Moon_LoadAddon("/home/alex/Music/Moon64-Packs/converted/beta-hud.bit");
// Moon_LoadAddon("/home/alex/disks/uwu/Projects/UnderVolt/Moon64-Packs/converted/owo.bit");
// Moon_LoadAddon("/home/alex/Music/Moon64-Packs/converted/minecraft.bit");
// Moon_BakeTextureCache({1, 0, 2, 3});
Moon_ScanAddonsDirectory( exePath, gamedir );
vector<int> order;
for(int i = 0; i < addons.size(); i++) order.push_back(i);
Moon_BakeTextureCache(order);
milliseconds end_ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
std::cout << "Finised loading in " << ((end_ms.count() - start_ms.count()) / 1000) << " seconds" << std::endl;

View File

@ -11,7 +11,9 @@ class MoonCategory {
public:
MoonCategory(string categoryName){
this->categoryName = categoryName;
this->titleKey = true;
};
bool titleKey = false;
string categoryName;
std::vector<MoonWidget*> catOptions;
};

View File

@ -12,29 +12,18 @@ extern "C" {
#include "pc/configfile.h"
}
std::vector<int> order = {1, 0, 2, 3};
std::vector<int> order;
MWValue *tmpButton;
MTexturesCategory::MTexturesCategory() : MoonCategory("TEXT_OPT_AUDIO"){
int idx = 0;
// for(auto &addon : addons){
// this->catOptions.push_back(new MWValue(22, 57 + (17 * idx), addon->name, {.bvar = &addon->enabled}, false));
// idx++;
// }
MTexturesCategory::MTexturesCategory() : MoonCategory("Textures"){
this->titleKey = false;
for(int i = 0; i < addons.size(); i++) order.push_back(i);
this->catOptions.push_back(tmpButton = new MWValue(22, 57, "Randomize packs", {.btn = [](){
tmpButton->title = "Randomize on progress";
std::random_shuffle ( order.begin(), order.end() );
Moon_TestRebuildOrder(order);
tmpButton->title = "Randomize packs";
}}, false));
// this->catOptions.push_back(new MWValue(22, 57 + (17 * 1), "Load minecraft pack", {.btn = [](){
// Moon_TextFlyLoad(1);
// }}, false));
// this->catOptions.push_back(new MWValue(22, 57 + (17 * 2), "Load owo pack", {.btn = [](){
// Moon_TextFlyLoad(2);
// }}, false));
// this->catOptions.push_back(new MWValue(22, 57 + (17 * 3), "Load Render96 pack", {.btn = [](){
// Moon_TextFlyLoad(2);
// }}, false));
}

View File

@ -83,7 +83,7 @@ void MoonOptMain::Update(){
}
void MoonOptMain::Draw(){
string curTitle = Moon_GetKey(categories[categoryIndex]->categoryName);
string curTitle = categories[categoryIndex]->titleKey ? Moon_GetKey(categories[categoryIndex]->categoryName) : categories[categoryIndex]->categoryName;
float txtWidth = MoonGetTextWidth(curTitle, 1.0, true);
MoonDrawRectangle(0, 0, GetScreenWidth(false), GetScreenHeight(), {0, 0, 0, 100}, false);