2017-08-03 22:51:40 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the planetblupi source code
|
|
|
|
* Copyright (C) 1997, Daniel Roux & EPSITEC SA
|
|
|
|
* Copyright (C) 2017, Mathieu Schroeter
|
|
|
|
* http://epsitec.ch; http://www.blupi.org; http://github.com/blupi-games
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see http://gnu.org/licenses
|
|
|
|
*/
|
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>
|
2017-03-04 17:19:36 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <cstdio>
|
|
|
|
|
2017-02-10 00:14:28 +01:00
|
|
|
#include "blupi.h"
|
2017-02-04 16:48:26 +01:00
|
|
|
|
2017-02-12 13:14:22 +01:00
|
|
|
extern void OutputDebug (const char *pMessage);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
2017-02-12 13:14:22 +01:00
|
|
|
extern POINT ConvLongToPos (LPARAM lParam);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
2017-02-12 13:14:22 +01:00
|
|
|
extern void InitRandom();
|
|
|
|
extern Sint32 Random (Sint32 min, Sint32 max);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
2017-02-18 17:58:52 +01:00
|
|
|
std::string GetBaseDir ();
|
2017-02-21 22:34:55 +01:00
|
|
|
std::string GetShareDir ();
|
2017-02-18 17:58:52 +01:00
|
|
|
std::string GetLocale ();
|
2017-03-04 17:19:36 +01:00
|
|
|
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...);
|
2017-03-04 17:19:36 +01:00
|
|
|
return std::string (buf.get (), buf.get () + size - 1);
|
|
|
|
}
|