Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

Thank you for considering contributing to TGUI!

All contributions are highly appreciated, whether they are code patches, bug reports or suggestions. Note that while reported bugs are usually handled very quickly, suggestions can sometimes take a long time to be implemented due to TGUI being developed in the spare time of a single developer with only occational code contributions by others.
All contributions are highly appreciated, whether they are code patches, bug reports or suggestions. Note that while reported bugs are usually handled very quickly, suggestions can sometimes take a long time to be implemented due to TGUI being developed in the spare time of a single developer with only occasional code contributions by others.


## Need help?

If you have any questions about TGUI, the [discord server](https://discord.gg/Msf4vyx) and the [forum](https://forum.tgui.eu/) are the best places to get an answer.
If you have any questions about TGUI, the [Discord server](https://discord.gg/Msf4vyx) and the [forum](https://forum.tgui.eu/) are the best places to get an answer.


## Style guide

TGUI has no official style guide yet, but since it's style was heavily influenced by SFML code, the [SFML code style guide](https://www.sfml-dev.org/style.php) mostly matches with TGUI code.
TGUI has no official style guide yet, but since its style was heavily influenced by SFML code, the [SFML code style guide](https://www.sfml-dev.org/style.php) mostly matches with TGUI code.

There are 3 differences that I'm aware of:
- TGUI uses `@` in doxygen documentation where SFML uses `\`
- Lines consisting of only shashes (to separate functions) are longer in TGUI
- TGUI code targets c++14
- TGUI uses `@` in Doxygen documentation where SFML uses `\`
- Lines consisting of only slashes (to separate functions) are longer in TGUI
- TGUI code targets C++14
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TGUI - Texus' Graphical User Interface
=======================================

TGUI is a cross-platform modern c++ GUI library.
TGUI is a cross-platform modern C++ GUI library.
Although originally a library for SFML, it now also has backends for SDL, GLFW and raylib.

For more information, take a look at the [website](https://tgui.eu).
Expand Down
4 changes: 2 additions & 2 deletions include/TGUI/Backend/Renderer/SFML-Graphics/CanvasSFML.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Copy constructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CanvasSFML(const CanvasSFML& copy);
CanvasSFML(const CanvasSFML& other);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Move constructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CanvasSFML(CanvasSFML&& copy) noexcept;
CanvasSFML(CanvasSFML&& other) noexcept;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Overload of copy assignment operator
Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Backend/Window/GLFW/BackendGuiGLFW.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Destructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
~BackendGuiGLFW();
~BackendGuiGLFW() override;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Inform the gui about a focus event when a callback from glfwSetWindowFocusCallback occurs
Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Backend/Window/SFML/BackendGuiSFML.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Destructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
~BackendGuiSFML();
~BackendGuiSFML() override;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Passes the event to the widgets
Expand Down
6 changes: 3 additions & 3 deletions include/TGUI/Container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Copy constructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Container(const Container& copy);
Container(const Container& other);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Move constructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Container(Container&& copy) noexcept;
Container(Container&& other) noexcept;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Destructor
Expand Down Expand Up @@ -204,7 +204,7 @@ namespace tgui
///
/// @throw Exception when file could not be opened for writing
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void saveWidgetsToFile(const String& filename);
void saveWidgetsToFile(const String& filename) const;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Loads the child widgets from a string stream
Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Signal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ namespace tgui
///
/// @return True when a callback function was executed, false when there weren't any connected callback functions
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool emit(ChildWindow* param);
bool emit(ChildWindow* childWindow);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private:
Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Widgets/GrowHorizontalLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Destructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
~GrowHorizontalLayout() = default;
~GrowHorizontalLayout() override = default;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Creates a new horizontal layout widget
Expand Down
2 changes: 1 addition & 1 deletion include/TGUI/Widgets/GrowVerticalLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Destructor
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
~GrowVerticalLayout() = default;
~GrowVerticalLayout() override = default;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Creates a new vertical layout widget
Expand Down
3 changes: 3 additions & 0 deletions src/Backend/Renderer/BackendText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ namespace tgui
case ' ': position.x += whitespaceWidth; continue;
case '\t': position.x += whitespaceWidth * 4; continue;
case '\n': position.y += lineSpacing; position.x = 0; continue;
default: break;
}

// For regular characters, add the advance offset of the glyph
Expand Down Expand Up @@ -365,6 +366,8 @@ namespace tgui
x = 0;
y += lineSpacing;
break;
default:
break;
}

// Next glyph, no need to create a quad for whitespace
Expand Down
1 change: 0 additions & 1 deletion src/Components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ namespace dev

GroupComponent::GroupComponent(const GroupComponent& other) :
Component{other},
m_children{},
m_clientSize(other.m_clientSize)
{
/// TODO: If this GroupComponent is a BackgroundComponent which contains a TextComponent, and this group is being copied
Expand Down
2 changes: 1 addition & 1 deletion src/Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ namespace tgui

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Container::saveWidgetsToFile(const String& filename)
void Container::saveWidgetsToFile(const String& filename) const
{
// If a resource path is set then place it in front of the filename (unless the filename is an absolute path)
String filenameInResources = filename;
Expand Down
6 changes: 3 additions & 3 deletions src/Loading/DataIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,10 @@ namespace tgui
void DataIO::emit(const std::unique_ptr<Node>& rootNode, std::stringstream& stream)
{
for (const auto& pair : rootNode->propertyValuePairs)
stream << pair.first << " = " << pair.second->value << ";" << std::endl;
stream << pair.first << " = " << pair.second->value << ";\n";

if (!rootNode->propertyValuePairs.empty() && !rootNode->children.empty())
stream << std::endl;
stream << '\n';

std::vector<String> output;
for (std::size_t i = 0; i < rootNode->children.size(); ++i)
Expand All @@ -593,7 +593,7 @@ namespace tgui
}

for (const auto& line : output)
stream << line << std::endl;
stream << line << '\n';
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 0 additions & 1 deletion src/Loading/Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <TGUI/Loading/DataIO.hpp>
#include <TGUI/Renderers/WidgetRenderer.hpp>
#include <TGUI/Backend/Window/Backend.hpp>
#include <TGUI/Backend/Font/BackendFont.hpp>
#include <TGUI/Global.hpp>

#include <cstdint>
Expand Down
2 changes: 0 additions & 2 deletions src/Loading/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <TGUI/Loading/Theme.hpp>
#include <TGUI/Loading/Serializer.hpp>
#include <TGUI/Widget.hpp>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -585,7 +584,6 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Theme::Theme(const Theme& other) :
m_renderers {},
m_globalProperties{other.m_globalProperties},
m_primary {other.m_primary}
{
Expand Down
1 change: 0 additions & 1 deletion src/Loading/ThemeLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <TGUI/Loading/WidgetFactory.hpp>

#include <sstream>
#include <fstream>

// Ignore warning "C4503: decorated name length exceeded, name was truncated" in Visual Studio
#if defined _MSC_VER
Expand Down
1 change: 0 additions & 1 deletion src/Renderers/BoxLayoutRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <TGUI/Renderers/BoxLayoutRenderer.hpp>
#include <TGUI/RendererDefines.hpp>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions src/Signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ namespace tgui

Signal::Signal(const Signal& other) :
m_enabled {other.m_enabled},
m_name {other.m_name},
m_handlers{} // signal handlers are not copied with the widget
m_name {other.m_name}
// signal handlers are not copied with the widget
{
}

Expand Down
3 changes: 2 additions & 1 deletion src/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ namespace tgui
}
else // When the delimeter is empty, each character is put in its own part
{
substrings.reserve(m_string.size());
for (const char32_t c : m_string)
substrings.push_back(c);
substrings.emplace_back(c);
}

if (trim)
Expand Down
3 changes: 0 additions & 3 deletions src/Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,13 @@ namespace tgui
m_scaleOrigin {other.m_scaleOrigin},
m_scaleFactors {other.m_scaleFactors},
m_rotationDeg {other.m_rotationDeg},
m_boundPositionLayouts {},
m_boundSizeLayouts {},
m_enabled {other.m_enabled},
m_visible {other.m_visible},
m_parent {nullptr},
m_parentGui {nullptr},
m_containerWidget {other.m_containerWidget},
m_toolTip {other.m_toolTip ? other.m_toolTip->clone() : nullptr},
m_renderer {other.m_renderer},
m_showAnimations {},
m_userData {other.m_userData},
m_mouseCursor {other.m_mouseCursor},
m_autoLayout {other.m_autoLayout},
Expand Down
1 change: 0 additions & 1 deletion src/Widgets/BoxLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <TGUI/Widgets/BoxLayout.hpp>
#include <TGUI/Widgets/ClickableWidget.hpp>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
12 changes: 2 additions & 10 deletions src/Widgets/ButtonBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,8 @@ namespace tgui
m_textOrigin {other.m_textOrigin},
background {other.background},
text {other.text},
m_stylePropertiesNames {},
m_stylePropertiesGlobalNames {},
m_namedComponents {},
m_backgroundComponent {std::make_shared<priv::dev::BackgroundComponent>(*other.m_backgroundComponent, &background)},
m_textComponent {std::make_shared<priv::dev::TextComponent>(*other.m_textComponent, &text)},
m_components {}
m_textComponent {std::make_shared<priv::dev::TextComponent>(*other.m_textComponent, &text)}
{
ButtonBase::initComponents();
}
Expand All @@ -87,12 +83,8 @@ namespace tgui
m_textOrigin {std::move(other.m_textOrigin)},
background {std::move(other.background)},
text {std::move(other.text)},
m_stylePropertiesNames {},
m_stylePropertiesGlobalNames {},
m_namedComponents {},
m_backgroundComponent {std::make_shared<priv::dev::BackgroundComponent>(*other.m_backgroundComponent, &background)},
m_textComponent {std::make_shared<priv::dev::TextComponent>(*other.m_textComponent, &text)},
m_components {}
m_textComponent {std::make_shared<priv::dev::TextComponent>(*other.m_textComponent, &text)}
{
ButtonBase::initComponents();
}
Expand Down
1 change: 0 additions & 1 deletion src/Widgets/EditBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <TGUI/Widgets/EditBox.hpp>
#include <TGUI/Container.hpp>
#include <TGUI/Keyboard.hpp>

#include <algorithm>
Expand Down
9 changes: 1 addition & 8 deletions src/Widgets/Grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ namespace tgui

Grid::Grid(const Grid& gridToCopy) :
Container {gridToCopy},
m_autoSize {gridToCopy.m_autoSize},
m_gridWidgets {},
m_objPadding {},
m_objAlignment{},
m_rowHeight {},
m_columnWidth {},
m_widgetCells {},
m_connectedSizeCallbacks{}
m_autoSize {gridToCopy.m_autoSize}
{
for (std::size_t i = 0; i < m_widgets.size(); ++i)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Widgets/GrowHorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GrowHorizontalLayout::GrowHorizontalLayout(const GrowHorizontalLayout& other) :
BoxLayout {other},
m_widgetLayouts{}
BoxLayout {other}
{
GrowHorizontalLayout::updateWidgets();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GrowHorizontalLayout::GrowHorizontalLayout(GrowHorizontalLayout&& other) noexcept :
BoxLayout {std::move(other)},
m_widgetLayouts{}
BoxLayout {std::move(other)}
{
GrowHorizontalLayout::updateWidgets();
}
Expand Down
6 changes: 2 additions & 4 deletions src/Widgets/GrowVerticalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GrowVerticalLayout::GrowVerticalLayout(const GrowVerticalLayout& other) :
BoxLayout {other},
m_widgetLayouts{}
BoxLayout {other}
{
GrowVerticalLayout::updateWidgets();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GrowVerticalLayout::GrowVerticalLayout(GrowVerticalLayout&& other) noexcept :
BoxLayout {std::move(other)},
m_widgetLayouts{}
BoxLayout {std::move(other)}
{
GrowVerticalLayout::updateWidgets();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ namespace tgui

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Label::setText(const String& string)
void Label::setText(const String& text)
{
m_string = string;
m_string = text;
rearrangeText();
}

Expand Down
9 changes: 2 additions & 7 deletions src/Widgets/ListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2479,13 +2479,8 @@ namespace tgui
if (m_columns.empty() || m_expandLastColumn)
return true;

for (const auto& column : m_columns)
{
if (column.expanded)
return true;
}

return false;
return std::any_of(m_columns.cbegin(), m_columns.cend(),
[](const auto& column) { return column.expanded; });
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading