aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksa Vučković <aleksav013@gmail.com>2022-01-19 22:31:38 +0100
committerAleksa Vučković <aleksav013@gmail.com>2022-01-19 22:31:38 +0100
commitf45bfee860577b244a9a9f01df0d1e34f2c148df (patch)
tree0d82c6b0d8c86d754686f858b221f328a254844d
parent6a3903cc8935adf774ba0c141fe757911be226d6 (diff)
Makefile updateHEADmaster
-rw-r--r--.gitignore2
-rw-r--r--Makefile30
-rw-r--r--README.md2
-rw-r--r--src/State.cpp2
4 files changed, 23 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index a1556de..80f7cac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
sfml-rpg
-*.o
+build
*.out
*.exe
diff --git a/Makefile b/Makefile
index a93df76..05f2fed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,35 @@
+RM = rm -f
+MKDIR = mkdir -p
+
CXX = g++
-CXXFLAGS = --std=c++14 -g -O0 -Wall
+CXXFLAGS = --std=c++14 -O3 -Wall
LDLIBS = -lsfml-graphics -lsfml-window -lsfml-system
-SOURCE_DIR = src/
-OBJECTS_DIR= obj/
+SOURCE_DIR = src
+OBJECT_DIR= build
OBJS = main.o State.o Game.o Global.o Enemy1.o Enemy2.o Enemy3.o Powerup.o Entity.o Player.o
-OBJECTS = $(addprefix $(OBJECTS_DIR),$(OBJS))
+OBJECTS = $(addprefix $(OBJECT_DIR)/,$(OBJS))
TARGET = sfml-rpg
-all: $(TARGET)
+.PHONY: all compile clean
+
+all: compile
+
+$(OBJECT_DIR)/%.o: $(SOURCE_DIR)/%.cpp
+ $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
$(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $(TARGET) $(LDLIBS)
-$(OBJECTS_DIR)%.o: $(SOURCE_DIR)%.cpp
- $(MKDIR_P) $(dir $@)
- $(CXX) $(CXXFLAGS) -c $< -o $@
+compile:
+ $(MKDIR) $(OBJECT_DIR)
+ $(MAKE) $(TARGET)
+
+run: compile
+ ./$(TARGET)
clean:
$(RM) $(OBJECTS) sfml-rpg
-RM = rm -f
-MKDIR_P = mkdir -p
+-include $(OBJECTS:.o=.d)
diff --git a/README.md b/README.md
index 0173ee1..430227c 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ make
- Install [mingw-w64](http://mingw-w64.org/doku.php/download/mingw-builds)
- Add mingw64\bin to $PATH
```
-g++ -std=c++14 -g -O2 -Wall -o sfml-rpg *.cpp -I SFML-2.5.1\include -L SFML-2.5.1\lib -lsfml-graphics -lsfml-window -lsfml-system
+g++ -std=c++14 -g -O2 -Wall -o sfml-rpg src\*.cpp -I SFML-2.5.1\include -L SFML-2.5.1\lib -lsfml-graphics -lsfml-window -lsfml-system
```
Or just use Linux
> If you use Visual Studio or Code::Blocks you can follow [official tutorial](https://www.sfml-dev.org/tutorials) for setting up SFML.
diff --git a/src/State.cpp b/src/State.cpp
index 9e20035..077a195 100644
--- a/src/State.cpp
+++ b/src/State.cpp
@@ -11,7 +11,7 @@ State::State()
}
void State::initwin()
{
- prozor=std::make_shared<sf::RenderWindow>(sf::VideoMode::getFullscreenModes()[0],"RPG igra",sf::Style::Fullscreen);
+ prozor=std::make_shared<sf::RenderWindow>(sf::VideoMode::getFullscreenModes()[0],"RPG igra",sf::Style::Default);
prozor->setVerticalSyncEnabled(true);
visina=prozor->getSize().y;
sirina=prozor->getSize().x;