Author Topic: Background Color  (Read 4711 times)

0 Members and 1 Guest are viewing this topic.

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Background Color
« on: June 16, 2012, 12:31:00 am »
Is there a way to change the background color of the screen without storing a gigantic sprite?
I like milk.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Background Color
« Reply #1 on: June 16, 2012, 06:12:24 pm »
Memcpy?

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Background Color
« Reply #2 on: June 16, 2012, 06:14:57 pm »
You mean memset.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: Background Color
« Reply #3 on: June 16, 2012, 09:08:29 pm »
How do I use memset?
I like milk.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Background Color
« Reply #4 on: June 17, 2012, 02:15:33 am »
Yup, i was tired and sleepy

So, you use memset like this:
void * memset ( void * ptr, int value, size_t num );
Ptr will be a pointer to the screen, value the color, and num the number of pixel to change.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Background Color
« Reply #5 on: June 17, 2012, 02:15:06 pm »
Also, memset returns the first argument.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: Background Color
« Reply #6 on: June 17, 2012, 05:17:51 pm »
Do you happen to know what number Brown is?
I like milk.

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Background Color
« Reply #7 on: June 17, 2012, 08:10:25 pm »
0xA8000000 it is.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Spenceboy98

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 547
  • Rating: +59/-2
    • View Profile
Re: Background Color
« Reply #8 on: June 17, 2012, 08:25:51 pm »
I like milk.

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Background Color
« Reply #9 on: June 17, 2012, 11:55:04 pm »
Actually, get the RGB value for brown, then encode it in 5-6-5 RGB.

So, according to my calculations, 0x9A60.

0xA8000000 is the pointer to the screen, I got confused, sorry.
« Last Edit: June 17, 2012, 11:55:57 pm by Juju »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline MPoupe

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +30/-1
  • The coder of yesterday
    • View Profile
    • My web site about Casio calculator
Re: Background Color
« Reply #10 on: June 18, 2012, 04:50:15 am »
So, you use memset like this:
void * memset ( void * ptr, int value, size_t num );
Ptr will be a pointer to the screen, value the color, and num the number of pixel to change.
memset works with bytes, so you can use it to fill the screen, but only for few colors, where the lower byte equals the higher byte.
Black or white is OK, but brown (0x9A60) not, because 0x9A != 0x60.
Also the num is NOT number of pixels, but number of pixels * sizeof(unsigned short), because 1 pixel (= 1 unsigned short) == 2 bytes.