Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gba color weirdness

This topic is 5150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote my first gba application today, modeled off of the first tutorial on www.gbajunkie.co.uk (great site, also check out www.thepernproject.com if you're interested in gba development). I got everything compiling ok and it somewhat works. There are, however, two small bugs that are quite perplexing. First off, the color green seems to overtake the color blue. My input function is as such:
int getInput()
{
	if(!((*KEYS) & KEY_A))
	{
		RED = 255;
	}
	else if(!((*KEYS) & KEY_B))
	{
		GREEN = 255;
		BLUE = 255;

	}
	else if(!((*KEYS) & KEY_R))
	{
		BLUE = 255;
	}

	return 0;
}



and my drawing routine is nothing more than

   
		for(int x = 0; x < 240; x++)
			for(int y = 0; y < 160; y++)
				screenBuffer[x+y*SCREEN_WIDTH] = RGB(RED, GREEN, BLUE);
Now, when I press A, the screen goes red. However when I press B, the screen turns green, not light blue as I would think it would. If I comment out blue, it's still the same shade of green. If i comment out green, it turns blue. So it's almost as if the green is swallowing up the blue. Very odd....anythoughts? Problem number 2 is that the R button is does not work. If I press it nothing happens. Should it not turn the screen light blue? Any help would be appreacited. Thanks! When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon... [edited by - CyberSlag5k on April 14, 2004 11:05:10 AM]

Share this post


Link to post
Share on other sites
Advertisement
My first thought is that you should check out the palette you''re using with this...I haven''t checked out those sites, but I did a little bit of GBA dev...but that''s all I can say. See if that helps, save some time maybe =).

Disclaimer: I don''t know what the hell I''m talking about more than 106% of the time.



"TV IS bad Meatwad...but we f***in need it"

If you''re a girl under the age of 12, and you''re high on marijuana...don''t ride your bike. -TRUTH

Share this post


Link to post
Share on other sites
I''m not doing any tiles or sprites so I don''t have a color pallette. I should just be able to set the pixel color using those sprites...it''s really quite weird.

When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...

Share this post


Link to post
Share on other sites
You need to zero the channels you don''t want, i.e.

int getInput()
{
if(!((*KEYS) & KEY_A))
{
RED = 255;
GREEN = 0;
BLUE = 0;
}
else if(!((*KEYS) & KEY_B))
{
RED = 0;
GREEN = 255;
BLUE = 255;
}
else if(!((*KEYS) & KEY_R))
{
RED = 0;
GREEN = 0;
BLUE = 255;
}
return 0;
}

Share this post


Link to post
Share on other sites
Sorry, I do that already but I didn''t put it in the post. I zero them all in the main loop just before I grab input.


And so the mystery continues...

When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
mode3 on teh gba is 16bit so you should do RED=31, GREEN=31, BLUE=31 instead... yeah

Share this post


Link to post
Share on other sites
Awsome, that did it. Thanks anonymous.

Coincidently, I found out that the shoulder trigger thing was just switched. Whenever I pressed the right shoulder trigger button, it did nothing, but when I pressed the left shoulder trigger, the screen went blue. I guess either my gba emulator or KEY_R definition is backwards. Craziness.

Thanks for everyone''s help!

When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!