C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-11-2007, 07:22 PM   #1
Registered User
 
Join Date: May 2007
Posts: 5
display character size...(quite urgent..)

Hi friends,

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

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..


the code is following..
--------------------------------------------------------------------------------------------
Code:
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++;
	}

}
waiting for your valuable reply..


with regarding,
karthi..
karthi is offline   Reply With Quote
Old 07-11-2007, 07:50 PM   #2
Deathray Engineer
 
MacGyver's Avatar
 
Join Date: Mar 2007
Posts: 3,211
Wow.... an urgent request to alter gameboy code. I don't think I've ever seen that.

Are you expecting expert gameboy programmers to be active here and able to help you? RTM and STW. If you'd like some help with it, you might want to point us to the documentation associated with the libraries you're using.

No guarentee people will feel like searching through them, but it's possible.
__________________
MacGyver is offline   Reply With Quote
Old 07-11-2007, 08:11 PM   #3
Registered User
 
Join Date: Oct 2006
Location: Canada
Posts: 1,230
and just to reinforce something macgyver touched on, when you title your thread as urgent, you wont get much more help than that given above. youll may get someone saying how you wont get much help when you post your thread urgent, though.

i havent really 'looked' at the code but ive glanced at it and it looks properly formed so thats good. however, use more coherent sentences in your post. dont just end each sentence with an ellipsis, and dont be afraid to use the entire line. im not trying to pick on you im trying to help you get help in the future--good luck
nadroj is offline   Reply With Quote
Old 07-11-2007, 08:16 PM   #4
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,295
If you wrote it, I'm pretty sure you'd know how to fix it too.
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is offline   Reply With Quote
Old 07-11-2007, 09:00 PM   #5
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,698
Code:
if (strlen(str) == 0)
Why not just
Code:
if(str[0] == '\0')
or even this?
Code:
if(!*str)
Code:
else if (((*str) >= 48) && ((*str) <= 57))
isdigit() from <ctype.h> is much more portable than that. http://www.cppreference.com/stdstring/isdigit.html

Also, declaring variables in the middle of a block is C99. You can do it, you should just be aware that it's a feature of a newer version of C.
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
dwks is offline   Reply With Quote
Old 07-11-2007, 09:13 PM   #6
Registered User
 
Join Date: May 2007
Posts: 5
HI nadroj,
Thanks for your reply..
this is whole function source code..
in this i just want to add , one more fucntion to make the character big, may be we get the from the function paramater..but afterthat how to make character as big to display. i need this concept..

the function value i pass currently

Code:
	printfC(MAP_ADDRESS, 0, 1, "
PASS", GREEN);
after i can display pass in my screen..but the displsy is small,, but i want to display more big to see clearly..

waiitng for your valuable reply..

with regards,
kar..
karthi is offline   Reply With Quote
Old 07-11-2007, 09:22 PM   #7
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,698
So you want to display some text in a larger font?

Well, the code snippet that you posted has no control over what font is used, as far as I can see.
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
dwks is offline   Reply With Quote
Old 07-11-2007, 09:27 PM   #8
Registered User
 
Join Date: May 2007
Posts: 5
Hi dwks,

Thanks for your quick reply..

i didn't use any font control..

and i dn't know how to use also

because i am new to c programming..

so if u have idea please forward the code , and how to use font control in this and make to display as larger??

i am really in deadline..

Please help me..

waiting for your reply..

with regards,
kar..
karthi is offline   Reply With Quote
Old 07-11-2007, 09:31 PM   #9
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,698
I have no idea if that's what you need. I was just guessing.

Are you able to change the screen mode of your display? If you used a lower resolution, everything would seem larger (and blockier, but that's the price you'd pay).

Where do you load your font, if anywhere? What library are you using? How much code do you have; can you post more of it?

[edit] Are you using the GBDK compiler? Does it come with documentation? [/edit]
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.

Last edited by dwks; 07-11-2007 at 09:34 PM.
dwks is offline   Reply With Quote
Old 07-11-2007, 09:38 PM   #10
Registered User
 
Join Date: May 2007
Posts: 5
Hi,

i don't have other source with me..

i just need to added this function here..

without font control can we make larger the character?

using any method or any new function to make larger?

if u have anything please post to me..

with regards,
kar..
karthi is offline   Reply With Quote
Old 07-11-2007, 09:42 PM   #11
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,698
Quote:
without font control can we make larger the character?

using any method or any new function to make larger?
I don't know. I've never programmed anything for the Game Boy.

But I might be able to find something about that if you can give me some more information about your program, like what compiler you are using. My educated guess is GDBK, based on LCC, which I linked to in my edit. Is that the one you are using?

So that's allf of the source code you have? That's not a complete program. Where's the rest of the source? Do you have access to it?

[edit] Are you using these functions? http://gbdk.sourceforge.net/doc/html/console.h.html [edit]
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
dwks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code review Elysia C++ Programming 71 05-13-2008 09:42 PM
Please Help - Problem with Compilers toonlover C++ Programming 5 07-23-2005 10:03 AM
syntax error when defining vectors starkhorn C++ Programming 5 09-22-2004 12:46 PM
mygets Dave_Sinkula C Programming 6 03-23-2003 07:23 PM
File Size and File Size on Disk DavidP A Brief History of Cprogramming.com 4 12-15-2001 08:03 PM


All times are GMT -6. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22