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.

Beginners > Mode 5 Font demo - help

#43634 - Impatient - Wed May 25, 2005 6:50 am

Can someone PLEASE post a font and some code that simply opens a mode 5 screen and displays a line of text on it? For the sake of god, I can't find a simple piece of font text handler to print basic text in mode 5!

#43643 - Cearn - Wed May 25, 2005 9:14 am

If you have something that works for mode 3, then you have something that works for mode 5, just change the pitch from 240 to 160 at it should work fine.

#43670 - Impatient - Wed May 25, 2005 4:33 pm

I dont have anything ...

#43675 - sajiimori - Wed May 25, 2005 6:08 pm

I say write one yourself. I mean, what's the point of being a hobbyist if not to learn from experience? ^_^

#43677 - Impatient - Wed May 25, 2005 6:11 pm

I AM trying to learn and looking at other peoples code is a good start. how do I display a single character from a bitmap font on mode 3 ?? the font is 8x8 and start with space

#43682 - sajiimori - Wed May 25, 2005 6:26 pm

On the contrary, I think trying it is a good start. Feel free to post questions if you run into a problem. :)

#43683 - Impatient - Wed May 25, 2005 6:28 pm

what an arrogant attitude towards newcomers.

#43686 - sajiimori - Wed May 25, 2005 6:36 pm

Hey, I gave it a shot. I've never said this to anybody in the two years I've been here, but if I were you I'd think about moving on.

#43687 - Impatient - Wed May 25, 2005 6:38 pm

you MUST be american ...

#43688 - Miked0801 - Wed May 25, 2005 6:39 pm

What a lazy additude for a learner.

I dub you a troll. Now I'll feed you a troll cookie.

There are a number of examples of pixel draws for modes 3-5 on the forum and in sample code. With that, all you need to do is create a draw yes/no table in a 2 dimensional array per letter (so 3 dim).

Code:

#define MAX_LETTERS 1

const u8 letterTab[MAX_LETTERS][8][8] =
{
    {0,0,0,1,1,0,0,0),
    {0,0,1,1,1,1,0,0),
    {0,1,1,0,0,1,1,0),
    {0,1,1,0,0,1,1,0),
    {0,1,1,1,1,1,1,0),
    {0,1,1,1,1,1,1,0),
    {0,1,1,0,0,1,1,0),
    {0,1,1,0,0,1,1,0),
};

void drawLetter(u32 x, u32 y, u8 letter)
{
    int i,j;

    ASSERT(letter < MAX_LETTERS);

    for(i=0; i<8; i++)
        for(j=0;j<8;j++)
        {
            plotPixel(x + j, y + i, letterTab[0][i][j]);
        }
}


The results and debugging of the above routine is left as an exercise for the student.

#43691 - sajiimori - Wed May 25, 2005 6:49 pm

Exercise?? But that sounds like... work! >_<

:P

#43692 - poslundc - Wed May 25, 2005 6:50 pm

Impatient wrote:
what an arrogant attitude towards newcomers.


The people in this forum all lead busy lives, but we are always happy to take time out to answer questions and do whatever we can to encourage and support new developers, usually because someone was there for us when we were still new to the platform and we know from experience how beneficial it is to have a community of resources to draw upon.

But someone who abjectly refuses to do anything to learn for themselves does not impress most of us into going out of our way to help them. This isn't arrogance; you simply aren't worth the time or effort.

The tutorials I pointed you to in a different thread teach you everything you need to know to write the code you've been looking for, with heaps of sample code that are only a stone's throw away from doing it. Have you even tried plotting a pixel in Mode 3 yet? (It's one of the exercises in the tutorial.)

To reiterate, if you run into any specific problems along on the way or have a specific question with code you are attempting to write, you will probably be deluged with responses from people eager to help out. But if you are honestly surprised by the responses you've been getting, you'll probably have a very tough road ahead.

Dan.

P.S. I'm not American; I just work here, but you're welcome to take a shot if you feel like alienating more countries.

#43780 - yaustar - Thu May 26, 2005 6:43 pm

Just to prove the above point (Still enternally gratefull to you sajiimori :) ) I say anyone that can go through 4 pages to help cannot be arrogant

#43782 - sajiimori - Thu May 26, 2005 8:04 pm

Wow, I sounded so different back then. Working on a team has changed me for the better.

#43811 - ScottLininger - Thu May 26, 2005 11:42 pm

sajiimori wrote:
Wow, I sounded so different back then. Working on a team has changed me for the better.


<LOL>

Saj, are you saying you've mellowed with age? Because if so, it's a good thing Impatient here didn't post their, er, "question" before then. ;)

To Mr. Impatient:

I say this with as much calm compassion as can be transmitted via a text message. I'd change your login name, develop a simple program that displays pixels as Dan suggests, and THEN ask questions as they come up. I think you'd experience a very different kind of response.

I am an American, but believe it or not, I'll happily help you out.

Let me start with this: Mode5 is one that is rarely used and therefore it will be hard to find a text system like you're asking for. I have one that I wrote, but it's so buried inside the code of a larger game that it would be at least an hour of work for me to pull it out and clean it up enough to be instantly helpful to you. If you demonstrate that you're a nice guy, I might actually make the effort for the betterment of the community, but right now I simply don't have an hour to spare.

I could send you the full source code of the game, if you're interested in trying to figure it out. PM me if that's the case.

-Scott