removing final parts of boost
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include "LiquidTextureManager.hpp"
|
||||
|
||||
#include <opengl/context.inl>
|
||||
#include <noggit/DBC.h>
|
||||
#include <noggit/application/NoggitApplication.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
|
||||
LiquidTextureManager::LiquidTextureManager(Noggit::NoggitRenderContext context)
|
||||
: _context(context)
|
||||
{
|
||||
@@ -57,7 +54,7 @@ void LiquidTextureManager::upload()
|
||||
|
||||
// init 2D texture array
|
||||
// loading a texture is required to get its dimensions and format
|
||||
blp_texture tex(boost::str(boost::format(filename) % 1), _context);
|
||||
blp_texture tex(string_format(filename,1), _context);
|
||||
tex.finishLoading();
|
||||
|
||||
int width_ = tex.width();
|
||||
@@ -94,13 +91,13 @@ void LiquidTextureManager::upload()
|
||||
unsigned n_frames = 30;
|
||||
for (int j = 0; j < N_FRAMES; ++j)
|
||||
{
|
||||
if (!NOGGIT_APP->clientData()->exists(boost::str(boost::format(filename) % (j + 1))))
|
||||
if (!NOGGIT_APP->clientData()->exists(string_format(filename, (j + 1))))
|
||||
{
|
||||
n_frames = j;
|
||||
break;
|
||||
}
|
||||
|
||||
blp_texture tex_frame(boost::str(boost::format(filename) % (j + 1)), _context);
|
||||
blp_texture tex_frame(string_format(filename, (j + 1)), _context);
|
||||
tex_frame.finishLoading();
|
||||
|
||||
// error checking
|
||||
|
||||
@@ -10,6 +10,17 @@
|
||||
#include <tuple>
|
||||
#include <glm/vec2.hpp>
|
||||
|
||||
template<typename ... Args>
|
||||
std::string string_format(const std::string& format, Args ... args)
|
||||
{
|
||||
int size_s = std::snprintf(nullptr, 0, format.c_str(), args ...) + 1; // Extra space for '\0'
|
||||
if (size_s <= 0) { throw std::runtime_error("Error during formatting."); }
|
||||
auto size = static_cast<size_t>(size_s);
|
||||
auto buf = std::make_unique<char[]>(size);
|
||||
std::snprintf(buf.get(), size, format.c_str(), args ...);
|
||||
return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
|
||||
}
|
||||
|
||||
class LiquidTextureManager
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user