Skip to content

Commit

Permalink
Updated 'samples'.
Browse files Browse the repository at this point in the history
  • Loading branch information
DualBrain committed Jun 14, 2022
1 parent d0ec211 commit bfbe1bc
Show file tree
Hide file tree
Showing 129 changed files with 7,655 additions and 4 deletions.
30 changes: 30 additions & 0 deletions samples.md

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions samples/254-chars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[Home](https://qb64.com)[News](../news.md)[GitHub](../github.md)[Wiki](../wiki.md)[Samples](../samples.md)[Media](../media.md)[Community](../community.md)[Rolodex](../rolodex.md)[More...](../more.md)

## SAMPLES: 254 CHARS

**[Bubbles](bubbles/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [screensaver](screensaver.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Die Odds](die-odds/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [statistics](statistics.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[ESP](esp/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [statistics](statistics.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Flip](flip/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [statistics](statistics.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Globs 0](globs-0/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [screensaver](screensaver.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Globs 1](globs-1/index.md)**

[🐝 Rick Ellis](rick-ellis.md) 🔗 [screensaver](screensaver.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[InYrFace](inyrface/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [screensaver](screensaver.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Slot](slot/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [money](money.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...

**[Wheel O](wheel-o/index.md)**

[🐝 Tom Sales](tom-sales.md) 🔗 [game](game.md), [dos world](dos-world.md), [254 chars](254-chars.md)

Copyright (C) 1994-95 DOS Resource Guide/DOS World Published in Issue #17, September 1994, page ...
12 changes: 12 additions & 0 deletions samples/2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## SAMPLES: 2D

**[American Flag](american-flag/index.md)**

[🐝 Vince](vince.md) 🔗 [2d](2d.md), [graphics](graphics.md)

Waving American Flag demo by Vince.

**[Lens Simulator](lens-simulator/index.md)**

[🐝 STxAxTIC](stxaxtic.md) 🔗 [2d](2d.md), [ray tracer](ray-tracer.md)
Expand All @@ -14,6 +20,12 @@ This program simulates light rays passing through a lens with a given index of r

Drawing program by Lucid.

**[Plumeria](plumeria/index.md)**

[🐝 Vince](vince.md) 🔗 [2d](2d.md), [graphics](graphics.md)

Plumeria demo by Vince.

**[Vector Field](vector-field/index.md)**

[🐝 STxAxTIC](stxaxtic.md) 🔗 [2d](2d.md), [vectors](vectors.md)
Expand Down
2 changes: 0 additions & 2 deletions samples/3d-engine-prototypes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ Various experiments in software 3D graphics. Warning: Uses no functions or subs!
![3dengineqb2.png](img/3dengineqb2.png)

🔗 [3d](../3d.md), [graph](../graph.md)


6 changes: 6 additions & 0 deletions samples/a&a-de-pasquale.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@
[🐝 A&A De Pasquale](a&a-de-pasquale.md) 🔗 [measure](measure.md), [dos world](dos-world.md)

' MEASURE.BAS - A program for performing measurement conversions ' by Antonio & Alfonso De P...

**[Sort](sort/index.md)**

[🐝 A&A De Pasquale](a&a-de-pasquale.md) 🔗 [sort](sort.md), [dos world](dos-world.md)

' SORT.BAS ' by Antonio and Alfonso De Pasquale ' Copyright (C) 1994 DOS Resource Guide ' Publi...
Binary file added samples/american-flag/img/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions samples/american-flag/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[Home](https://qb64.com)[News](../../news.md)[GitHub](../../github.md)[Wiki](../../wiki.md)[Samples](../../samples.md)[Media](../../media.md)[Community](../../community.md)[Rolodex](../../rolodex.md)[More...](../../more.md)

## SAMPLE: AMERICAN FLAG

![screenshot.png](img/screenshot.png)

### Author

[🐝 Vince](../vince.md)

### Description

```text
Waving American Flag demo by Vince.
```

### QBjs

> Please note that QBjs is still in early development and support for these examples is extremely experimental (meaning will most likely not work). With that out of the way, give it a try!
* [LOAD "usflag2.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?src=https://qb64.com/samples/american-flag/src/usflag2.bas)
* [RUN "usflag2.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?mode=auto&src=https://qb64.com/samples/american-flag/src/usflag2.bas)
* [PLAY "usflag2.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?mode=play&src=https://qb64.com/samples/american-flag/src/usflag2.bas)

### File(s)

* [usflag2.bas](src/usflag2.bas)

🔗 [2d](../2d.md), [graphics](../graphics.md)
124 changes: 124 additions & 0 deletions samples/american-flag/src/usflag2.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
Option _Explicit
DefLng A-Z

Dim sw, sh
Dim h, w, a
Dim img
Dim x0, y0, x, y, dz
Dim tl, tr, bl, br
Dim r, g, b
Dim i, j, t

sw = 640
sh = 480

Dim Shared pi As Double
pi = 4 * Atn(1)

Screen _NewImage(sw, sh, 32)

h = 300
w = 1.9 * h
a = h / 7

img = _NewImage(w, h, 32)
_Dest img
x0 = 0
y0 = 0

Line (0, 0)-Step(w, h), _RGB(255, 255, 255), BF
For i = 0 To 6
Line (0, i * h * 2 / 13)-Step(w, h / 13), _RGB(255 * 0.698, 255 * 0.132, 255 * 0.203), BF
Next
Line (0, 0)-Step(w * 2 / 5, h * 7 / 13), _RGB(255 * 0.234, 255 * 0.233, 255 * 0.430), BF

For i = 0 To 4
For j = 0 To 5
starf (j * 2 + 1) * w * 2 / (5 * 12), (i * 2 + 1) * h * 7 / 130, h * 4 / (13 * 5 * 2), _RGB(255, 255, 255)
Next
Next

For i = 1 To 4
For j = 1 To 5
starf (j * 2) * w * 2 / (5 * 12), (i * 2) * h * 7 / 130, h * 4 / (13 * 5 * 2), _RGB(255, 255, 255)
Next
Next

_Dest 0
'_putimage (sw/2 - w/2, sh/2 - h/2), img
_Source img

x0 = sw / 2 - w / 2 '+ sw
y0 = sh / 2 - h / 2 '+ sh

Dim t As Double
Dim z As Double

Dim xx As Double, yy As Double
Dim dx As Double, dy As Double
Do
t = t + 0.2

Line (0, 0)-Step(sw, sh), _RGB(0, 0, 0), BF

For y = 0 To h + a * 0.707 Step 1
For x = 0 To w + a * 0.707 Step 1
z = (0.1 + 0.4 * (x / w)) * a * Sin(x / 35 - y / 70 - t) + 0.5 * a
dz = 50 * a * Cos(x / 35 - y / 70 - t) / 35

xx = x + z * 0.707 - a * 0.707
yy = y - z * 0.707

If (Int(xx) >= 0 And Int(xx) < w - 1 And Int(yy) >= 0 And Int(yy) < h - 1) Then
tl = Point(Int(xx), Int(yy))
tr = Point(Int(xx) + 1, Int(yy))
bl = Point(Int(xx), Int(yy) + 1)
br = Point(Int(xx) + 1, Int(yy) + 1)

dx = xx - Int(xx)
dy = yy - Int(yy)

r = _Round((1 - dy) * ((1 - dx) * _Red(tl) + dx * _Red(tr)) + dy * ((1 - dx) * _Red(bl) + dx * _Red(br)))
g = _Round((1 - dy) * ((1 - dx) * _Green(tl) + dx * _Green(tr)) + dy * ((1 - dx) * _Green(bl) + dx * _Green(br)))
b = _Round((1 - dy) * ((1 - dx) * _Blue(tl) + dx * _Blue(tr)) + dy * ((1 - dx) * _Blue(bl) + dx * _Blue(br)))

r = r + dz
g = g + dz
b = b + dz

If r < 0 Then r = 0
If r > 255 Then r = 255
If g < 0 Then g = 0
If g > 255 Then g = 255
If b < 0 Then b = 0
If b > 255 Then b = 255

PSet (x0 + x, y0 - a * 0.707 + y), _RGB(r, g, b)
End If
Next
Next

_Display
_Limit 50
Loop Until _KeyHit = 27

Sleep
System

Sub starf (x, y, r, c)
Dim i, xx, yy
PSet (x + r * Cos(pi / 2), y - r * Sin(pi / 2)), c
For i = 0 To 5
xx = r * Cos(i * 4 * pi / 5 + pi / 2)
yy = r * Sin(i * 4 * pi / 5 + pi / 2)
Line -(x + xx, y - yy), c
Next
Paint (x, y), c
For i = 0 To 5
xx = r * Cos(i * 4 * pi / 5 + pi / 2) / 2
yy = r * Sin(i * 4 * pi / 5 + pi / 2) / 2
Paint (x + xx, y - yy), c
Next
End Sub


12 changes: 12 additions & 0 deletions samples/art.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ Move mouse to rotate, escape to quit
[🐝 qbguy](qbguy.md) 🔗 [art](art.md), [drawing](drawing.md)

Left-click to draw, right click or middle click to clear screen, escape to quit.

**[Pattern Editor](pattern-editor/index.md)**

[🐝 Abacus](abacus.md) 🔗 [art](art.md), [pattern](pattern.md)

Pattern Editor by Abacus.

**[Tile Engine Test](tile-engine-test/index.md)**

[🐝 Abacus](abacus.md) 🔗 [art](art.md), [tile](tile.md)

Tile Engine Test by Abacus.
2 changes: 1 addition & 1 deletion samples/author-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## AUTHORS

[Microsoft:31](microsoft.md) • [Fellippe Heitor:27](fellippe-heitor.md) • [Antoni Gual:25](antoni-gual.md) • [*missing*:23](author-missing.md) • [STxAxTIC:23](stxaxtic.md) • [Rho Sigma:19](rho-sigma.md) • [qbguy:11](qbguy.md) • [A&A De Pasquale:9](a&a-de-pasquale.md) • [bplus:9](bplus.md) • [Bob Seguin:7](bob-seguin.md) • [Hardin Brothers:5](hardin-brothers.md) • [Relsoft:5](relsoft.md) • [Richard Frost:5](richard-frost.md) • [Terry Ritchie:5](terry-ritchie.md) • [Zom-B:5](zom-b.md) • [Alan Zeichick:3](alan-zeichick.md) • [Ashish Kushwaha:3](ashish-kushwaha.md) • [Cyperium:3](cyperium.md) • [Dav:3](dav.md) • [vince:3](vince.md) • [Artelius:1](artelius.md) • [Brian Murphy:1](brian-murphy.md) • [Chris Chadwick:1](chris-chadwick.md) • [Cobalt:1](cobalt.md) • [Danilin:1](danilin.md) • [darokin:1](darokin.md) • [David Bannon:1](david-bannon.md) • [David Ferrier:1](david-ferrier.md) • [David Joffe:1](david-joffe.md) • [Dietmar Moritz:1](dietmar-moritz.md) • [Douglas Park:1](douglas-park.md) • [Folker Fritz:1](folker-fritz.md) • [Galleon:1](galleon.md) • [Glenn Powell:1](glenn-powell.md) • [harixxx:1](harixxx.md) • [Jeh:1](jeh.md) • [Jeremy Munn:1](jeremy-munn.md) • [JKC:1](jkc.md) • [John Wolfskill:1](john-wolfskill.md) • [Kevin:1](kevin.md) • [kinem:1](kinem.md) • [Leif J. Burrow:1](leif-j.-burrow.md) • [Lucid:1](lucid.md) • [Luke:1](luke.md) • [Matt Bross:1](matt-bross.md) • [Matthew:1](matthew.md) • [Matthew River Knight:1](matthew-river-knight.md) • [Mennonite:1](mennonite.md) • [Michael Fogleman:1](michael-fogleman.md) • [Nathan Thomas:1](nathan-thomas.md) • [Paul Meyer:1](paul-meyer.md) • [pcluddite:1](pcluddite.md) • [Petr:1](petr.md) • [Philipp Strathausen:1](philipp-strathausen.md) • [QB64 Team 2018:1](qb64-team-2018.md) • [RETROQB45:1](retroqb45.md) • [RhoSigma:1](rhosigma.md) • [rpgfan3233:1](rpgfan3233.md) • [Steve M.:1](steve-m..md) • [Timothy Baxendale:1](timothy-baxendale.md) • [Tor Myklebust:1](tor-myklebust.md) • [TrialAndTerror:1](trialandterror.md) • [triggered:1](triggered.md) • [Tsiplacov Sergey:1](tsiplacov-sergey.md) • [TylerDarko:1](tylerdarko.md) • [William Loughner:1](william-loughner.md) • [Yu:1](yu.md) • [Zack Johnson:1](zack-johnson.md)
[Microsoft:31](microsoft.md) • [Fellippe Heitor:27](fellippe-heitor.md) • [Antoni Gual:25](antoni-gual.md) • [*missing*:23](author-missing.md) • [STxAxTIC:23](stxaxtic.md) • [Rho Sigma:19](rho-sigma.md) • [Tom Sales:15](tom-sales.md) • [Vince:13](vince.md) • [A&A De Pasquale:11](a&a-de-pasquale.md) • [qbguy:11](qbguy.md) • [bplus:9](bplus.md) • [Abacus:7](abacus.md) • [Bob Seguin:7](bob-seguin.md) • [Hardin Brothers:5](hardin-brothers.md) • [Relsoft:5](relsoft.md) • [Richard Frost:5](richard-frost.md) • [Terry Ritchie:5](terry-ritchie.md) • [Zom-B:5](zom-b.md) • [Alan Zeichick:3](alan-zeichick.md) • [Ashish Kushwaha:3](ashish-kushwaha.md) • [Cyperium:3](cyperium.md) • [Dav:3](dav.md) • [Greg Ennen:3](greg-ennen.md) • [Jon Mark O'Connor:3](jon-mark-o'connor.md) • [Tim Syrop:3](tim-syrop.md) • [Artelius:1](artelius.md) • [Brian Murphy:1](brian-murphy.md) • [Chris Chadwick:1](chris-chadwick.md) • [Cobalt:1](cobalt.md) • [Danilin:1](danilin.md) • [darokin:1](darokin.md) • [David Bannon:1](david-bannon.md) • [David Ferrier:1](david-ferrier.md) • [David Joffe:1](david-joffe.md) • [Dennis Mull:1](dennis-mull.md) • [Dietmar Moritz:1](dietmar-moritz.md) • [Doug Lowe:1](doug-lowe.md) • [Douglas Park:1](douglas-park.md) • [Folker Fritz:1](folker-fritz.md) • [Galleon:1](galleon.md) • [Glenn Powell:1](glenn-powell.md) • [harixxx:1](harixxx.md) • [Jeff Davis:1](jeff-davis.md) • [Jeh:1](jeh.md) • [Jeremy Munn:1](jeremy-munn.md) • [JKC:1](jkc.md) • [John Wolfskill:1](john-wolfskill.md) • [Kevin:1](kevin.md) • [kinem:1](kinem.md) • [Leif J. Burrow:1](leif-j.-burrow.md) • [Lucid:1](lucid.md) • [Luke:1](luke.md) • [Matt Bross:1](matt-bross.md) • [Matthew:1](matthew.md) • [Matthew River Knight:1](matthew-river-knight.md) • [Mennonite:1](mennonite.md) • [Michael Fogleman:1](michael-fogleman.md) • [Nathan Thomas:1](nathan-thomas.md) • [Paul Meyer:1](paul-meyer.md) • [pcluddite:1](pcluddite.md) • [Petr:1](petr.md) • [Philipp Strathausen:1](philipp-strathausen.md) • [QB64 Team 2018:1](qb64-team-2018.md) • [R. K. Fink:1](r.-k.-fink.md) • [RETROQB45:1](retroqb45.md) • [RhoSigma:1](rhosigma.md) • [Rick Ellis:1](rick-ellis.md) • [rpgfan3233:1](rpgfan3233.md) • [Scott Edwards:1](scott-edwards.md) • [Steve M.:1](steve-m..md) • [Timothy Baxendale:1](timothy-baxendale.md) • [Tor Myklebust:1](tor-myklebust.md) • [TrialAndTerror:1](trialandterror.md) • [triggered:1](triggered.md) • [Tsiplacov Sergey:1](tsiplacov-sergey.md) • [TylerDarko:1](tylerdarko.md) • [William Loughner:1](william-loughner.md) • [Yu:1](yu.md) • [Zack Johnson:1](zack-johnson.md)
9 changes: 9 additions & 0 deletions samples/bezier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](https://qb64.com)[News](../news.md)[GitHub](../github.md)[Wiki](../wiki.md)[Samples](../samples.md)[Media](../media.md)[Community](../community.md)[Rolodex](../rolodex.md)[More...](../more.md)

## SAMPLES: BEZIER

**[Curve Approximator](curve-approximator/index.md)**

[🐝 Vince](vince.md) 🔗 [curve](curve.md), [bezier](bezier.md)

Curve Approximator by Vince.
Binary file added samples/big-leds/img/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions samples/big-leds/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[Home](https://qb64.com)[News](../../news.md)[GitHub](../../github.md)[Wiki](../../wiki.md)[Samples](../../samples.md)[Media](../../media.md)[Community](../../community.md)[Rolodex](../../rolodex.md)[More...](../../more.md)

## SAMPLE: BIG LEDS

![screenshot.png](img/screenshot.png)

### Author

[🐝 Scott Edwards](../scott-edwards.md)

### Description

```text
' BIG_LEDS.BAS
' by Scott Edwards
' Copyright (C) 1994 DOS World Magazine
' Published in Issue #19, January 1995, page 62
*****************************************************************************
BIG_LEDS.BAS
by Scott Edwards
Copyright (C) 1994 DOS World Magazine
Published in Issue #19, January 1995, page 62
If you've ever wanted your QBasic programs to display GIANT numbers on your
display, this program is for you. BIG_LEDS.BAS demonstrates the usage of two
subroutines, DISPLAY and LED, that display large numbers that look like the
LED display on a digital clock or wrist watch. The demo program displays a
four-digit value as it counts from zero to 9999, updating the display once
per second. You can stop the demo at any time by pressing any key.
To run the program from the DOS command line, change to the directory
containing BIG_LEDS.BAS, then type:
QBASIC /RUN BIG_LEDS
Like a real LED (light emitting diode) display, each numeral displayed by
this program consists of seven segments, each of which can be on or off. The
number 8, for example. uses all seven segments:
****
* *
* *
****
* *
* *
****
The DISPLAY subroutine extracts the digits of the number you want to display,
converts it to a bit pattern and feeds it to the LED subroutine. The LED
subroutine turns each segment on or off according to the pattern of bits
provided in the integer variable SEGS%.
The demo program's main loop consists of just five lines:
FOR X = 0 TO 9999
DISPLAY (X): SLEEP 1
IF INKEY$ <> "" THEN SYSTEM
NEXT X
END
This FOR...NEXT loop counts from 0 to 9999 and calls the DISPLAY subroutine
each time through the loop. If you press any key, the program exits back to
the QBasic environment.
You may customize the program by changing the values of the constants that
set the color, size, and screen position of the LED numerals. The constant
SCALE controls the spacing of the numerals. Only four values are useful:
1(small), 2(medium), 3(huge), and 4(jumbo). If you change SCALE, you must
also change the "Sn" value for constants A$ through G$. If you set SCALE to
1, for instance, the line that sets the value of A$ must be changed to:
CONST A$ = "S1 B M+0,-242 B R4 E8 R80 F8 G8 L80 H8 B R10"
In this example, S4 was changed to S1 because SCALE was changed from 4 to 1.
You may change the color of the numerals by altering the value of the
constant LIT. Values of 1 through 15 are permissible. To change the location
at which the numerals are displayed, substitute new values for the constants
XBASE and YBASE. Reducing XBASE moves the display to the left, increasing it
moves the display to the right. Reducing YBASE moves the display up,
increasing it moves the display down.
To use these routines in a program of your own, add the entire BIG_LEDS.BAS
listing to your program, except for the five lines shown above that comprise
the main program loop of the demo program. The easiest way to do this is to
Open BIG_LEDS.BAS in QBasic, Copy the relevant portions of the listing, Open
your program, and Paste the copied portion of BIG_LEDS.BAS into your program.
Now anytime you want to display a BIG number, insert the statement Display
(X) into your program, after first setting X equal to the number you wish to
display.
```

### QBjs

> Please note that QBjs is still in early development and support for these examples is extremely experimental (meaning will most likely not work). With that out of the way, give it a try!
* [LOAD "big_leds.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?src=https://qb64.com/samples/big-leds/src/big_leds.bas)
* [RUN "big_leds.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?mode=auto&src=https://qb64.com/samples/big-leds/src/big_leds.bas)
* [PLAY "big_leds.bas"](https://v6p9d9t4.ssl.hwcdn.net/html/5963335/index.html?mode=play&src=https://qb64.com/samples/big-leds/src/big_leds.bas)

### File(s)

* [big_leds.bas](src/big_leds.bas)

🔗 [clock](../clock.md), [dos world](../dos-world.md)
Loading

0 comments on commit bfbe1bc

Please sign in to comment.