๐ŸŽ‰ Celebrating 25 Years of GameDev.net! ๐ŸŽ‰

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How can i make the characters of my simple font renderer face the correct direction

Started by
2 comments, last by nomacaly 9ย months, 2ย weeks ago

hello. gamedev.net this is my first post here.

im trying to add font rendering to my simple pixel graphics engine, i dont really understand how bitmaps work but i have gotten quite close.

the problem that i am facing is the characters that are rendered aren't facing the correction direction. and i can't seem to figure out how to fix it. i know I'm suppose to inverse something but i cant figure out what or how to do it.

void drawCharacter(char *bitmap, int x, int y, Color c) {
    int i,j;
    int set;
    for (i=0; i < 8; i++) {
        for (j=0; j < 8; j++) {
            set = bitmap[j] & 1 << i; 
            if (set)
            {
              drawPixel(i+x,j+y,c);
            }
        }
    }
}

it works with the character C

but not the A

any help would be appreciated. ๐Ÿ™‚

Advertisement

Is the second image an โ€˜aโ€™?

If so, i assume your letter are flipped vertically, which for โ€˜Cโ€™ does not show because it's symmetric. A fix could be:

drawPixel(x+i, y-j /*+8*/, c);

Btw, i always use the letter 'F' in debug textures. Because with this letter you see any combination of flipping instantly without uncertainty.

JoeJ said:
Is the second image an โ€˜aโ€™?

i was messing around with the bitmap font header file and changed something with out realizing. but yes it is an A.

JoeJ said:
drawPixel(x+i, y-j /*+8*/, c);

thanks dude that fixed it. ๐Ÿ™‚

This topic is closed to new replies.

Advertisement