GP32 load and display BMP


Nelligan

Still Fresh
Joined
Aug 22, 2003
Messages
67
Hi everybody,

I'm in the process of repeatedly crying of joy as I compile and run stuff on my GP32 with minigp32 and the SDL port. A big thank you and cuddos to all concerned!! :D

I ported SDL tutorial 1 on the SDL official site with no problem. It is about filling the screen with color pixels. But I'm having problems with tutorial 2. It compiles without errors but all I get is a black screen. It loads a BMP as background and another as a movable square.

I assumed I didn't have to do any treatment on the bitmaps, since I thought SDL would do all the necesseray grunt work. I only resized them. I don't want to convert them to a bin data file.

Did anyone tried loading a BMP with SDL/minigp32 ?

Thanks
 
Well ofently it comes from a bad link to the image file.
Here is the good way to set the path :
screen = load_bitmap("gp:\\gpmm\\data\\my_image.bmp", 1);

or

my_screen = IMG_Load("gp:\\gpmm\\data\\my_image.bmp");

It depends on what function you used
It is better to use name of less than 8 characters.

Look if you have that. And try it.

good luck

I have adapted a little demo with bmp tile loading.
look at the sources on www.gp32news.com, game/demo section
 
I load the bitmap from the HD not from the SMC as in your example. Here is the loading code i was using

back = SDL_LoadBMP("bg.bmp")

I tried this,but got same black screen

back = SDL_LoadBMP("C:\\minigp32\\projets\\demos\\lesson2\\bg.bmp")

and I tried this

back = IMG_Load("C:\\minigp32\\projets\\demos\\lesson2\\bg.bmp")

and this

back = load_bitmap("C:\\minigp32\\projets\\demos\\lesson2\\bg.bmp",1)

with the last two, I got those errors and the same black screen
lesson2.c:41: warning: implicit declaration of function `IMG_Load'
lesson2.c:41: warning: assignment makes pointer from integer without a cast
lesson2.c:42: warning: assignment makes pointer from integer without a cast

I'm new to c, c++ so I'm pretty sure I'm doing something wrong. will keep at it.

thanks for your help


Oups, just realized that loading the file wont make it part of the executable :rolleyes:

At work right now so I only have access to emulator, will try later tonight.
 
Ok, I'm loading with this:
back = SDL_LoadBMP("gp:\\gpmm\\data\\bg.bmp");

the bmp is in the right dir on my smc, and still the black screen. maybe it has to do with the display code.
 
Well, this means you use Geepee to run your code, no ?
This means you have to use SMCmaker otherwise nothing can't run.

When you use SMC maker you have to put the path like in the real gp32, like i wrote above.

In SMC maker directories you have the same folders as your GP32.
just create a DATA directory in your GPMM folder on your harddisk and put you .bmp here.

You have a guide on www.gp32emu.com om, in the pc tools section, on how to use smcmaker
 
Sorry, my confusion is confusing. At work I tried on geepee forgetting that I could create a SMC file (even if I did it a while ago, go figure). So I stopped there and my last post is from a test I did at home on my GP32.
 
well i can't see much where the mystake come from.
maybe you should post more code........What are the 41 and 42 line ?
hmmmm...is this the exemple from cone3d website ?

i compiled it a while ago....

If it is that i will try to compil it again.
 
Yep it is from that site. If you compile the second tutorial and it works maybe you could send me the code and I could compare it to mine. Or I could post my code. But I don't know what would be relevent or not and it is more than one hundred lines...

Line 41 and 42 are lines where I call IMG_Load or load_bitmap. Only SDL_LoadBMP doesn't give those errors. I should mention that the original source was cpp. But I was getting errors I didn't understand so I converted it to c. I think it is my make file wich is not up to specs concerning cpp.

Thanks
 
Ok you were right ;)

i remember now that it was hard to get it work.
So i coded my own code inspired by this exemple.

I did not found exactly why it did not work....I suspect the loop.

For your warning i advise you to include SDL_image.h

Here a package with the sources code i wrote, the .bmp to load.

http://unplugandplay.free.fr/Pekele/SDL/loadbmp.zip

Have fun

Pékélé
 
Ok, with help from your working code, I found out what was causing the problem. It's the screen locking functions. Remove them and change a few things and it should compile and work even without including SDL_image.h.

Thank you very much for your help :D
 
Back
Top