goblinhack / zorbash Goto Github PK
View Code? Open in Web Editor NEWAn ascii and/or pixelart roguelike.
License: GNU General Public License v3.0
An ascii and/or pixelart roguelike.
License: GNU General Public License v3.0
Suggestions for improving your current Makefiles (1 small, 1 big):
Here's a sample makefile I created to replace the one generated in src/ (forgive the weird formatting):
COMPILER_FLAGS = -I/usr/include/SDL2 -I/usr/include/python3.9 -DMYVER=\"0.0.4\" -DPYVER=\"3.9\" -O3
CLANG_COMPILER_WARNINGS = -Wall -std=c++2a
GCC_COMPILER_WARNINGS = -x c++ -Wall -std=c++2a
LDFLAGS = -rdynamic
COMPILER_WARNINGS = $(CLANG_COMPILER_WARNINGS)
CC = clang++
EXE =
DSYM =
LDLIBS = -pthread -lSDL2 -lSDL2_mixer -lSDL2_ttf -L/usr/lib64 -lpython3.9 -lcrypt -lpthread -ldl -lutil -lm -lm -lGL
CFLAGS = $(COMPILER_FLAGS) $(COMPILER_WARNINGS)
NAME = zorbash-game
OBJDIR = .build
TARGET_GAME = $(NAME)$(EXE)
.PHONY: all
all: $(TARGET_GAME)
GAME_SOURCE := $(wildcard *.cpp) $(wildcard *.S)
GAME_OBJECTS :=\
$(addprefix $(OBJDIR)/,$(addsuffix .o,$(basename $(GAME_SOURCE))))
DEP_FILES := $(patsubst %.o,%.d,$(GAME_OBJECTS))
DEP_FLAGS = -MMD -MP
$(OBJDIR): ; mkdir -p $(OBJDIR)
$(GAME_OBJECTS): | $(OBJDIR)
$(OBJDIR)/%.o: %.cpp
<tab>$(CC) $(EXTRA_CFLAGS) $(CFLAGS) $(DEP_FLAGS) -c -o $@ $<
$(OBJDIR)/%.o: %.S
<tab>$(CC) $(DEP_FLAGS) -c -o $@ $<
# link
$(TARGET_GAME): $(GAME_OBJECTS)
<tab>$(CC) $(LDFLAGS) $(GAME_OBJECTS) $(LDLIBS) -o $@
# format/clean/clobber
.PHONY: format clean clobber
format:
<tab>clang-format -i *cpp *hpp
clean:
<tab>rm -f ../$(TARGET_GAME) ../stdout.txt ../stderr.txt
<tab>rm -f $(TARGET_GAME) stdout.txt stderr.txt
<tab>rm -rf $(OBJDIR)
clobber: clean
<tab>rm -rf $(OBJDIR)
<tab>mkdir -p $(OBJDIR)
# delete corresponding object file if dependency file needs regeneration
$(OBJDIR)/%.d: ; @rm -f "$(@:.d=.o)"
# include all dependency files
-include $(DEP_FILES)
Change summary:
Hello - I found your project while doing a search for C++ roguelikes. Seems very interesting!
Anyways, I managed to build it on my Fedora 34 system but I did run into a few small issues:
I upgraded my system to Fedora 35 and its newer python version uncovered some minor issues.
Good day ...
The program doesn't finish the compilation, because I can't find the SDL2 [Maybe] library (which I have in its version 2.0.9), the problem is probably due in part to me, since I have compiled both SDL and SDL2, so the program [probably] won't be able to determine exactly which library to use.
Thanks ....
I recently upgraded to Fedora 37 (which includes python 3.11) and now get the following compile warnings & errors:
clang++ -I/usr/include/SDL2 -I/usr/include/python3.11 -include config.h -O3 -Wall -std=c++2a -MMD -MP -c -o .build/py_ttf.o py_ttf.cpp
python.cpp:118:3: warning: 'PySys_SetPath' is deprecated [-Wdeprecated-declarations]
PySys_SetPath(wc_new_path);
^
/usr/include/python3.11/sysmodule.h:15:1: note: 'PySys_SetPath' has been explicitly marked deprecated here
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
^
/usr/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
clang++ -I/usr/include/SDL2 -I/usr/include/python3.11 -include config.h -O3 -Wall -std=c++2a -MMD -MP -c -o .build/random_name.o random_name.cpp
python_log.cpp:173:25: error: no member named 'frame' in '_ts'; did you mean 'cframe'?
if (tstate && tstate->frame) {
^~~~~
cframe
/usr/include/python3.11/cpython/pystate.h:110:16: note: 'cframe' declared here
_PyCFrame *cframe;
^
python_log.cpp:174:36: error: no member named 'frame' in '_ts'
PyFrameObject *frame = tstate->frame;
~~~~~~ ^
python_log.cpp:179:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
int line = frame->f_lineno;
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:180:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
char *filename = py_obj_to_string(frame->f_code->co_filename);
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:181:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
char *funcname = py_obj_to_string(frame->f_code->co_name);
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:183:20: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
frame = frame->f_back;
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:200:25: error: no member named 'frame' in '_ts'; did you mean 'cframe'?
if (tstate && tstate->frame) {
^~~~~
cframe
/usr/include/python3.11/cpython/pystate.h:110:16: note: 'cframe' declared here
_PyCFrame *cframe;
^
python_log.cpp:201:36: error: no member named 'frame' in '_ts'
PyFrameObject *frame = tstate->frame;
~~~~~~ ^
python_log.cpp:208:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
int line = frame->f_lineno;
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:209:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
char *filename = py_obj_to_string(frame->f_code->co_filename);
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:210:46: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
char *funcname = py_obj_to_string(frame->f_code->co_name);
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
python_log.cpp:212:20: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
frame = frame->f_back;
^
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
typedef struct _frame PyFrameObject;
^
Are you accepting pull requests? I have some fixes for compile errors & warnings I found when I upgraded to gcc 12 (which includes libstdc++)
Here's my 'git diff' output in case you would rather handle the fixes yourself:
diff --git a/src/my_range.hpp b/src/my_range.hpp
index 51a9f711b..b2dba9abd 100644
--- a/src/my_range.hpp
+++ b/src/my_range.hpp
@@ -5,6 +5,8 @@
#pragma once
#include
+#include
+#include
//
// Create a vector of numbers
@@ -27,8 +29,6 @@ template < class T > std::vector< T > make_range(T start, T stop)
//
// Create a vector of numbers and then shuffle them
//
-#include
-#include
extern std::default_random_engine rng;
template < class T > std::vector< T > make_shuffled_range(const size_t how_many)
{
diff --git a/src/my_wid.hpp b/src/my_wid.hpp
index d412cfc72..96ddd3eaa 100644
--- a/src/my_wid.hpp
+++ b/src/my_wid.hpp
@@ -308,7 +308,7 @@ public:
uint64_t key {};
};
-struct tree_wid_key_cmp : public std::binary_function< class tree_wid_key, class tree_wid_key, bool > {
+struct tree_wid_key_cmp {
bool operator()(const tree_wid_key &lhs, const tree_wid_key &rhs) const
{
if (lhs.priority < rhs.priority) {
diff --git a/src/string.cpp b/src/string.cpp
index 260115c3a..00d372f0c 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -7,6 +7,7 @@
#include <libgen.h>
#include
#include
+#include
#include "my_ptrcheck.hpp"
#include "my_sdl.hpp"
Hey Richard, how about add one more line in readme to brief hardware spec for this game? James
Hi - I opened a pull request to fix compile errors with the latest gcc/libstdc++ v13.
Just opening an issue as well in case you didn't see it.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.