MSVC compilation fixes

This commit is contained in:
Bertrand Songis
2019-10-31 12:20:18 +01:00
parent d156bf8171
commit afe0216671
3 changed files with 17 additions and 4 deletions
+6 -3
View File
@@ -75,9 +75,12 @@
#define GET_BLUE(color) \ #define GET_BLUE(color) \
(((color) & 0x001F) << 3) (((color) & 0x001F) << 3)
// remove windows default definitions #ifndef __GNUC__
#undef OPAQUE #include <windows.h>
#undef RGB // remove windows default definitions
#undef OPAQUE
#undef RGB
#endif
#define OPACITY_MAX 0x0F #define OPACITY_MAX 0x0F
#define OPACITY(x) ((x)<<24) #define OPACITY(x) ((x)<<24)
+6 -1
View File
@@ -22,6 +22,11 @@
#include <string> #include <string>
#if defined(min)
#undef min
#undef max
#endif
template<class T> template<class T>
inline T min(T a, T b) inline T min(T a, T b)
{ {
@@ -51,7 +56,7 @@ inline int divRoundClosest(const int n, const int d)
inline std::string TEXT_AT_INDEX(const char * val, uint8_t idx) inline std::string TEXT_AT_INDEX(const char * val, uint8_t idx)
{ {
const char * start = val + 1 + idx * val[0]; const char * start = val + 1 + idx * val[0];
return std::string(start, min<uint8_t>(val[0], strlen(start))); return std::string(start, min<uint8_t>(val[0], (uint8_t)strlen(start)));
} }
#endif #endif
+5
View File
@@ -33,6 +33,11 @@
typedef uint32_t WindowFlags; typedef uint32_t WindowFlags;
#if !defined(_GNUC_)
#undef OPAQUE
#undef TRANSPARENT
#endif
constexpr WindowFlags OPAQUE = 1 << 0; constexpr WindowFlags OPAQUE = 1 << 0;
constexpr WindowFlags TRANSPARENT = 1 << 1; constexpr WindowFlags TRANSPARENT = 1 << 1;
constexpr WindowFlags NO_SCROLLBAR = 1 << 2; constexpr WindowFlags NO_SCROLLBAR = 1 << 2;