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.

C/C++ > display character size...(quite urgent..)

#134258 - mk2007 - Thu Jul 12, 2007 2:32 am

Hi friends,

i have a function in my program to dispaly the character with color whatever i put..

the code is following..


void printfC(u32 address, u8 x, u8 y, char *str, enum COLOUR colour)

//address - destination address (i.e.: map address)
//x, y - co-ordinate determines location in array

// (0,0) = 0; (1,0) = 1; ... (29,0) = 29; (30,0) = 30; (31,0) = 31;
// (0,1) = 32; (1,1) = 33; ... (29,1) = 61; (30,1) = 62; (31,1) = 63;
// (0,2) = 64; (1,2) = 65; ... (29,2) = 93; (30,2) = 94; (31,2) = 95;
// (0,3) = 96; (1,3) = 97; ... (29,3) = 125; (30,3) = 126; (31,3) = 127;
// so (x,y) = (x + (y * 32));
{
if (strlen(str) == 0)
return;


u16 *pDst;
pDst = (u16*)address;

u16 location;

location = (x + (y * 32));

u16 len = strlen(str) + location;
u8 value;

for (u16 i = location; i < len; i++)
{
if (*str == 32)
value = (*str - 32);
else if (((*str) >= 48) && ((*str) <= 57))
{
value = *str;

switch (colour)
{
case GREEN:
value += 73; //121 - 48
break;
case RED:
value += 109;
break;
case BLUE:
value += 145;
break;
}
}
else
{
value = *str;

switch (colour)
{
case GREEN:
value += 30; //95 - 65
break;
case RED:
value += 66;
break;
case BLUE:
value += 102;
break;
}
}
pDst[i] = value;
str++;
}

}

i am using this in my game boy program..

by this function i can display the character with color..

but i want to display my character as big size..how to i display my character in the screen as big size then now..

is there any function to make character big to display..

is there any formula to display the character as big then now.??


please if u have any example coding or any information regarding this..

please forward me..

this is quite urgent..

waiting for your valuable reply..


with regarding,
karthi..

#134271 - tepples - Thu Jul 12, 2007 4:59 am

To draw big characters, you draw them as multiple tiles. For instance, you can draw a 16x16 pixel "3" by making the four tiles that make up the image and then drawing those to the screen.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.