Author Topic: Color Constants  (Read 4045 times)

0 Members and 1 Guest are viewing this topic.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Color Constants
« on: October 18, 2018, 12:41:20 am »
Hey everyone, I could have swore I saw a file someone made of CONSTant values for common colors.

Something like:

CONST RED = &HFF0000
CONST YELLOW = &HFFFF00
CONST GOLDENROD = &HDAA520

etc..

However, after searching the site I can't seem to find it. Was I seeing things? If you are the person that posted it could you please point me to the post?

Thanks everyone :)
« Last Edit: October 18, 2018, 12:43:34 am by TerryRitchie »
In order to understand recursion, one must first understand recursion.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Color Constants
« Reply #1 on: October 18, 2018, 01:07:07 am »
https://www.qb64.org/forum/index.php?topic=351.msg2346#msg2346

It used to be just for 32-bit colors, but now it works for all our screen modes.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: Color Constants
« Reply #2 on: October 18, 2018, 01:32:14 am »
Thanks Steve!
In order to understand recursion, one must first understand recursion.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Color Constants
« Reply #3 on: October 18, 2018, 01:49:22 am »
Happy to be of service.  Honestly, if it was entirely up to me, I'd love to set those added to QB64 itself so they'd be permanently available for everyone to use.

Only issue with that idea though: It'd break existing code for everybody who may have used those names already in their programs.  :(
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: Color Constants
« Reply #4 on: October 18, 2018, 02:19:57 am »
Yeah, an external file is the only way to go for constants. I want to incorporate your color code into my library. Is that ok?
In order to understand recursion, one must first understand recursion.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Color Constants
« Reply #5 on: October 18, 2018, 02:22:29 am »
Absolutely.  It's there for everybody to use and enjoy.  ;)

Just remind people to be certain to set the precompiler KOLOR variable to match their screen mode.  (Or, if you're only going to support 32-bit screens with the library, just $LET KOLOR = 32 at the top of your library to begin with.)

Also, if you're not supporting 256 color mode, you don't need to worry about the *.BM file.  It's only for setting the 256 color palette on a screen, so can be ignored otherwise.
« Last Edit: October 18, 2018, 02:27:41 am by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: Color Constants
« Reply #6 on: October 19, 2018, 03:23:28 pm »
Gotcha, thanks Steve :)
In order to understand recursion, one must first understand recursion.