Fixed some warnings
parent
0f3380c755
commit
00836be5e1
|
@ -51,7 +51,7 @@ int main()
|
|||
|
||||
auto menu = tgui::MenuBar::create();
|
||||
menu->setRenderer(theme.getRenderer("MenuBar"));
|
||||
menu->setSize((float)window.getSize().x, 22.f);
|
||||
menu->setSize(static_cast<float>(window.getSize().x), 22.f);
|
||||
menu->addMenu("File");
|
||||
menu->addMenuItem("Load");
|
||||
menu->addMenuItem("Save");
|
||||
|
|
|
@ -97,7 +97,7 @@ int main()
|
|||
// When the window is resized, the view is changed
|
||||
else if (event.type == sf::Event::Resized)
|
||||
{
|
||||
window.setView(sf::View(sf::FloatRect(0, 0, (float)event.size.width, (float)event.size.height)));
|
||||
window.setView(sf::View(sf::FloatRect(0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height))));
|
||||
gui.setView(window.getView());
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ struct ComboBoxProperties : WidgetProperties
|
|||
comboBox->addItem(item);
|
||||
}
|
||||
else if (property == "SelectedItemIndex")
|
||||
comboBox->setSelectedItemByIndex(tgui::stoi(value));
|
||||
comboBox->setSelectedItemByIndex(static_cast<std::size_t>(tgui::stoi(value)));
|
||||
else if (property == "TextSize")
|
||||
comboBox->setTextSize(static_cast<unsigned int>(tgui::stoi(value)));
|
||||
else if (property == "MaximumItems")
|
||||
|
|
|
@ -45,7 +45,7 @@ struct ListBoxProperties : WidgetProperties
|
|||
listBox->addItem(item);
|
||||
}
|
||||
else if (property == "SelectedItemIndex")
|
||||
listBox->setSelectedItemByIndex(tgui::stoi(value));
|
||||
listBox->setSelectedItemByIndex(static_cast<std::size_t>(tgui::stoi(value)));
|
||||
else if (property == "ItemHeight")
|
||||
listBox->setItemHeight(static_cast<unsigned int>(tgui::stoi(value)));
|
||||
else if (property == "TextSize")
|
||||
|
|
|
@ -35,11 +35,11 @@ struct SpinButtonProperties : WidgetProperties
|
|||
{
|
||||
auto spinButton = std::dynamic_pointer_cast<tgui::SpinButton>(widget);
|
||||
if (property == "Minimum")
|
||||
spinButton->setMinimum(tgui::stoi(value));
|
||||
spinButton->setMinimum(tgui::stof(value));
|
||||
else if (property == "Maximum")
|
||||
spinButton->setMaximum(tgui::stoi(value));
|
||||
spinButton->setMaximum(tgui::stof(value));
|
||||
else if (property == "Value")
|
||||
spinButton->setValue(tgui::stoi(value));
|
||||
spinButton->setValue(tgui::stof(value));
|
||||
else
|
||||
WidgetProperties::updateProperty(widget, property, value);
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ void Form::importLoadedWidgets(tgui::Container::Ptr parent)
|
|||
{
|
||||
const std::string potentialNumber = widgetNames[i].substring(6);
|
||||
if (std::all_of(potentialNumber.begin(), potentialNumber.end(), ::isdigit))
|
||||
m_idCounter = std::max<unsigned int>(m_idCounter, tgui::stoi(potentialNumber));
|
||||
m_idCounter = std::max(m_idCounter, static_cast<unsigned int>(tgui::stoi(potentialNumber)));
|
||||
}
|
||||
|
||||
if (widgets[i]->isContainer())
|
||||
|
|
|
@ -286,7 +286,7 @@ void GuiBuilder::mainLoop()
|
|||
}
|
||||
else if (event.type == sf::Event::Resized)
|
||||
{
|
||||
m_window.setView(sf::View({0, 0, (float)event.size.width, (float)event.size.height}));
|
||||
m_window.setView(sf::View({0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height)}));
|
||||
m_gui.setView(m_window.getView());
|
||||
}
|
||||
else if (event.type == sf::Event::MouseButtonReleased)
|
||||
|
@ -402,7 +402,7 @@ void GuiBuilder::closeForm(Form* form)
|
|||
}
|
||||
else if (event.type == sf::Event::Resized)
|
||||
{
|
||||
m_window.setView(sf::View({0, 0, (float)event.size.width, (float)event.size.height}));
|
||||
m_window.setView(sf::View({0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height)}));
|
||||
m_gui.setView(m_window.getView());
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace tgui
|
|||
const unsigned int textSize = m_text.getCharacterSize();
|
||||
for (std::size_t i = 0; i < string.getSize(); ++i)
|
||||
{
|
||||
const float kerning = static_cast<float>(font->getKerning(prevChar, string[i], textSize));
|
||||
const float kerning = font->getKerning(prevChar, string[i], textSize);
|
||||
if (string[i] == '\n')
|
||||
{
|
||||
maxWidth = std::max(maxWidth, width);
|
||||
|
|
|
@ -1237,7 +1237,7 @@ namespace tgui
|
|||
else
|
||||
charWidth = static_cast<float>(m_fontCached.getGlyph(curChar, textSize, bold).advance);
|
||||
|
||||
const float kerning = static_cast<float>(m_fontCached.getKerning(prevChar, curChar, textSize));
|
||||
const float kerning = m_fontCached.getKerning(prevChar, curChar, textSize);
|
||||
if (width + charWidth < posX)
|
||||
width += charWidth + kerning;
|
||||
else
|
||||
|
|
|
@ -408,7 +408,7 @@ namespace tgui
|
|||
if (compareFloats(m_angle, m_startRotation))
|
||||
setValue(m_minimum);
|
||||
else
|
||||
setValue(static_cast<int>((((360.0 - m_angle) + m_startRotation) / allowedAngle * (m_maximum - m_minimum)) + m_minimum));
|
||||
setValue(static_cast<int>((((360.0f - m_angle) + m_startRotation) / allowedAngle * (m_maximum - m_minimum)) + m_minimum));
|
||||
}
|
||||
}
|
||||
else // counter-clockwise
|
||||
|
@ -417,7 +417,7 @@ namespace tgui
|
|||
setValue(static_cast<int>(((m_angle - m_startRotation) / allowedAngle * (m_maximum - m_minimum)) + m_minimum));
|
||||
else
|
||||
{
|
||||
setValue(static_cast<int>(((m_angle + (360.0 - m_startRotation)) / allowedAngle * (m_maximum - m_minimum)) + m_minimum));
|
||||
setValue(static_cast<int>(((m_angle + (360.0f - m_startRotation)) / allowedAngle * (m_maximum - m_minimum)) + m_minimum));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ namespace tgui
|
|||
{
|
||||
Vector2f textTranslation = (getInnerSize() - m_textBack.getSize()) / 2.f;
|
||||
|
||||
if (Color(m_textBack.getColor()) == Color(m_textFront.getColor()))
|
||||
if (m_textBack.getColor() == m_textFront.getColor())
|
||||
{
|
||||
states.transform.translate(textTranslation);
|
||||
m_textBack.draw(target, states);
|
||||
|
|
|
@ -1025,7 +1025,7 @@ namespace tgui
|
|||
else
|
||||
charWidth = static_cast<float>(m_fontCached.getGlyph(curChar, getTextSize(), false).advance);
|
||||
|
||||
const float kerning = static_cast<float>(m_fontCached.getKerning(prevChar, curChar, getTextSize()));
|
||||
const float kerning = m_fontCached.getKerning(prevChar, curChar, getTextSize());
|
||||
if (width + charWidth + kerning <= position.x)
|
||||
width += charWidth + kerning;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue