mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 15:09:13 +01:00
Merge remote-tracking branch 'origin/feat/switch-blades' into feat/renderers-cleanup
This commit is contained in:
@@ -179,7 +179,7 @@ struct global_settings {
|
||||
float FieldOfView{ 45.f }; // vertical field of view for the camera. TODO: move it to the renderer
|
||||
bool EditorOrtho{ false };
|
||||
float EditorOrthoExtent{ 150.f };
|
||||
bool EditorOrthoBallast{ true }; // the ballast of the railway drawn in the top view of the editor
|
||||
int EditorOrthoTracks{ 0 }; // the railway in the top view of the editor: 0 whole, 1 without the ballast, 2 the rails alone
|
||||
GLint iMaxTextureSize{ 4096 }; // maksymalny rozmiar tekstury
|
||||
GLint iMaxCabTextureSize{ 4096 }; // largest allowed texture in vehicle cab
|
||||
int iMultisampling{ 2 }; // tryb antyaliasingu: 0=brak,1=2px,2=4px,3=8px,4=16px
|
||||
|
||||
@@ -73,6 +73,24 @@ std::filesystem::path user_config_path(const std::string &filename)
|
||||
return {}; // env var missing → caller falls back to CWD-relative filename
|
||||
}
|
||||
|
||||
std::filesystem::path user_cache_path(const std::string &filename)
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
#if defined(_WIN32)
|
||||
if (const char *local = std::getenv("LOCALAPPDATA"))
|
||||
return fs::path(local) / "MaSzyna" / "cache" / filename;
|
||||
#elif defined(__APPLE__)
|
||||
if (const char *home = std::getenv("HOME"))
|
||||
return fs::path(home) / "Library" / "Caches" / "MaSzyna" / filename;
|
||||
#else
|
||||
if (const char *cache = std::getenv("XDG_CACHE_HOME"); cache != nullptr && *cache != '\0')
|
||||
return fs::path(cache) / "MaSzyna" / filename;
|
||||
if (const char *home = std::getenv("HOME"))
|
||||
return fs::path(home) / ".cache" / "MaSzyna" / filename;
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
// zwraca różnicę czasu
|
||||
// jeśli pierwsza jest aktualna, a druga rozkładowa, to ujemna oznacza opóżnienie
|
||||
// na dłuższą metę trzeba uwzględnić datę, jakby opóżnienia miały przekraczać 12h (towarowych)
|
||||
|
||||
@@ -28,6 +28,9 @@ template <typename T> constexpr T sq(T v)
|
||||
// returns the per-user config path for `filename` (platform-specific dir),
|
||||
// or an empty path if the home/appdata env var is unavailable
|
||||
std::filesystem::path user_config_path(const std::string &filename);
|
||||
// the per-user path for `filename` among the files kept only to be fetched again faster, which don't roam with the profile:
|
||||
// %LOCALAPPDATA%\MaSzyna\cache, ~/Library/Caches/MaSzyna, $XDG_CACHE_HOME/MaSzyna or ~/.cache/MaSzyna; empty as user_config_path
|
||||
std::filesystem::path user_cache_path(const std::string &filename);
|
||||
|
||||
// TODO: Shouldn't this be in globals?
|
||||
namespace paths
|
||||
|
||||
Reference in New Issue
Block a user