Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SET (Steve's Extended Toolset)
#4
As we've now managed to get a few different releases out for QB64 Phoenix Edition, and all seems like it's starting to get stable for the forums, wiki, repo, and all, I'm going to try and sit down and write up a little demo of the various different routines inside these libraries for everyone to see if they contain anything which might be of interest, or use to them.  Since @madscijr asked about this one in particular, let me start here with it and explain what it is and what it can do for folks. Smile



First thing to keep in mind is this is an old library, and some of the parts of it would be obsoleted for folks using the modern versions of QB64.  The reason?  I'm also one of those guys who help develop QB64 itself, and often you'll find portions of my libraries end up becoming part of QB64 itself, once they've been tested and enough people have decided they want to make the features permanent.  With Steve's Extended Toolset, that holds true in more than one place -- features that we have in here are now standard in QB64 itself.  Big Grin

For instance, the color constants that a lot of folks enjoy the simplicity of using, originated here first, before being partially implemented into QB64.  If you've ever used $COLOR:32 or $COLOR:0, then you've used code which originated from this library....


But have you ever wondered why there isn't a $COLOR:256??

There is!  At least, here, there is.  It's just more of a two step process, rather than a simple one step command, so it never got migrated over to QB64 proper.

Code: (Select All)
$Let KOLOR = 256
'$INCLUDE:'SET.BI'

Screen _NewImage(640, 480, 256)
Set256Palette 0

Line (100, 100)-(300, 300), Peach, BF
Sleep
Line (100, 100)-(300, 300), Gold, BF
Sleep
Line (100, 100)-(300, 300), Silver, BF
Sleep
Line (100, 100)-(300, 300), SkyBlue, BF


'$INCLUDE:'SET.BM'

Notice that we have a couple of things to do here to set up the color names to work with a 256 color screen:

First, $LET KOLOR = 256.  This is a flag which says we want to use the 256 color values and not the screen 0 or 32-bit screen color values.  This needs to come before the $INCLUDE for the library.

Then we set the SCREEN to become a 256 color image with Screen _NewImage(640,480,256)

And then we set the image that we want to use the color named palette with Set256Palette (image handle), which is 0 in this case for the current screen.

And that's it!  You can now use the color names for Red, Blue, Green, Yellow, Midnight, White, Black, Purple, and whatnot, rather than having to try and remember the color codes for them with your program!

(Further demos and explanations to follow.)
Reply


Messages In This Thread
SET (Steve's Extended Toolset) - by SMcNeill - 04-17-2022, 09:42 PM
RE: SET (Steve's Extended Toolset) - by madscijr - 05-10-2022, 02:26 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-10-2022, 02:46 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-12-2022, 12:51 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-12-2022, 01:34 PM



Users browsing this thread: 2 Guest(s)