-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
build | ||
lib | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,88 @@ | ||
CC := g++ | ||
APP_NAME := Dungeon-Game | ||
VERSION := 0.0.1 | ||
PLATFORM ?= linux | ||
|
||
EXEC := debug | ||
BUILD_DIR := build | ||
BUILD_DIR = build/$(PLATFORM) | ||
SRC_DIR := src | ||
LIB_DIR := lib | ||
RES_DIR := res | ||
|
||
LIBRARIES := -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio | ||
WIN64_SFML_URL := https://www.sfml-dev.org/files/SFML-2.6.1-windows-gcc-13.1.0-mingw-64-bit.zip | ||
WIN64_SFML_VER := 2.6.1 | ||
WIN64_SFML_DIR := $(LIB_DIR)/SFML-$(WIN64_SFML_VER) | ||
|
||
OPTIONS := -Wall -O3 | ||
ifeq ($(PLATFORM), linux) | ||
TARGET := $(BUILD_DIR)/$(APP_NAME) | ||
CXX := g++ | ||
CXXFLAGS := $(shell pkg-config --cflags sfml-all) | ||
LDFLAGS := $(shell pkg-config --libs sfml-all) | ||
|
||
SOURCES := $(shell find src -name '*.cpp') | ||
OBJECTS := $(SOURCES:.cpp=.o) | ||
DEPENDS := $(SOURCES:.cpp=.d) | ||
else ifeq ($(PLATFORM), win64) | ||
TARGET := $(BUILD_DIR)/$(APP_NAME).exe | ||
CXX := x86_64-w64-mingw32-g++ | ||
CXXFLAGS := -I $(WIN64_SFML_DIR)/include -DSFML_STATIC | ||
LDFLAGS := -L $(WIN64_SFML_DIR)/lib -lsfml-graphics-s -lsfml-window-s -lsfml-audio-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -lopenal32 -lFLAC -lvorbisenc -lvorbisfile -lvorbis -logg -lfreetype -mwindows --static | ||
BUILD_DEP := $(WIN64_SFML_DIR) | ||
|
||
.PHONY: all clean audio | ||
else | ||
$(error Unsupported platform: $(PLATFORM)) | ||
|
||
all: $(BUILD_DIR)/$(EXEC) | ||
endif | ||
|
||
$(BUILD_DIR)/$(EXEC): $(OBJECTS) | ||
@mkdir -p $(BUILD_DIR) | ||
$(CC) $(OPTIONS) $^ -o $@ $(LIBRARIES) | ||
SOURCES := $(shell find $(SRC_DIR) -name '*.cpp') | ||
OBJECTS = $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SOURCES)) | ||
DEPENDS = $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.d,$(SOURCES)) | ||
|
||
-include $(DEPENDS) | ||
.PHONY: all run release clean | ||
|
||
%.o : %.cpp Makefile | ||
$(CC) -MMD -MP -c $< -o $@ | ||
all: $(TARGET) | ||
|
||
clean: | ||
rm -f $(BUILD_DIR)/$(EXEC) | ||
rm -f $(OBJECTS) | ||
rm -f $(DEPENDS) | ||
-include $(DEPENDS) | ||
|
||
audio: | ||
rm -f res/sfx.wav | ||
find res/sfx/* | sed "s/.*/file \'&\'/" > audiolist | ||
ffmpeg -f concat -safe 0 -i audiolist -c copy res/sfx.wav | ||
@rm audiolist | ||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(BUILD_DEP) | ||
@mkdir -p $(dir $@) | ||
$(CXX) -MMD -MP -c $< -o $@ $(CXXFLAGS) | ||
|
||
$(TARGET): $(OBJECTS) | ||
$(CXX) -o $@ $^ $(LDFLAGS) | ||
|
||
$(WIN64_SFML_DIR): | ||
@echo "Downloading SFML..." | ||
@wget -O sfml.zip $(WIN64_SFML_URL) | ||
@echo "Extracting SFML..." | ||
@unzip -q sfml.zip -d $(LIB_DIR) | ||
@rm sfml.zip | ||
|
||
# Run in Fullscreen | ||
run: | ||
$(BUILD_DIR)/$(EXEC) | ||
run: $(TARGET) | ||
ifeq ($(PLATFORM), linux) | ||
./$(TARGET) | ||
endif | ||
|
||
# Run windowed | ||
runw: | ||
$(BUILD_DIR)/$(EXEC) w | ||
runw: $(TARGET) | ||
ifeq ($(PLATFORM), linux) | ||
./$(TARGET) w | ||
endif | ||
|
||
release: $(TARGET) | ||
@mkdir -p release | ||
@cp $(TARGET) release/ | ||
@cp -r $(RES_DIR) release/ | ||
ifeq ($(PLATFORM), linux) | ||
@tar -czvf release/$(APP_NAME)-$(VERSION).tar.gz -C release $(notdir $(TARGET)) $(RES_DIR) | ||
else ifeq ($(PLATFORM), win64) | ||
@cd release && zip -r $(APP_NAME)-$(VERSION).zip $(notdir $(TARGET)) $(RES_DIR) | ||
endif | ||
@rm release/$(notdir $(TARGET)) | ||
@rm -rf release/$(RES_DIR) | ||
|
||
clean: | ||
@rm -rf build/* | ||
@rm -rf lib/* | ||
@rm -rf release/* | ||
|
||
audio: | ||
rm -f res/sfx.wav | ||
find res/sfx/* | sed "s/.*/file \'&\'/" > /tmp/audiolist | ||
ffmpeg -f concat -safe 0 -i /tmp/audiolist -c copy res/sfx.wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
# Dungeon-game | ||
Dungeon style game made with sfml | ||
|
||
## Dependecies | ||
g++\ | ||
Make\ | ||
Sfml | ||
## Building | ||
|
||
## Screenshots | ||
### Dependecies | ||
- g++ | ||
- Make | ||
- Sfml-lib | ||
- MinGW (for building Windows exe) | ||
|
||
### Linux | ||
After installing the `sfml` package for your distribution, the application can be compiled with the `make` command. | ||
|
||
### Windows (For Windows on Linux) | ||
After installing the `MinGW` set of compilers, a release can be built using the `make release PLATFORM=win64` command. Note that the first time this command is executed, it will download the MinGW version of SFML from the internet. | ||
|
||
## Usage | ||
### Linux | ||
After compiling, the application can be started using `make run`. | ||
|
||
![Death screen](https://github.com/SharkAce/Dungeon-game/blob/main/screenshots/2024-06-12_16.png?raw=true) | ||
### Windows | ||
A Windows release can be extracted and then launched by executing the `Dungeon-Game.exe`. | ||
|
||
## Screenshots | ||
![Tutorial screen](https://github.com/SharkAce/Dungeon-game/blob/main/screenshots/2024-06-12_18.png?raw=true) | ||
![End screen](https://github.com/SharkAce/Dungeon-game/blob/main/screenshots/2024-06-12_18-2.png?raw=true) | ||
|
||
## Credit | ||
Sprites : https://0x72.itch.io/16x16-dungeon-tileset \ | ||
Font : https://www.1001fonts.com/arcadeclassic-font.html \ | ||
Music : https://www.pond5.com/royalty-free-music/item/33253562-dungeon | ||
|
||
- Sprites : https://0x72.itch.io/16x16-dungeon-tileset \ | ||
- Font : https://www.1001fonts.com/arcadeclassic-font.html \ | ||
- Music : https://www.pond5.com/royalty-free-music/item/33253562-dungeon |