Welcome, Guest |
You have to register before you can post on our site.
|
Latest Threads |
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 762
|
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 31
|
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 32
|
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 2,034
|
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,261
|
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 315
|
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 127
|
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,589
|
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 254
|
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 155
|
|
|
program generated by chatgpt |
Posted by: James D Jarvis - 12-16-2022, 07:06 PM - Forum: General Discussion
- Replies (17)
|
|
this program was generated by chat gpt. I did have to lightly edit it because it tried to use the symbol "&" in place of the symbol ";" in print commands, otherwise it all came from this prompt:
create qb64pe source code that allows the user to select from a displayed list of 10 entries.
Code: (Select All) ' Define an array to hold the list of entries
Dim entries(10) As String
' Populate the array with sample data
entries(1) = "Apple"
entries(2) = "Banana"
entries(3) = "Cherry"
entries(4) = "Date"
entries(5) = "Eggplant"
entries(6) = "Fig"
entries(7) = "Grape"
entries(8) = "Honeydew"
entries(9) = "Kiwi"
entries(10) = "Lemon"
' Display the list of entries
Print "Please select an entry from the list:"
For i = 1 To 10
Print i; ") "; entries(i)
Next i
' Get the user's selection
Do
Input "Enter your selection: ", selection
If selection < 1 Or selection > 10 Then
Print "Invalid selection. Please try again."
Else
Exit Do
End If
Loop
' Display the selected entry
Print "You selected: "; entries(selection)
|
|
|
_OS$ Very interesting, but... |
Posted by: Pete - 12-16-2022, 04:57 PM - Forum: Help Me!
- Replies (4)
|
|
Rowin and Martin's Laugh IN aside,
I don't quite get this about _OS$.
The wiki states _OS$ ireturns the operating system that compiled the program. So If I compile a program in Windows, and a Linux user gets the .exe file, and runs it., all the _OS$ conditional statements can do is to indicate to the Linux user the exe was compiled on a Windows OS.
It seems to me we would be better off having it or something else identify the OS the exe is actually running on, but maybe I'm missing some value here. I haven't used it before.
Pete
|
|
|
Sending Color to Specific Location |
Posted by: Dimster - 12-16-2022, 04:03 PM - Forum: Works in Progress
- Replies (7)
|
|
I was just wondering if there is way to change the color of a value which is displaying on a screen. For example, something like this
Screen _NewImage(1900, 900, 32)
$Color:32
A$ = "5"
Color White
_PrintString (100, 100), A$
Color Green
_printstring (100,100), color green
So the value 5 is displaying on the screen in white however, later on in the program I want that value to pop out if certain conditions apply. Present coding requires a complete repeat of the value plus the new color but if I just want to change the color only at that same location doesn't appear color only can be changed? or might there be a way???
|
|
|
Liney Christmas Star |
Posted by: James D Jarvis - 12-16-2022, 01:54 PM - Forum: Christmas Code
- No Replies
|
|
one of my facebook groups has gone insane with christmas stars and somebody posted a much simpler version of this that I just had to dress up and add options to.
press any key for a new Christmas star
press c to copy the values to the clipboard, if you see one you want to try to use elsewhere (for windows users, edit it out if you can't use the clipboard command)
press <ESC> to quit
Code: (Select All) ' xmas star
' modified from
' https://www.youtube.com/watch?v=vw3k3xkGtIY
'
' press any key for a new star
' press c to copy values to clipboard
'press ESC to quit
Screen _NewImage(800, 600, 32)
_Title "X-Mas Star"
Randomize Timer
Do
Cls
segments = 8 + 2 * (Int(Rnd * 12))
lineop = Int(Rnd * 14)
xorigin = _Width \ 2
yorigin = _Height \ 2
Color 0: Rem color black
r1 = 70 + Int(Rnd * 150)
r2 = r1 / Int(2 + Rnd * 3)
For counter = 0 To segments
If counter Mod 2 = 0 Then
radius = r1
Else
radius = r2
End If
angle = 360 / segments * counter
angle = angle / 360 * 2 * 3.141592654
x = radius * Sin(angle) + xorigin
y = radius * -Cos(angle) + yorigin
Rem PSet (x, y)
Line (x_hold, y_hold)-(x, y)
Select Case lineop
Case 1
Line (xorigin, yorigin)-(x, y)
Case 2
If counter Mod 2 = 0 Then Line (xorigin, yorigin)-(x, y)
Case 3
If counter Mod 2 <> 0 Then Line (xorigin, yorigin)-(x, y)
Case 4
x2 = 1.2 * radius * Sin(angle) + xorigin
y2 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
xh2 = x2
yh2 = y2
Case 5
x2 = 1.4 * radius * Sin(angle) + xorigin
y2 = 1.4 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
Line (x, y)-(x2, y2)
xh2 = x2
yh2 = y2
Case 6
x2 = 1.2 * radius * Sin(angle) + xorigin
y2 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
xh2 = x2
yh2 = y2
Line (xorigin, yorigin)-(x, y)
Case 7
x2 = 1.2 * radius * Sin(angle) + xorigin
y2 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
xh2 = x2
yh2 = y2
If counter Mod 2 = 0 Then Line (xorigin, yorigin)-(x, y)
Case 8
x2 = 1.2 * radius * Sin(angle) + xorigin
y2 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
xh2 = x2
yh2 = y2
If counter Mod 2 <> 0 Then Line (xorigin, yorigin)-(x, y)
Case 9
x2 = 1.4 * radius * Sin(angle) + xorigin
y2 = 1.4 * radius * -Cos(angle) + yorigin
x3 = 1.2 * radius * Sin(angle) + xorigin
y3 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
Line (xh3, yh3)-(x3, y3)
Line (x3, y3)-(x2, y2)
xh2 = x2
yh2 = y2
xh3 = x3
yh3 = y3
Case 10
x2 = 1.4 * radius * Sin(angle) + xorigin
y2 = 1.4 * radius * -Cos(angle) + yorigin
x3 = 1.2 * radius * Sin(angle) + xorigin
y3 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
Line (xh3, yh3)-(x3, y3)
Line (x3, y3)-(x2, y2)
Line (xorigin, yorigin)-(x, y)
xh2 = x2
yh2 = y2
xh3 = x3
yh3 = y3
Case 11
x2 = 1.4 * radius * Sin(angle) + xorigin
y2 = 1.4 * radius * -Cos(angle) + yorigin
x3 = 1.2 * radius * Sin(angle) + xorigin
y3 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
Line (xh3, yh3)-(x3, y3)
Line (x3, y3)-(x2, y2)
If counter Mod 2 = 0 Then Line (xorigin, yorigin)-(x, y)
xh2 = x2
yh2 = y2
xh3 = x3
yh3 = y3
Case 12
x2 = 1.4 * radius * Sin(angle) + xorigin
y2 = 1.4 * radius * -Cos(angle) + yorigin
x3 = 1.2 * radius * Sin(angle) + xorigin
y3 = 1.2 * radius * -Cos(angle) + yorigin
Line (xh2, yh2)-(x2, y2)
Line (xh3, yh3)-(x3, y3)
Line (x3, y3)-(x2, y2)
If counter Mod 2 <> 0 Then Line (xorigin, yorigin)-(x, y)
xh2 = x2
yh2 = y2
xh3 = x3
yh3 = y3
End Select
Color _RGB32(100 + Rnd * 155, 100 + Rnd * 155, 100 + Rnd * 155)
x_hold = x
y_hold = y
Next counter
Do
_Limit 30
kk$ = InKey$
Loop Until kk$ <> ""
'comment this part out if you aren't running in windows
'--------------------------------------------
If kk$ = "c" Then
cc$ = "lineop " + Str$(lineop) + ", segments " + Str$(segments) + ", radius1 " + Str$(r1) + ", radius2 " + Str$(r2)
_Clipboard$ = cc$
Locate 1, 1: Print "Values copied to clipboard"
Sleep 1
End If
'--------------------------
Loop Until kk$ = Chr$(27)
|
|
|
Screen Saver Function Call |
Posted by: eoredson - 12-16-2022, 06:11 AM - Forum: Help Me!
- Replies (10)
|
|
I have been using this code to call the screen saver and blank the windows screen:
But for some reason it stopped working!?
Does anyone know of a screen saver function call that actually works?
Thanks, Erik.
Code: (Select All) ' declare external libraries.
Declare Dynamic Library "user32"
Function SendMessageA%& (ByVal hWnd%&, Byval Msg~&, Byval wParam~%&, Byval lParam%&)
End Declare
' declare screen saver call constants
Const wm_syscommand = &H112&
Const sc_screensave = &HF140&
Sleep 2
s%& = SendMessageA(&HFFFF&, wm_syscommand, sc_screensave, 0&)
|
|
|
ASCII_xmas trees |
Posted by: James D Jarvis - 12-16-2022, 04:08 AM - Forum: Christmas Code
- Replies (4)
|
|
Some randomly decorated ascii xmas trees.
Code: (Select All) 'ascii X_mas trees
_Title "ASCII X_mas Trees"
Randomize Timer
Do
tmid = 40
Color 14, 0
Locate 3, tmid
Print "X"
treetri tmid, 3, 5
treetri tmid, 6, 7
treetri tmid, 11, 8
Color 6, 0
Locate 20, tmid: Print "#"
Locate 21, tmid: Print "#"
Color 15, 0
tmid = 20
Color 14, 0
Locate 6, tmid: Print "x"
treetri tmid, 6, 4
treetri tmid, 8, 6
treetri tmid, 11, 8
Color 6, 0
Locate 20, tmid: Print "#"
Locate 21, tmid: Print "#"
Color 15, 0
tmid = 60
Color 14, 0
Locate 6, tmid: Print "x"
treetri tmid, 6, 4
treetri tmid, 8, 6
treetri tmid, 11, 8
Color 6, 0
Locate 20, tmid: Print "#"
Locate 21, tmid: Print "#"
Color 15, 0
Do
_Limit 30
kk$ = InKey$
Loop Until kk$ <> ""
Loop Until kk$ = Chr$(27)
Sub treetri (tx, ty, th)
For y = 1 To th
For x = tx - y + 1 To tx + y - 1
Color 2, 0
Locate y + ty, x: Print "*"
Select Case Int(Rnd * 12)
Case 1
Color 4, 0
Locate y + ty, x: Print "O"
Case 2
Color 14, 0
Locate y + ty, x: Print "o"
End Select
Next x
Next y
End Sub
|
|
|
BadLimit |
Posted by: SMcNeill - 12-16-2022, 03:50 AM - Forum: Works in Progress
- Replies (9)
|
|
Code: (Select All) Type ConfigSettings_Type
Heading As String
Name As String
Value As String
High As String
Low As String
Default As String
End Type
Type Color_Type
Name As String
Value As _Unsigned Long
End Type
ReDim Shared ConfigSettings(0) As ConfigSettings_Type
ReDim Shared Kolor(1000) As Color_Type
count = count + 1: Kolor(count).Name = "AliceBlue": Kolor(count).Value = 4293982463
count = count + 1: Kolor(count).Name = "Almond": Kolor(count).Value = 4293910221
count = count + 1: Kolor(count).Name = "AntiqueBrass": Kolor(count).Value = 4291663221
count = count + 1: Kolor(count).Name = "AntiqueWhite": Kolor(count).Value = 4294634455
count = count + 1: Kolor(count).Name = "Apricot": Kolor(count).Value = 4294826421
count = count + 1: Kolor(count).Name = "Aqua": Kolor(count).Value = 4278255615
count = count + 1: Kolor(count).Name = "Aquamarine": Kolor(count).Value = 4286578644
count = count + 1: Kolor(count).Name = "Asparagus": Kolor(count).Value = 4287080811
count = count + 1: Kolor(count).Name = "AtomicTangerine": Kolor(count).Value = 4294943860
count = count + 1: Kolor(count).Name = "Azure": Kolor(count).Value = 4293984255
count = count + 1: Kolor(count).Name = "BananaMania": Kolor(count).Value = 4294633397
count = count + 1: Kolor(count).Name = "Beaver": Kolor(count).Value = 4288643440
count = count + 1: Kolor(count).Name = "Beige": Kolor(count).Value = 4294309340
count = count + 1: Kolor(count).Name = "Bisque": Kolor(count).Value = 4294960324
count = count + 1: Kolor(count).Name = "Bittersweet": Kolor(count).Value = 4294802542
count = count + 1: Kolor(count).Name = "Black": Kolor(count).Value = 4278190080
count = count + 1: Kolor(count).Name = "BlanchedAlmond": Kolor(count).Value = 4294962125
count = count + 1: Kolor(count).Name = "BlizzardBlue": Kolor(count).Value = 4289521134
count = count + 1: Kolor(count).Name = "Blue": Kolor(count).Value = 4278190335
count = count + 1: Kolor(count).Name = "BlueBell": Kolor(count).Value = 4288848592
count = count + 1: Kolor(count).Name = "BlueGray": Kolor(count).Value = 4284914124
count = count + 1: Kolor(count).Name = "BlueGreen": Kolor(count).Value = 4279081146
count = count + 1: Kolor(count).Name = "BlueViolet": Kolor(count).Value = 4287245282
count = count + 1: Kolor(count).Name = "Blush": Kolor(count).Value = 4292763011
count = count + 1: Kolor(count).Name = "BrickRed": Kolor(count).Value = 4291510612
count = count + 1: Kolor(count).Name = "Brown": Kolor(count).Value = 4289014314
count = count + 1: Kolor(count).Name = "BurlyWood": Kolor(count).Value = 4292786311
count = count + 1: Kolor(count).Name = "BurntOrange": Kolor(count).Value = 4294934345
count = count + 1: Kolor(count).Name = "BurntSienna": Kolor(count).Value = 4293557853
count = count + 1: Kolor(count).Name = "CadetBlue": Kolor(count).Value = 4284456608
count = count + 1: Kolor(count).Name = "Canary": Kolor(count).Value = 4294967193
count = count + 1: Kolor(count).Name = "CaribbeanGreen": Kolor(count).Value = 4280079266
count = count + 1: Kolor(count).Name = "CarnationPink": Kolor(count).Value = 4294945484
count = count + 1: Kolor(count).Name = "Cerise": Kolor(count).Value = 4292691090
count = count + 1: Kolor(count).Name = "Cerulean": Kolor(count).Value = 4280134870
count = count + 1: Kolor(count).Name = "ChartReuse": Kolor(count).Value = 4286578432
count = count + 1: Kolor(count).Name = "Chestnut": Kolor(count).Value = 4290534744
count = count + 1: Kolor(count).Name = "Chocolate": Kolor(count).Value = 4291979550
count = count + 1: Kolor(count).Name = "Copper": Kolor(count).Value = 4292711541
count = count + 1: Kolor(count).Name = "Coral": Kolor(count).Value = 4294934352
count = count + 1: Kolor(count).Name = "Cornflower": Kolor(count).Value = 4288335595
count = count + 1: Kolor(count).Name = "CornflowerBlue": Kolor(count).Value = 4284782061
count = count + 1: Kolor(count).Name = "Cornsilk": Kolor(count).Value = 4294965468
count = count + 1: Kolor(count).Name = "CottonCandy": Kolor(count).Value = 4294950105
count = count + 1: Kolor(count).Name = "CrayolaAquamarine": Kolor(count).Value = 4286110690
count = count + 1: Kolor(count).Name = "CrayolaBlue": Kolor(count).Value = 4280251902
count = count + 1: Kolor(count).Name = "CrayolaBlueViolet": Kolor(count).Value = 4285753021
count = count + 1: Kolor(count).Name = "CrayolaBrown": Kolor(count).Value = 4290013005
count = count + 1: Kolor(count).Name = "CrayolaCadetBlue": Kolor(count).Value = 4289771462
count = count + 1: Kolor(count).Name = "CrayolaForestGreen": Kolor(count).Value = 4285378177
count = count + 1: Kolor(count).Name = "CrayolaGold": Kolor(count).Value = 4293379735
count = count + 1: Kolor(count).Name = "CrayolaGoldenrod": Kolor(count).Value = 4294760821
count = count + 1: Kolor(count).Name = "CrayolaGray": Kolor(count).Value = 4287992204
count = count + 1: Kolor(count).Name = "CrayolaGreen": Kolor(count).Value = 4280069240
count = count + 1: Kolor(count).Name = "CrayolaGreenYellow": Kolor(count).Value = 4293978257
count = count + 1: Kolor(count).Name = "CrayolaIndigo": Kolor(count).Value = 4284315339
count = count + 1: Kolor(count).Name = "CrayolaLavender": Kolor(count).Value = 4294751445
count = count + 1: Kolor(count).Name = "CrayolaMagenta": Kolor(count).Value = 4294337711
count = count + 1: Kolor(count).Name = "CrayolaMaroon": Kolor(count).Value = 4291311706
count = count + 1: Kolor(count).Name = "CrayolaMidnightBlue": Kolor(count).Value = 4279912566
count = count + 1: Kolor(count).Name = "CrayolaOrange": Kolor(count).Value = 4294931768
count = count + 1: Kolor(count).Name = "CrayolaOrangeRed": Kolor(count).Value = 4294912811
count = count + 1: Kolor(count).Name = "CrayolaOrchid": Kolor(count).Value = 4293306583
count = count + 1: Kolor(count).Name = "CrayolaPlum": Kolor(count).Value = 4287513989
count = count + 1: Kolor(count).Name = "CrayolaRed": Kolor(count).Value = 4293795917
count = count + 1: Kolor(count).Name = "CrayolaSalmon": Kolor(count).Value = 4294941610
count = count + 1: Kolor(count).Name = "CrayolaSeaGreen": Kolor(count).Value = 4288668351
count = count + 1: Kolor(count).Name = "CrayolaSilver": Kolor(count).Value = 4291675586
count = count + 1: Kolor(count).Name = "CrayolaSkyBlue": Kolor(count).Value = 4286634731
count = count + 1: Kolor(count).Name = "CrayolaSpringGreen": Kolor(count).Value = 4293716670
count = count + 1: Kolor(count).Name = "CrayolaTann": Kolor(count).Value = 4294616940
count = count + 1: Kolor(count).Name = "CrayolaThistle": Kolor(count).Value = 4293642207
count = count + 1: Kolor(count).Name = "CrayolaViolet": Kolor(count).Value = 4287786670
count = count + 1: Kolor(count).Name = "CrayolaYellow": Kolor(count).Value = 4294764675
count = count + 1: Kolor(count).Name = "CrayolaYellowGreen": Kolor(count).Value = 4291158916
count = count + 1: Kolor(count).Name = "Crimson": Kolor(count).Value = 4292613180
count = count + 1: Kolor(count).Name = "Cyan": Kolor(count).Value = 4278255615
count = count + 1: Kolor(count).Name = "Dandelion": Kolor(count).Value = 4294826861
count = count + 1: Kolor(count).Name = "DarkBlue": Kolor(count).Value = 4278190219
count = count + 1: Kolor(count).Name = "DarkCyan": Kolor(count).Value = 4278225803
count = count + 1: Kolor(count).Name = "DarkGoldenRod": Kolor(count).Value = 4290283019
count = count + 1: Kolor(count).Name = "DarkGray": Kolor(count).Value = 4289309097
count = count + 1: Kolor(count).Name = "DarkGreen": Kolor(count).Value = 4278215680
count = count + 1: Kolor(count).Name = "DarkKhaki": Kolor(count).Value = 4290623339
count = count + 1: Kolor(count).Name = "DarkMagenta": Kolor(count).Value = 4287299723
count = count + 1: Kolor(count).Name = "DarkOliveGreen": Kolor(count).Value = 4283788079
count = count + 1: Kolor(count).Name = "DarkOrange": Kolor(count).Value = 4294937600
count = count + 1: Kolor(count).Name = "DarkOrchid": Kolor(count).Value = 4288230092
count = count + 1: Kolor(count).Name = "DarkRed": Kolor(count).Value = 4287299584
count = count + 1: Kolor(count).Name = "DarkSalmon": Kolor(count).Value = 4293498490
count = count + 1: Kolor(count).Name = "DarkSeaGreen": Kolor(count).Value = 4287609999
count = count + 1: Kolor(count).Name = "DarkSlateBlue": Kolor(count).Value = 4282924427
count = count + 1: Kolor(count).Name = "DarkSlateGray": Kolor(count).Value = 4281290575
count = count + 1: Kolor(count).Name = "DarkTurquoise": Kolor(count).Value = 4278243025
count = count + 1: Kolor(count).Name = "DarkViolet": Kolor(count).Value = 4287889619
count = count + 1: Kolor(count).Name = "DeepPink": Kolor(count).Value = 4294907027
count = count + 1: Kolor(count).Name = "DeepSkyBlue": Kolor(count).Value = 4278239231
count = count + 1: Kolor(count).Name = "Denim": Kolor(count).Value = 4281035972
count = count + 1: Kolor(count).Name = "DesertSand": Kolor(count).Value = 4293905848
count = count + 1: Kolor(count).Name = "DimGray": Kolor(count).Value = 4285098345
count = count + 1: Kolor(count).Name = "DodgerBlue": Kolor(count).Value = 4280193279
count = count + 1: Kolor(count).Name = "Eggplant": Kolor(count).Value = 4285419872
count = count + 1: Kolor(count).Name = "ElectricLime": Kolor(count).Value = 4291755805
count = count + 1: Kolor(count).Name = "Fern": Kolor(count).Value = 4285643896
count = count + 1: Kolor(count).Name = "FireBrick": Kolor(count).Value = 4289864226
count = count + 1: Kolor(count).Name = "Floralwhite": Kolor(count).Value = 4294966000
count = count + 1: Kolor(count).Name = "ForestGreen": Kolor(count).Value = 4280453922
count = count + 1: Kolor(count).Name = "Fuchsia": Kolor(count).Value = 4290995397
count = count + 1: Kolor(count).Name = "FuzzyWuzzy": Kolor(count).Value = 4291585638
count = count + 1: Kolor(count).Name = "Gainsboro": Kolor(count).Value = 4292664540
count = count + 1: Kolor(count).Name = "GhostWhite": Kolor(count).Value = 4294506751
count = count + 1: Kolor(count).Name = "Gold": Kolor(count).Value = 4294956800
count = count + 1: Kolor(count).Name = "GoldenRod": Kolor(count).Value = 4292519200
count = count + 1: Kolor(count).Name = "GrannySmithApple": Kolor(count).Value = 4289258656
count = count + 1: Kolor(count).Name = "Gray": Kolor(count).Value = 4286611584
count = count + 1: Kolor(count).Name = "Green": Kolor(count).Value = 4278222848
count = count + 1: Kolor(count).Name = "GreenBlue": Kolor(count).Value = 4279329972
count = count + 1: Kolor(count).Name = "GreenYellow": Kolor(count).Value = 4289593135
count = count + 1: Kolor(count).Name = "Grey": Kolor(count).Value = 4286611584
count = count + 1: Kolor(count).Name = "HoneyDew": Kolor(count).Value = 4293984240
count = count + 1: Kolor(count).Name = "HotMagenta": Kolor(count).Value = 4294909390
count = count + 1: Kolor(count).Name = "HotPink": Kolor(count).Value = 4294928820
count = count + 1: Kolor(count).Name = "Inchworm": Kolor(count).Value = 4289915997
count = count + 1: Kolor(count).Name = "IndianRed": Kolor(count).Value = 4291648604
count = count + 1: Kolor(count).Name = "Indigo": Kolor(count).Value = 4283105410
count = count + 1: Kolor(count).Name = "Ivory": Kolor(count).Value = 4294967280
count = count + 1: Kolor(count).Name = "JazzberryJam": Kolor(count).Value = 4291442535
count = count + 1: Kolor(count).Name = "JungleGreen": Kolor(count).Value = 4282101903
count = count + 1: Kolor(count).Name = "Khaki": Kolor(count).Value = 4293977740
count = count + 1: Kolor(count).Name = "LaserLemon": Kolor(count).Value = 4294901282
count = count + 1: Kolor(count).Name = "Lavender": Kolor(count).Value = 4293322490
count = count + 1: Kolor(count).Name = "LavenderBlush": Kolor(count).Value = 4294963445
count = count + 1: Kolor(count).Name = "LawnGreen": Kolor(count).Value = 4286381056
count = count + 1: Kolor(count).Name = "LemonChiffon": Kolor(count).Value = 4294965965
count = count + 1: Kolor(count).Name = "LemonYellow": Kolor(count).Value = 4294964303
count = count + 1: Kolor(count).Name = "LightBlue": Kolor(count).Value = 4289583334
count = count + 1: Kolor(count).Name = "LightCoral": Kolor(count).Value = 4293951616
count = count + 1: Kolor(count).Name = "LightCyan": Kolor(count).Value = 4292935679
count = count + 1: Kolor(count).Name = "LightGoldenRodYellow": Kolor(count).Value = 4294638290
count = count + 1: Kolor(count).Name = "LightGray": Kolor(count).Value = 4292072403
count = count + 1: Kolor(count).Name = "LightGreen": Kolor(count).Value = 4287688336
count = count + 1: Kolor(count).Name = "LightPink": Kolor(count).Value = 4294948545
count = count + 1: Kolor(count).Name = "LightSalmon": Kolor(count).Value = 4294942842
count = count + 1: Kolor(count).Name = "LightSeaGreen": Kolor(count).Value = 4280332970
count = count + 1: Kolor(count).Name = "LightSkyBlue": Kolor(count).Value = 4287090426
count = count + 1: Kolor(count).Name = "LightSlateGray": Kolor(count).Value = 4286023833
count = count + 1: Kolor(count).Name = "LightSteelBlue": Kolor(count).Value = 4289774814
count = count + 1: Kolor(count).Name = "LightYellow": Kolor(count).Value = 4294967264
count = count + 1: Kolor(count).Name = "Lime": Kolor(count).Value = 4278255360
count = count + 1: Kolor(count).Name = "LimeGreen": Kolor(count).Value = 4281519410
count = count + 1: Kolor(count).Name = "Linen": Kolor(count).Value = 4294635750
count = count + 1: Kolor(count).Name = "MacaroniAndCheese": Kolor(count).Value = 4294950280
count = count + 1: Kolor(count).Name = "Magenta": Kolor(count).Value = 4294902015
count = count + 1: Kolor(count).Name = "MagicMint": Kolor(count).Value = 4289392849
count = count + 1: Kolor(count).Name = "Mahogany": Kolor(count).Value = 4291643980
count = count + 1: Kolor(count).Name = "Maize": Kolor(count).Value = 4293775772
count = count + 1: Kolor(count).Name = "Manatee": Kolor(count).Value = 4288125610
count = count + 1: Kolor(count).Name = "MangoTango": Kolor(count).Value = 4294935107
count = count + 1: Kolor(count).Name = "Maroon": Kolor(count).Value = 4286578688
count = count + 1: Kolor(count).Name = "Mauvelous": Kolor(count).Value = 4293892266
count = count + 1: Kolor(count).Name = "MediumAquamarine": Kolor(count).Value = 4284927402
count = count + 1: Kolor(count).Name = "MediumBlue": Kolor(count).Value = 4278190285
count = count + 1: Kolor(count).Name = "MediumOrchid": Kolor(count).Value = 4290401747
count = count + 1: Kolor(count).Name = "MediumPurple": Kolor(count).Value = 4287852763
count = count + 1: Kolor(count).Name = "MediumSeaGreen": Kolor(count).Value = 4282168177
count = count + 1: Kolor(count).Name = "MediumSlateBlue": Kolor(count).Value = 4286277870
count = count + 1: Kolor(count).Name = "MediumSpringGreen": Kolor(count).Value = 4278254234
count = count + 1: Kolor(count).Name = "MediumTurquoise": Kolor(count).Value = 4282962380
count = count + 1: Kolor(count).Name = "MediumVioletRed": Kolor(count).Value = 4291237253
count = count + 1: Kolor(count).Name = "Melon": Kolor(count).Value = 4294818996
count = count + 1: Kolor(count).Name = "MidnightBlue": Kolor(count).Value = 4279834992
count = count + 1: Kolor(count).Name = "MintCream": Kolor(count).Value = 4294311930
count = count + 1: Kolor(count).Name = "MistyRose": Kolor(count).Value = 4294960353
count = count + 1: Kolor(count).Name = "Moccasin": Kolor(count).Value = 4294960309
count = count + 1: Kolor(count).Name = "MountainMeadow": Kolor(count).Value = 4281383567
count = count + 1: Kolor(count).Name = "Mulberry": Kolor(count).Value = 4291120012
count = count + 1: Kolor(count).Name = "NavajoWhite": Kolor(count).Value = 4294958765
count = count + 1: Kolor(count).Name = "Navy": Kolor(count).Value = 4278190208
count = count + 1: Kolor(count).Name = "NavyBlue": Kolor(count).Value = 4279858386
count = count + 1: Kolor(count).Name = "NeonCarrot": Kolor(count).Value = 4294943555
count = count + 1: Kolor(count).Name = "OldLace": Kolor(count).Value = 4294833638
count = count + 1: Kolor(count).Name = "Olive": Kolor(count).Value = 4286611456
count = count + 1: Kolor(count).Name = "OliveDrab": Kolor(count).Value = 4285238819
count = count + 1: Kolor(count).Name = "OliveGreen": Kolor(count).Value = 4290426988
count = count + 1: Kolor(count).Name = "Orange": Kolor(count).Value = 4294944000
count = count + 1: Kolor(count).Name = "OrangeRed": Kolor(count).Value = 4294919424
count = count + 1: Kolor(count).Name = "OrangeYellow": Kolor(count).Value = 4294497640
count = count + 1: Kolor(count).Name = "Orchid": Kolor(count).Value = 4292505814
count = count + 1: Kolor(count).Name = "OuterSpace": Kolor(count).Value = 4282468940
count = count + 1: Kolor(count).Name = "OutrageousOrange": Kolor(count).Value = 4294929994
count = count + 1: Kolor(count).Name = "PacificBlue": Kolor(count).Value = 4280068553
count = count + 1: Kolor(count).Name = "PaleGoldenRod": Kolor(count).Value = 4293847210
count = count + 1: Kolor(count).Name = "PaleGreen": Kolor(count).Value = 4288215960
count = count + 1: Kolor(count).Name = "PaleTurquoise": Kolor(count).Value = 4289720046
count = count + 1: Kolor(count).Name = "PaleVioletRed": Kolor(count).Value = 4292571283
count = count + 1: Kolor(count).Name = "PapayaWhip": Kolor(count).Value = 4294963157
count = count + 1: Kolor(count).Name = "Peach": Kolor(count).Value = 4294954923
count = count + 1: Kolor(count).Name = "PeachPuff": Kolor(count).Value = 4294957753
count = count + 1: Kolor(count).Name = "Periwinkle": Kolor(count).Value = 4291154150
count = count + 1: Kolor(count).Name = "Peru": Kolor(count).Value = 4291659071
count = count + 1: Kolor(count).Name = "PiggyPink": Kolor(count).Value = 4294827494
count = count + 1: Kolor(count).Name = "PineGreen": Kolor(count).Value = 4279599224
count = count + 1: Kolor(count).Name = "Pink": Kolor(count).Value = 4294951115
count = count + 1: Kolor(count).Name = "PinkFlamingo": Kolor(count).Value = 4294735101
count = count + 1: Kolor(count).Name = "PinkSherbet": Kolor(count).Value = 4294414247
count = count + 1: Kolor(count).Name = "Plum": Kolor(count).Value = 4292714717
count = count + 1: Kolor(count).Name = "PowderBlue": Kolor(count).Value = 4289781990
count = count + 1: Kolor(count).Name = "Purple": Kolor(count).Value = 4286578816
count = count + 1: Kolor(count).Name = "PurpleHeart": Kolor(count).Value = 4285809352
count = count + 1: Kolor(count).Name = "PurpleMountainsMajesty": Kolor(count).Value = 4288512442
count = count + 1: Kolor(count).Name = "PurplePizzazz": Kolor(count).Value = 4294856410
count = count + 1: Kolor(count).Name = "RadicalRed": Kolor(count).Value = 4294920556
count = count + 1: Kolor(count).Name = "RawSienna": Kolor(count).Value = 4292250201
count = count + 1: Kolor(count).Name = "RawUmber": Kolor(count).Value = 4285614883
count = count + 1: Kolor(count).Name = "RazzleDazzleRose": Kolor(count).Value = 4294920400
count = count + 1: Kolor(count).Name = "Razzmatazz": Kolor(count).Value = 4293076331
count = count + 1: Kolor(count).Name = "Red": Kolor(count).Value = 4294901760
count = count + 1: Kolor(count).Name = "RedOrange": Kolor(count).Value = 4294923081
count = count + 1: Kolor(count).Name = "RedViolet": Kolor(count).Value = 4290790543
count = count + 1: Kolor(count).Name = "RobinsEggBlue": Kolor(count).Value = 4280274635
count = count + 1: Kolor(count).Name = "RosyBrown": Kolor(count).Value = 4290547599
count = count + 1: Kolor(count).Name = "RoyalBlue": Kolor(count).Value = 4282477025
count = count + 1: Kolor(count).Name = "RoyalPurple": Kolor(count).Value = 4286075305
count = count + 1: Kolor(count).Name = "SaddleBrown": Kolor(count).Value = 4287317267
count = count + 1: Kolor(count).Name = "Salmon": Kolor(count).Value = 4294606962
count = count + 1: Kolor(count).Name = "SandyBrown": Kolor(count).Value = 4294222944
count = count + 1: Kolor(count).Name = "Scarlet": Kolor(count).Value = 4294715463
count = count + 1: Kolor(count).Name = "ScreaminGreen": Kolor(count).Value = 4285988730
count = count + 1: Kolor(count).Name = "SeaGreen": Kolor(count).Value = 4281240407
count = count + 1: Kolor(count).Name = "SeaShell": Kolor(count).Value = 4294964718
count = count + 1: Kolor(count).Name = "Sepia": Kolor(count).Value = 4289030479
count = count + 1: Kolor(count).Name = "Shadow": Kolor(count).Value = 4287265117
count = count + 1: Kolor(count).Name = "Shamrock": Kolor(count).Value = 4282764962
count = count + 1: Kolor(count).Name = "ShockingPink": Kolor(count).Value = 4294672125
count = count + 1: Kolor(count).Name = "Sienna": Kolor(count).Value = 4288696877
count = count + 1: Kolor(count).Name = "Silver": Kolor(count).Value = 4290822336
count = count + 1: Kolor(count).Name = "SkyBlue": Kolor(count).Value = 4287090411
count = count + 1: Kolor(count).Name = "SlateBlue": Kolor(count).Value = 4285160141
count = count + 1: Kolor(count).Name = "SlateGray": Kolor(count).Value = 4285563024
count = count + 1: Kolor(count).Name = "Snow": Kolor(count).Value = 4294966010
count = count + 1: Kolor(count).Name = "SpringGreen": Kolor(count).Value = 4278255487
count = count + 1: Kolor(count).Name = "SteelBlue": Kolor(count).Value = 4282811060
count = count + 1: Kolor(count).Name = "Sunglow": Kolor(count).Value = 4294954824
count = count + 1: Kolor(count).Name = "SunsetOrange": Kolor(count).Value = 4294794835
count = count + 1: Kolor(count).Name = "Tann": Kolor(count).Value = 4291998860
count = count + 1: Kolor(count).Name = "Teal": Kolor(count).Value = 4278222976
count = count + 1: Kolor(count).Name = "TealBlue": Kolor(count).Value = 4279805877
count = count + 1: Kolor(count).Name = "Thistle": Kolor(count).Value = 4292394968
count = count + 1: Kolor(count).Name = "TickleMePink": Kolor(count).Value = 4294740396
count = count + 1: Kolor(count).Name = "Timberwolf": Kolor(count).Value = 4292597714
count = count + 1: Kolor(count).Name = "Tomato": Kolor(count).Value = 4294927175
count = count + 1: Kolor(count).Name = "TropicalRainForest": Kolor(count).Value = 4279730285
count = count + 1: Kolor(count).Name = "Tumbleweed": Kolor(count).Value = 4292782728
count = count + 1: Kolor(count).Name = "Turquoise": Kolor(count).Value = 4282441936
count = count + 1: Kolor(count).Name = "TurquoiseBlue": Kolor(count).Value = 4286045671
count = count + 1: Kolor(count).Name = "UnmellowYellow": Kolor(count).Value = 4294967142
count = count + 1: Kolor(count).Name = "Violet": Kolor(count).Value = 4293821166
count = count + 1: Kolor(count).Name = "VioletBlue": Kolor(count).Value = 4281486002
count = count + 1: Kolor(count).Name = "VioletRed": Kolor(count).Value = 4294398868
count = count + 1: Kolor(count).Name = "VividTangerine": Kolor(count).Value = 4294942857
count = count + 1: Kolor(count).Name = "VividViolet": Kolor(count).Value = 4287582365
count = count + 1: Kolor(count).Name = "Wheat": Kolor(count).Value = 4294303411
count = count + 1: Kolor(count).Name = "White": Kolor(count).Value = 4294967295
count = count + 1: Kolor(count).Name = "Whitesmoke": Kolor(count).Value = 4294309365
count = count + 1: Kolor(count).Name = "WildBlueYonder": Kolor(count).Value = 4288851408
count = count + 1: Kolor(count).Name = "WildStrawberry": Kolor(count).Value = 4294919076
count = count + 1: Kolor(count).Name = "WildWatermelon": Kolor(count).Value = 4294732933
count = count + 1: Kolor(count).Name = "Wisteria": Kolor(count).Value = 4291667166
count = count + 1: Kolor(count).Name = "Yellow": Kolor(count).Value = 4294967040
count = count + 1: Kolor(count).Name = "YellowGreen": Kolor(count).Value = 4288335154
count = count + 1: Kolor(count).Name = "YellowOrange": Kolor(count).Value = 4294946370
ReDim _Preserve Kolor(count) As Color_Type
$Color:32
Print BadLimit("unsigned integer", "-1", "2"), "unsigned integer from -1 to 2"
Print BadLimit("integer", "-1", "1"), "integer from -1 to 1"
c1$ = "black": c2$ = "white"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$
Print BadLimit("color", c2$, c1$), "color from "; c2$; " to "; c1$
c1$ = "&HFF000000": c2$ = "&HFFFFFFFF"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$
c1$ = "_RGB32(0,0,0)": c2$ = "_RGB32(255,255,255)"
Print BadLimit("color", c1$, c2$), "color from "; c1$; " to "; c2$
Sub DeclareConfigSetting (heading$, name$, type$, low$, high$, default$, value$)
Dim As String h, tn, tt, tl, th, td, tv
'Preserve user values by transfering them to temp copies of their original selfs
h = _Trim$(heading$): tn = _Trim$(name$): tt = _Trim$(UCase$(type$))
tl = _Trim$(low$): th = _Trim$(high$): td = _Trim$(default$): tv = _Trim$(value$)
'prevent duplicate braces from being around our heading
h = RemoveCharacters(h, "[", 1)
h = RemoveCharacters(h, "]", 2)
If h = "" Then h = "[Unsorted Settings]" Else h = "[" + h + "]"
'check for blank variable names. If that's what we have, then toss an error and quit.
If tn = "" Then
_MessageBox "Terminal Error", "Configuration setting [NULL] can not declared. All settings must have a valid name. Terminating the program until the issue is resolved.", "error"
System
End If
'Check to see if the variable name has been declared already. If so, then toss an error and quit.
'If you want to change config type or default values and such, then call EditConfigSetting instead.
u = UBound(ConfigSettings)
For i = 1 To u
If tn = ConfigSettings(i).Name Then
_MessageBox "Terminal Error", "Configuration setting [" + name$ + "] has already been declared. Can not declare the same setting twice. Terminating the program until the issue is resolved.", "error"
System
End If
Next
'Check for invalid limits for the variable type we declared
InValidateLimits = BadLimit(tt, tl, th)
Select Case InvalidLimits
Case 1 'tl is not a number
message$ = "Configuration setting has an invalid low limit set. [" + tl + "] is not a number. Terminating the program until the issue is resolved."
Case 2 'th is not a number
message$ = "Configuration setting has an invalid high limit set. [" + th + "] is not a number. Terminating the program until the issue is resolved."
Case 3 'tl is less than the min possible with the declared type
message$ = "Configuration setting has an invalid low limit set [" + tl + "]. Terminating the program until the issue is resolved."
Case 4 'th is greater than the max possible with the declared type
message$ = "Configuration setting has an invalid high limit set [" + th + "]. Terminating the program until the issue is resolved."
Case 5 'tl is greater than th
message$ = "Configuration setting has a low limit set [" + tl + "] which is greater than the high limit set [" + th + "]. Terminating the program until the issue is resolved."
End Select
If InvalidLimits Then
message$ = message$ + ">> [" + heading$ + "] [" + name$ + "] [" + type$ + "]"
_MessageBox "Terminal Error!", message$, "error"
System
End If
End Sub
Function RemoveCharacters$ (passed_from_what As String, what_character As String, from_which_side As Integer)
'from_which_side: 1 = left, 2 = right, 3 = left and right, 0 = whole string
Dim from_what As String
from_what = passed_from_what
If from_which_side = 0 Then 'strip from the whole string
Do
p = InStr(from_what, what_character)
If p Then from_what = Left$(from_what, p - 1) + Mid$(from_what, p + 1)
Loop Until p = 0
End If
If from_which_side And 1 Then 'strip from the left
Do Until Left$(from_what, 1) <> what_character
from_what = Mid$(from_what, 2)
Loop
End If
If from_which_side And 2 Then 'strip from the right
Do Until Right$(from_what, 1) <> what_character
from_what = Left$(from_what, Len(from_what) - 1)
Loop
End If
RemoveCharacters = from_what
End Function
Function BadLimit (type$, low$, high$)
'Error Report Values
'1 'tl is not a number
'2 'th is not a number
'3 'tl is invalid limit with the declared type (too low or too high, such as -1 for an unsigned integer)
'4 'th is invalid limit with the declared type
'5 'low is larger than high. (a range from 10 to 1, for example)
'Try and sort out type, and overall type limits.
Dim As String tt, tl, th 'temp type, temp low, temp high
Dim As _Integer64 ll1, hli, tlTemp, thTemp 'low limit integer, high limit integer, (temp low temp , temp high temp <-- these last 2 are for color names and such)
Dim As _Float llf, hlf 'low limit float, high limit float
tt = UCase$(_Trim$(type$)): tl = low$: th = high$
Select Case tt
Case "BIT", "_BIT", "_UNSIGNED _BIT", "UNSIGNED BIT", "BOOLEAN", "BOOL", "TRUEFALSE"
type$ = "BOOLEAN"
tl = "": th = ""
Case "BYTE", "_BYTE", "INT8"
type$ = "BYTE"
If tl = "" Then tl = "-128"
If th = "" Then th = "127"
lli = -128: hli = 127
GoSub checkintegers
Case "UNSIGNED BYTE", "_UNSIGNED _BYTE", "UINT8"
type$ = "UNSIGNED BYTE"
If tl = "" Then tl = "0"
If th = "" Then th = "255"
lli = -0: hli = 255
GoSub checkintegers
Case "INTEGER", "INT16"
type$ = "INTEGER"
If tl = "" Then tl = "-32768"
If th = "" Then th = "32767"
lli = -32768: hli = 32767
GoSub checkintegers
Case "UNSIGNED INTEGER", "_UNSIGNED INTEGER", "UINT16"
type$ = "UNSIGNED INTEGER"
If tl = "" Then tl = "0"
If th = "" Then th = "65535"
lli = 0: hli = 65535
GoSub checkintegers
Case "LONG", "INT32"
type$ = "LONG"
If tl = "" Then tl = "-2147483648"
If th = "" Then th = "2147483647"
lli = -2147483648: hli = 2147483647
GoSub checkintegers
Case "UNSIGNED LONG", "_UNSIGNED LONG", "UINT32"
type$ = "UNSIGNED LONG"
If tl = "" Then tl = "0"
If th = "" Then th = "4294967295"
lli = 0: hli = 4294967295
GoSub checkintegers
Case "COLOR", "RGB", "RGB32", "_RGB", "_RGB32"
type$ = "COLOR"
If tl = "" Then tl = "0"
If th = "" Then th = "4294967295"
tlTemp = ColorValue(tl): thTemp = ColorValue(th)
If tlTemp = -1 Then InvalidLimits = 1
If thTemp = -1 Then InvalidLimits = 2
n1$ = tl: n2$ = th
If InvalidLimits = 0 Then
tl = _Trim$(Str$(tlTemp)): th = _Trim$(Str$(thTemp))
lli = 0: hli = 4294967295
GoSub checkintegers
End If
tl = n1$: th = n2$
Case "INTEGER64", "_INTEGER64", "INT64", "OFFSET", "_OFFSET"
type$ = "INTEGER64"
If tl = "" Then tl = "-9223372036854775808"
If th = "" Then th = "-9223372036854775807"
lli = -9223372036854775808&&: hli = -9223372036854775807&&
GoSub checkintegers
Case "UNSIGNED INTEGER64", "_UNSIGNED _INTEGER64", "UINT64", "_UNSIGNED _OFFSET", "UNSIGNED OFFSET"
type$ = "INTEGER64"
If tl = "" Then tl = "0"
If th = "" Then th = "18446744073709551615"
If IsNum(tl) = 0 Then InvalidLimits = 1
If IsNum(th) = 0 Then InvalidLimits = 2
If Val(tl) < 0 Then InvalidLimits = 3
If Val(th + "~&&") > 18446744073709551615~&& Then InvalidLimits = 4
Case "SINGLE"
type$ = "SINGLE"
If tl = "" Then tl = "-2.802597E-45"
If th = "" Then th = "3.402823E+38"
llf = -2.802597E-45: hlf = 3.402823E+38
GoSub checkfloats
Case "DOUBLE"
type$ = "DOUBLE"
If tl = "" Then tl = "-4.490656458412465E-324"
If th = "" Then th = "1.797693134862310E+308"
llf = -4.490656458412465E-324: hlf = 1.797693134862310E+308
GoSub checkfloats
Case "FLOAT", "_FLOAT"
type$ = "FLOAT"
If tl = "" Then tl = "-1.18E-4932"
If th = "" Then th = "1.18E+4932"
llf = -1.18E-4932: hlf = 1.18E+4932
GoSub checkfloats
Case "STRING", "$"
type$ = "STRING"
Case "QSTRING", "Q$"
type$ = "QSTRING"
Case Else 'unspecified or unrecognized type
'we don't change anything, and trust the end-user knows what they're doing and setting
InvalidLimits = 5
tt = type$: tl = low$: th = high$
End Select
BadLimit = InvalidLimits
type$ = tt: low$ = tl: high$ = th
Exit Function 'We're finished and our gosubs go below
checkintegers:
If IsNum(tl) = 0 Then InvalidLimits = 1
If IsNum(th) = 0 Then InvalidLimits = 2
If Val(tl) < lli Or Val(tl) > hli Then InvalidLimits = 3
If Val(th) < lli Or Val(th) > hli Then InvalidLimits = 4
If Val(tl) > Val(th) Then InvalidLimits = 5
Return
checkfloats:
If IsNum(tl) = 0 Then InvalidLimits = 1
If IsNum(th) = 0 Then InvalidLimits = 2
If Val(tl) < llf Or Val(tl) > hlf Then InvalidLimits = 3
If Val(th) < llf Or Val(th) > hlf Then InvalidLimits = 4
If Val(tl) > Val(th) Then InvalidLimits = 5
Return
End Function
Function IsNum%% (PassedText As String)
text$ = PassedText
special$ = UCase$(Left$(text$, 2))
Select Case special$
Case "&H", "&B", "&O"
'check for symbols on right side of value
r3$ = Right$(text$, 3)
Select Case r3$
Case "~&&", "~%%", "~%&" 'unsigned int64, unsigned byte, unsigned offset
text$ = Left$(text$, Len(text$) - 3)
Case Else
r2$ = Right$(text$, 2)
Select Case r2$
Case "~&", "##", "%&", "%%", "~%", "&&" 'unsigned long, float, offset, byte, unsigned integer, int64
text$ = Left$(text$, Len(text$) - 2)
Case Else
r$ = Right$(text$, 1)
Select Case r$
Case "&", "#", "%", "!" 'long, double, integer, single
text$ = Left$(text$, Len(text$) - 1)
End Select
End Select
End Select
check$ = "0123456789ABCDEF"
If special$ = "&O" Then check$ = "01234567"
If special$ = "&B" Then check$ = "01"
temp$ = Mid$(UCase$(text$), 2)
For i = 1 To Len(temp$)
If InStr(check$, Mid$(temp$, i, 1)) = 0 Then Exit For
Next
If i <= Len(temp$) Then IsNum = -1
Case Else
If _Trim$(Str$(Val(text$))) = text$ Then IsNum = -1
End Select
End Function
Function ColorValue&& (text$)
ReDim values(1000) As String
ColorValue = -1 'This is to report a failed attempt to get a valid color.
' All valid colors will be greater than -1, so be certain the return variable is an _INTEGER64 type
' so that this -1 value doesn't overflow and become bright white (most likely), or some other color
If IsNum(text$) Then 'our color is either in plain number form (COLOR 15, for example), or hex form (&HFFFFFFFF, for example)
temp&& = Val(text$)
If temp&& >= 0 Then
ColorValue = temp&&
Else
If temp&& >= -2147483648 Then 'it's probably a color, but in LONG (signed) format. Let's convert it automagically and roll with it.
temp~& = temp&&
ColorValue = temp~&
End If
End If
Else
temp$ = _Trim$(UCase$(text$))
If Left$(temp$, 7) = "_RGBA32" Or Left$(temp$, 6) = "RGBA32" Then 'It's in RGBA32 format
If ParseValues(text$, values()) <> 4 Then ColorValue = -1: Exit Function
r% = Val(values(1))
g% = Val(values(2))
b% = Val(values(3))
a% = Val(values(4))
ColorValue = _RGBA32(r%, g%, b%, a%)
ElseIf Left$(temp$, 5) = "_RGBA" Or Left$(temp$, 4) = "RGBA" Then 'It's in RGBA format
p = ParseValues(text$, values())
If p < 4 Or p > 5 Then ColorValue = -1: Exit Function
r% = Val(values(1))
g% = Val(values(2))
b% = Val(values(3))
a% = Val(values(4))
If p = 5 Then
d% = Val(values(5)) 'the destination of the screen whose palette we're matching against
ColorValue = _RGBA(r%, g%, b%, a%, d%)
Else
ColorValue = _RGBA(r%, g%, b%, a%) 'note that this value will change depending upon the screen that it's called from
'RGBA tries to match the called value to the closest possible color match that the existing palette has.
End If
ElseIf Left$(temp$, 6) = "_RGB32" Or Left$(temp$, 5) = "RGB32" Then 'It's in RGB32 format
p = ParseValues(text$, values())
Select Case p
Case 4 '_RGB32(num, num2, num3, num4) <-- this is RGBA format
r% = Val(values(1))
g% = Val(values(2))
b% = Val(values(3))
a% = Val(values(4))
ColorValue = _RGBA32(r%, g%, b%, a%)
Case 3 ' _RGB32(num, num2, num3) <-- this is RGB format
r% = Val(values(1))
g% = Val(values(2))
b% = Val(values(3))
ColorValue = _RGB32(r%, g%, b%)
Case 2 ' _RGB32(num, num2) <-- Grayscale with alpha
r% = Val(values(1))
g% = Val(values(2))
ColorValue = _RGB32(r%, g%)
Case 1 ' _RGB32(num) <-- Grayscale alone
r% = Val(values(1))
ColorValue = _RGB32(r%)
Case Else
ColorValue = -1: Exit Function '<-- can not return a valid color value
End Select
ElseIf Left$(temp$, 4) = "_RGB" Or Left$(temp$, 3) = "RGB" Then 'It's in RGB format
p = ParseValues(text$, values())
If p < 3 Or p > 4 Then ColorValue = -1: Exit Function
r% = Val(values(1))
g% = Val(values(2))
b% = Val(values(3))
If p = 4 Then
d% = Val(values(4)) 'the destination of the screen whose palette we're matching against
ColorValue = _RGB(r%, g%, b%, d%)
Else
ColorValue = _RGB(r%, g%, b%) 'note that this value will change depending upon the screen that it's called from
'RGBA tries to match the called value to the closest possible color match that the existing palette has.
End If
Else 'check to see if it's a color name value
For i = 1 To UBound(Kolor)
If UCase$(temp$) = UCase$(Kolor(i).Name) Then
text$ = Kolor(i).Name
ColorValue = Kolor(i).Value
Exit Function
End If
Next
End If
End If
End Function
Function ParseValues (text$, values() As String)
ReDim values(1000) As String
temp$ = text$ 'preserve without changing our text
lp = InStr(temp$, "("): temp$ = Mid$(temp$, lp + 1) 'strip off any left sided parenthesis, such as _RGB32(
rp = _InStrRev(temp$, ")"): If rp Then temp$ = Left$(temp$, rp - 1) 'strip off the right sided parenthesis )
Do
p = InStr(temp$, ",")
If p Then
eval$ = Left$(temp$, p - 1)
If IsNum(eval$) = 0 Then ParseValues = -1: Exit Function
count = count + 1
If count > UBound(values) Then ReDim _Preserve values(UBound(values) + 1000) As String
values(count) = eval$
temp$ = Mid$(temp$, p + 1)
Else
eval$ = temp$
If IsNum(eval$) = 0 Then ParseValues = -1: Exit Function
count = count + 1
If count > UBound(values) Then ReDim _Preserve values(UBound(values) + 1) As String
values(count) = eval$
temp$ = ""
End If
Loop Until temp$ = ""
ReDim _Preserve values(count) As String
ParseValues = count
End Function
Much like my little routine to get color values from strings the other day, this is also part of an enhanced config system that I'm working up for a long running personal project of mine. What we have here, that I'm highlighting, is the BadLimit routine which is an essential part of the overall roadmap to what I'm doing.
BadLimit is a rather complex little piece of code, that simply lets us pass it a variable type and then two values which we want to set to become valid limits for that variable type, and then it checks to see if those two limits are valid or not for that type.
For example, pass it: "Integer", "-1", "10", and it'll pass back a 0 for you. There's nothing bad about a limit from -1 to 10 for an integer.
Pass it, "Unsigned Integer", "-1", "10", and it'll pass back a 3 for you. Error code 3 says you have an invalid low limit. 0 is as low as an unsigned integer can go, so you can't set a limit of -1 for one!
The end goal, is to eventually cobble all the pieces together, so that I can validate and read and write such entries as the following in my config file:
BackGround AS Color FROM Black TO White Default Black = Red
XPos AS INTEGER FROM -32000 TO 32000 DEFAULT 0 = 150
And so on...
(And the above isn't as confusing as it first might seem. For example, the first entry would be for the BackGround color which has to be in a range from full alpha Black to full alpha White, with the default color being Black, but which is current set to being Red.)
I don't know if anyone else would ever need a limit checker, but if someone does, there's one here now that anyone can feel free to use if desired.
|
|
|
DAY 035: SHELL |
Posted by: Pete - 12-16-2022, 02:10 AM - Forum: Keyword of the Day!
- Replies (3)
|
|
You might think this keyword was leftover from TurtleBASIC, but you'd be wrong. It's actually from DOS.
SHELL is a very versatile way to either call a DOS command or run another app while staying in your current program.
SYNTAX SHELL [_DONTWAIT] [_HIDE] [DOSCommand$]
_DONTWAIT means continue on in our program flow instead of hanging until the call or program started is finished or terminated.
_HIDE means don't show the cmd.exe console window.
Hiding the console is usually preferred. If _HIDE prevents the program from launching, try adding cmd /c to the SHELL.
Waiting is useful if the app or DOS function you are accessing needs to pass information back to your program. SHELL "Dir" (and piped to a file - we'll discus piping later...) to get the directory info into the next part of your program, for instance.
So let's continue by discussing some other improvements from when this keyword was used in QBasic.
In Windows 98 and prior, we had to use COMMAND\c with our SHELLcall. command.exe was the command prompt then, but sometime after Windows 98, M$ remade the command prompt, and called it cmd.exe. We then used CMD /c in our SHELL calls. Well, along comes QB64 and guess what, cmd /c, forgetaboutit! We don't need it anymore, well, that isn't quite true. QB64 takes care of the command prompt call for us, but it fails once in awhile. (See the example marked INCLUDE PATH, a few lines below).
QB64 can use long path folder names and file names and SHELL command lines can be longer than 124 characters. (Wiki).
So now let's discuss some SHELL components and common ways to use SHELL:
A QBasic SHELL component we can still use in QB64 is START. START is an alternative to _DONTWAIT, and has one added advantages, switches...
Switches in a SHELL START to another app tell the operating how to launch it.
Commonly used switches:
/min Launch minimized to the taskbar.
/max Launch it full screen.
/p Send any text file called with the app to the printer.
Example: Launch Wordpad minimized to print a text file...
Remember, since we are using START we do not have to use _DONTWAIT in this example.
Code: (Select All) SHELL _HIDE "START /min /p wordpad myfile.txt"
Now you might ask, "Hey, where's the path?" Well, in some, but certainly not all instances, registered programs can be automatically found by a SHELL call. For instance, my Firefox browser will launch without a path included. My advice, give it a try without a path, but if it cannot be found, include the path.
How to include a path in a SHELL call.
The easiest way is to include the drive an path.
Example: INCLUDE PATH
Code: (Select All) SHELL _HIDE _DONTWAIT "cmd /c C:\Windows\Notepad.exe"
So hold on there Petey! What's up with the cmd /c in there? Well, in my system, I can't get: HELL _HIDE _DONTWAIT "C:\Windows\Notepad.exe" unless I add it. Go figure. My advice, SHELL is a bit fickle and you may have to play with some of these command line statements to get it to work.
Okay, now this is a PITA, but an important PITA. If you have a path with a space in it like PROGRAM FILES, you need to enclose that particular directory in quotes, using ASCII CHR$(34), the quote symbol, to avoid it being concatenated.
PRINT CHR$(34) + "Program Files" + CHR$(34)
So let's try to access Windows Photo View Device Imaging Devices...
Code: (Select All) SHELL _HIDE _DONTWAIT "C:\" + CHR$(34) + "Program Files" + CHR$(34) + "\" + CHR$(34) + "Windows Photo Viewer" + CHR$(34) + "\ImagingDevices.exe"
Note we had to enclose two file paths with spaces in this example. Oh, and go figure, this one I could get to run with _HIDE and no cmd /c.
Anyway, we can save a little work by just enclosing both paths in quotes, one time...
Code: (Select All) SHELL _HIDE _DONTWAIT "C:\" + CHR$(34) + "Program Files\Windows Photo Viewer" + CHR$(34) + "\ImagingDevices.exe"
So just remember, paths with spaces require quotes, paths without do not. I believe Linux and Mac have the option of using the apostrophe or CHR$(34).
So besides just running other apps while your program keeps running, SHELL can access command window functions, which you can PIPE into your program or into a file.
WARNING - Some of these examples make a file called mytemp.tmp. If you already have a file named mytemp.tmp, running any example with this file name will overwrite your file.
Code: (Select All) $CONSOLE:ONLY
SHELL _HIDE "DIR /b *.bas>mytemp.tmp" ' The /b switch "bare" prints just the file names. > sign sends this info to the file.
OPEN "mytemp.tmp" FOR INPUT AS #1
DO
LINE INPUT #1, a$
PRINT a$
LOOP UNTIL EOF(1)
CLOSE #1
Okay, so how about instead of a file, we just pipe it to the clipboard?
Code: (Select All) $CONSOLE:ONLY
SHELL _HIDE "DIR /b | clip"
PRINT _CLIPBOARD$
This example example will be to find that mytemp.tmp file in your qb64 folder. Be sure to change the example path to your path.
Code: (Select All) SHELL _DONTWAIT "Explorer /select, C:\QB64PE\qb64pe3.3\qb64pe\mytemp.tmp"
Our last example is using SHELL to find our IP Address. This might not work on non-English platforms.
Code: (Select All) ' CAUTION - THE SHELL STATEMENT WILL OVERWRITE ANY PREEXISTING FILE YOU HAVE IN YOUR LOCAL DIRECTORY NAMED "mytemp.tmp".
' Change mytemp.tmp to something else if that's a problem.
SHELL _HIDE "ipconfig>mytemp.tmp"
OPEN "mytemp.tmp" FOR BINARY AS #1
a$ = SPACE$(LOF(1))
GET #1, , a$
CLOSE #1
DO
j = INSTR(LCASE$(a$), search$)
IPAddy$ = MID$(a$, j)
IPAddy$ = MID$(IPAddy$, 1, INSTR(IPAddy$, CHR$(13)) - 1)
IPAddy$ = _TRIM$(MID$(IPAddy$, INSTR(IPAddy$, ":") + 1))
IF j AND LEN(search$) > 0 THEN
PRINT "Your IP Address is: "; IPAddy$
EXIT DO
ELSE
SELECT CASE cnt
CASE 0
search$ = "ipv4 address"
CASE 1
search$ = "ip address"
CASE 2
search$ = "ipv4 "
CASE 3
search$ = "ipv4-address"
CASE 4
search$ = "ip-address"
CASE 5
search$ = "ipv4-"
CASE ELSE
PRINT "Sorry, can't find IP addy. Opening Notepad so you can find it..."
SHELL _HIDE "START Notepad mytemp.tmp"
' Other ways to write our SHELL...
REM SHELL _HIDE _DONTWAIT "Notepad mytemp.tmp"
REM SHELL _HIDE _DONTWAIT "cmd /c Notepad mytemp.tmp"
REM SHELL _HIDE "cmd /c START Notepad mytemp.tmp"
EXIT DO
END SELECT
END IF
cnt = cnt + 1
LOOP
Pete
|
|
|
Merry Xelfmas !!! |
Posted by: James D Jarvis - 12-14-2022, 07:02 PM - Forum: Christmas Code
- Replies (11)
|
|
A goofy little seasonal graphics demo. Uses some of the techniques I've been using in my sprite mixer programs and puts them to use.
Code: (Select All) 'XELFMAS
'By James D. Jarvis December 2022
'This program uses BASIMAGE coded by Dav for QB64GL 1.4, MAY/2020
'
'A jumble of christmas elves and a terribe little festive song
'pres <esc> to quit
'
Randomize Timer
Dim Shared ms&
ms& = _NewImage(800, 600, 32)
Screen ms&
_Title "X E L F M A S"
Dim Shared part&
Dim Shared kk1 As _Unsigned Long
Dim Shared kk2 As _Unsigned Long
Dim Shared kk3 As _Unsigned Long
Dim Shared kk4 As _Unsigned Long
Dim Shared kk5 As _Unsigned Long
Dim Shared kk6 As _Unsigned Long
Dim Shared clr~&
part& = BASIMAGE1&
Type elfbits_type
legs As Integer
boots As Integer
top As Integer
gloves As Integer
face As Integer
hat As Integer
End Type
Type balls
bx As Integer
by As Integer
klr As _Unsigned Long
d As Integer
End Type
Type anelf
i As Long
ex As Single
ey As Single
rot As Single
ss As Single
End Type
Dim Shared elf_limit
elf_limit = 80
Dim Shared ball(30) As balls
Dim Shared elook(elf_limit) As elfbits_type
Dim Shared elf(elf_limit) As anelf
_Source part&
'read the colors from the color reference bar whichever color is in the top left corner will be transparent
clr~& = Point(0, 0) 'find background color of image
_Dest part&
Line (0, 0)-(0, 8), clr~& 'erase the color reference bar from the bit map
_ClearColor clr~&, ms& 'set background color as transparent not using it in this program
_ClearColor clr~&, part&
_Source ms&
_Dest ms&
_FullScreen _SquarePixels
Color , _RGB32(250, 250, 250)
Cls
For b = 1 To 30
ball(b).bx = Int(Rnd * _Width)
ball(b).by = Int(Rnd * _Height)
Select Case Int(Rnd * 6)
Case 0
ball(b).klr = _RGB32(50 + Rnd * 150, 50 + Rnd * 150, 50 + Rnd * 150)
Case 1
ball(b).klr = _RGB32(50 + Rnd * 50, 0, 0)
Case 2
ball(b).klr = _RGB32(0, 50 + Rnd * 50, 0)
Case 3
ball(b).klr = _RGB32(0, 0, 50 + Rnd * 50)
Case 4
ball(b).klr = _RGB32(50 + Rnd * 50, 0, 50 + Rnd * 50)
Case 5
ball(b).klr = _RGB32(50 + Rnd * 50, 50 + Rnd * 50, 0)
End Select
ball(b).d = Int(20 + Rnd * 40)
Next b
For e = 1 To 80
elf(e).i = _NewImage(32, 32, 32)
Next e
mmx = 0: mmy = 0
For m = 1 To elf_limit
'create a new set of weapon sprites
elook(m).legs = Int(1 + Rnd * 6)
elook(m).boots = Int(1 + Rnd * 6)
elook(m).top = Int(1 + Rnd * 6)
elook(m).gloves = Int(1 + Rnd * 6)
elook(m).face = Int(1 + Rnd * 6)
elook(m).hat = Int(1 + Rnd * 6)
make_elf mmx, mmy, m, elf(m).i
elf(m).ex = Int(Rnd * _Width)
elf(m).ey = Int(Rnd * _Height)
elf(m).rot = 0
elf(m).ss = 1
' RotoZoom2 elf(m).ex, elf(m).ey, elf(m).i, elf(m).ss, elf(m).ss, elf(m).rot
Next m
s1$ = "MB O3 L4 GEDCG GGGEDCA AFED B, GGFDE GEDCG GEDC A A AFED , GGGG A G F D C E E E E E E E G C D "
s2$ = " O4 L4 GEDCG GGGEDCA AFED B, GGFDE GEDCG GEDC A A AFED , GGGG A G F D C E E E E E E E G C D "
s3$ = " O3 L4 MS GEDCG GGGEDCA AFED B, GGFDE GEDCG GEDC A A AFED , GGGG A G F D C E E E E E E E G C D "
s4$ = " O2 L4 MS GEDCG GGGEDCA AFED B, GGFDE GEDCG GEDC A A AFED , GGGG A G F D C E E E E E E E G C D "
Play s1$ + s2$ + s3$ + s4$
'Hmmm.... I've gotten pretty bad at reading music, sorry
Do
_Limit 30
Cls
For b = 1 To 30
cball ball(b).bx, ball(b).by, ball(b).d, ball(b).klr
Select Case Int(Rnd * 100)
Case 1
ball(b).bx = ball(b).bx + 2
Case 2
ball(b).bx = ball(b).bx - 2
Case 3
ball(b).by = ball(b).by + 2
Case 4
ball(b).by = ball(b).by - 2
Case 5
ball(b).d = ball(b).d - 2
Case 6
ball(b).d = ball(b).d + 2
End Select
Next b
mmx = 0: mmy = 0
For m = 1 To elf_limit
RotoZoom2 elf(m).ex, elf(m).ey, elf(m).i, elf(m).ss, elf(m).ss, elf(m).rot
Select Case Int(1 + Rnd * 200)
Case 1 To 20
elf(m).ex = elf(m).ex + Int(Rnd * 16)
Case 21 To 40
elf(m).ex = elf(m).ex - Int(Rnd * 16)
Case 41 To 45
elf(m).rot = elf(m).rot + 2
Case 46 To 50
elf(m).rot = elf(m).rot - 2
Case 51 To 70
elf(m).ey = elf(m).ey + Int(Rnd * 16)
Case 71 To 90
elf(m).ey = elf(m).ey - Int(Rnd * 16)
Case 91
elf(m).ss = elf(m).ss + .05
Case 92
elf(m).ss = elf(m).ss - .05
Case Else
'nothing happens here
End Select
If elf(m).ey < -16 Then elf(m).ey = _Height - 8
If elf(m).ex < -16 Then elf(m).ex = _Width - 8
If elf(m).ey > _Height + 16 Then elf(m).ey = 0
If elf(m).ex > _Width + 16 Then elf(m).ex = 0
Next m
_Display
kk$ = InKey$
Loop Until kk$ = Chr$(27)
_FreeImage part&
For e = 1 To 80
_FreeImage elf(e).i
Next e
System
Sub make_elf (Mx, my, mid, ii As Long)
tempi& = _NewImage(32, 32, 32)
_Source part&
_ClearColor Point(0, 0), tempi&
_Dest tempi&
Color , clr~&
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).legs - 1) * 32, 0)-((elook(mid).legs - 1) * 32 + 31, 31)
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).boots - 1) * 32, 32)-((elook(mid).boots - 1) * 32 + 31, 32 + 31)
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).top - 1) * 32, 64)-((elook(mid).top - 1) * 32 + 31, 64 + 31)
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).gloves - 1) * 32, 96)-((elook(mid).gloves - 1) * 32 + 31, 96 + 31)
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).face - 1) * 32, 128)-((elook(mid).face - 1) * 32 + 31, 128 + 31)
_PutImage (0, 0)-(31, 31), part&, tempi&, ((elook(mid).hat - 1) * 32, 160)-((elook(mid).hat - 1) * 32 + 31, 160 + 31)
_Source tempi&
_PutImage (Mx, my)-(Mx + 31, my + 31), tempi&, ii
_Source ms&
_Dest ms&
_FreeImage tempi&
End Sub
Sub RotoZoom2 (centerX As Long, centerY As Long, Image As Long, xScale As Single, yScale As Single, Rotation As Single)
Dim px(3) As Single: Dim py(3) As Single
W& = _Width(Image&): H& = _Height(Image&)
px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
sinr! = Sin(-(0.01745329 * Rotation)): cosr! = Cos(-(0.01745329 * Rotation))
For i& = 0 To 3
x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + centerX: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + centerY
px(i&) = x2&: py(i&) = y2&
Next
_MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
_MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub
Sub cball (CX As Long, CY As Long, R As Long, C As _Unsigned Long)
Dim kl As _Unsigned Long
kl = C
rr = _Red(kl)
bb = _Blue(kl)
gg = _Green(kl)
For d = R To (R - Int(R / 2)) Step -1
fcirc CX, CY, d, _RGB32(rr, bb, gg)
rr = rr + Int(1 + Rnd * 2)
gg = gg + Int(1 + Rnd * 2)
bb = bb + Int(1 + Rnd * 2)
Next d
End Sub
Sub fcirc (CX As Long, CY As Long, R As Long, C As _Unsigned Long)
Dim Radius As Long, RadiusError As Long
Dim X As Long, Y As Long
Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
If Radius = 0 Then PSet (CX, CY), C: Exit Sub
Line (CX - X, CY)-(CX + X, CY), C, BF
While X > Y
RadiusError = RadiusError + Y * 2 + 1
If RadiusError >= 0 Then
If X <> Y + 1 Then
Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
End If
X = X - 1
RadiusError = RadiusError - X * 2
End If
Y = Y + 1
Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
Wend
End Sub
'================================
'PNG file saved using BASIMAGE1&
'================================
Function BASIMAGE1& 'xelfs.png
v& = _NewImage(192, 192, 32)
Dim m As _MEM: m = _MemImage(v&)
A$ = ""
A$ = A$ + "haIkM7VLSZ[460eIAj=YgTlNaE8G\R48<ZUH`7Zj<VPMhCZE3clS9TYkCCC`7Z_nj[Q?6PQIj4<6P1if]73O<0Sbg_<ja0<:g?1S1HD^mhf`73``lmO<ja0<"
A$ = A$ + "8?LoO00000000000000^XnnWGVe4MnOooGke<b\kaHHdeo=o01Wom=4MniZemZnGZ?[7mOefk7me0S\nod;=S[L\0\E_O?^6XDM^gmokimJI^SnJPCCoO]7_"
A$ = A$ + "AZ]g?j[16IoobNaJ?N[cemooIWJ?NSU6gF77^BVg]fS3000000000000000000000000000000WBYKKMloUc?gijMb_USYd\FkHA_6Dka_Hnj[_NZfSo?Kn5"
A$ = A$ + "F?gMn]^_H:ci<gaRBYLjDnUnmKD_nmOg8joGNN[=oF<FbUeNVo=]VTK[Vg[Een]>oINoFf?\e_O_RngoGc[UK]n7ae1YWkJb_ESQLWgJc?TonXTN\=O_6<oC"
A$ = A$ + "g_dl_dWoXFfG_Em?Z[16Io_lGojk#_^[`iO[lKM_OJFU6SUnn0000000000000P?LYKAL^KEn1<6Olhf;^Deo=TncJb8noJl]oO=OYN=7OGkO]]e5]mo]TfS"
A$ = A$ + "o^>Bmoi`^5_n^iGIoakNNfZonXmo_ke7EeC?EgWkmjoWfOAK[Ch>of6MooLmmX_NTnoQLo_ko]onXRJn_\6knoG_kooYfoGC=I^fNdiJnnoeNoB3`gllEY8k"
A$ = A$ + "gcE[W[_7meS\VT^^FCON;k5>3mmkiJPFWGemnKM=#3dcnoBenijmJ_6I=XegWO_jMonIKn_m0<^\7MoocIO=_fQeodOFgkMoOjFGjo[M;dl_W4BjaR;oAgoO"
A$ = A$ + "6^oolfcWe2If?d\__hil`DQmk`LOc=iO=cOaHh??[CjAfg7Lo?LFT^=ja300000000000000000000`e`d59SoAMO^f4A=J:9S]b_USQ5W_ebog<3<o\WgY:"
A$ = A$ + "n<=ZnoW\FHniWC4?7MZiLokk5hl?Gn_la2>ooTe98oGf^W\O[b>mLG:oFWM5ITn\\:ZnoBITmIYE0coeVSoYD5#nIkm:UO;73I>MkYo8bN_ROV0Zo[MnkMoo"
A$ = A$ + "J_ODcoZjmW[EADocUe98oGf^W\O[b>mLG:oFWM5ITfG4monWchmoce[4Aog^kGJMogI<oYT?C;c>]nWVE6AfoglNUAN>100000000000000000n0mm;WQcaW"
A$ = A$ + "\SDoDk?N]oXeoS^6<jeoc#n;[SKm]Tkki:YViODIm>eoS>VFnUc?g4:macmn]\6<RlcF?o9[UiV;ZFf;DcJODi>jlcEoWFi[KmhHijl_?OBbTOJogE9odePJ"
A$ = A$ + "ZoAf3<?GGFGTOli_\okUn\YGOfjLEcO?T_l_BiW>F^Mka_7JNo8cKilJ>cUFnN]^6T;oBelN\6lKMonSWjaJn8GoW]lnk?GgoIn?WOD?k6;FoGdk5mjmNc_U"
A$ = A$ + "SWUOiFiWnI_2eoAWOjc]`Bi7mc`dBm4m\f?ZlCcH]lkehiCZnGjJPIm\g7>3VgMdS3H4VgMdS3H4VgMdS3000000000000000hLkn:nMkM>go\mha]W:miVO"
A$ = A$ + "oL>Dn[XHNAG_Wn_jjZ_>heoND7b^=hiMTmoYmI[eggSnoUS]imkA=oidISG7ijOdinBmnW]N_6\J?OPckZjikdJ`Wjmo7ejobJ`;gKK:iHGlioIYoO^VoYMo"
A$ = A$ + "oc`jo_ekOfn4^oobioIXoO4IGcoVCgo?f\[JKTI7iHXVaaE]nO6bOdeoAJ_KSNl200000000000000000000000#Fo?0=48A%%%0"
btemp$ = ""
For i& = 1 To Len(A$) Step 4: B$ = Mid$(A$, i&, 4)
If InStr(1, B$, "%") Then
For C% = 1 To Len(B$): F$ = Mid$(B$, C%, 1)
If F$ <> "%" Then C$ = C$ + F$
Next: B$ = C$: End If: For j = 1 To Len(B$)
If Mid$(B$, j, 1) = "#" Then
Mid$(B$, j) = "@": End If: Next
For t% = Len(B$) To 1 Step -1
B& = B& * 64 + Asc(Mid$(B$, t%)) - 48
Next: X$ = "": For t% = 1 To Len(B$) - 1
X$ = X$ + Chr$(B& And 255): B& = B& \ 256
Next: btemp$ = btemp$ + X$: Next
btemp$ = _Inflate$(btemp$)
_MemPut m, m.OFFSET, btemp$: _MemFree m
BASIMAGE1& = _CopyImage(v&): _FreeImage v&
End Function
|
|
|
|