You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _build/pages/index.markdown
+85-42Lines changed: 85 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,49 +2,92 @@
2
2
3
3
> one more basic
4
4
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.
7
6
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
8
49
```
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()
30
73
```
31
74
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).
34
78
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.
36
79
37
-
[Read more](/pages/guide.html)
80
+
## News
38
81
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
40
83
41
84
::: date
42
85
| March 26, 2023
43
86
:::
44
87
45
88
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.
46
89
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
48
91
49
92
::: date
50
93
| June 20, 2022
@@ -53,7 +96,7 @@ For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/relea
53
96
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.
54
97
55
98
56
-
## New article: "Language Support" provided by Joe7M
99
+
###New article: "Language Support" provided by Joe7M
57
100
58
101
::: date
59
102
| February 15, 2022
@@ -62,23 +105,23 @@ For details see: [Latest release](https://github.com/smallbasic/SmallBASIC/relea
62
105
For details see: [Language Support](/pages/language_support.html)
63
106
64
107
65
-
## SmallBASIC version 12.23 has been released
108
+
###SmallBASIC version 12.23 has been released
66
109
67
110
::: date
68
111
| August 31, 2021
69
112
:::
70
113
71
114
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.
72
115
73
-
## SmallBASIC version 12.20 has been released
116
+
###SmallBASIC version 12.20 has been released
74
117
75
118
::: date
76
119
| January 8, 2021
77
120
:::
78
121
79
122
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.
80
123
81
-
## SmallBASIC version 12.19 has been released
124
+
###SmallBASIC version 12.19 has been released
82
125
83
126
::: date
84
127
| July 16, 2020
@@ -87,55 +130,55 @@ This release includes new loadable modules with support for [RAYLIB](https://www
87
130
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.
88
131
89
132
90
-
## New teaching resource: "Programming SmallBASIC" provided by Gerard Thomas Labèrnia
133
+
###New teaching resource: "Programming SmallBASIC" provided by Gerard Thomas Labèrnia
91
134
92
135
::: date
93
136
| April 11, 2020
94
137
:::
95
138
96
139
For details see: [Articles](/pages/articles.html)
97
140
98
-
## SmallBASIC version 0.12.18 has been released
141
+
###SmallBASIC version 0.12.18 has been released
99
142
100
143
::: date
101
144
| March 16, 2020
102
145
:::
103
146
104
147
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.
105
148
106
-
## SmallBASIC version 0.12.17 has been released
149
+
###SmallBASIC version 0.12.17 has been released
107
150
108
151
::: date
109
152
| December 22, 2019
110
153
:::
111
154
112
155
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.
113
156
114
-
## New discussion forum
157
+
###New discussion forum
115
158
116
159
::: date
117
160
| October 29, 2019
118
161
:::
119
162
120
163
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!
121
164
122
-
## Cool new sample program, news on progress
165
+
###Cool new sample program, news on progress
123
166
124
167
::: date
125
168
| June 2, 2019
126
169
:::
127
170
128
171
[Read more](/posts/2019-06-02.html)
129
172
130
-
## SmallBASIC version 0.12.14 has been released
173
+
###SmallBASIC version 0.12.14 has been released
131
174
132
175
::: date
133
176
| November 22, 2018
134
177
:::
135
178
136
179
[Read more](/pages/changelog.html)
137
180
138
-
## SmallBASIC version 0.12.13 has been released
181
+
###SmallBASIC version 0.12.13 has been released
139
182
140
183
::: date
141
184
| September 13, 2018
@@ -147,15 +190,15 @@ The Retrogamecoding and Basicprogramming Forum is scheduled for closure on 4th o
Copy file name to clipboardExpand all lines: _build/reference/1015-console-definekey.markdown
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> DEFINEKEY k, sub
4
4
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.
6
6
7
7
Keycodes for PC keyboard
8
8
@@ -33,7 +33,7 @@ Keycodes for PC keyboard
33
33
| Shift + A to Z | asc("A") to asc("Z") |
34
34
35
35
36
-
## Examples
36
+
###Examples
37
37
38
38
Example 1: Bind keystroke for left and right arrow key
Copy file name to clipboardExpand all lines: _build/reference/1429-graphics-showpage.markdown
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# SHOWPAGE
2
2
3
-
> SHOWPAGE
3
+
> SHOWPAGE ([n])
4
4
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.
Copy file name to clipboardExpand all lines: _build/reference/525-console-form.markdown
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# FORM
2
2
3
-
> FORM(formMap)
3
+
> f = FORM(formMap)
4
4
5
5
Creates a form object `f` from a MAP variable `formMap`. Form object `f` gives access to the following GUI elements:
6
6
@@ -22,7 +22,7 @@ In listboxes and dropdown listboxes press and hold mouse button to scroll throug
22
22
|-------------|-------------------------------|
23
23
| doEvents() | Process system events for mouse and keyboard handling.
24
24
| 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`.
26
26
27
27
The form object `f` may contain the following properties:
28
28
@@ -70,6 +70,17 @@ The type attribute can be one of the following:
70
70
| "text" | Single or multi-line text input.
71
71
| "image" | Image button.
72
72
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
+
73
84
### Example 1: Creating a push button using callback function
0 commit comments