Skip to content

Commit

Permalink
Added a few samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
DualBrain committed Jan 12, 2024
1 parent a8d11f7 commit eb9b8c9
Show file tree
Hide file tree
Showing 35 changed files with 4,845 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,5 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

*.exe
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "QB64 Build and Run",
"type": "QB64",
"request": "launch",
"command": "${config:qb64.installPath}/qb64.exe -c -x \"${fileDirname}\\${fileBasename}\" -o \"${fileDirname}\\${fileBasenameNoExtension}.exe\" -x; if ($?) { cd \"${fileDirname}\"; start \"${fileDirname}\\${fileBasenameNoExtension}.exe\"}",
"terminalName": "QB64",
"terminalIndex": -1,
"showTerminal": true,
"linux": {
"name": "QB64 Build and Run",
"type": "QB64",
"request": "launch",
"command": "${config:qb64.installPath}/qb64 '${fileDirname}/${fileBasename}' -c -x -o '${fileDirname}/${fileBasenameNoExtension}' && '${fileDirname}/${fileBasenameNoExtension}'",
},
"osx": {
"name": "QB64 Build and Run",
"type": "QB64",
"request": "launch",
"command": "${config:qb64.installPath}/qb64 '${fileDirname}/${fileBasename}' -c -x -o '${fileDirname}/${fileBasenameNoExtension}'; mv '${fileDirname}/${fileBasenameNoExtension}' '${fileDirname}/${fileBasenameNoExtension}.run'; '${fileDirname}/${fileBasenameNoExtension}.run'",
}
}
]
}
43 changes: 43 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"files.exclude": {
"**/*.bas-bak": true,
"**/*.bi-bak": true,
"**/*.bm-bak": true,
"**/*.cmp-out": true,
"**/*.json-bak": true,
"**/desktop.ini": true
},
"files.defaultLanguage": "QB64",
"editor.multiCursorModifier": "ctrlCmd",
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"graphics.QB64"
],
"settings": {
"foreground": "#00ff2a"
}
},
{
"scope": [
"sound.QB64"
],
"settings": {
"foreground": "#f0b411"
}
},
{
"scope": [
"keyword.control.QB64"
],
"settings": {
"foreground": "#d611f0"
}
}
]
},
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2
}
99 changes: 99 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "${config:qb64.installPath}/qb64.exe",
"args": [
"-c",
"'${fileDirname}/${fileBasename}'",
"-x",
"-o",
"'${fileDirname}/${fileBasenameNoExtension}.exe'"
],
"linux": {
"command": "${config:qb64.installPath}/qb64",
"args": [
"-c",
"'${fileDirname}/${fileBasename}'",
"-x",
"-o",
"'${fileDirname}/${fileBasenameNoExtension}'"
]
},
"osx": {
"command": "${config:qb64.installPath}/qb64",
"args": [
"-c",
"'{fileDirname}/${fileBasename}'",
"-x",
"-o",
"'${fileDirname}/${fileBasenameNoExtension}'"
]
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Clean QB64",
"type": "shell",
"options": {
"cwd": "${config:qb64.installPath}/internal",
},
"command": "${config:qb64.installPath}/internal/clean.bat",
"linux": {
"command":"${config:qb64.installPath}/internal/clean.sh",
},
"osx": {
"command":"${config:qb64.installPath}/internal/clean.sh",
},
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Exe Compact",
"type": "shell",
"windows": {
"command": "compact",
"args": [
"/c",
"/exe:lzx",
"\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
]
},
"linux": {
"command": "upx",
"args": [
"${fileDirname}/${fileBasenameNoExtension}.exe"
]
},
"osx": {
"command": "upx",
"args": [
"${fileDirname}/${fileBasenameNoExtension}.exe"
]
},
"group": {
"kind": "build",
"isDefault": false
},
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
Binary file not shown.
38 changes: 38 additions & 0 deletions code/bplus/bilateral_kaleidoscope/bilateral_kaleidoscope.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
_Title "Bilateral Kaleidoscope" ' 2023-01-02 NOT May 2022 version by b+
Const sh = 600, sw = 800
Screen _NewImage(sw, sh, 32)
'_ScreenMove 200, 100
_FullScreen
Randomize Timer
Do
If lc = 0 Then
dx1 = 0: dx2 = 0: dy1 = 0: dy2 = 0: dr = 0: dg = 0: db = 0
x1 = sw * Rnd: y1 = sh * Rnd: x2 = sw * Rnd: y2 = sh * Rnd: r = Rnd * 255: g = Rnd * 255: b = Rnd * 255
While dx1 = 0: dx1 = Rnd * 6 - 3: Wend
While dx2 = 0: dx2 = Rnd * 6 - 3: Wend
While dy1 = 0: dy1 = Rnd * 6 - 3: Wend
While dy2 = 0: dy2 = Rnd * 6 - 3: Wend
While dr = 0: dr = Rnd * 4 - 2: Wend
While dg = 0: dg = Rnd * 4 - 2: Wend
While db = 0: db = Rnd * 4 - 2: Wend
End If
Line (x1, y1)-(x2, y2), _RGB32(r, g, b, 100)
Line (sw - x1, y1)-(sw - x2, y2), _RGB32(r, g, b, 100)
Line (x1, sh - y1)-(x2, sh - y2), _RGB32(r, g, b, 100)
Line (sw - x1, sh - y1)-(sw - x2, sh - y2), _RGB32(r, g, b, 100)
x1 = Remainder(x1 + dx1, sw)
x2 = Remainder(x2 + dx2, sw)
y1 = Remainder(y1 + dy1, sh)
y2 = Remainder(y2 + dy2, sh)
r = Remainder(r + dr, 255)
g = Remainder(g + dr, 255)
b = Remainder(b + db, 255)
lc = lc + 1
If ((Rnd > .999) And (lc > 300)) Or (lc > 4000) Then Sleep 1: Cls: lc = 0
_Limit 60
Loop Until _KeyDown(27)

Function Remainder (n, d)
If d = 0 Then Exit Function
Remainder = n - (d) * Int(n / (d))
End Function
56 changes: 56 additions & 0 deletions code/bplus/bilateral_kaleidoscope/bilateral_kaleidoscope2.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
_Title "Bilateral Kaleidoscope 2 - shape shifter" ' 2023-01-02 NOT May 2022 version by b+
Const sh = 600, sw = 800: linelimit = 400
Type lion
As Single x1, y1, x2, y2
As _Unsigned Long c
End Type
Dim Shared l(linelimit) As lion, li As Long
Screen _NewImage(sw, sh, 32)
'_ScreenMove 200, 100
_FullScreen
Randomize Timer
Do
If lc = 0 Then
dx1 = 0: dx2 = 0: dy1 = 0: dy2 = 0: dr = 0: dg = 0: db = 0
x1 = sw * Rnd: y1 = sh * Rnd: x2 = sw * Rnd: y2 = sh * Rnd: r = Rnd * 255: g = Rnd * 255: b = Rnd * 255
While dx1 = 0: dx1 = Rnd * 6 - 3: Wend
While dx2 = 0: dx2 = Rnd * 6 - 3: Wend
While dy1 = 0: dy1 = Rnd * 6 - 3: Wend
While dy2 = 0: dy2 = Rnd * 6 - 3: Wend
While dr = 0: dr = Rnd * 4 - 2: Wend
While dg = 0: dg = Rnd * 4 - 2: Wend
While db = 0: db = Rnd * 4 - 2: Wend
End If
Cls
For i = 0 To li
Line (l(i).x1, l(i).y1)-(l(i).x2, l(i).y2), l(i).c
Line (sw - l(i).x1, l(i).y1)-(sw - l(i).x2, l(i).y2), l(i).c
Line (l(i).x1, sh - l(i).y1)-(l(i).x2, sh - l(i).y2), l(i).c
Line (sw - l(i).x1, sh - l(i).y1)-(sw - l(i).x2, sh - l(i).y2), l(i).c
Next
x1 = Remainder(x1 + dx1, sw)
x2 = Remainder(x2 + dx2, sw)
y1 = Remainder(y1 + dy1, sh)
y2 = Remainder(y2 + dy2, sh)
r = Remainder(r + dr, 255)
g = Remainder(g + dr, 255)
b = Remainder(b + db, 255)
If li < linelimit Then
li = li + 1
l(li).x1 = x1: l(li).y1 = y1: l(li).x2 = x2: l(li).y2 = y2: l(li).c = _RGB32(r, g, b, 100)
Else
For i = 0 To linelimit - 1
l(i) = l(i + 1)
Next
l(linelimit).x1 = x1: l(linelimit).y1 = y1: l(linelimit).x2 = x2: l(linelimit).y2 = y2: l(linelimit).c = _RGB32(r, g, b, 100)
End If
lc = lc + 1
If lc > 4000 Then Sleep 1: Cls: lc = 0: li = 0
_Display
_Limit 100
Loop Until _KeyDown(27)

Function Remainder (n, d)
If d = 0 Then Exit Function
Remainder = n - (d) * Int(n / (d))
End Function
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
_Title "Kaleidoscope" 'b+ 2022-05-24
' it so obvious to use maptriangle!
Randomize Timer
Dim Shared sH, sW, sHd2, sWd2
sH = 700: sW = 700: sHd2 = sH / 2: sWd2 = sW / 2
Screen _NewImage(700, 700, 32)
_ScreenMove 290, 0
Do Until _KeyDown(27)
If Rnd > .05 Then Line (0, 0)-(sW - 1, sH - 1), _RGB32(0, 0, 0, 10), BF Else Cls
n = (n + 1) Mod 66 + 4
If n Mod 2 Then n = n + 1
ReDim px(0 To n - 1), py(0 To n - 1)
circleDivN = _Pi(2 / n)
For i = 0 To n - 1
px(i) = sWd2 + sHd2 * Cos(i * circleDivN)
py(i) = sHd2 + sHd2 * Sin(i * circleDivN)
Next
For i = 1 To 700
Line (Rnd * sW, Rnd * sH)-Step(Rnd * 5, Rnd * 5), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), BF
Circle (Rnd * sW, Rnd * sH), Rnd * 8 + 2, _RGB32(Rnd * 255, Rnd * 255, Rnd * 255)
Next
For i = 1 To 30
w = Rnd * 700
Line (sWd2 - w / 2, Rnd * sH)-Step(w, Rnd * 5), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), BF
Next
For s = 0 To n - 1
For i = 0 To n - 1
_MapTriangle (sWd2, sHd2)-(px((i + s) Mod n), py((i + s) Mod n))-(px((i + 1 + s) Mod n), py((i + 1 + s) Mod n)), 0 To(sWd2, sHd2)-(px((i + 2 + s) Mod n), py((i + 2 + s) Mod n))-(px((i + 1 + s) Mod n), py((i + 1 + s) Mod n))
Next
Next
_Display
_Limit 2
Loop
35 changes: 35 additions & 0 deletions code/bplus/bubble_universe/bubble_universe.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Const xmax = 512, ymax = 512
_Title "Bubble Universe - ESC to exit" ' from johnno at RCBasic forum 2022-11-14
Screen _NewImage(xmax, ymax, 32)
' ---------------
' Paul Dunn posted this code but for SpecBAS in a facebook group.
' It looked so cool that I had to rewrite it in Naalaa 7. Marcus
'
' bplus QB64 Mod of RCB version by Johnno56
TAU = 6.283185307179586
n = 200
r = TAU / 235
x = 0
y = 0
v = 0
t = 0
hw = xmax / 2
hh = ymax / 2
Do
Color _RGB32(0, 0, 0)
Cls
For i = 0 To n
For j = 0 To n
u = Sin(i + v) + Sin(r * i + x)
v = Cos(i + v) + Cos(r * i + x)
x = u + t
Color _RGB(i, j, 99)
PSet (hw + u * hw * 0.4, hh + v * hh * 0.4)
Next
Next
t = t + 0.001 ' slowed way way down from .025
_Display
_Limit 30
Loop Until _KeyDown(27)


Loading

0 comments on commit eb9b8c9

Please sign in to comment.