QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Dimster on February 21, 2020, 10:35:50 am
-
I'm going to convert a program written with a mixture of QBASIC and QB64 over to QB64 v 1.4. I have found myself a little lost on the color commands. The old program uses Dim Shared and the colors were standard names like Red, Blue, Green , Purple etc. Each color name ended with the ampersand and the _RGB value. To convert to $Color, is it a simple matter of placing $NOPREFEX at the beginning of the program, delete all Dim Shared colors and removing the ampersand on the color name?
For example
OLD Program:
DIM SHARED Blue&
Blue& = _RGB(0, 0, 129)
NEW Program
$NOPREFEX
$Color:32
Blue = RGB(0,0,129)
But seems I'm missing something in the conversion code.
The old program is very large, many screens, lots of colorful data. I thought it would be a relatively easy matter to simply use the Find/Replace to remove all offending underscores and ampersands but seems there could be a lot more to converting the color than I think. I have been to the WIKI, can't seem to decipher how to alter the name of the colors I already have.
-
It is not recommended to use $NOPREFIX with old code being adapted. The recommendation is to add it to new projects, as to avoid naming conflicts.
And, as per the wiki, $COLOR and $NOPREFIX are not to be used in conjunction, as $COLOR contains color names which also double as keywords, like RED, GREEN, BLUE, and these become keywords with $NOPREFIX.
-
Oh - thanks Fellippe, save me, in the nick of time, to a waste of time. Looks like v1.4 may be a step too far for that old program and a daunting challenge to rewrite it in QB64 only.
-
One thing is not to use the top-notch features, another is not to convert it to safe-for-old-code new features. Does your code not run as is?