Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efd8b68

Browse files
committed
Update manual and android file transfer
1 parent de3225d commit efd8b68

File tree

8 files changed

+592
-89
lines changed

8 files changed

+592
-89
lines changed

_build/pages/android_file_transfer.markdown

+31-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,45 @@
22

33
Easy file transfer between your Android device and your desktop using WIFI.
44

5-
## Step-by-Step Guide
5+
## File Transfer in the Browser
6+
7+
On your Android device:
68

79
1. Enable WIFI on your mobile to access your home network.
810
2. In the [setup]-screen, select a font, enable extensions and give a port number, for example 5432.
911
3. Follow the instructions to restart SmallBASIC.
1012
4. Open the [about]-screen to display the device IP and token.
11-
5. On your desktop browser, enter http://device-ip:port. For example: http://192.168.1.5:5432.
13+
14+
On your desktop browser:
15+
16+
5. Enter http://device-ip:port. For example: http://192.168.1.5:5432.
1217
6. You should see a login screen with "Enter your access token".
1318
7. Enter the token as shown in the [about]-page.
1419
8. You can now upload and download SmallBASIC files between your desktop and your mobile.
1520

1621
<div class="video-container">
1722
<iframe width="1158" height="651" src="https://www.youtube.com/embed/4Daj4YflyS0" title="SmallBASIC File Transfer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
18-
</div>
23+
</div>
24+
25+
## File Transfer in the IDE
26+
27+
On your Android device:
28+
29+
1. Enable WIFI on your mobile to access your home network.
30+
2. In the [setup]-screen, select a font, enable extensions and give a port number, for example 5432.
31+
3. Follow the instructions to restart SmallBASIC.
32+
4. Open the [about]-screen to display the device IP and token.
33+
34+
On your desktop:
35+
36+
5. Start the SDL or FLTK-version of SmallBASIC
37+
6. Navigate to the .bas file then click to begin editing.
38+
7. Press F3, then enter the address and port as shown in the Android [about]-screen (IP-Address:PORT), for example 192.168.1.5:5432
39+
8. Enter the token as shown in the [about]-page.
40+
9. Once the settings are successful, you can press F4 to upload your program.
41+
42+
On your Android device:
43+
44+
10. If `EDITOR [ON]` in the three-dot menu, the uploaded program will be opened in the editor. If `EDITOR [OFF]`, the uploaded program will be executed.
45+
46+
At first connection after restarting SmallBASIC on your Android device, you might need to give permission for web portal access.

_build/pages/guide.markdown

+76
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Contents
7575
* [Input and Output](#InputAndOutput)
7676
* [Print on Screen](#PrintOnScreen)
7777
* [Read Input from the Keyboard](#ReadInputFromKeyboard)
78+
* [Draw Graphics on Screen](#DrawGraphicsOnScreen)
7879
* [The USE Keyword](#TheUseKeyword)
7980
* [OPTION](#Statement1)
8081
* [OPTION BASE](#Statement2)
@@ -1539,6 +1540,81 @@ For more information see language reference of [INPUT](/reference/527.html).
15391540
[INKEY](/reference/539.html) and [DEFINEKEY](/reference/1015.html) allow to read from
15401541
a keyboard without blocking the execution of the program.
15411542

1543+
### Draw Graphics on Screen {#DrawGraphicsOnScreen}
1544+
1545+
In SmallBASIC graphics and text can be mixed on the same screen. The graphics screen consist
1546+
of pixels. In standard configuration the top-left pixel has the coordinate `[0,0]`. The pixel
1547+
left of `[0,0]` has the coordinate `[1,0]`. The pixel below `[0,0]` has the coordinate `[0,1]`.
1548+
The bottom-right pixel has the coordinate given by the size of the window minus one. For a
1549+
window size of 640 pixel in x- and 480 pixel in y-direction, the bottom-right pixel would have
1550+
the coordinate `[639,479]`.
1551+
1552+
A color can be assigned to every pixel. SmallBASIC supports two ways to specify a color. The easy
1553+
way is to pick a color from a build in color palette of 16 colors by specifying the corresponding
1554+
color index as listed in the following table.
1555+
1556+
| Index | Color |
1557+
|:-----:|:----------------------------------------------------------|
1558+
| 0 | <font style='color:#000000'>&block;</font> black |
1559+
| 1 | <font style='color:#000080'>&block;</font> blue |
1560+
| 2 | <font style='color:#008000'>&block;</font> green |
1561+
| 3 | <font style='color:#008080'>&block;</font> cyan |
1562+
| 4 | <font style='color:#800000'>&block;</font> red |
1563+
| 5 | <font style='color:#800080'>&block;</font> magenta |
1564+
| 6 | <font style='color:#808000'>&block;</font> yellow |
1565+
| 7 | <font style='color:#c0c0c0'>&block;</font> white |
1566+
| 8 | <font style='color:#808080'>&block;</font> gray |
1567+
| 9 | <font style='color:#0000ff'>&block;</font> bright blue |
1568+
| 10 | <font style='color:#00ff00'>&block;</font> bright green |
1569+
| 11 | <font style='color:#00ffff'>&block;</font> bright cyan |
1570+
| 12 | <font style='color:#ff0000'>&block;</font> bright red |
1571+
| 13 | <font style='color:#ff00ff'>&block;</font> bright magenta |
1572+
| 14 | <font style='color:#ffff00'>&block;</font> bright yellow |
1573+
| 15 | <font style='color:#ffffff'>&block;</font> bright white |
1574+
1575+
A slightly more complicated way is to compose a color by defining the red, green and blue
1576+
component of the color using the command `RGB(r, g, b)`. Every color component has a value from
1577+
0 to 255. To assign a color for the next drawing command use the command `COLOR foreground, background`.
1578+
`foreground` and `background` are either a color index from 0 to 15 or the return value of the
1579+
command `RGB`.
1580+
1581+
SmallBASIC support a variety of basic drawing routines, like draw a point, a line or a rectangle.
1582+
1583+
The following example sets colors and draws a line and a rectangle.
1584+
1585+
```smallbasic
1586+
COLOR 15,0 ' set foregound and background color using a color index
1587+
CLS ' clear the screen using the background color
1588+
LINE 0,0,50,50 ' draw a line
1589+
COLOR RGB(128,45,200) ' set foreground color using RGB values
1590+
RECT 0,0,50,50 ' draw a rectangle
1591+
```
1592+
1593+
To specify “world” coordinates for the screen use the command `WINDOW(x1,x2,y2,y1)`. `WINDOW`
1594+
allows you to redefine the corners of the display screen as a pair of “world” coordinates. The
1595+
coordinates of the upper-left corner of the screen is given by [x1, y1], the lower-left corner
1596+
by [x2, y2].The world space defined by WINDOW is disabled by a WINDOW command without parameters.
1597+
1598+
`VIEW(x1,y1,x2,y2)` defines a viewport with starting point (upper left corner)) [x1,y1] and end
1599+
point (lower right corner) [x2,y2]. Drawing outside the viewport is not possible.
1600+
1601+
The `WINDOW` command can be used to setup several additional window parameters or to display GUI
1602+
elements, for example:
1603+
1604+
```Smallbasic
1605+
' Display an alert
1606+
w = window()
1607+
w.alert("This is an alert", "title")
1608+
```
1609+
1610+
```Smallbasic
1611+
w = window()
1612+
w.setLocation(100, 100) ' Set window screen location
1613+
w.setSize(800, 680) ' Set window size
1614+
```
1615+
1616+
For more information about graphics commands please see [Graphics](/pages/graphics.html).
1617+
15421618
## OPTION {#Statement1}
15431619

15441620
The `OPTION` command is used to pass parameters to the SB-environment. There are

_build/reference/614-graphics-color.markdown

+32-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
55
Specifies the foreground color `foreground-color` and the optional background color `background-color`.
66

7-
See RGB and RGBF to create colors.
7+
Color can be either an index from the build in color palette (see table) or the return value of the
8+
commands `RGB` and `RGBF`.
9+
10+
| Index | Color |
11+
|:-----:|:----------------------------------------------------------|
12+
| 0 | <font style='color:#000000'>&block;</font> black |
13+
| 1 | <font style='color:#000080'>&block;</font> blue |
14+
| 2 | <font style='color:#008000'>&block;</font> green |
15+
| 3 | <font style='color:#008080'>&block;</font> cyan |
16+
| 4 | <font style='color:#800000'>&block;</font> red |
17+
| 5 | <font style='color:#800080'>&block;</font> magenta |
18+
| 6 | <font style='color:#808000'>&block;</font> yellow |
19+
| 7 | <font style='color:#c0c0c0'>&block;</font> white |
20+
| 8 | <font style='color:#808080'>&block;</font> gray |
21+
| 9 | <font style='color:#0000ff'>&block;</font> bright blue |
22+
| 10 | <font style='color:#00ff00'>&block;</font> bright green |
23+
| 11 | <font style='color:#00ffff'>&block;</font> bright cyan |
24+
| 12 | <font style='color:#ff0000'>&block;</font> bright red |
25+
| 13 | <font style='color:#ff00ff'>&block;</font> bright magenta |
26+
| 14 | <font style='color:#ffff00'>&block;</font> bright yellow |
27+
| 15 | <font style='color:#ffffff'>&block;</font> bright white |
828

929
### Example 1
1030

@@ -27,7 +47,17 @@ For back = 0 To 7 Do
2747
Next
2848
```
2949

30-
### Example 3: Assigning RGB-colors to text
50+
### Example 3: Using RGB and RGBF to draw a magenta filled rectangle with white boarder
51+
52+
```
53+
color rgb(255, 67, 133)
54+
rect 10, 10, 100, 100 filled ' filling always with foreground color
55+
56+
color rgbf(1, 1, 1)
57+
rect 10, 10, 100, 100
58+
```
59+
60+
### Example 4: Assigning RGB-colors to text
3161

3262
```
3363
Print "Try color printing with some RGB shades"
@@ -47,16 +77,6 @@ For shade = 0 To 10
4777
Next
4878
```
4979

50-
### Example 4: Using RGB and RGBF to draw a magenta filled rectangle with white boarder
51-
52-
```
53-
color rgb(255, 67, 133)
54-
rect 10, 10, 100, 100 filled ' filling always with foreground color
55-
56-
color rgbf(1, 1, 1)
57-
rect 10, 10, 100, 100
58-
```
59-
6080
### Example 5: Chart of the 16 SmallBASIC standard colors and their numbers
6181

6282
```

pages/android_file_transfer.html

+33-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@
4040
<h1 id="smallbasic-file-transfer">SmallBASIC File Transfer</h1>
4141
<p>Easy file transfer between your Android device and your desktop using
4242
WIFI.</p>
43-
<h2 id="step-by-step-guide">Step-by-Step Guide</h2>
43+
<h2 id="file-transfer-in-the-browser">File Transfer in the Browser</h2>
44+
<p>On your Android device:</p>
4445
<ol type="1">
4546
<li>Enable WIFI on your mobile to access your home network.</li>
4647
<li>In the [setup]-screen, select a font, enable extensions and give a
4748
port number, for example 5432.</li>
4849
<li>Follow the instructions to restart SmallBASIC.</li>
4950
<li>Open the [about]-screen to display the device IP and token.</li>
50-
<li>On your desktop browser, enter http://device-ip:port. For example:
51+
</ol>
52+
<p>On your desktop browser:</p>
53+
<ol start="5" type="1">
54+
<li>Enter http://device-ip:port. For example:
5155
http://192.168.1.5:5432.</li>
5256
<li>You should see a login screen with “Enter your access token”.</li>
5357
<li>Enter the token as shown in the [about]-page.</li>
@@ -58,6 +62,33 @@ <h2 id="step-by-step-guide">Step-by-Step Guide</h2>
5862
<iframe width="1158" height="651" src="https://www.youtube.com/embed/4Daj4YflyS0" title="SmallBASIC File Transfer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen>
5963
</iframe>
6064
</div>
65+
<h2 id="file-transfer-in-the-ide">File Transfer in the IDE</h2>
66+
<p>On your Android device:</p>
67+
<ol type="1">
68+
<li>Enable WIFI on your mobile to access your home network.</li>
69+
<li>In the [setup]-screen, select a font, enable extensions and give a
70+
port number, for example 5432.</li>
71+
<li>Follow the instructions to restart SmallBASIC.</li>
72+
<li>Open the [about]-screen to display the device IP and token.</li>
73+
</ol>
74+
<p>On your desktop:</p>
75+
<ol start="5" type="1">
76+
<li>Start the SDL or FLTK-version of SmallBASIC</li>
77+
<li>Navigate to the .bas file then click to begin editing.</li>
78+
<li>Press F3, then enter the address and port as shown in the Android
79+
[about]-screen (IP-Address:PORT), for example 192.168.1.5:5432</li>
80+
<li>Enter the token as shown in the [about]-page.</li>
81+
<li>Once the settings are successful, you can press F4 to upload your
82+
program.</li>
83+
</ol>
84+
<p>On your Android device:</p>
85+
<ol start="10" type="1">
86+
<li>If <code>EDITOR [ON]</code> in the three-dot menu, the uploaded
87+
program will be opened in the editor. If <code>EDITOR [OFF]</code>, the
88+
uploaded program will be executed.</li>
89+
</ol>
90+
<p>At first connection after restarting SmallBASIC on your Android
91+
device, you might need to give permission for web portal access.</p>
6192
</div>
6293
<div class="pagefooter">
6394
This page was last edited on Wed, 16 Apr 2025 21:04:07 +0200

0 commit comments

Comments
 (0)