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 > Graphical console

#168806 - SteveH - Tue May 26, 2009 10:58 am

If anyone is interested in this, I know WinterMute was interested in it from the convo on IRC the other day.

Anyway here's the first release of a graphical console:

http://www.stevensprogsite.co.uk/nds/gfxconsole_dist.zip

There's a readme file with a quick and dirty overview of the code, and I took some of the examples from libnds and converted them to using my graphical lib.

There's a couple of features that don't work 100% yet, mainly windows and the clear screen stuff.

I'd like to add a few new features to this once I get the windows working, but I think that will have to wait for a little bit.

At the moment it's feature list is limited, but it is one of the things I wanted to work on as a basis for a game I'm attempting to develop.

Future releases may include the ability to output directly to the sprite memory, so that you can use sprites for text dialogues, like the old GB games did, also I'm looking into adding some basic alpha blending code to the but I'm not sure if it will be needed or not.

If you have any sugestions on what to add to this please let me know, I might end up making this a lib when it gets more complex

#168808 - Echo49 - Tue May 26, 2009 11:44 am

Just a few quick questions:

Can I print to any specific pixel offset? (default console is fixed at 8x8)
Can I print on top of a 3D scene?
Can I use any bitmap font I want?

Thanks :)

#168809 - SteveH - Tue May 26, 2009 12:52 pm

Echo49 wrote:
Just a few quick questions:

Can I print to any specific pixel offset? (default console is fixed at 8x8)


At the moment yes and no - yes you can move to a specific x pixel, but the y location is fixed at the font height. The change needed to make the console code print at any Y offset is very small, and I'm looking at the full ANSI documents to see if there is anything I can use, like a line height option or something like that.

Echo49 wrote:

Can I print on top of a 3D scene?


I've not tried this yet, mainly as I've not played around with the 3D features of the DS, I'll have a play around later today with the 3D examples.

Echo49 wrote:

Can I use any bitmap font I want?

Thanks :)


Almost, the font engine I use is based on the ByteMaped Fonts format (more information can be found here), and they allow multiple sized fonts (smallest font in the bmf library at the moment is 3x3, maximum is something like 239 line height). There is a bmf editor available on the main BMF site but it needs a dos environment to run as it's wrote in pascal. I am going to write a bmp2bmf converter for the fonts, but it will take a little while to get it working correctly I think.

#168811 - Dwedit - Tue May 26, 2009 1:05 pm

How about just a generic transparent sprite routine for the 4bpp tilemap mode? Want text? Draw font characters.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#168812 - SteveH - Tue May 26, 2009 1:15 pm

Dwedit wrote:
How about just a generic transparent sprite routine for the 4bpp tilemap mode? Want text? Draw font characters.


Can you get a sprite to do any of the following images?

http://www.stevensprogsite.co.uk/blog/wp-content/uploads/2009/05/shot4.png

http://www.stevensprogsite.co.uk/blog/wp-content/uploads/2009/05/shot5.png

Granted that you possibly could, this first version is just a proof of concept of what can be done with the currently console code and a slight change of the drawing features, I'm pretty sure that a future version will have what you want, but at the moment it's working on a 2D 16bit color background layer, all my tests have been done in MODE_5_2D so far, I'm going to be looking at extending the features, and hopefully I'll get something working that can assist anyone that needs some text rendered on the screen, without the need to write their own.

Oh and in response to Echo29 - I found the ANSI escape sequence to set the way the move cursor code works, I'll implement it in the next version.

#168813 - Echo49 - Tue May 26, 2009 1:45 pm

Thanks for looking into it.

It might be a bit early to say this, but I think this has the potential to become an extremely useful font system - I'll definitely be looking at replacing my own one with this in my game :)

#168943 - Echo49 - Thu Jun 04, 2009 12:30 pm

Just wondering, do you have a rough timeframe for the next release?

#168944 - Dwedit - Thu Jun 04, 2009 12:40 pm

I'd like to see a sprite routine to blit to tiles for 4bpp tilemap mode. Obviously Nintendo has used them before (in GBA games like Advance Wars).

The idea is that you'd define an area which you want to contain a big text box, set the MAP tiles to point to your VRAM tiles, then draw to the VRAM tiles. Since the pixels are arranged in non-sequential order, it might be a little tricky to implement well, but would be quite useful, since it would conserve VRAM.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."


Last edited by Dwedit on Fri Jun 05, 2009 12:24 pm; edited 1 time in total

#168946 - a128 - Thu Jun 04, 2009 6:41 pm

Great work.

Very usefull......
_________________
"Hey! It compiles! Ship it!"

#168954 - SteveH - Fri Jun 05, 2009 11:45 am

Thanks for the feedback, and the request..

I'm working on the sprite stuff, I've got to get my head around how the sprite data is stored first as I've not played with sprites before.

I've updated the version I linked to in my first post with some minor tweaks, mainly I moved where the fonts are stored from the data folder into their own font folder, updated the instructions for the makefile. Oh and got the console windows to work correctly.

I also added a more standard 4x6 font as the main one - the font is based on the 4x6 terminal font for windows and I downloaded the font from a roguelike game (full links in the readme). I've got some code to convert bmp files to the BMF file format which makes a fair few assumptions (mono spaced font, no gap between characters, input format type is very specific) that I will try and fix for the next release.

I've just started a small project that will need the sprite printing code so I will attempt to get that sorted out at the same time.

#169307 - Echo49 - Tue Jun 30, 2009 11:06 pm

Any update?

Sorry if I sound a bit persistant :P

#169308 - SteveH - Wed Jul 01, 2009 12:49 am

Just a small code fix on the console to allow UTF-8 encoding to be used if wanted - Download test nds file here only runs on real hardware as it reads your user profile from the system and then outputs it to the screen.

I'm still trying to work out the best way to use sprites as the output method, since I'm limited to at max 64x64 per sprite, and have to actually try and workout how to use sprites first...

Unfortunatly I'm a perfectionist, and will only release code once it's at an acceptable level to myself - I'll get it sorted soon, as I'm taking a break from console coding for a bit (I tried for 2 weeks to design a unified console that allowed tiles, graphics and sprites, and failed to get anything working the way I wanted it), so I'm working on another mini-project to take my mind off consoles for a little bit, but don't worry I'll be back on the console case soon.

#169905 - Echo49 - Wed Aug 12, 2009 1:54 am

Hi, it's me again :3

Do you have any plans for a next version? If not, can I modify the source code in the first post to add in any extra functionality I need?

#169907 - SteveH - Wed Aug 12, 2009 1:12 pm

I have plans for a new version, and you can modify the current code as you see fit. I've been working on another project for the past month and I've managed to talk myself into yet another project for the forseeable future, so the graphical console is put on hold, for the time beeing anyway.

#169908 - Echo49 - Wed Aug 12, 2009 1:31 pm

Thanks!