1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00
planetblupi/src/misc.h

31 lines
730 B
C
Raw Normal View History

2017-01-21 17:27:46 +01:00
2017-01-21 23:44:30 +01:00
#pragma once
2017-02-11 18:10:32 +01:00
#include <string>
#include <memory>
#include <cstdio>
2017-02-10 00:14:28 +01:00
#include "blupi.h"
extern void OutputDebug (const char *pMessage);
2017-01-21 17:27:46 +01:00
extern POINT ConvLongToPos (LPARAM lParam);
2017-01-21 17:27:46 +01:00
extern void InitRandom();
extern Sint32 Random (Sint32 min, Sint32 max);
2017-01-21 17:27:46 +01:00
std::string GetBaseDir ();
2017-02-21 22:34:55 +01:00
std::string GetShareDir ();
std::string GetLocale ();
extern void AddUserPath (std::string &pFilename);
template<typename ...Args>
std::string
string_format (const std::string &format, Args ...args)
{
size_t size = snprintf (nullptr, 0, format.c_str (), args...) + 1;
std::unique_ptr<char[]> buf (new char[size]);
2017-03-21 18:34:26 +01:00
snprintf (buf.get(), size, format.c_str (), args...);
return std::string (buf.get (), buf.get () + size - 1);
}