Skip to content

Commit

Permalink
Mark more internal functions as [[nodiscard]]
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Oct 29, 2024
1 parent c331f7f commit 6cf555a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ static_assert(sizeof(GLuint) <= sizeof(ImTextureID), "ImTextureID is not large e
namespace
{
// various helper functions
ImColor toImColor(sf::Color c);
ImVec2 toImVec2(const sf::Vector2f& v);
sf::Vector2f toSfVector2f(const ImVec2& v);
ImVec2 getTopLeftAbsolute(const sf::FloatRect& rect);
ImVec2 getDownRightAbsolute(const sf::FloatRect& rect);
[[nodiscard]] ImColor toImColor(sf::Color c);
[[nodiscard]] ImVec2 toImVec2(const sf::Vector2f& v);
[[nodiscard]] sf::Vector2f toSfVector2f(const ImVec2& v);
[[nodiscard]] ImVec2 getTopLeftAbsolute(const sf::FloatRect& rect);
[[nodiscard]] ImVec2 getDownRightAbsolute(const sf::FloatRect& rect);

struct SpriteTextureData
{
Expand All @@ -131,35 +131,35 @@ struct SpriteTextureData
ImTextureID textureID{};
};

SpriteTextureData getSpriteTextureData(const sf::Sprite& sprite);
[[nodiscard]] SpriteTextureData getSpriteTextureData(const sf::Sprite& sprite);

ImTextureID convertGLTextureHandleToImTextureID(GLuint glTextureHandle);
GLuint convertImTextureIDToGLTextureHandle(ImTextureID textureID);
[[nodiscard]] ImTextureID convertGLTextureHandleToImTextureID(GLuint glTextureHandle);
[[nodiscard]] GLuint convertImTextureIDToGLTextureHandle(ImTextureID textureID);

void RenderDrawLists(ImDrawData* draw_data); // rendering callback function prototype

// Default mapping is XInput gamepad mapping
void initDefaultJoystickMapping();

// Returns first id of connected joystick
unsigned int getConnectedJoystickId();
[[nodiscard]] unsigned int getConnectedJoystickId();

void updateJoystickButtonState(ImGuiIO& io);
void updateJoystickDPadState(ImGuiIO& io);
void updateJoystickAxisState(ImGuiIO& io);

// clipboard functions
void setClipboardText(void* userData, const char* text);
const char* getClipboardText(void* userData);
std::string s_clipboardText;
void setClipboardText(void* userData, const char* text);
[[nodiscard]] const char* getClipboardText(void* userData);
std::string s_clipboardText;

// mouse cursors
void loadMouseCursor(ImGuiMouseCursor imguiCursorType, sf::Cursor::Type sfmlCursorType);
void updateMouseCursor(sf::Window& window);

// Key mappings
ImGuiKey keycodeToImGuiKey(sf::Keyboard::Key code);
ImGuiKey keycodeToImGuiMod(sf::Keyboard::Key code);
[[nodiscard]] ImGuiKey keycodeToImGuiKey(sf::Keyboard::Key code);
[[nodiscard]] ImGuiKey keycodeToImGuiMod(sf::Keyboard::Key code);

// data
constexpr unsigned int NULL_JOYSTICK_ID = sf::Joystick::Count;
Expand Down

0 comments on commit 6cf555a

Please sign in to comment.