Hopson97 / MineCraft-One-Week-Challenge

I challenged myself to see if I could create a voxel game (Minecraft-like) in just one week using C++ and OpenGL, and here is the result
https://www.youtube.com/watch?v=Xq3isov6mZ8
MIT License
2.65k stars 379 forks source link

Rewrite Settings System #77

Open kennyrkun opened 7 years ago

kennyrkun commented 7 years ago

I feel like the current Settings System is a little bulky and inflexible. I suggest rewriting it using Settings Parser. This is a very simple and flexible configuration manager. (I would implement this myself but I haven't been able to get the project to compile properly yet anyway.)

Here's an example from one of my projects on how this could be used

{
    SettingsParser settings;

    if (settings.loadFromFile(".\\" + GBL::DIR::BASE + "kunlauncher.conf"))
    {
        settings.get("window_width", app->settings.width);
        settings.get("window_height", app->settings.height);
        settings.get("updatelauncheronstart", app->settings.updateLauncherOnStart);
        settings.get("checkforitemsonstart", app->settings.checkForNewItemsOnStart);
        settings.get("experimentalThemes", app->settings.experimentalThemes);
        settings.get("printdownloadprogress", app->settings.printdownloadprogress);
        settings.get("defaultTheme", app->settings.selectedTheme);
    }
    else
    {
        std::cout << "failed to load settings, using defaults" << std::endl;
    }
}

With this, it would be very simple to add and remove things from the list without breaking things. And, things can very easily be changed whilst the game is running.

IridescentRose commented 7 years ago

I'll look into this after the current update to settings and stuff.