Closed ghost closed 12 years ago
Once you merge with antirez/master you should be able to use SDL_BlitSurface to draw the sprite.
If the image load fails, maybe it would be better to throw a Lua error instead of returning nothing?
Wanted to do that. After your makefile cleanup I can't build. Had to make two changes to the makefile. This is my first time using git, so still trying to figure out how to do this.
What's the error message? You'll need to add SDL_image to the PKGS list and install SDL_gfx if you don't already have it.
1) doesn't build liblua.a
$ make
cc -O2 -Wall -W -Ilua/src pkg-config --cflags sdl SDL_gfx
-c -o load81.o load81.c
cc load81.o -lm lua/src/liblua.a pkg-config --libs sdl SDL_gfx
-o load81
cc: error: lua/src/liblua.a: No such file or directory
make: *\ [load81] Error 1
2) some error finding sin. had to swap -lm and liblua.
@rlane I have the blit working. I'll try to clean things up, including throwing an error, and resubmit later this evening.
BTW, where is the origin of the sprite in Codea? (Don't have an iPad yet.)
I was experimenting with sprites which might be a cool feature.
This uses SDL_Image to load an image. Currently it only handles 24 bit RGB png. Needs some flexibility to handle other formats like 32-bit RGBA. It stores the SDL_Surface pointer in a user data and caches it in the Lua registry.
Feel free to merge, modify or reject with suggestions.