Added automatic backtracing via RegisterStacktrace in Backtrace. Added a simple hello world demo that just throws up a window. Started working on TileSet again and skeletoned a demo for it.
This commit is contained in:
30
Makefile
30
Makefile
@@ -4,9 +4,9 @@
|
|||||||
ifndef $(CFG)
|
ifndef $(CFG)
|
||||||
CFG=Debug
|
CFG=Debug
|
||||||
endif
|
endif
|
||||||
# you can also pass : mingw32 and macosx
|
# you can also pass : linux and macosx
|
||||||
ifndef $(OS)
|
ifndef $(OS)
|
||||||
OS=linux
|
OS=mingw32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBNAME=sdlgame
|
LIBNAME=sdlgame
|
||||||
@@ -21,9 +21,17 @@ EXESUFFIX=
|
|||||||
LIBSUFFIX=
|
LIBSUFFIX=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows
|
ADDL_CFLAGS=-rdynamic -mwindows -DOS_WIN32
|
||||||
EXESUFFIX=".exe"
|
EXESUFFIX=.exe
|
||||||
LIBSUFFIX=".a"
|
LIBSUFFIX=.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(OS)" "macosx"
|
||||||
|
ADDL_CFLAGS=-rdynamic -DOS_MACOSX
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(OS)" "linux"
|
||||||
|
ADDL_CFLAGS=-rdynamic -DOS_LINUX
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(CFG)" "Debug"
|
ifeq "$(CFG)" "Debug"
|
||||||
@@ -42,7 +50,8 @@ endif
|
|||||||
|
|
||||||
LINKLIBS=-L../../$(CFG) -L$(OUTDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSDL_mixer
|
LINKLIBS=-L../../$(CFG) -L$(OUTDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSDL_mixer
|
||||||
|
|
||||||
LIBOBJ=$(OBJDIR)/Common.o \
|
LIBOBJ=$(OBJDIR)/Backtrace.o \
|
||||||
|
$(OBJDIR)/Common.o \
|
||||||
$(OBJDIR)/FontRenderer.o \
|
$(OBJDIR)/FontRenderer.o \
|
||||||
$(OBJDIR)/Renderable.o \
|
$(OBJDIR)/Renderable.o \
|
||||||
$(OBJDIR)/SpriteStrip.o \
|
$(OBJDIR)/SpriteStrip.o \
|
||||||
@@ -53,11 +62,14 @@ LIBOBJ=$(OBJDIR)/Common.o \
|
|||||||
$(OBJDIR)/MenuDisplay.o \
|
$(OBJDIR)/MenuDisplay.o \
|
||||||
$(OBJDIR)/Game.o
|
$(OBJDIR)/Game.o
|
||||||
|
|
||||||
DEMOS=bouncingball \
|
DEMOS=backtrace \
|
||||||
|
bouncingball \
|
||||||
exploder \
|
exploder \
|
||||||
explodingball \
|
explodingball \
|
||||||
frictionball \
|
frictionball \
|
||||||
gravity
|
helloworld \
|
||||||
|
gravity \
|
||||||
|
tilemap \
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
@@ -91,7 +103,7 @@ clean:
|
|||||||
cd demo && for dir in $(DEMOS); do cd $$dir && make CFG=$(CFG) OS=$(OS) clean; if [ $$? -ne 0 ]; then exit 1 ; fi; cd .. ; done
|
cd demo && for dir in $(DEMOS); do cd $$dir && make CFG=$(CFG) OS=$(OS) clean; if [ $$? -ne 0 ]; then exit 1 ; fi; cd .. ; done
|
||||||
.PHONY: demos
|
.PHONY: demos
|
||||||
demos:
|
demos:
|
||||||
cd demo && for dir in $(DEMOS); do cd $$dir && make CFG=$(CFG) OS=$(OS); if [ $$? -ne 0 ]; then exit 1 ; fi; cd .. ; done
|
cd demo && for dir in $(DEMOS); do cd $$dir && make "ADDL_CFLAGS=$(ADDL_CFLAGS)" CFG=$(CFG) OS=$(OS); if [ $$? -ne 0 ]; then exit 1 ; fi; cd .. ; done
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
98
demo/backtrace/Makefile
Executable file
98
demo/backtrace/Makefile
Executable file
@@ -0,0 +1,98 @@
|
|||||||
|
# This makefile is a bit hackish. I wrote it early in the AM.
|
||||||
|
# Fohgiveuhness, please!!
|
||||||
|
|
||||||
|
|
||||||
|
ifndef $(CFG)
|
||||||
|
CFG=Debug
|
||||||
|
endif
|
||||||
|
|
||||||
|
# you can also pass : mingw32 and macosx
|
||||||
|
ifndef $(OS)
|
||||||
|
OS=linux
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET=demo
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
PROJECTHOME=$(shell pwd)
|
||||||
|
SDL_CFLAGS=$(shell sdl-config --cflags)
|
||||||
|
SDL_LDFLAGS=$(shell sdl-config --libs)
|
||||||
|
LIBDIR=/usr/lib
|
||||||
|
HEADERDIR=/usr/include
|
||||||
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
|
endif
|
||||||
|
ifeq "$(OS)" "linux"
|
||||||
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
|
endif
|
||||||
|
|
||||||
|
# default for release configs
|
||||||
|
ifeq "$(CFG)" "Release"
|
||||||
|
OUTDIR=Release
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET).exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
ifeq "$(CFG)" "Debug"
|
||||||
|
OUTDIR=Debug
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET)-dbg.exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)-dbg
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame-dbg
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -pg -g -ggdb -gstabs -Wall -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSDL_mixer -lSDL_gfx -lSDL_ttf
|
||||||
|
|
||||||
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
LD = $(CXX)
|
||||||
|
INSTALL = $(which install)
|
||||||
|
|
||||||
|
$(OUTDIR)/%.o : cpp/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all: bin
|
||||||
|
|
||||||
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f $(OUTDIR)/*
|
||||||
|
|
||||||
|
.PHONY: rebuild
|
||||||
|
rebuild:
|
||||||
|
make clean
|
||||||
|
make CFG=$(CFG)
|
||||||
28
demo/backtrace/cpp/demo.cpp
Executable file
28
demo/backtrace/cpp/demo.cpp
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* This demo starts up and intentionally crashes itself to prove the backtrace stuff works
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libsdlgame/libsdlgame.h>
|
||||||
|
|
||||||
|
class Object {
|
||||||
|
private:
|
||||||
|
int *x;
|
||||||
|
public:
|
||||||
|
int crashme(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
int Object::crashme(void)
|
||||||
|
{
|
||||||
|
this->x = 0;
|
||||||
|
return *(this->x);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
RegisterStacktrace();
|
||||||
|
|
||||||
|
// We don't initialize anything here because we would lose the memory
|
||||||
|
Object x;
|
||||||
|
x.crashme();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
demo/backtrace/gfx/tileset_collision.png
Executable file
BIN
demo/backtrace/gfx/tileset_collision.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 389 B |
BIN
demo/backtrace/gfx/tileset_mario.png
Executable file
BIN
demo/backtrace/gfx/tileset_mario.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
demo/backtrace/gmon.out
Executable file
BIN
demo/backtrace/gmon.out
Executable file
Binary file not shown.
7285
demo/backtrace/map.tmx
Executable file
7285
demo/backtrace/map.tmx
Executable file
File diff suppressed because it is too large
Load Diff
@@ -21,10 +21,10 @@ HEADERDIR=/usr/include
|
|||||||
ADDL_CFLAGS=
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "linux"
|
ifeq "$(OS)" "linux"
|
||||||
ADDL_CFLAGS=-DBUILD_LINUX
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# default for release configs
|
# default for release configs
|
||||||
@@ -53,6 +53,10 @@ LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSD
|
|||||||
|
|
||||||
BINOBJ=$(OUTDIR)/demo.o
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LD = $(CXX)
|
LD = $(CXX)
|
||||||
@@ -63,14 +67,30 @@ $(OUTDIR)/%.o : cpp/%.cpp
|
|||||||
|
|
||||||
all: bin
|
all: bin
|
||||||
|
|
||||||
bin: $(BINOBJ)
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
-pg $(BINOBJ) $(LINKLIBS)
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTDIR)/*.o
|
rm -f $(OUTDIR)/*
|
||||||
rm -f $(OUTDIR)/$(BINTARGET)
|
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
Binary file not shown.
@@ -21,10 +21,10 @@ HEADERDIR=/usr/include
|
|||||||
ADDL_CFLAGS=
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "linux"
|
ifeq "$(OS)" "linux"
|
||||||
ADDL_CFLAGS=-DBUILD_LINUX
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# default for release configs
|
# default for release configs
|
||||||
@@ -36,7 +36,7 @@ ifeq "$(CFG)" "Release"
|
|||||||
BINTARGET=$(TARGET)
|
BINTARGET=$(TARGET)
|
||||||
endif
|
endif
|
||||||
LINKLIB=sdlgame
|
LINKLIB=sdlgame
|
||||||
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
endif
|
endif
|
||||||
ifeq "$(CFG)" "Debug"
|
ifeq "$(CFG)" "Debug"
|
||||||
OUTDIR=Debug
|
OUTDIR=Debug
|
||||||
@@ -53,6 +53,10 @@ LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSD
|
|||||||
|
|
||||||
BINOBJ=$(OUTDIR)/demo.o
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LD = $(CXX)
|
LD = $(CXX)
|
||||||
@@ -63,14 +67,30 @@ $(OUTDIR)/%.o : cpp/%.cpp
|
|||||||
|
|
||||||
all: bin
|
all: bin
|
||||||
|
|
||||||
bin: $(BINOBJ)
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
-pg $(BINOBJ) $(LINKLIBS)
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTDIR)/*.o
|
rm -f $(OUTDIR)/*
|
||||||
rm -f $(OUTDIR)/$(BINTARGET)
|
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
Binary file not shown.
@@ -21,10 +21,10 @@ HEADERDIR=/usr/include
|
|||||||
ADDL_CFLAGS=
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "linux"
|
ifeq "$(OS)" "linux"
|
||||||
ADDL_CFLAGS=-DBUILD_LINUX
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# default for release configs
|
# default for release configs
|
||||||
@@ -53,6 +53,10 @@ LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSD
|
|||||||
|
|
||||||
BINOBJ=$(OUTDIR)/demo.o
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LD = $(CXX)
|
LD = $(CXX)
|
||||||
@@ -63,14 +67,30 @@ $(OUTDIR)/%.o : cpp/%.cpp
|
|||||||
|
|
||||||
all: bin
|
all: bin
|
||||||
|
|
||||||
bin: $(BINOBJ)
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
-pg $(BINOBJ) $(LINKLIBS)
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTDIR)/*.o
|
rm -f $(OUTDIR)/*
|
||||||
rm -f $(OUTDIR)/$(BINTARGET)
|
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
Binary file not shown.
@@ -21,10 +21,10 @@ HEADERDIR=/usr/include
|
|||||||
ADDL_CFLAGS=
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "linux"
|
ifeq "$(OS)" "linux"
|
||||||
ADDL_CFLAGS=-DBUILD_LINUX
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# default for release configs
|
# default for release configs
|
||||||
@@ -53,6 +53,10 @@ LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSD
|
|||||||
|
|
||||||
BINOBJ=$(OUTDIR)/demo.o
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LD = $(CXX)
|
LD = $(CXX)
|
||||||
@@ -63,14 +67,30 @@ $(OUTDIR)/%.o : cpp/%.cpp
|
|||||||
|
|
||||||
all: bin
|
all: bin
|
||||||
|
|
||||||
bin: $(BINOBJ)
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
-pg $(BINOBJ) $(LINKLIBS)
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTDIR)/*.o
|
rm -f $(OUTDIR)/*
|
||||||
rm -f $(OUTDIR)/$(BINTARGET)
|
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
Binary file not shown.
@@ -21,10 +21,10 @@ HEADERDIR=/usr/include
|
|||||||
ADDL_CFLAGS=
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
ifeq "$(OS)" "mingw32"
|
ifeq "$(OS)" "mingw32"
|
||||||
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
endif
|
endif
|
||||||
ifeq "$(OS)" "linux"
|
ifeq "$(OS)" "linux"
|
||||||
ADDL_CFLAGS=-DBUILD_LINUX
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# default for release configs
|
# default for release configs
|
||||||
@@ -53,6 +53,10 @@ LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSD
|
|||||||
|
|
||||||
BINOBJ=$(OUTDIR)/demo.o
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LD = $(CXX)
|
LD = $(CXX)
|
||||||
@@ -63,14 +67,30 @@ $(OUTDIR)/%.o : cpp/%.cpp
|
|||||||
|
|
||||||
all: bin
|
all: bin
|
||||||
|
|
||||||
bin: $(BINOBJ)
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
-pg $(BINOBJ) $(LINKLIBS)
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTDIR)/*.o
|
rm -f $(OUTDIR)/*
|
||||||
rm -f $(OUTDIR)/$(BINTARGET)
|
|
||||||
|
|
||||||
.PHONY: rebuild
|
.PHONY: rebuild
|
||||||
rebuild:
|
rebuild:
|
||||||
|
|||||||
Binary file not shown.
98
demo/helloworld/Makefile
Executable file
98
demo/helloworld/Makefile
Executable file
@@ -0,0 +1,98 @@
|
|||||||
|
# This makefile is a bit hackish. I wrote it early in the AM.
|
||||||
|
# Fohgiveuhness, please!!
|
||||||
|
|
||||||
|
|
||||||
|
ifndef $(CFG)
|
||||||
|
CFG=Debug
|
||||||
|
endif
|
||||||
|
|
||||||
|
# you can also pass : mingw32 and macosx
|
||||||
|
ifndef $(OS)
|
||||||
|
OS=linux
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET=demo
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
PROJECTHOME=$(shell pwd)
|
||||||
|
SDL_CFLAGS=$(shell sdl-config --cflags)
|
||||||
|
SDL_LDFLAGS=$(shell sdl-config --libs)
|
||||||
|
LIBDIR=/usr/lib
|
||||||
|
HEADERDIR=/usr/include
|
||||||
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
|
endif
|
||||||
|
ifeq "$(OS)" "linux"
|
||||||
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
|
endif
|
||||||
|
|
||||||
|
# default for release configs
|
||||||
|
ifeq "$(CFG)" "Release"
|
||||||
|
OUTDIR=Release
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET).exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
ifeq "$(CFG)" "Debug"
|
||||||
|
OUTDIR=Debug
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET)-dbg.exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)-dbg
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame-dbg
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -pg -g -ggdb -gstabs -Wall -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSDL_mixer -lSDL_gfx -lSDL_ttf
|
||||||
|
|
||||||
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
LD = $(CXX)
|
||||||
|
INSTALL = $(which install)
|
||||||
|
|
||||||
|
$(OUTDIR)/%.o : cpp/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all: bin
|
||||||
|
|
||||||
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f $(OUTDIR)/*
|
||||||
|
|
||||||
|
.PHONY: rebuild
|
||||||
|
rebuild:
|
||||||
|
make clean
|
||||||
|
make CFG=$(CFG)
|
||||||
33
demo/helloworld/cpp/demo.cpp
Executable file
33
demo/helloworld/cpp/demo.cpp
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* This demo starts up and does nothing until you hit Escape to kill it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libsdlgame/libsdlgame.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
Display2D display = Display2D();
|
||||||
|
Game &myGame = Game::NewSingleton();
|
||||||
|
unsigned int lastTimer = 0;
|
||||||
|
|
||||||
|
myGame.initSDL();
|
||||||
|
myGame.initVideo(640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
|
||||||
|
display.initVideo((Vector){0,0,0}, 640, 480, 32, SDL_HWSURFACE);
|
||||||
|
display.setActive(1);
|
||||||
|
myGame.windows.push_back(&display);
|
||||||
|
|
||||||
|
lastTimer = SDL_GetTicks();
|
||||||
|
|
||||||
|
while ( 1 ) {
|
||||||
|
if ( (SDL_GetTicks() - lastTimer) >= (1000/30) ) {
|
||||||
|
myGame.update();
|
||||||
|
lastTimer = SDL_GetTicks();
|
||||||
|
} else {
|
||||||
|
myGame.update(1);
|
||||||
|
}
|
||||||
|
if ( myGame.keyHeldDown(SDLK_ESCAPE) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
myGame.finishFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
demo/helloworld/gfx/tileset_collision.png
Executable file
BIN
demo/helloworld/gfx/tileset_collision.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 389 B |
BIN
demo/helloworld/gfx/tileset_mario.png
Executable file
BIN
demo/helloworld/gfx/tileset_mario.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
7285
demo/helloworld/map.tmx
Executable file
7285
demo/helloworld/map.tmx
Executable file
File diff suppressed because it is too large
Load Diff
98
demo/tilemap/Makefile
Executable file
98
demo/tilemap/Makefile
Executable file
@@ -0,0 +1,98 @@
|
|||||||
|
# This makefile is a bit hackish. I wrote it early in the AM.
|
||||||
|
# Fohgiveuhness, please!!
|
||||||
|
|
||||||
|
|
||||||
|
ifndef $(CFG)
|
||||||
|
CFG=Debug
|
||||||
|
endif
|
||||||
|
|
||||||
|
# you can also pass : mingw32 and macosx
|
||||||
|
ifndef $(OS)
|
||||||
|
OS=linux
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET=demo
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
PROJECTHOME=$(shell pwd)
|
||||||
|
SDL_CFLAGS=$(shell sdl-config --cflags)
|
||||||
|
SDL_LDFLAGS=$(shell sdl-config --libs)
|
||||||
|
LIBDIR=/usr/lib
|
||||||
|
HEADERDIR=/usr/include
|
||||||
|
ADDL_CFLAGS=
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
ADDL_CFLAGS=-mwindows -DBUILD_MINGW32 -rdynamic
|
||||||
|
endif
|
||||||
|
ifeq "$(OS)" "linux"
|
||||||
|
ADDL_CFLAGS=-DBUILD_LINUX -rdynamic
|
||||||
|
endif
|
||||||
|
|
||||||
|
# default for release configs
|
||||||
|
ifeq "$(CFG)" "Release"
|
||||||
|
OUTDIR=Release
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET).exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
ifeq "$(CFG)" "Debug"
|
||||||
|
OUTDIR=Debug
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BINTARGET=$(TARGET)-dbg.exe
|
||||||
|
else
|
||||||
|
BINTARGET=$(TARGET)-dbg
|
||||||
|
endif
|
||||||
|
LINKLIB=sdlgame-dbg
|
||||||
|
CXXFLAGS=-I../../ -I$(HEADERDIR) -I./cpp -pg -g -ggdb -gstabs -Wall -c $(SDL_CFLAGS) $(ADDL_CFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LINKLIBS=-L../../$(CFG) -L$(LIBDIR) -l$(LINKLIB) $(SDL_LDFLAGS) -lSDL_image -lSDL_mixer -lSDL_gfx -lSDL_ttf
|
||||||
|
|
||||||
|
BINOBJ=$(OUTDIR)/demo.o
|
||||||
|
|
||||||
|
ifeq "$(OS)" "mingw32"
|
||||||
|
BTOBJ=$(OUTDIR)/backtrace.dll
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
LD = $(CXX)
|
||||||
|
INSTALL = $(which install)
|
||||||
|
|
||||||
|
$(OUTDIR)/%.o : cpp/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all: bin
|
||||||
|
|
||||||
|
.PHONY: $(BTOBJ)
|
||||||
|
$(BTOBJ):
|
||||||
|
cp /usr/local/lib/backtrace.dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/av*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/lib/swscale*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*SDL*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/freetype*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*png*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*jpeg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libimage*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libogg*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/*vorbis*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/librle*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libtiff*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/libxml2*dll $(OUTDIR)/
|
||||||
|
cp /usr/local/bin/zlib*dll $(OUTDIR)/
|
||||||
|
|
||||||
|
bin: $(BINOBJ) $(BTOBJ)
|
||||||
|
$(LD) -pg -o $(OUTDIR)/$(BINTARGET) \
|
||||||
|
-pg $(BINOBJ) $(LINKLIBS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f $(OUTDIR)/*
|
||||||
|
|
||||||
|
.PHONY: rebuild
|
||||||
|
rebuild:
|
||||||
|
make clean
|
||||||
|
make CFG=$(CFG)
|
||||||
33
demo/tilemap/cpp/demo.cpp
Executable file
33
demo/tilemap/cpp/demo.cpp
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* This demo starts up and does nothing until you hit Escape to kill it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libsdlgame/libsdlgame.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
Display2D display = Display2D();
|
||||||
|
Game &myGame = Game::NewSingleton();
|
||||||
|
unsigned int lastTimer = 0;
|
||||||
|
|
||||||
|
myGame.initSDL();
|
||||||
|
myGame.initVideo(640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
|
||||||
|
display.initVideo((Vector){0,0,0}, 640, 480, 32, SDL_HWSURFACE);
|
||||||
|
display.setActive(1);
|
||||||
|
myGame.windows.push_back(&display);
|
||||||
|
|
||||||
|
lastTimer = SDL_GetTicks();
|
||||||
|
|
||||||
|
while ( 1 ) {
|
||||||
|
if ( (SDL_GetTicks() - lastTimer) >= (1000/30) ) {
|
||||||
|
myGame.update();
|
||||||
|
lastTimer = SDL_GetTicks();
|
||||||
|
} else {
|
||||||
|
myGame.update(1);
|
||||||
|
}
|
||||||
|
if ( myGame.keyHeldDown(SDLK_ESCAPE) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
myGame.finishFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
demo/tilemap/gfx/tileset_collision.png
Executable file
BIN
demo/tilemap/gfx/tileset_collision.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 389 B |
BIN
demo/tilemap/gfx/tileset_mario.png
Executable file
BIN
demo/tilemap/gfx/tileset_mario.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
7285
demo/tilemap/map.tmx
Executable file
7285
demo/tilemap/map.tmx
Executable file
File diff suppressed because it is too large
Load Diff
7
deps/Makefile
vendored
7
deps/Makefile
vendored
@@ -4,7 +4,7 @@ CFLAGS=$(CFLAGS) -I/usr/local/include -I/usr/include
|
|||||||
LDFLAGS=$(LDFLAGS) -L/usr/local/lib -L/usr/lib
|
LDFLAGS=$(LDFLAGS) -L/usr/local/lib -L/usr/lib
|
||||||
|
|
||||||
.PHONY: packages
|
.PHONY: packages
|
||||||
packages: SDL zlib libpng libjpeg libtiff SDL_image libvorbis flac SDL_mixer freetype SDL_ttf SDL_gfx libxml2 cmake ffmpeg SDL_ffmpeg
|
packages: SDL zlib libpng libjpeg libtiff SDL_image libvorbis flac SDL_mixer freetype SDL_ttf SDL_gfx libxml2 cmake ffmpeg SDL_ffmpeg backtrace
|
||||||
|
|
||||||
.PHONY: SDL
|
.PHONY: SDL
|
||||||
SDL:
|
SDL:
|
||||||
@@ -144,6 +144,11 @@ yaml-cpp:
|
|||||||
cp -vR yaml-cpp/include/yaml-cpp /usr/local/include/
|
cp -vR yaml-cpp/include/yaml-cpp /usr/local/include/
|
||||||
cp yaml-cpp/libyaml-cpp.a /usr/local/lib/
|
cp yaml-cpp/libyaml-cpp.a /usr/local/lib/
|
||||||
|
|
||||||
|
.PHONY: backtrace
|
||||||
|
backtrace:
|
||||||
|
svn checkout http://backtrace-mingw.googlecode.com/svn/trunk/ backtrace-mingw-read-only
|
||||||
|
cd backtrace-mingw-read-only && make && cp backtrace.dll /usr/local/lib/
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf *gz *zip *bz2
|
rm -rf *gz *zip *bz2
|
||||||
|
|||||||
67
libsdlgame/Backtrace.cpp
Executable file
67
libsdlgame/Backtrace.cpp
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
#ifdef __WIN32__
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
void RegisterStacktrace()
|
||||||
|
{
|
||||||
|
#ifdef __WIN32__
|
||||||
|
if ( LoadLibraryA("backtrace.dll") == NULL ) {
|
||||||
|
std::cerr << "Unable to locate backtrace.dll.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
signal(SIGSEGV, &__libsdlgame_sigsegvhandler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef __WIN32__
|
||||||
|
|
||||||
|
#include <execinfo.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
/* Backtrace.cpp
|
||||||
|
*
|
||||||
|
* This file is compiled for OS X and Linux targets. mingw32 targets
|
||||||
|
* use backtrace pulled in the dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Obtain a backtrace and print it to stdout. */
|
||||||
|
void __libsdlgame_show_stacktrace (void)
|
||||||
|
{
|
||||||
|
void *array[10];
|
||||||
|
size_t size;
|
||||||
|
char **strings;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
size = backtrace (array, 10);
|
||||||
|
// The heap may be corrupt at this point, so this may be an
|
||||||
|
// invitation to disaster, but we don't have much choice.
|
||||||
|
strings = backtrace_symbols (array, size);
|
||||||
|
|
||||||
|
fprintf(stderr, "Obtained %zd stack frames.\n", size);
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
fprintf(stderr, "%s\n", strings[i]);
|
||||||
|
|
||||||
|
free (strings);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __libsdlgame_sigsegvhandler(int z)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Caught segmentation fault; stacktrace follows.\n");
|
||||||
|
print_trace();
|
||||||
|
#ifdef DEBUG_LOOPONSEGFAULT
|
||||||
|
fprintf(stderr, "Entering infinite loop; please connect a debugger to me and then kill me.\n");
|
||||||
|
fflush(stderr);
|
||||||
|
while ( 1 ) { };
|
||||||
|
#endif
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
11
libsdlgame/Backtrace.h
Executable file
11
libsdlgame/Backtrace.h
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __BACKTRACE_H__
|
||||||
|
#define __BACKTRACE_H__
|
||||||
|
|
||||||
|
#ifdef __WIN32__
|
||||||
|
extern void __libsdlgame_sigsegvhandler(int z);
|
||||||
|
extern void __libsdlgame_show_stacktrace(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void RegisterStacktrace(void);
|
||||||
|
|
||||||
|
#endif // __BACKTRACE_H__
|
||||||
BIN
libsdlgame/Backtrace.o
Executable file
BIN
libsdlgame/Backtrace.o
Executable file
Binary file not shown.
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @def GAMEFPS
|
* @def GAMEFPS
|
||||||
* Redefine this value to change the FPS you want the game to lock to (USUALLY works)
|
* Redefine this value to change the FPS you want the game to lock to
|
||||||
|
* (USUALLY works)
|
||||||
*/
|
*/
|
||||||
#define GAMEFPS 60
|
#define GAMEFPS 60
|
||||||
|
|
||||||
|
|||||||
@@ -7,26 +7,53 @@ int TileDisplay::loadFromTMX(std::string filename)
|
|||||||
{
|
{
|
||||||
xmlTextReaderPtr reader;
|
xmlTextReaderPtr reader;
|
||||||
const xmlChar *name;
|
const xmlChar *name;
|
||||||
|
const xmlChar *attr;
|
||||||
const xmlChar *value;
|
const xmlChar *value;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
reader = xmlReaderForFile(filename.c_str(), NULL, 0);
|
reader = xmlReaderForFile(filename.c_str(), NULL, 0);
|
||||||
if ( reader != NULL ) {
|
if ( reader == NULL )
|
||||||
ret = xmlTextReaderRead(reader);
|
goto loadfromtmx_fail;
|
||||||
while ( ret == 1) {
|
ret = xmlTextReaderRead(reader);
|
||||||
name = xmlTextReaderConstName(reader);
|
|
||||||
if ( name != NULL ) {
|
|
||||||
if ( !strcmp(name, "map") ) {
|
|
||||||
|
|
||||||
}
|
name = xmlTextReaderConstName(reader);
|
||||||
value = xmlTextReaderConstValue(reader);
|
// -- buildup the map flags
|
||||||
}
|
if ( name != NULL ) {
|
||||||
// process current node
|
if ( !strcmp(name, "map") ) {
|
||||||
}
|
goto loadfromtmx_fail;
|
||||||
xmlFreeTextReader(reader);
|
}
|
||||||
if ( ret == 0 ) {
|
attr = xmlTextReaderGetAttribute(reader, ATTR_ORIENTATION_KEY);
|
||||||
return 1;
|
if ( !strcmp(attr, ATTR_ORIENTATION_ORTHO) )
|
||||||
}
|
this->flags = this->flags & TILEMAP_ORTHOGONAL;
|
||||||
|
else if ( !strcmp(attr, ATTR_ORIENTATION_ISO) )
|
||||||
|
this->flags = this->flags & TILEMAP_ISOMETRIC;
|
||||||
|
else
|
||||||
|
goto loadfromtmx_fail;
|
||||||
|
this->w = atoi(xmlTextReaderGetAttribute(reader, ATTR_MAPWIDTH_KEY));
|
||||||
|
this->h = atoi(xmlTextReaderGetAttribute(reader, ATTR_MAPHEIGHT_KEY));
|
||||||
|
this->tw = atoi(xmlTextReaderGetAttribute(reader, ATTR_TILEWIDTH_KEY));
|
||||||
|
this->th = atoi(xmlTextReaderGetAttribute(reader, ATTR_TILEHEIGHT_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -- load the actual map
|
||||||
|
while ( ret == 1) {
|
||||||
|
name = xmlTextReaderConstName(reader);
|
||||||
|
if ( name != NULL ) {
|
||||||
|
if ( !strcmp(name, "map") ) {
|
||||||
|
goto loadfromtmx_fail;
|
||||||
|
}
|
||||||
|
value = xmlTextReaderConstValue(reader);
|
||||||
|
}
|
||||||
|
// process current node
|
||||||
|
}
|
||||||
|
xmlTextReaderClose(reader);
|
||||||
|
xmlFreeTextReader(reader);
|
||||||
return 0;
|
return 0;
|
||||||
|
loadfromtmx_fail:
|
||||||
|
ret = 1;
|
||||||
|
if ( reader ) {
|
||||||
|
xmlTextReaderClose(reader);
|
||||||
|
xmlFreeTextReader(reader);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "Display2D.h"
|
#include "Display2D.h"
|
||||||
|
|
||||||
|
#define ATTR_ORIENTATION_KEY "orientation"
|
||||||
|
#define ATTR_ORIENTATION_ORTHO "orthogonal"
|
||||||
|
#define ATTR_ORIENTATION_ISO "isometric"
|
||||||
|
#define ATTR_MAPWIDTH_KEY "width"
|
||||||
|
#define ATTR_MAPHEIGHT_KEY "height"
|
||||||
|
#define ATTR_TILEWIDTH_KEY "tilewidth"
|
||||||
|
#define ATTR_TILEHEIGHT_KEY "tileheight"
|
||||||
|
|
||||||
#define TILEMAP_ORTHOGONAL 1
|
#define TILEMAP_ORTHOGONAL 1
|
||||||
#define TILEMAP_ISOMETRIC 2
|
#define TILEMAP_ISOMETRIC 2
|
||||||
|
|
||||||
@@ -22,6 +30,7 @@ class TileDisplay : public Display2D {
|
|||||||
protected:
|
protected:
|
||||||
TileGroup tilegroup;
|
TileGroup tilegroup;
|
||||||
std::vector<int>[MAX_LAYERS] layers;
|
std::vector<int>[MAX_LAYERS] layers;
|
||||||
|
int flags;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
int tw;
|
int tw;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef __LIBGAME_H__
|
#ifndef __LIBGAME_H__
|
||||||
#define __LIBGAME_H__
|
#define __LIBGAME_H__
|
||||||
|
|
||||||
|
#include "Backtrace.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "FontRenderer.h"
|
#include "FontRenderer.h"
|
||||||
#include "Renderable.h"
|
#include "Renderable.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user