larrybtoys
Full Member
 
Retired Part Time IT Professional
Posts: 154
|
Post by larrybtoys on May 25, 2023 12:56:13 GMT 1
Can anyone tell me why this does not work?
Auto MY_Color%, Size&
' $Library "gfawinx"
$Library "UpdateRT"
UpdateRuntime ' Patches GfaWin23.Ocx
DefFill 7
DefLine 0, 3
' MY_Color% = RGB(255, 0, 0)
Color MY_Color%, MY_Color%
'
For Size& = 3 To 15 Step 3 'This circle does not draw correctly
PCircle 100, 100, Size&
Next Size&
'
PCircle 300, 100, 15 'This circle draws fine
'
Repeat
Until MouseK = 1
'
End
|
|
larrybtoys
Full Member
 
Retired Part Time IT Professional
Posts: 154
|
Post by larrybtoys on May 25, 2023 13:33:54 GMT 1
Still did not work. My original variable was MY_Size&
I changed it but it seems any variable for this function does not work
|
|
|
Post by (X) on May 25, 2023 13:34:53 GMT 1
$Library "gfawinx" $Library "UpdateRT" UpdateRuntime ' Patches GfaWin23.Ocx Auto MY_Color%, Size As Int DefFill 7 DefLine 0, 3 MY_Color% = RGB(255, 0, 0) Color MY_Color%, MY_Color% Dim i = 1 For Size = 3 To 15 Step 3 PCircle 100, 100 * i, Size i++ Next Size PCircle 300, 100, 15 'This circle draws fine Repeat Sleep Until Me Is Nothing
|
|
larrybtoys
Full Member
 
Retired Part Time IT Professional
Posts: 154
|
Post by larrybtoys on May 25, 2023 13:36:25 GMT 1
Yep, just figured it out. 2 byte variables do not work for this function. 4 byte or floating point variables seem to work. I think this is a bug as you should be able to use 2 byte variables for drawing a circle.
|
|
|
Post by (X) on May 25, 2023 13:44:21 GMT 1
Yep, just figured it out. 2 byte variables do not work for this function. 4 byte or floating point variables seem to work. I think this is a bug as you should be able to use 2 byte variables for drawing a circle. Nice catch!
Apparently, there is a problem with using:
Byte (1B),
Short (2 B),
Int16 (2B) and
Word type (2B) typed radius variables because the radius seems to always output as 1.
GFA specifies: Single (4B) typed parameters for the Circle commands*, though:
Card (2B), // From GFA Help: The unsigned integral types are Byte (8-bit) and Card (16-bit).
Int (4B),
Int32 (4B),
Long (4B),
Large (8B),
Double (8B) and
Variant (16B)
types seem to work fine.
At the end of the day, variable types matter, even in Basic where things are meant to be 'basic'.
|
|
|
Post by dragonjim on May 25, 2023 16:22:02 GMT 1
Noted. I'll update the Help File...
|
|
|
Post by dragonjim on May 28, 2023 11:49:50 GMT 1
Just for information, this bug also affects the Ellipse and PEllipse commands.
|
|
|
Post by dragonjim on May 29, 2023 13:37:43 GMT 1
Just checked the help file and this issue is already noted on both Circle and Ellipse; it appears that the same thing also happens if the size variable is a declared as a Byte Type.
|
|
|
Post by scalion on Jun 6, 2023 14:50:07 GMT 1
If you want use an int16 variable like "Radius As Int16", You can also write "PCircle x,y,Csng(Radius)"
|
|