Fix errors and warnings in templates

This commit is contained in:
vittorioromeo 2023-04-24 01:20:35 +02:00 committed by Vittorio Romeo
parent 5480bf8a93
commit 2af0ba66f1
2 changed files with 8 additions and 8 deletions

View File

@ -20,22 +20,22 @@
// Here is a small helper for you! Have a look.
#include "ResourcePath.hpp"
int main(int, char const**)
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML window");
// Set the Icon
sf::Image icon;
if (!icon.loadFromFile(resourcePath() + "icon.png"))
if (!icon.loadFromFile(resourcePath() / "icon.png"))
{
return EXIT_FAILURE;
}
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
window.setIcon(icon);
// Load a sprite to display
sf::Texture texture;
if (!texture.loadFromFile(resourcePath() + "background.jpg"))
if (!texture.loadFromFile(resourcePath() / "background.jpg"))
{
return EXIT_FAILURE;
}
@ -43,7 +43,7 @@ int main(int, char const**)
// Create a graphical text to display
sf::Font font;
if (!font.loadFromFile(resourcePath() + "tuffy.ttf"))
if (!font.loadFromFile(resourcePath() / "tuffy.ttf"))
{
return EXIT_FAILURE;
}
@ -52,7 +52,7 @@ int main(int, char const**)
// Load a music to play
sf::Music music;
if (!music.openFromFile(resourcePath() + "doodle_pop.ogg"))
if (!music.openFromFile(resourcePath() / "doodle_pop.ogg"))
{
return EXIT_FAILURE;
}

View File

@ -18,7 +18,7 @@
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main(int argc, char const** argv)
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML window");
@ -29,7 +29,7 @@ int main(int argc, char const** argv)
{
return EXIT_FAILURE;
}
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
window.setIcon(icon);
// Load a sprite to display
sf::Texture texture;