Skip to content

Commit

Permalink
samples: use dgs_load_settings_blk() and read .getInt("max_tex_count"…
Browse files Browse the repository at this point in the history
…, 1024)
  • Loading branch information
NicSavichev committed Dec 14, 2024
1 parent a742bec commit c82579d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions samples/skiesSample/prog/test_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,8 @@ void game_demo_init()
df_close(file);*/

debug("[DEMO] registering factories");
::enable_tex_mgr_mt(true, 1024);
const DataBlock &blk = *dgs_get_settings();
::enable_tex_mgr_mt(true, blk.getInt("max_tex_count", 1024));
if (!cpujobs::is_inited())
cpujobs::init();
::set_gameres_sys_ver(2);
Expand All @@ -2885,7 +2886,6 @@ void game_demo_init()
console::init();
add_con_proc(&test_console);

const DataBlock &blk = *dgs_get_settings();
::set_gameres_sys_ver(2);

const char *res_vrom = "res/grp_hdr.vromfs.bin";
Expand Down
4 changes: 2 additions & 2 deletions samples/testGI/prog/test_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3083,14 +3083,14 @@ void game_demo_init()
df_close(file);*/

debug("[DEMO] registering factories");
::enable_tex_mgr_mt(true, 1024);
const DataBlock &blk = *dgs_get_settings();
::enable_tex_mgr_mt(true, blk.getInt("max_tex_count", 1024));
::set_gameres_sys_ver(2);
::register_dynmodel_gameres_factory();
::register_geom_node_tree_gameres_factory();
console::init();
add_con_proc(&test_console);

const DataBlock &blk = *dgs_get_settings();
::set_gameres_sys_ver(2);

enable_taa_override = dgs_get_settings()->getBlockByNameEx("render")->getBool("taa", false);
Expand Down
16 changes: 5 additions & 11 deletions samples/testGI/prog/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#include <startup/dag_linuxMain.inc.cpp>
#endif

static DataBlock *global_settings_blk = NULL;
static const DataBlock *get_glob_settings_blk() { return global_settings_blk; }
static InitOnDemand<De3GuiMgrDrawFps> gui_mgr;
namespace ddsx
{
Expand All @@ -69,8 +67,6 @@ static void post_shutdown_handler()
shutdown_game(RESTART_INPUT);
shutdown_game(RESTART_ALL);
threadpool::shutdown();
del_it(global_settings_blk);
dgs_get_settings = nullptr;
cpujobs::term(true, 1000);
}

Expand Down Expand Up @@ -120,9 +116,7 @@ int DagorWinMain(int nCmdShow, bool /*debugmode*/)
::dgs_post_shutdown_handler = post_shutdown_handler;

// prepare global settings datablock
global_settings_blk = new DataBlock;
dgs_get_settings = &get_glob_settings_blk;
global_settings_blk->load("settings.blk");
dgs_load_settings_blk(true, "settings.blk", nullptr, true, false, false);

::register_common_game_tex_factories();
cpujobs::init();
Expand Down Expand Up @@ -157,18 +151,18 @@ int DagorWinMain(int nCmdShow, bool /*debugmode*/)
::startup_game(RESTART_ALL);
shaders_register_console(true);

const char *sh_bindump_prefix = global_settings_blk->getStr("shaders", "compiledShaders/game");
const char *sh_bindump_prefix = dgs_get_settings()->getStr("shaders", "compiledShaders/game");
::startup_shaders(sh_bindump_prefix);
::startup_game(RESTART_ALL);
dagor_use_reversed_depth(true);
// ShaderGlobal::enableAutoBlockChange(true);
ShaderGlobal::set_int(get_shader_variable_id("in_editor", true), 0);
ShaderGlobal::set_vars_from_blk(*global_settings_blk->getBlockByNameEx("shaderVar"), true);
da_profiler::set_profiling_settings(*global_settings_blk->getBlockByNameEx("debug"));
ShaderGlobal::set_vars_from_blk(*dgs_get_settings()->getBlockByNameEx("shaderVar"), true);
da_profiler::set_profiling_settings(*dgs_get_settings()->getBlockByNameEx("debug"));

::dagor_common_startup();

bool drawFps = global_settings_blk->getBool("draw_fps", false);
bool drawFps = dgs_get_settings()->getBool("draw_fps", false);
::startup_gui_base("ui/fonts.blk");

::startup_game(RESTART_ALL);
Expand Down

0 comments on commit c82579d

Please sign in to comment.