Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Dec 27, 2024
1 parent 6a55e88 commit f1bba57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ build: ## Build

configure: clean ## Configure
conan remote update conancenter --url https://center2.conan.io
conan install . --output-folder=build --build=missing --profile=default --settings compiler.cppstd=20 --settings build_type=Release
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DSDL2_DIR=generators -DCMAKE_BUILD_TYPE=Release -DLOCAL=OFF -DSANDBOX=ON -DENABLE_PROFILING=ON
conan install . --output-folder=build --build=missing --profile=webassembly --settings compiler.cppstd=20 --settings build_type=Release
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DSDL2_DIR=generators -DCMAKE_BUILD_TYPE=Release -DLOCAL=ON -DSANDBOX=OFF -DENABLE_PROFILING=ON
4 changes: 3 additions & 1 deletion src/timermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ timermanager::~timermanager() noexcept {
for (const auto &timer : _timers) {
SDL_RemoveTimer(timer.first);
}

_timers.clear();
}

void timermanager::set(int32_t interval, std::function<void()> fn) {
Expand All @@ -38,7 +40,7 @@ void timermanager::clear(int32_t id) noexcept {
}

void timermanager::add_timer(int32_t interval, std::function<void()> fn, bool repeat) {
const auto ptr = std::make_shared<std::function<void()>>(std::move(fn));
const auto ptr = std::make_shared<std::function<void()>>(fn);
const auto id = SDL_AddTimer(interval, repeat ? wrapper : singleshot_wrapper, ptr.get());
if (!id) [[unlikely]] {
std::ostringstream oss;
Expand Down

0 comments on commit f1bba57

Please sign in to comment.