Console problems: Font is too big
Console problems: Font is too big
I have a problem with using the console.. the problem is the font is too big.. I mean, I know 8x8 isn't THAT big, but I can only put it at certain tile coordinates (meaning no half tiles.. so If I want the text to start at pixel coords of 1,3 I can't because those aren't multiple of 8 so they aren't tiles) and it's really bothering me.
I can't type the font where I want but only at set coordinates of 8x8... Is there a way to change this? I've tried looking in the headers but the only thing that I can think of is to directly change the libraries... @_@
I can't type the font where I want but only at set coordinates of 8x8... Is there a way to change this? I've tried looking in the headers but the only thing that I can think of is to directly change the libraries... @_@
Re: Console problems: Font is too big
the hardware uses tiles of 8*8 pixels, so its not easely possible to put text at a position thats not a multiple of 8. to do this means that you can't let the hardware do it and that you have to draw the text on it yourself, which will be both slower and bigger.
you can also shift the entire background a few pixels, but that will move every text and not just parts of it.
you can also shift the entire background a few pixels, but that will move every text and not just parts of it.
Re: Console problems: Font is too big
But then why and how do some commercial games have a font smaller than 8x8 pixels?vuurrobin wrote:the hardware uses tiles of 8*8 pixels, so its not easely possible to put text at a position thats not a multiple of 8. to do this means that you can't let the hardware do it and that you have to draw the text on it yourself, which will be both slower and bigger.
you can also shift the entire background a few pixels, but that will move every text and not just parts of it.
Re: Console problems: Font is too big
they probably used software to draw each pixel to the right position instead of using the hardware. its bigger and slower, but not impossible and useally has a better result.
Re: Console problems: Font is too big
vuurrobin wrote:they probably used software to draw each pixel to the right position instead of using the hardware. its bigger and slower, but not impossible and useally has a better result.
Mmm.. honestly I may say that I doubt it.. I mean, I find it hard to believe that for every dialogue every game just manually colors different pixel depending on the dialogue itself... it sounds too much a bother... I'm sure there must be a way to make it so, anybody has got any suggestion? What bothers me is the positioning, I can't put a text in a different position than a multiple of 8, but there MUST be a way..
Re: Console problems: Font is too big
Well, the default font output uses the tile-map engine built into the DS I believe. There is simply no way to move the text over on a per-letter basis using a tilemap, since the whole foundation of the tile engine is that there IS a set width/height. So your next option is to use sprites or something. I myself wrote a per-pixel text renderer, it's really slow and I'm attempting to come up with a more clever method.
Re: Console problems: Font is too big
I dunno how any commercial games do it, but doing it this way is simpler than it sounds, and I think it can be plenty fast enough for a lot of uses of text - e.g. menu screens, dialogue windows in RPGs, etc..Morgawr wrote:Mmm.. honestly I may say that I doubt it.. I mean, I find it hard to believe that for every dialogue every game just manually colors different pixel depending on the dialogue itself... it sounds too much a bother...
There are probably better ways to do it, I don't know yet.. How I've done it is basically like this:
1. Start off by making a function to set the colour of a single pixel, given an x and y position on screen.
2. Have a font stored in some kind of array. There must be lots of different ways of storing font data. The easiest to understand way (definitely not the best!) would be to have an array like this, for example: (simple letter 'A')
Code: Select all
0,1,1,1,1,1,0,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,1,1,1,1,1,1,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0
4. To write a whole string, make a function which iterates through the string, calling the single letter drawing function for each letter.
So, basically building up your own simple version of printf(), bit by bit... Once you've made some functions like these, it's not a hassle to actually use - in your game code you'll be able to just go myPrint("hi there!",12,15) to print starting at pixel 12x15... or something like that..
..if any of that makes sense?
This of course lets you use fonts of whatever size you like, and have variable width letters, be able to scale up each letter on the fly by drawing multiple pixels for each point, etc.. It's obviously only a single colour font, I haven't got further than that yet. It's also slower than using a tiled mode, and you have to use a bitmap background of course.. but yeah, I think it could be okay for the average text display in many games..
Of course, having each letter stored as an array of ints of bools like that isn't very efficient, and you don't want to be having to type in 1s and 0s for your whole font by hand!
*this is where it gets slightly more scary*
I'm using Usenti (or I think you can setup Grit to do it?) to convert a graphics file containing the font into code.. so instead of the 'A' array above, you have each letter stored in two unsigned ints, looking something like this:
Code: Select all
0x18336300, 0x0063660C
see how the eight hex digits are broken down into four groups of two? each pair of hex digits representing an 8-bit binary number.. each 8-bit binary number represents one row of pixels (those 0s and 1s) in a letter. (that's why each letter is stored in two unsigned ints - each int holds 4 rows, each letter needs 8 rows)
...sorry if you already know that, it's probably obvious to people who've learnt about bitwise operations.. it's fairly new to me
So from there it's just a matter of figuring out how to change step 3 from above so that instead of just reading 1s and 0s from an array, it seperates out those 1s and 0s from the hex numbers..
I have no idea if this makes it faster or slower to draw the font, but it must use less memory, and is way cooler -_-
Anyway, hopefully some of that makes sense. I really don't know if this is a good way of going about it or not, it's just the way I tried a couple weeks ago, and it seems to work fine. You could of course use some already existing text display lib. Ok I'll shut up now. Good luck!
Re: Console problems: Font is too big
You could also take a look at this.. http://www.coranac.com/tonc/text/tte.htm
Who is online
Users browsing this forum: Google [Bot] and 5 guests