Skip to content

Commit d3c6eb1

Browse files
authored
Merge pull request #28 from Joe7M/master
Update of entry page
2 parents 51c8c51 + 9a07c4d commit d3c6eb1

20 files changed

Lines changed: 204 additions & 126 deletions

_build/pages/guide.markdown

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,18 @@ Examples
244244
#inc:"mylib.bas"
245245
...
246246
MyLibProc "Hi"
247-
*Arrays and Matrices*
248-
Define a 3x2 matrix
249-
A = [11, 12; 21, 22; 31, 32]
250247
```
251248

249+
250+
### Arrays and Matrices
251+
252+
Define a 3x2 matrix
253+
254+
`A = [11, 12; 21, 22; 31, 32]`
255+
252256
That creates the array
253257

258+
254259
-- --
255260
11 12
256261
21 22

_build/pages/index.markdown

Lines changed: 85 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,92 @@
22

33
> one more basic
44
5-
::: articleRight ::
6-
::: articleRightInner ::
5+
SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, sound, graphic commands and communication via serial or sockets along with structured programming syntax.
76

7+
```smallbasic
8+
' Example for using functions in SmallBASIC
9+
10+
s = AddStrings("My", "String")
11+
print s
12+
13+
func AddStrings(a, b)
14+
return a + b
15+
end
16+
```
17+
18+
## Multi-platform
19+
20+
SmallBASIC is released for Windows, Linux and Android. It can be build from source for many other POSIX compliant operating systems including Raspberry Pi OS for the Raspberry Pi. Thanks to the build in IDE programs can be written on your Android powered tablet or mobile phone and executed immediately ([Downloads](/pages/download.html)).
21+
22+
Your program can be bundled with all necessary libraries to create executable files for Windows (exe-files) or Linux (AppImage). For Android a signed pkg can be created and for example distributed using Google play ([Distribute your program](/pages/distributiontool.html)).
23+
24+
Additionally you can start programming with the online version of SmallBASIC in your browser right now: [Start online](/online/sbasic.html).
25+
26+
## Editors, IDE and SmallBASIC versions
27+
28+
SmallBASIC comes in three different flavors for the desktop. The SDL version offers a simple but efficient IDE and is perfect for working with graphics. The FLTK version has a great IDE. The console version doesn't offer an IDE and is text-only but works perfect with plugins like raylib or nuklear ([Downloads](/pages/download.html)).
29+
30+
No matter which SmallBASIC version you prefer, external editors like Visual Studio Code, Geany, Sublime Text or KDE Kate can be setup for syntax highlighting or code execution ([Setup external editors](/language_support.html)).
31+
32+
Instructions on how to use the editor in the SDL and Android version can be found in the article [Android](/pages/android.html)
33+
34+
## Units
35+
36+
Units are sets of functions, procedures and constants bundled in a BASIC-library and can be imported in your program. Units use their own namespace and therefore are separated from your program.
37+
38+
```smallbasic
39+
' Example for importing the CSS color-name unit
40+
41+
Import crgb as c
42+
43+
Color c.Black, c.Tomato
44+
Print " Standard CSS Tomato background color "
45+
Color c.Black, c.LightSteelBlue
46+
Print " Standard CSS LightSteelBlue background color "
47+
48+
rect 200, 200, 400, 400 COLOR c.DeepPink filled
849
```
9-
############## ## ## ##############
10-
## ## ## ## ## ##
11-
## ###### ## ######## ## ###### ##
12-
## ###### ## ## ###### ## ###### ##
13-
## ###### ## #### ## ## ###### ##
14-
## ## #### ## ##
15-
############## ## ## ## ##############
16-
## ##
17-
#### ## #### ## ## ## ##########
18-
#### ## ## ## ###### ##
19-
######## ## #### ######## ####
20-
#### #### ###### #### ##
21-
## ## ######## ## #### ##
22-
########## #### ##
23-
############## ###### #### ######
24-
## ## ########## ##
25-
## ###### ## ## ###### ## ######
26-
## ###### ## ## ######## ##
27-
## ###### ## #### ## ###### ##
28-
## ## ## ###### ##
29-
############## ## ## ## ##########
50+
## Plugins
51+
52+
Plugins are libraries written in C which extent the functionality of SmallBASIC. SmallBASIC offers an API to write your own plugins. The following plugins are part of the release version of SmallBASIC: raylib (2D and 3D game development), nuklear (GUI programming), clipboard, gifencoder and WebSockets. You can also import a plugin for the Raspberry Pi to use the GPIO ports and some additional hardware like displays or temperature sensors.
53+
54+
```smallbasic
55+
' Example how to use raylib to open a window and print text.
56+
57+
import raylib as rl
58+
import raylibc as c
59+
60+
const screenWidth = 800
61+
const screenHeight = 450
62+
63+
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
64+
rl.SetTargetFPS(60)
65+
66+
while (!rl.WindowShouldClose())
67+
rl.BeginDrawing()
68+
rl.ClearBackground(c.RAYWHITE)
69+
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, c.LIGHTGRAY)
70+
rl.EndDrawing()
71+
wend
72+
rl.CloseWindow()
3073
```
3174

32-
:::
33-
:::
75+
## More information
76+
77+
Read more in the short [user guide](/pages/guide.html) or in the [SmallBASIC handbook](/pages/vade.html). See the documentation of all SmallBASIC commands in the [language reference](/pages/reference.html) or browse additional articles in the [article section](/pages/articles.html).
3478

35-
SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, sound, and graphic commands along with structured programming syntax.
3679

37-
[Read more](/pages/guide.html)
80+
## News
3881

39-
## SmallBASIC version 12.26 has been released for Windows, Linux and web browser
82+
### SmallBASIC version 12.26 has been released for Windows, Linux and web browser
4083

4184
::: date
4285
| March 26, 2023
4386
:::
4487

4588
For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/releases/tag/12_26). Please report any issues to either the forum, email or github issues page.
4689

47-
## SmallBASIC version 12.24 has been released for Windows, Linux and web browser
90+
### SmallBASIC version 12.24 has been released for Windows, Linux and web browser
4891

4992
::: date
5093
| June 20, 2022
@@ -53,7 +96,7 @@ For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/relea
5396
For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/releases/tag/v12.24). Please report any issues to either the forum, email or github issues page.
5497

5598

56-
## New article: "Language Support" provided by Joe7M
99+
### New article: "Language Support" provided by Joe7M
57100

58101
::: date
59102
| February 15, 2022
@@ -62,23 +105,23 @@ For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/relea
62105
For details see: [Language Support](/pages/language_support.html)
63106

64107

65-
## SmallBASIC version 12.23 has been released
108+
### SmallBASIC version 12.23 has been released
66109

67110
::: date
68111
| August 31, 2021
69112
:::
70113

71114
For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/releases/tag/v12.23). Please report any issues to either the forum, email or github issues page.
72115

73-
## SmallBASIC version 12.20 has been released
116+
### SmallBASIC version 12.20 has been released
74117

75118
::: date
76119
| January 8, 2021
77120
:::
78121

79122
This release includes new loadable modules with support for [RAYLIB](https://www.raylib.com/), [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) and WebSockets. For details see: [release notes](https://github.com/smallbasic/SmallBASIC/releases/tag/v12.20). Please report any issues to either the forum, email or github issues page.
80123

81-
## SmallBASIC version 12.19 has been released
124+
### SmallBASIC version 12.19 has been released
82125

83126
::: date
84127
| July 16, 2020
@@ -87,55 +130,55 @@ This release includes new loadable modules with support for [RAYLIB](https://www
87130
For details see: [release notes](https://github.com/smallbasic/SmallBASIC/releases/tag/12_19). Please report any issues to either the forum, email or github issues page.
88131

89132

90-
## New teaching resource: "Programming SmallBASIC" provided by Gerard Thomas Labèrnia
133+
### New teaching resource: "Programming SmallBASIC" provided by Gerard Thomas Labèrnia
91134

92135
::: date
93136
| April 11, 2020
94137
:::
95138

96139
For details see: [Articles](/pages/articles.html)
97140

98-
## SmallBASIC version 0.12.18 has been released
141+
### SmallBASIC version 0.12.18 has been released
99142

100143
::: date
101144
| March 16, 2020
102145
:::
103146

104147
For details see: [release notes](https://github.com/smallbasic/SmallBASIC/releases/tag/0_12_18). Please report any issues to either the forum, email or github issues page.
105148

106-
## SmallBASIC version 0.12.17 has been released
149+
### SmallBASIC version 0.12.17 has been released
107150

108151
::: date
109152
| December 22, 2019
110153
:::
111154

112155
For details see: [release notes](https://github.com/smallbasic/SmallBASIC/releases/tag/0_12_17). The windows package includes sbasici.exe which is a recreation of the previous FLTK version. Please report any issues to either the forum, email or github issues page.
113156

114-
## New discussion forum
157+
### New discussion forum
115158

116159
::: date
117160
| October 29, 2019
118161
:::
119162

120163
The Retrogamecoding and Basicprogramming Forum is scheduled for closure on 4th of November 2019. A new forum has been created at www.syntaxbomb.com. Click the **Discuss** link above and join the discussion!
121164

122-
## Cool new sample program, news on progress
165+
### Cool new sample program, news on progress
123166

124167
::: date
125168
| June 2, 2019
126169
:::
127170

128171
[Read more](/posts/2019-06-02.html)
129172

130-
## SmallBASIC version 0.12.14 has been released
173+
### SmallBASIC version 0.12.14 has been released
131174

132175
::: date
133176
| November 22, 2018
134177
:::
135178

136179
[Read more](/pages/changelog.html)
137180

138-
## SmallBASIC version 0.12.13 has been released
181+
### SmallBASIC version 0.12.13 has been released
139182

140183
::: date
141184
| September 13, 2018
@@ -147,15 +190,15 @@ The Retrogamecoding and Basicprogramming Forum is scheduled for closure on 4th o
147190

148191
[Samples](/pages/samples.html)
149192

150-
## Web site updated
193+
### Web site updated
151194

152195
::: date
153196
| March 29, 2018
154197
:::
155198

156199
[Read more](/posts/2018-29-03.html)
157200

158-
## SmallBASIC version 0.12.10 has been released
201+
### SmallBASIC version 0.12.10 has been released
159202

160203
::: date
161204
| December 24, 2017

_build/reference/1015-console-definekey.markdown

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> DEFINEKEY k, sub
44
5-
Binds a keystroke to a user defined function. To unbind the keystroke definition pass 0 as the `sub` argument.
5+
Binds a keycode `k` to a user defined sub routine `sub`. When the key is pressed, the coresponding sub routine will be called. To unbind the keycode definition pass `0` as the `sub` argument.
66

77
Keycodes for PC keyboard
88

@@ -33,7 +33,7 @@ Keycodes for PC keyboard
3333
| Shift + A to Z | asc("A") to asc("Z") |
3434

3535

36-
## Examples
36+
### Examples
3737

3838
Example 1: Bind keystroke for left and right arrow key
3939

@@ -57,13 +57,13 @@ wend
5757
```
5858

5959

60-
Example 2: Unbind a keystroke
60+
### Example 2: Unbind a keystroke
6161

6262
```
6363
DEFINEKEY 0xFF04, 0
6464
```
6565

66-
Example 3: Etch-a-Sketch
66+
### Example 3: Etch-a-Sketch
6767

6868
```
6969
' DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
@@ -131,7 +131,7 @@ sub quit
131131
end
132132
```
133133

134-
Example 4: This example is outdated and just a reference for buttons in PALM OS
134+
### Example 4: This example is outdated and just a reference for buttons in PALM OS
135135

136136
```
137137
' Note:

_build/reference/1429-graphics-showpage.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SHOWPAGE
22

3-
> SHOWPAGE
3+
> SHOWPAGE ([n])
44
5-
This command is used to display pending graphics operations allowing for smooth animations.
5+
This command is used to display pending graphics operations allowing for smooth animations. If SHOWPAGE is used, the internal SmallBASIC graphics update mechanism is set to manual mode. To enable automatic mode again, call SHOWPAGE with the optional parameter `n = 1`. This is useful, if the FORM command is used to display GUI elements.
66

77
### Example
88

_build/reference/1522-system-cwd.markdown

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# CWD
22

3-
> CWD
3+
> s = CWD
44
55
Gets current working directory.
66

7+
### Example
8+
79
```
810
print cwd
911
```

_build/reference/525-console-form.markdown

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FORM
22

3-
> FORM(formMap)
3+
> f = FORM(formMap)
44
55
Creates a form object `f` from a MAP variable `formMap`. Form object `f` gives access to the following GUI elements:
66

@@ -22,7 +22,7 @@ In listboxes and dropdown listboxes press and hold mouse button to scroll throug
2222
|-------------|-------------------------------|
2323
| doEvents() | Process system events for mouse and keyboard handling.
2424
| close() | Closes the active FORM.
25-
| refresh(n) | n = 1 Copy the UI state into the FORM input variables. n = 0 Update the UI state using the FORM input variables.
25+
| refresh(n) | `n = 1` copy the UI state into the FORM input variables `f.inputs`. `n = 0` update the UI state using the FORM input variables `f.inputs`.
2626

2727
The form object `f` may contain the following properties:
2828

@@ -70,6 +70,17 @@ The type attribute can be one of the following:
7070
| "text" | Single or multi-line text input.
7171
| "image" | Image button.
7272

73+
### Change or read the GUI elements
74+
75+
Once the GUI elements are rendered on screen they can be changed for example to respond to user input. By calling `f.refresh(1)` the current state of the GUI elements will be copied to `f`. The content of `f` is rendered to screen, when calling `f.refresh(0)`. `f.inputs` is an array of MAP variables. The first element of that array is the first GUI element added to `formMap.inputs`. For example the color of the first element can be changed:
76+
77+
```
78+
f.inputs[0].color = 12
79+
f.refresh(0)
80+
```
81+
82+
To get a list of all available elements of the n-th GUI element, you can simply use `print f.inputs[n]`.
83+
7384
### Example 1: Creating a push button using callback function
7485

7586
```
@@ -174,6 +185,8 @@ l.y = 120
174185
l.height = 200
175186
l.width = 100
176187
l.value = "cats|dogs|fish|birds|insects"
188+
' alternative way is to pass an array:
189+
' l.value = ["cats", "dogs", "fish", "birds", "insects"]
177190
l.color = rgb(255, 255, 255)
178191
l.backgroundColor = rgb(100, 100, 100)
179192
@@ -202,6 +215,8 @@ l.x = 120
202215
l.y = 120
203216
l.width = 100
204217
l.value = "cats|dogs|fish|birds|insects"
218+
' alternative way is to pass an array:
219+
' l.value = ["cats", "dogs", "fish", "birds", "insects"]
205220
l.color = rgb(255, 255, 255)
206221
l.backgroundColor = rgb(100, 100, 100)
207222

0 commit comments

Comments
 (0)