gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > graphics problems...can't figure it out

#147560 - myersn024 - Sun Dec 23, 2007 7:15 am

I've been working on learning everything that I need to know to get started programming for the DS for the last two weeks. Tonight I wrote my first lines of DS homebrew code, and I've run into a problem regarding graphics files. Thus far, I've been unable to link any graphics files into my programs. I've tried using GraphicConverter for OSX to save as a byte-array and then use hConvert to convert them into .bin files, but I can't get them to link. Are there any special steps required in getting them to work?

I haven't had any problems creating my own tiles using something like this->
Code:
u8 myTile[64] = {
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1 };

and then drawing them to the screen using colors manually specified by the BG_PALETTE[1] = RGB15(what ever color I want) command. Coming from coding PSP homebrew, the DS is a huge change. I always liked programming 2D games and the PSP was a bit of a bear to use to make 2D games since it has 3D hardware. The DS is the first system that I've used that has 2D hardware, and I LOVE IT thus far. It's almost like cheating compared to the PSP stuff.

Thanks in advance,
Nick

#147563 - melw - Sun Dec 23, 2007 11:17 am

Check out the nds examples pack, there's plenty of good graphics examples, including how to include .bin files to your project. In short you need to define in the makefile how binary files are handled - pretty much all the examples use directory called "data" for this.

#147569 - myersn024 - Sun Dec 23, 2007 4:34 pm

I tried using the makefiles for several of the 2d examples, but nothing would work. I'll take another look into it this afternoon and see if I can figure it out. I didn't have any problems linking in raw audio files, though; so I'm not sure exactly where the problem lies.

I'll post back if I can't figure it out.

#147964 - Bloodypriest - Mon Dec 31, 2007 5:43 am

You should get into the habit of not linking .bin files directly into your project. It is wasting good ram with a permanent copy of data whose true place lies elsewhere.

Instead, you can malloc the memory when needed, read the files from disk using libfat, then free the memory afterwards. No ram wasted.

#147983 - tepples - Mon Dec 31, 2007 1:50 pm

I disagree with Bloodypriest, especially in the case of a beginner who is having trouble compiling programs at the level of hello world. But I'll take it to another topic.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.