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

View File

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

View File

@ -12,29 +12,18 @@ extern "C" {
#include "pc/configfile.h" #include "pc/configfile.h"
} }
std::vector<int> order = {1, 0, 2, 3}; std::vector<int> order;
MWValue *tmpButton; MWValue *tmpButton;
MTexturesCategory::MTexturesCategory() : MoonCategory("TEXT_OPT_AUDIO"){ MTexturesCategory::MTexturesCategory() : MoonCategory("Textures"){
int idx = 0; this->titleKey = false;
// for(auto &addon : addons){ for(int i = 0; i < addons.size(); i++) order.push_back(i);
// this->catOptions.push_back(new MWValue(22, 57 + (17 * idx), addon->name, {.bvar = &addon->enabled}, false));
// idx++;
// }
this->catOptions.push_back(tmpButton = new MWValue(22, 57, "Randomize packs", {.btn = [](){ this->catOptions.push_back(tmpButton = new MWValue(22, 57, "Randomize packs", {.btn = [](){
tmpButton->title = "Randomize on progress"; tmpButton->title = "Randomize on progress";
std::random_shuffle ( order.begin(), order.end() ); std::random_shuffle ( order.begin(), order.end() );
Moon_TestRebuildOrder(order); Moon_TestRebuildOrder(order);
tmpButton->title = "Randomize packs"; tmpButton->title = "Randomize packs";
}}, false)); }}, 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(){ 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); float txtWidth = MoonGetTextWidth(curTitle, 1.0, true);
MoonDrawRectangle(0, 0, GetScreenWidth(false), GetScreenHeight(), {0, 0, 0, 100}, false); MoonDrawRectangle(0, 0, GetScreenWidth(false), GetScreenHeight(), {0, 0, 0, 100}, false);