xyginext  0.2.0
Second generation of xygine game creation framework
Classes | Functions
xy::ui Namespace Reference

Utility functions which act as ImGui wrappers. These are for a convenience, however it is possible to use ImGui directly if preferred. Immediate mode ui information is rendered to the status window via GuiClient::registerTabControl(). More...

Classes

struct  Style
 

Functions

XY_EXPORT_API void begin (const std::string &title, bool *open=nullptr)
 
XY_EXPORT_API void setNextWindowSize (float x, float y)
 
XY_EXPORT_API void setNextWindowConstraints (float minW, float minY, float maxW, float maxY)
 
XY_EXPORT_API void setNextWindowPosition (float x, float y)
 Set the next window position in window coordinates. More...
 
XY_EXPORT_API void text (const std::string &str)
 
XY_EXPORT_API bool button (const std::string &label, float w=0.f, float h=0.f)
 
XY_EXPORT_API void checkbox (const std::string &title, bool *value)
 
XY_EXPORT_API void slider (const std::string &title, float &value, float min, float max, float itemWidth=200.f)
 
XY_EXPORT_API void separator ()
 
XY_EXPORT_API void sameLine (float posX=0.f, float spacing=-1.f)
 
XY_EXPORT_API bool simpleCombo (const std::string &title, std::int32_t &index, const char *items, float itemWidth=200.f)
 Simple combo box. More...
 
XY_EXPORT_API bool input (const std::string &label, std::int32_t &value, float itemWidth=200.f)
 
XY_EXPORT_API bool radioButton (const std::string &title, std::int32_t &output, std::int32_t value)
 
XY_EXPORT_API void showToolTip (const std::string &message)
 Displays a tool tip when the previously drawn item is hovered. More...
 
XY_EXPORT_API bool colourPicker (const std::string &label, sf::Color &output)
 Displays an RGBA colour picker and places the result in output. More...
 
XY_EXPORT_API bool beginMenuBar ()
 
XY_EXPORT_API void endMenuBar ()
 
XY_EXPORT_API bool beginMenu (const std::string &title)
 
XY_EXPORT_API void endMenu ()
 
XY_EXPORT_API bool menuItem (const std::string &title, bool &selected)
 
XY_EXPORT_API void image (const sf::Texture &texture, sf::Color tint=sf::Color::White, sf::Color border=sf::Color::Black)
 Draws an image using the given texture. More...
 
XY_EXPORT_API void end ()
 
XY_EXPORT_API bool wantsMouse ()
 
XY_EXPORT_API bool wantsKeyboard ()
 
XY_EXPORT_API const StylegetStyle ()
 Get the current style.
 
XY_EXPORT_API void setStyle (const Style &style)
 Set the current style.
 

Detailed Description

Utility functions which act as ImGui wrappers. These are for a convenience, however it is possible to use ImGui directly if preferred. Immediate mode ui information is rendered to the status window via GuiClient::registerTabControl().

See also
GuiClient

Function Documentation

◆ begin()

XY_EXPORT_API void xy::ui::begin ( const std::string &  title,
bool *  open = nullptr 
)
See also
ImGui::Begin()

◆ beginMenu()

XY_EXPORT_API bool xy::ui::beginMenu ( const std::string &  title)
See also
ImGui::BeginMenu()

◆ beginMenuBar()

XY_EXPORT_API bool xy::ui::beginMenuBar ( )
See also
ImGui::BeginMenuBar()

◆ button()

XY_EXPORT_API bool xy::ui::button ( const std::string &  label,
float  w = 0.f,
float  h = 0.f 
)
See also
ImGui::Button()

◆ checkbox()

XY_EXPORT_API void xy::ui::checkbox ( const std::string &  title,
bool *  value 
)
See also
ImGui::CheckBox()

◆ colourPicker()

XY_EXPORT_API bool xy::ui::colourPicker ( const std::string &  label,
sf::Color &  output 
)

Displays an RGBA colour picker and places the result in output.

Parameters
outputReference to an sf::Colour in which to store the result

◆ end()

XY_EXPORT_API void xy::ui::end ( )
See also
ImGui::End()

◆ endMenu()

XY_EXPORT_API void xy::ui::endMenu ( )
See also
ImGui::EndMenu()

◆ endMenuBar()

XY_EXPORT_API void xy::ui::endMenuBar ( )
See also
ImGui::EndMenuBar()

◆ image()

XY_EXPORT_API void xy::ui::image ( const sf::Texture &  texture,
sf::Color  tint = sf::Color::White,
sf::Color  border = sf::Color::Black 
)

Draws an image using the given texture.

Parameters
textureTexture to use when drawing the image
tintColour to multiply with the texture when drawing
borderColour to use when drawing the border

◆ input()

XY_EXPORT_API bool xy::ui::input ( const std::string &  label,
std::int32_t &  value,
float  itemWidth = 200.f 
)
See also
ImGui::InputInt()

◆ menuItem()

XY_EXPORT_API bool xy::ui::menuItem ( const std::string &  title,
bool &  selected 
)
See also
ImGui::MenuItem()

◆ radioButton()

XY_EXPORT_API bool xy::ui::radioButton ( const std::string &  title,
std::int32_t &  output,
std::int32_t  value 
)
Parameters
titleString containing title of the radio button
outputReference to an integer to hold the value of the selected radio button
valueThe value of the radio button which will be placed in output when the radio button is selected
See also
ImGui::RadioButton

◆ sameLine()

XY_EXPORT_API void xy::ui::sameLine ( float  posX = 0.f,
float  spacing = -1.f 
)
See also
ImGui::SameLine()

◆ separator()

XY_EXPORT_API void xy::ui::separator ( )
See also
ImGui::Separator()

◆ setNextWindowConstraints()

XY_EXPORT_API void xy::ui::setNextWindowConstraints ( float  minW,
float  minY,
float  maxW,
float  maxY 
)
See also
ImGui::SetNextWindowSizeConstraints()

◆ setNextWindowPosition()

XY_EXPORT_API void xy::ui::setNextWindowPosition ( float  x,
float  y 
)

Set the next window position in window coordinates.

See also
ImGui::SetNextWindowPos()

◆ setNextWindowSize()

XY_EXPORT_API void xy::ui::setNextWindowSize ( float  x,
float  y 
)
See also
ImGui::SetNextWindowSize()

◆ showToolTip()

XY_EXPORT_API void xy::ui::showToolTip ( const std::string &  message)

Displays a tool tip when the previously drawn item is hovered.

Parameters
messageString containing the message to display

◆ simpleCombo()

XY_EXPORT_API bool xy::ui::simpleCombo ( const std::string &  title,
std::int32_t &  index,
const char *  items,
float  itemWidth = 200.f 
)

Simple combo box.

Parameters
nameString containing the label of the combobox
indexReference to the integer variable which holds the selected index
itemsA string containing a null delimited list of items eg "item01\0item02\0item the third\0\0"

◆ slider()

XY_EXPORT_API void xy::ui::slider ( const std::string &  title,
float &  value,
float  min,
float  max,
float  itemWidth = 200.f 
)
See also
ImGui::FloatSlider()

◆ text()

XY_EXPORT_API void xy::ui::text ( const std::string &  str)
See also
ImGui::Text()

◆ wantsKeyboard()

XY_EXPORT_API bool xy::ui::wantsKeyboard ( )
See also
ImGui::GetIo().WantCaptureKeyboard

◆ wantsMouse()

XY_EXPORT_API bool xy::ui::wantsMouse ( )
See also
ImGui::GetIo().WantCaptureMouse