Skip to content

Commit

Permalink
Replace sf::Uint8 with std::uint8_t (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
pifopi authored Sep 21, 2022
1 parent a80d954 commit e0bf635
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions imconfig-SFML.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <SFML/Graphics/Color.hpp>
#include <SFML/System/Vector2.hpp>

#include <cstdint>

#include "imgui-SFML_export.h"

#define IM_VEC2_CLASS_EXTRA \
Expand All @@ -20,6 +22,8 @@
#define IM_VEC4_CLASS_EXTRA \
ImVec4(const sf::Color& c) : x(c.r / 255.f), y(c.g / 255.f), z(c.b / 255.f), w(c.a / 255.f) {} \
operator sf::Color() const { \
return sf::Color(static_cast<sf::Uint8>(x * 255.f), static_cast<sf::Uint8>(y * 255.f), \
static_cast<sf::Uint8>(z * 255.f), static_cast<sf::Uint8>(w * 255.f)); \
return sf::Color(static_cast<std::uint8_t>(x * 255.f), \
static_cast<std::uint8_t>(y * 255.f), \
static_cast<std::uint8_t>(z * 255.f), \
static_cast<std::uint8_t>(w * 255.f)); \
}
3 changes: 2 additions & 1 deletion imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cassert>
#include <cmath> // abs
#include <cstddef> // offsetof, NULL, size_t
#include <cstdint> // uint8_t
#include <cstring> // memcpy

#include <algorithm>
Expand Down Expand Up @@ -1376,7 +1377,7 @@ void setClipboardText(void* /*userData*/, const char* text) {
}

const char* getClipboardText(void* /*userData*/) {
std::basic_string<sf::Uint8> tmp = sf::Clipboard::getString().toUtf8();
std::basic_string<std::uint8_t> tmp = sf::Clipboard::getString().toUtf8();
s_clipboardText = std::string(tmp.begin(), tmp.end());
return s_clipboardText.c_str();
}
Expand Down

0 comments on commit e0bf635

Please sign in to comment.