~vladh/peony

f9ec49a433a13b17a85b1de7cd1a500fd8b0b7b1 — Vlad-Stefan Harbuz 1 year, 10 months ago c8555e9 + 7e8f0c8 main
Merge branch 'main' of git.sr.ht:~vladh/peony
2 files changed, 52 insertions(+), 15 deletions(-)

M src/constants.hpp
M src/main.cpp
M src/constants.hpp => src/constants.hpp +50 -15
@@ 33,6 33,11 @@ constexpr f64 PI = 3.14159265358979323846;
#error "Unknown platform"
#endif

#if defined(PLATFORM_UNIX)
#include <unistd.h>
#include <limits.h>
#endif

#define USE_TIMERS true
#define USE_MEMORYPOOL_ITEM_DEBUG false



@@ 53,22 58,8 @@ struct Settings {
    bool memory_debug_logs_on;
};

constexpr Settings SETTINGS = {
    .graphics_quality = GraphicsQuality::high,
    .opengl_debug_on = false,
    .vsync_on = false,
    .shader_debug_on = false,
    .shadows_on = true,
    .bloom_on = true,
    .fog_on = false,
    .windowed_fullscreen_on = true,
    .fullscreen_on = true,
    .target_monitor = 0,
    .print_fps_on = false,
    .memory_debug_logs_on = false,
};
Settings SETTINGS = {};

// Constants
constexpr char WINDOW_TITLE[] = "peony";
constexpr char TEXTURE_DIR[] = "resources/textures/";
constexpr char MODEL_DIR[] = "resources/models/";


@@ 103,3 94,47 @@ constexpr u32 MAX_NODE_NAME_LENGTH = 32;
constexpr u32 MAX_N_ANIMATIONS = 2;
constexpr u32 MAX_N_ANIM_KEYS = 256;
constexpr u16 MAX_N_LIGHTS = 8;


void
init_constants()
{
#if defined(PLATFORM_UNIX)
    char hostname[HOST_NAME_MAX];
    gethostname(hostname, HOST_NAME_MAX);
#else
    char *hostname = "dunno lol!";
#endif

    if (pstr_eq(hostname, "usu")) {
        SETTINGS = {
            .graphics_quality = GraphicsQuality::low,
            .opengl_debug_on = false,
            .vsync_on = false,
            .shader_debug_on = false,
            .shadows_on = true,
            .bloom_on = true,
            .fog_on = false,
            .windowed_fullscreen_on = true,
            .fullscreen_on = false,
            .target_monitor = 0,
            .print_fps_on = false,
            .memory_debug_logs_on = false,
        };
    } else {
        SETTINGS = {
            .graphics_quality = GraphicsQuality::high,
            .opengl_debug_on = false,
            .vsync_on = false,
            .shader_debug_on = false,
            .shadows_on = true,
            .bloom_on = true,
            .fog_on = false,
            .windowed_fullscreen_on = true,
            .fullscreen_on = true,
            .target_monitor = 0,
            .print_fps_on = false,
            .memory_debug_logs_on = false,
        };
    }
}

M src/main.cpp => src/main.cpp +2 -0
@@ 3,6 3,7 @@
#include <time.h>
#include <stdio.h>
#include "types.hpp"
#include "constants.hpp"
#include "core.hpp"
#include "logs.hpp"



@@ 12,6 13,7 @@ main()
{
    // Seed RNG
    srand((u32)time(NULL));
    init_constants();

    //
    //                                    ___