Skip to content

Commit

Permalink
feat: add "-windowless" launch option
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan committed Oct 19, 2023
1 parent 4c02019 commit 1a13da5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build_scripts/scripts/external_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
os.chdir(external_libs_dir)
get_submodule("alsoundsystem","https://github.com/Silverlan/alsoundsystem.git","4ffcd98")
get_submodule("datasystem","https://github.com/Silverlan/datasystem.git","a6dfff6")
get_submodule("iglfw","https://github.com/Silverlan/iglfw.git","4b9cf5c8f7f5e38e84c7e8529f956cd35897401e")
get_submodule("iglfw","https://github.com/Silverlan/iglfw.git","dff0063cc37d248c4eb11fc9fec356e091f7364c")
get_submodule("luasystem","https://github.com/Silverlan/luasystem.git","e22584368ce0f9a5c0c223b8a632d968377d1ae3")
get_submodule("materialsystem","https://github.com/Silverlan/materialsystem.git","6214d38")
get_submodule("mathutil","https://github.com/Silverlan/mathutil.git","5aa9ec46b104b086ddfd090d1be0030c9f2788b5")
get_submodule("networkmanager","https://github.com/Silverlan/networkmanager.git","68d2f5c")
get_submodule("panima","https://github.com/Silverlan/panima.git","2a83de9c5893bb1ca7ed5c154122500af3babd65")
get_submodule("prosper","https://github.com/Silverlan/prosper.git","1062716010d53b5c350cad431fcc30b218ef3541")
get_submodule("prosper","https://github.com/Silverlan/prosper.git","e5ab87ba684775b49a9b5548b12a3142fa8c50b2")
get_submodule("sharedutils","https://github.com/Silverlan/sharedutils.git","ea6e60be7f59c300484addba83ba41359671df9d")
get_submodule("util_bsp","https://github.com/Silverlan/util_bsp.git","3c11053")
get_submodule("util_formatted_text","https://github.com/Silverlan/util_formatted_text.git","3bd9e2de37d0cb14bf8228fde5e25c97698e927b")
Expand Down
2 changes: 2 additions & 0 deletions core/client/src/c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ extern std::optional<uint32_t> g_launchParamWidth;
extern std::optional<uint32_t> g_launchParamHeight;
extern std::optional<Color> g_titleBarColor;
extern std::optional<Color> g_borderColor;
extern bool g_windowless;
void register_game_shaders();
bool CEngine::Initialize(int argc, char *argv[])
{
Expand Down Expand Up @@ -584,6 +585,7 @@ bool CEngine::Initialize(int argc, char *argv[])
prosper::IPrContext::CreateInfo contextCreateInfo {};
contextCreateInfo.width = 1280;
contextCreateInfo.height = 1024;
contextCreateInfo.windowless = g_windowless;
if(windowRes) {
std::vector<std::string> vals;
ustring::explode(*windowRes, "x", vals);
Expand Down
10 changes: 10 additions & 0 deletions core/client/src/c_launchparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ std::optional<uint32_t> g_launchParamWidth {};
std::optional<uint32_t> g_launchParamHeight {};
std::optional<Color> g_titleBarColor {};
std::optional<Color> g_borderColor {};
bool g_windowless = false;
static void LPARAM_windowed(const std::vector<std::string> &argv) { g_launchParamWindowedMode = true; }

static void LPARAM_refresh(const std::vector<std::string> &argv)
Expand Down Expand Up @@ -81,6 +82,14 @@ static void LPARAM_icon(const std::vector<std::string> &argv)
g_customWindowIcon = argv.front();
}

static void LPARAM_windowless(const std::vector<std::string> &argv)
{
auto windowless = true;
if(!argv.empty())
windowless = util::to_boolean(argv.front());
g_windowless = windowless;
}

static void LPARAM_title_bar_color(const std::vector<std::string> &argv)
{
if(argv.empty())
Expand Down Expand Up @@ -122,5 +131,6 @@ REGISTER_LAUNCH_PARAMETER_HELP(-graphics_api, LPARAM_render_api, "<moduleName>",
REGISTER_LAUNCH_PARAMETER_HELP(-audio_api, LPARAM_audio_api, "<moduleName>", "Changes the audio API to use for audio playback.");
REGISTER_LAUNCH_PARAMETER_HELP(-auto_exec, LPARAM_auto_exec, "<script>", "Auto-execute this Lua-script on launch.");
REGISTER_LAUNCH_PARAMETER_HELP(-icon, LPARAM_icon, "<iconPath>", "Path to custom window icon location.");
REGISTER_LAUNCH_PARAMETER_HELP(-windowless, LPARAM_windowless, "<1/0>", "If enabled, Pragma will be launched without a visible window.");
REGISTER_LAUNCH_PARAMETER_HELP(-title_bar_color, LPARAM_title_bar_color, "<hexColor>", "Hex color for the window title bar.");
REGISTER_LAUNCH_PARAMETER_HELP(-border_color, LPARAM_border_bar_color, "<hexColor>", "Hex color for the window border.");

0 comments on commit 1a13da5

Please sign in to comment.