commit dbb69dd80e91be8e66d3707b405c9e2951d6db51 Author: Sheldon Lee Date: Thu Mar 30 23:36:54 2023 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4df700a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# ignore binaries +obj +main diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..dff85e8 --- /dev/null +++ b/main.cpp @@ -0,0 +1,26 @@ +#include +#include + +int main() +{ + sf::Uint32 style = sf::Style::Titlebar; + sf::RenderWindow window(sf::VideoMode(1600, 900), "SFML works!", style); + sf::CircleShape shape(450.f); + shape.setFillColor(sf::Color::Green); + + printf("Hello meme!\n"); + + 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; +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..c3e2bf4 --- /dev/null +++ b/makefile @@ -0,0 +1,28 @@ +TARGET = main + +CC = g++ + +OBJD = obj +SRCS := $(wildcard *.cpp) +OBJS := $(SRCS:%.cpp=$(OBJD)/%.o) + +CCFLAGS = -Wall +LDFLAGS = -lsfml-graphics -lsfml-window -lsfml-system + +.PHONY: all run clean + +all: $(TARGET) $(OBJD) + +$(TARGET): $(OBJS) + $(CC) $^ -o $(TARGET) $(LDFLAGS) $(CCFLAGS) + +$(OBJS): $(OBJD)/%.o: %.cpp + mkdir -p $(@D) + $(CC) -c $? -o $@ $(CCFLAGS) + +clean: + rm -r $(TARGET) $(OBJD) + +run: + ./$(TARGET) +