F.E.I.S/include/imgui/imgui-SFML.h
Stepland 8d44098063 - Tab selection in linear view
- Cut/Copy/Paste selected notes
- LN displayed correctly in the Linear View
- bunch of other small stuff
2019-03-27 20:37:30 +01:00

103 lines
4.4 KiB
C++

#ifndef IMGUI_SFML_H
#define IMGUI_SFML_H
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/Window/Joystick.hpp>
#include "imgui.h"
namespace sf
{
class Event;
class RenderTarget;
class RenderWindow;
class Sprite;
class Texture;
class Window;
}
namespace ImGui
{
namespace SFML
{
void Init(sf::RenderWindow& window, bool loadDefaultFont = true);
void Init(sf::Window& window, sf::RenderTarget& target, bool loadDefaultFont = true);
void ProcessEvent(const sf::Event& event);
void Update(sf::RenderWindow& window, sf::Time dt);
void Update(sf::Window& window, sf::RenderTarget& target, sf::Time dt);
void Update(const sf::Vector2i& mousePos, const sf::Vector2f& displaySize, sf::Time dt);
void Render(sf::RenderTarget& target);
void Shutdown();
void UpdateFontTexture();
sf::Texture& GetFontTexture();
// joystick functions
void SetActiveJoystickId(unsigned int joystickId);
void SetJoytickDPadThreshold(float threshold);
void SetJoytickLStickThreshold(float threshold);
void SetJoystickMapping(int action, unsigned int joystickButton);
void SetDPadXAxis(sf::Joystick::Axis dPadXAxis, bool inverted = false);
void SetDPadYAxis(sf::Joystick::Axis dPadYAxis, bool inverted = false);
void SetLStickXAxis(sf::Joystick::Axis lStickXAxis, bool inverted = false);
void SetLStickYAxis(sf::Joystick::Axis lStickYAxis, bool inverted = false);
}
// custom ImGui widgets for SFML stuff
// Image overloads
void Image(const sf::Texture& texture,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Texture& texture, const sf::Vector2f& size,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Texture& texture, const ImVec2& uv0, const ImVec2& uv1,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Texture& texture, const sf::FloatRect& textureRect,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Texture& texture, const sf::Vector2f& size, const sf::FloatRect& textureRect,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Sprite& sprite,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
void Image(const sf::Sprite& sprite, const sf::Vector2f& size,
const sf::Color& tintColor = sf::Color::White,
const sf::Color& borderColor = sf::Color::Transparent);
// ImageButton overloads
bool ImageButton(const sf::Texture& texture, const int framePadding = -1,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);
bool ImageButton(const sf::Texture& texture, const sf::Vector2f& size, const int framePadding = -1,
const sf::Color& bgColor = sf::Color::Transparent, const sf::Color& tintColor = sf::Color::White);
bool ImageButton(const sf::Sprite& sprite, const int framePadding = -1,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);
bool ImageButton(const sf::Sprite& sprite, const sf::Vector2f& size, const int framePadding = -1,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);
// Custom custom stuff for F.E.I.S
bool ColorEdit4(const char* label, sf::Color& col, ImGuiColorEditFlags flags = 0);
// Draw_list overloads. All positions are in relative coordinates (relative to top-left of the current window)
void DrawLine(const sf::Vector2f& a, const sf::Vector2f& b, const sf::Color& col, float thickness = 1.0f);
void DrawRect(const sf::FloatRect& rect, const sf::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f);
void DrawRectFilled(const sf::FloatRect& rect, const sf::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F);
}
#endif //# IMGUI_SFML_H