text
stringlengths
0
721
- Image/sound/shape IDs are stable integer handles **always** store as constants: `LET MY_IMG# = LOADIMAGE("x.png")` never use `$` variables for these
- Group many IDs → use arrays: `DIM sprites$` / `sprites$("player") = LOADIMAGE(...)` but prefer named constants when count is small
---
## Performance Tips
- `LINE (0,0)-(W,H), 0, BF` to clear much faster than `CLS`
- Always wrap draw code in `SCREENLOCK ON` / `SCREENLOCK OFF`
- Store `RGB()` results in constants/variables don't call RGB in hot loops
- Declare all variables in `[inits]`, not inside loops or subroutines
- Use `FastTrig` for any loop calling trig hundreds of times per frame
- `SLEEP 16` in game loop → ~60 FPS
---
## Known Limitations
Things to be aware of most are deliberate design decisions, a few are practical constraints.
- **Platform: Windows x64 only.** Linux and macOS are not supported. Browser/Android are not feasible the runtime depends on SDL2 via P/Invoke.
- **Arrays cannot be passed to functions.** Use the `ASJSON` / `ASARRAY` round-trip pattern. The function receives an independent copy.
- **`DEF FN` scope is fully isolated.** Functions can read global `#` constants but cannot see any `$` variables from the outer scope. Pass values as parameters.
- **No block scope.** `IF`, `FOR`, and `WHILE` do not create new variable scopes all main-code variables share one namespace.
- **No exception handling.** There is no `TRY`/`CATCH` and no `ON ERROR`. Runtime errors halt the program with a line-numbered message printed to the console.
- **Division by zero returns `0` silently.** No exception, no warning. Guard with `IF b$ = 0 THEN ...` when correctness matters.
- **No integer-division operator.** Use `INT(a / b)`, `FLOOR(a / b)`, or `CINT(a / b)` depending on the rounding behavior you need.
- **Compiled `.bb` libraries are version-locked** to the BazzBasic build that produced them. Recompile after upgrading the interpreter.
- **`DEF FN` definitions must precede their first call** in source order. Forward references don't resolve.
---
## IDE Features (v1.4)
### New File Template
When the IDE opens with no file (or a new file), this template is auto-inserted:
```basic
' BazzBasic version {ver_num}
' https://ekbass.github.io/BazzBasic/
```
### Beginner's Guide
- **IDE:** Menu → **Help** → **Beginner's Guide** opens `https://github.com/EkBass/BazzBasic-Beginners-Guide/releases` in default browser
- **CLI:** `bazzbasic.exe -guide` or `bazzbasic.exe -help` prints URL to terminal
### Check for Updates
- **IDE:** Menu → **Help** → **Check for updated...** IDE reports if a newer version is available
- **CLI:** `bazzbasic.exe -checkupdate`
### Compile via IDE
- **Menu → Run → Compile as Exe** compiles open file to standalone `.exe` (auto-saves first)
- **Menu → Run → Compile as Library (.bb)** compiles open file as reusable `.bb` library (auto-saves first)
EOF