I am on an M1 Macbook if that changes anything. I am using SFML 2.5.1 also. Here is what the code looks like:
// Include important libraries here
#include <SFML/Graphics.hpp>
// Make code easier to type with "using namespace"
using namespace sf;
// This is where our game starts from
int main()
{
// Create a video mode object
VideoMode vm(1920, 1080);
// Create and open a window for the game
RenderWindow window(vm, "Timber!!!", Style::Fullscreen);
while (window.isOpen())
{
// Handle the players input
if (Keyboard::isKeyPressed(Keyboard::Escape))
{
window.close();
}
// Update the scene
// Draw the scene
// Clear everything from the last scene
window.clear();
// Draw our game scene here
// Show everything we just drew
window.display();
}
return 0;
}
However, when I run this, no window opens and I get multiple warnings. Now I have no idea if these warning have anything to do with the window not opening, but I thought I would include that detail.
The warnings I receive are as follows:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window/Keyboard.hpp:161:41: Declaration is marked with '\deprecated' command but does not have a deprecation attribute
/Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:32:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:32:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window.hpp:37:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window.hpp:37:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window/Event.hpp:33:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window/Event.hpp:33:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window/Event.hpp:105:10: Declaration is marked with '\deprecated' command but does not have a deprecation attribute
/Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:32:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:32:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window.hpp:37:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Window.hpp:37:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/PrimitiveType.hpp:52:43: Declaration is marked with '\deprecated' command but does not have a deprecation attribute
/Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/Timber/Timber/main.cpp:9:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:34:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics.hpp:34:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/CircleShape.hpp:32:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/CircleShape.hpp:32:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/Shape.hpp:34:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/Shape.hpp:34:
/Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/VertexArray.hpp:33:10: in file included from /Users/charlescreighton/Desktop/stuff/xcode_projects/External Libraries/SFML/include/SFML/Graphics/VertexArray.hpp:33:
And if that is confusing, here is an image of the warnings:
When I click on the 3 warnings to see where they appear, this is what it shows:
First warning location:
Second warning location:
Third warning location: