summaryrefslogtreecommitdiffstats
path: root/Tools/GrownBiomeGenVisualiser
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Tools/GrownBiomeGenVisualiser/CMakeLists.txt3
-rw-r--r--Tools/GrownBiomeGenVisualiser/Globals.h31
-rw-r--r--Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp14
3 files changed, 10 insertions, 38 deletions
diff --git a/Tools/GrownBiomeGenVisualiser/CMakeLists.txt b/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
index 0a8b7930e..4626ecf73 100644
--- a/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
+++ b/Tools/GrownBiomeGenVisualiser/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.0.2)
project (GrownBiomeGenVisualiser)
# Without this, the MSVC variable isn't defined for MSVC builds ( https://www.cmake.org/pipermail/cmake/2011-November/047130.html )
@@ -89,4 +90,6 @@ add_executable(GrownBiomeGenVisualiser
${SHARED_OSS_HDR}
)
+target_link_libraries(GrownBiomeGenVisualiser fmt::fmt)
+
set_target_properties(GrownBiomeGenVisualiser PROPERTIES FOLDER Tools)
diff --git a/Tools/GrownBiomeGenVisualiser/Globals.h b/Tools/GrownBiomeGenVisualiser/Globals.h
index bc2b6834f..11adc2f53 100644
--- a/Tools/GrownBiomeGenVisualiser/Globals.h
+++ b/Tools/GrownBiomeGenVisualiser/Globals.h
@@ -22,13 +22,6 @@
#define ALIGN_8
#define ALIGN_16
- #define FORMATSTRING(formatIndex, va_argsIndex)
-
- // MSVC has its own custom version of zu format
- #define SIZE_T_FMT "%Iu"
- #define SIZE_T_FMT_PRECISION(x) "%" #x "Iu"
- #define SIZE_T_FMT_HEX "%Ix"
-
#define NORETURN __declspec(noreturn)
#elif defined(__GNUC__)
@@ -49,27 +42,6 @@
// Some portability macros :)
#define stricmp strcasecmp
- #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
-
- #if defined(_WIN32)
- // We're compiling on MinGW, which uses an old MSVCRT library that has no support for size_t printfing.
- // We need direct size formats:
- #if defined(_WIN64)
- #define SIZE_T_FMT "%I64u"
- #define SIZE_T_FMT_PRECISION(x) "%" #x "I64u"
- #define SIZE_T_FMT_HEX "%I64x"
- #else
- #define SIZE_T_FMT "%u"
- #define SIZE_T_FMT_PRECISION(x) "%" #x "u"
- #define SIZE_T_FMT_HEX "%x"
- #endif
- #else
- // We're compiling on Linux, so we can use libc's size_t printf format:
- #define SIZE_T_FMT "%zu"
- #define SIZE_T_FMT_PRECISION(x) "%" #x "zu"
- #define SIZE_T_FMT_HEX "%zx"
- #endif
-
#define NORETURN __attribute((__noreturn__))
#else
@@ -92,8 +64,6 @@
#define ALIGN_16
*/
- #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
-
#endif
@@ -213,6 +183,7 @@ typedef unsigned char Byte;
// Common headers (without macros):
+#include "fmt/format.h"
#include "StringUtils.h"
diff --git a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
index 0efaf9a59..31418b008 100644
--- a/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
+++ b/Tools/GrownBiomeGenVisualiser/GrownBiomeGenVisualiser.cpp
@@ -10,6 +10,7 @@
#define PROT_INT_BUFFER_SIZE (130 * 130)
#include "Generating/ProtIntGen.h"
+#include "fmt/printf.h"
@@ -20,7 +21,6 @@ typedef int Color[3]; // Color is an array of 3 ints
// Forward declarations, needed for GCC and Clang:
-void log(const char * a_Fmt, ...) FORMATSTRING(1, 2);
void outputBitmapFile(
const AString & a_FileName,
unsigned a_ImageSizeX, unsigned a_ImageSizeY,
@@ -155,14 +155,12 @@ biomeColorMap[] =
-void log(const char * a_Fmt, ...)
+template <typename ... Args>
+void log(const char * a_Fmt, const Args & ... a_Args)
{
- AString buf;
- va_list args;
- va_start(args, a_Fmt);
- AppendVPrintf(buf, a_Fmt, args);
- va_end(args);
- std::cout << buf << std::endl << std::flush;
+ fmt::printf(a_Fmt, a_Args...);
+ putchar('\n');
+ fflush(stdout);
}