We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
获取已构建好的发布包 (SFML 3 SDK)
https://artifacts.sfml-dev.org/by-branch/master/macos-clang-arm64.tar.gz
mkdir sfml-macos-arm64 # 用 --strip-components 跳过第一级目录名,因为它名字真的很丑 tar xf macos-clang-arm64.tar.gz -C sfml-macos-arm64 --strip-components 1 cd sfml-macos-arm64 sudo rsync -a Library/Frameworks/*.framework /Library/Frameworks sudo rsync -a Library/Frameworks/lib/*.framework /Library/Frameworks sudo rsync -a Library/Frameworks/lib/*.dylib /usr/local/lib sudo rsync -a Library/Frameworks/include/SFML /usr/local/include
创建一个 main.cpp 文件
#include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(sf::Vector2u(200, 200)), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) { window.close(); } } window.clear(); window.draw(shape); window.display(); } return 0; }
g++ -std=c++17 -c main.cpp -I/usr/local/include g++ main.o -o sfml -lsfml-network -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system ./sfml
运行结果:
因为 Apple 麻烦的安全机制,需要自行在系统的 “Privacy & Security” 设置中允许依赖库的运行。
The text was updated successfully, but these errors were encountered:
当前 master 分支是 SFML 3, API 有改动,并且教程不多。
为了运行官方教程中的例子,选用 2.6.x 分支的 SDK
https://artifacts.sfml-dev.org/by-branch/2.6.x/macos-clang-arm64.tar.gz
相应地测试代码改成
#include <SFML/Graphics.hpp> int main() { sf::RenderWindow window({200, 200}, "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) { window.close(); } } window.clear(); window.draw(shape); window.display(); } return 0; }
Sorry, something went wrong.
No branches or pull requests
准备
获取已构建好的发布包 (SFML 3 SDK)
https://artifacts.sfml-dev.org/by-branch/master/macos-clang-arm64.tar.gz
配置
测试
创建一个 main.cpp 文件
运行结果:
参考
The text was updated successfully, but these errors were encountered: