mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-12 17:32:30 -04:00
import ADV settings, platform files
This commit is contained in:
parent
9b86bed2d8
commit
ccebc91f0d
17 changed files with 244 additions and 14 deletions
|
@ -1,2 +0,0 @@
|
|||
|
||||
add_library(skeldal_linux map_file.cpp timer.cpp)
|
25
platform/linux/save_folder.cpp
Normal file
25
platform/linux/save_folder.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "../save_folder.h"
|
||||
#include "../error.h"
|
||||
#include <filesystem>
|
||||
|
||||
static std::string get_default_savegame_dir() {
|
||||
|
||||
// Linux
|
||||
char* home = std::getenv("HOME");
|
||||
if (home) {
|
||||
return std::filesystem::path(home) / ".local/share/" SAVEGAME_FOLDERNAME;
|
||||
} else {
|
||||
display_error("$HOME has no value (user with no home)");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char *get_default_savegame_directory() {
|
||||
|
||||
static std::string dir = get_default_savegame_dir();
|
||||
return dir.c_str();
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#include "timer.h"
|
||||
#include <chrono>
|
||||
#include "../platform.h"
|
||||
|
||||
#include <thread>
|
||||
int get_timer_value() {
|
||||
auto n = std::chrono::steady_clock::now();
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(n.time_since_epoch()).count()/TIMERSPEED;
|
||||
}
|
||||
|
||||
uint32_t get_game_tick_count() {
|
||||
auto n = std::chrono::steady_clock::now();
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(n.time_since_epoch()).count();
|
||||
}
|
||||
|
||||
void sleep_ms(uint32_t x) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(x));
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* timer.h
|
||||
*
|
||||
* Created on: 26. 1. 2025
|
||||
* Author: ondra
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_LINUX_TIMER_H_
|
||||
#define PLATFORM_LINUX_TIMER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int get_timer_value();
|
||||
uint32_t get_game_tick_count();
|
||||
void sleep_ms(uint32_t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* PLATFORM_LINUX_TIMER_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue