Patch by MagerValp to allow building on mac with make. Thanks !

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@902 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-07-07 13:58:37 +00:00
parent 243b645383
commit 15a8c67db7
3 changed files with 57 additions and 9 deletions

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>Grafx2</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>http://grafx2.googlecode.com/</string>
<string>com.googlecode.grafx2</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<string>Grafx2</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>

View File

@ -31,6 +31,8 @@
### PLATFORM DETECTION AND CONFIGURATION ###
PLATFORMOBJ =
# There is no uname under windows, but we can guess we are there with the COMSPEC env.var
# Windows specific
ifdef COMSPEC
@ -69,6 +71,25 @@ else
ZIP = lha
ZIPOPT = a
else ifeq ($(PLATFORM),Darwin)
#Mac OS X specific
DELCOMMAND = rm -rf
MKDIR = mkdir -p
RMDIR = rmdir
CP = cp
ZIP = zip
PLATFORMFILES = gfx2.png
BIN = grafx2
COPT = -D__macosx__ -D__linux__-W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT) -I/usr/X11/include
LOPT = `sdl-config --libs` -framework SDL_image -framework SDL_ttf -L/usr/X11/lib -R/usr/X11/lib -lpng
# Use gcc for compiling. Use ncc to build a callgraph and analyze the code.
CC = gcc
#CC = nccgen -ncgcc -ncld -ncfabs
OBJDIR = obj/macosx
PLATFORMOBJ = $(OBJDIR)/SDLMain.o
X11LOPT =
MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2
else ifeq ($(PLATFORM),AROS)
#AROS specific
DELCOMMAND = rm -rf
@ -185,7 +206,7 @@ else
# Compiles a regular linux exectutable for the native platform
BIN = grafx2
COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT)
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng
# Use gcc for compiling. Use ncc to build a callgraph and analyze the code.
CC = gcc
@ -225,11 +246,30 @@ endif
.PHONY : all debug release clean depend zip version force install uninstall
# This is the list of the objects we want to build. Dependancies are built by "make depend" automatically.
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o
OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/misc.o $(OBJDIR)/special.o $(OBJDIR)/buttons.o $(OBJDIR)/palette.o $(OBJDIR)/help.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/engine.o $(OBJDIR)/filesel.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/keyboard.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/text.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/pxtriple.o $(OBJDIR)/pxtall2.o $(OBJDIR)/pxwide2.o $(OBJDIR)/pxquad.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o $(OBJDIR)/transform.o $(OBJDIR)/pversion.o $(PLATFORMOBJ)
SKIN_FILES = skins/skin_classic.png skins/skin_modern.png skins/font_Classic.png skins/font_Fun.png
ifeq ($(PLATFORM),Darwin)
all : $(MACAPPEXE)
$(MACAPPEXE) : $(BIN)
rm -rf Grafx2.app
mkdir -p Grafx2.app Grafx2.app/Contents Grafx2.app/Contents/Frameworks Grafx2.app/Contents/MacOS Grafx2.app/Contents/Resources
echo 'APPL????' > Grafx2.app/Contents/PkgInfo
cp Info.plist Grafx2.app/Contents
cp -r English.lproj Grafx2.app/Contents/Resources
cp -r fonts Grafx2.app/Contents/Resources
cp -r skins Grafx2.app/Contents/Resources
cp -r gfx2.cfg Grafx2.app/Contents/Resources
cp -r gfx2def.ini Grafx2.app/Contents/Resources
cp -Rp /Library/Frameworks/SDL.framework Grafx2.app/Contents/Frameworks
cp -Rp /Library/Frameworks/SDL_image.framework Grafx2.app/Contents/Frameworks
cp -Rp /Library/Frameworks/SDL_ttf.framework Grafx2.app/Contents/Frameworks
cp $(BIN) $(MACAPPEXE)
else
all : $(BIN)
endif
debug : $(BIN)
@ -272,10 +312,14 @@ else
$(DELCOMMAND) pversion.c
endif
$(OBJDIR)/%.o :
$(OBJDIR)/%.o : %.c
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
$(OBJDIR)/%.o : %.m
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
$(CC) $(COPT) -c $*.m -o $(OBJDIR)/$*.o
depend :
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep

View File

@ -1367,20 +1367,24 @@ void Clamp_coordinates_regular_angle(short ax, short ay, short* bx, short* by)
dx = *bx-ax;
dy = *by-ay;
// No mouse move: no need to clamp anything
if (dx==0 || dy == 0) return;
// On est en lockx et de toutes façons le X n'a pas bougé, on sort tout
// de suite pour éviter une méchante division par 0
angle = atan2(dx, dy);
// Horizontal < 15/16
if (angle < M_PI*(-15.0/16.0) || angle > M_PI*(15.0/16.0))
angle = M_PI*(16.0/16.0);
// 15/16 < Iso < 13/16
else if (angle < M_PI*(-13.0/16.0))
angle = -2.677945045;
// 13/16 < 45deg (3pi/4) < 11/16
else if (angle < M_PI*(-11.0/16.0))
angle = M_PI*(-12.0/16.0);
// 11/16 < "vertical iso" < 9/19
else if (angle < M_PI*(-9.0/16.0))
angle = -2.034443936;
// 9/16 < vertical < 7/16
else if (angle < M_PI*(-7.0/16.0))
angle = M_PI*(-8.0/16.0);
else if (angle < M_PI*(-5.0/16.0))