feat(window): add video driver selection via config and --video-driver argument

This commit is contained in:
2026-07-17 14:08:02 +08:00
parent 9617978dd5
commit 0c8073d71d
5 changed files with 39 additions and 3 deletions

View File

@@ -8,5 +8,6 @@ struct Argument {
std::optional<std::string> player;
std::optional<bool> no_debug;
std::optional<std::string> language;
std::optional<std::string> video_driver;
};
} // namespace Cubed

View File

@@ -0,0 +1,14 @@
#pragma once
#include <cstdlib> // IWYU pragma: keep
namespace Cubed {
namespace Tools {
inline void set_env(const char* name, const char* value) {
#ifdef _WIN32
_putenv_s(name, value);
#else
setenv(name, value, 1);
#endif
}
} // namespace Tools
} // namespace Cubed

View File

@@ -1,5 +1,6 @@
#pragma once
#include "Cubed/argument.hpp"
#include "Cubed/config.hpp"
#include "Cubed/input/event.hpp"
@@ -15,7 +16,7 @@ public:
bool is_mouse_enable() const;
const SDL_Window* get_window() const;
SDL_Window* get_window();
void init();
void init(const Argument& argument);
void imgui_init();
// end of frame to reload!