57 lines
1.3 KiB
C
Raw Normal View History

2024-05-12 03:19:01 -04:00
#pragma once
#include <string>
#include "../options/parser.h"
2024-11-21 02:16:25 -05:00
#include "../ui/frame.h"
2024-05-12 03:19:01 -04:00
2024-11-21 22:07:50 -05:00
#include <libreborn/flags.h>
2024-11-26 06:47:48 -05:00
#include <libreborn/servers.h>
2024-11-21 22:07:50 -05:00
2024-11-21 02:16:25 -05:00
// Default Configuration
2024-05-12 03:19:01 -04:00
#define DEFAULT_USERNAME "StevePi"
#define DEFAULT_RENDER_DISTANCE "Short"
2024-11-21 02:16:25 -05:00
// State
struct State {
2024-11-24 19:57:52 -05:00
State();
2024-11-21 02:16:25 -05:00
// Methods
void update(bool save);
2024-11-21 14:47:48 -05:00
bool operator==(const State &other) const;
2024-11-21 02:16:25 -05:00
// Properties
std::string username;
std::string render_distance;
Flags flags;
};
// UI
struct ConfigurationUI final : Frame {
2024-11-21 16:16:53 -05:00
explicit ConfigurationUI(State &state_, bool &save_settings_);
2024-11-21 02:16:25 -05:00
int render() override;
private:
2024-11-26 06:47:48 -05:00
// Bottom Row
int get_render_distance_index() const;
int draw_bottom(bool hide_reset_revert) const;
// General
void draw_main() const;
// Advanced
2024-11-21 02:16:25 -05:00
void draw_advanced() const;
static void draw_category(FlagNode &category);
2024-11-26 06:47:48 -05:00
// Server List
bool are_servers_unsaved() const;
void draw_servers();
void draw_server_list();
// State
2024-11-21 16:16:53 -05:00
const State original_state;
2024-11-21 02:16:25 -05:00
State &state;
2024-11-21 16:16:53 -05:00
bool &save_settings;
2024-11-26 06:47:48 -05:00
// Server List
ServerList last_saved_servers;
ServerList servers;
2024-11-21 02:16:25 -05:00
};
2024-05-12 03:19:01 -04:00
// Handle Non-Launch Commands
void handle_non_launch_client_only_commands(const options_t &options);
// Configure Client Options
void configure_client(const options_t &options);