I got C++/SDL running last weekend - I'm pretty sure there's a better way of doing it, but it (mostly) seems to work - libpng crashes on load, for example, and I'm hoping that this isn't because of all sorts of other reasons. But blit and fill_rect both work.
Anyway, try something like:
- Get hold of devkitarm_r14 (last one I think with gcc 3.4.4 - it didn't like 4.0.1), install to c:\devkitarm.
- Install MirkoSDK (to c:\devkitarm\libmirko)
- Install binary version of SDL (to c:\devkitarm\SDL)
- Download and unzip source version of SDL from Chui's site to some other separate location.
- Recompile the SDL libraries after removing -msoft-float from each makefile.gp32, because this seems to cause a conflict with libc++, and overwrite the libraries in c:\devkitarm\SDL\lib
((I've tried SDL, SDL_Image, SDL_Gfx, (which worked), libpng (which didn't) and libz (untested)
In your program, use #include <gp32.h> (Mirko's) rather than #include <x_gp32.h> (SDL).
The file io part of SDL doesn't seem to work with this setup, but you can use Mirko's SDK to load a file into a buffer, and then use SDL_RWFromMem to do things with it - e.g. load as a gif, and subsequently blit.
Makefile below - based on Mirko's pure C++ example.
Código:
CC *= arm-elf-gcc
LD *= arm-elf-g++
AS *= arm-elf-as
AR *= arm-elf-ar
CXX = arm-elf-g++
PRG *= framerate
OBJS = test.o control.o screen.o gp32_fileio.o
MIRKOROOT = c:/devkitarm/libmirko
SDLROOT = c:/devkitarm/SDL
LIBS * * *= -L$(MIRKOROOT)/lib -L$(SDLROOT)/lib -lm
MIRKOLIBS = -lmirkoSDK_GEEPEE
SDLLIBS * = -lSDL -lSDL_gfx -lSDL_image -lZ
CRT0 * * *= $(MIRKOROOT)/lib/crt0.S
LNKSCRIPT = $(MIRKOROOT)/lib/lnkscript
INCLUDES *= -I$(MIRKOROOT)/include -I$(SDLROOT)/include/SDL -I$(SDLROOT)/include
CFLAGS * *= $(INCLUDES) -O2 -s -mtune=arm9tdmi -DGP32
CXXFLAGS *= $(CFLAGS)
all: $(OBJS)
$(CC) -c -o crt0.o $(CRT0)
$(LD) -nostartfiles -s -Wall -Wl,-Map,Test.map *-T $(LNKSCRIPT) crt0.o -o $(PRG).elf $(OBJS) $(LIBS) $(SDLLIBS) $(MIRKOLIBS)
arm-elf-objcopy -O binary $(PRG).elf $(PRG).bin
cp $(PRG).bin e:\$(PRG).gxb
b2fxec -a Muffinman -t Test_$(PRG) $(PRG).bin $(PRG).fxe
cp $(PRG).fxe e:/
install:
gplink put $(PRG).fxe gpmm
clean:
rm -f *.o *~ Test.map *.bin *.elf
Marcadores