Extract updater

This commit is contained in:
Maurice Heumann 2023-01-31 18:13:54 +01:00
parent 3177b74a37
commit b82d2d9438
3 changed files with 30 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "splash.hpp"
#include "updater.hpp"
#include <version.hpp>
@ -127,6 +128,25 @@ namespace updater
}
}
void update()
{
#if defined(NDEBUG) && defined(CI)
try
{
if (requires_update())
{
perform_update(splash::get_window());
activate_update();
}
}
catch (...)
{
}
#else
requires_update();
#endif
}
class component final : public generic_component
{
public:
@ -136,7 +156,7 @@ namespace updater
this->update_thread_ = std::thread([this]
{
this->update();
update();
});
}
@ -165,21 +185,6 @@ namespace updater
this->update_thread_.join();
}
}
void update()
{
try
{
if (requires_update())
{
perform_update(splash::get_window());
activate_update();
}
}
catch (...)
{
}
}
};
}

View File

@ -0,0 +1,6 @@
#pragma once
namespace updater
{
void update();
}

View File

@ -5,11 +5,14 @@
#include "html/html_window.hpp"
#include "resource.hpp"
#include "component/updater.hpp"
namespace launcher
{
bool run()
{
updater::update();
bool run_game = false;
html_window window("BOIII", 750, 430);