Skip to content

Instantly share code, notes, and snippets.

@santa4nt
Created June 2, 2015 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santa4nt/a1d8aaf072a36658d960 to your computer and use it in GitHub Desktop.
Save santa4nt/a1d8aaf072a36658d960 to your computer and use it in GitHub Desktop.
Sample SFML app (Linux-based)
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "Sample SFML");
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;
}
CXX = g++ -std=c++11
LIBS = -lsfml-graphics -lsfml-window -lsfml-system
all: sample-sfml-app
%.o: %.cpp
$(CXX) -c $< -o $@
%.o: %.hpp
$(CXX) -c $< -o $@
sample-sfml-app: main.o
@echo "** Building the game"
$(CXX) -o sample-sfml-app main.o $(LIBS)
clean:
@echo "** Removing object files and executable..."
rm -f sample-sfml-app *.o
.PHONY: all clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment