An open API service indexing awesome lists of open source software.

https://github.com/nagydani/loveputer

A console-based Lua-programmable computer for children based on löve2d framework.
https://github.com/nagydani/loveputer

android cli education lua

Last synced: about 1 year ago
JSON representation

A console-based Lua-programmable computer for children based on löve2d framework.

Awesome Lists containing this project

README

          

# Compy

A console-based Lua-programmable computer for children based on
[LÖVE2D][löve2d] framework.

## Principles

- Command-line based UI
- Full control over each pixel of the display
- Ability to easily reset to initial state
- Impossible to damage with non-violent interaction
- Syntactic mistakes caught early, not accepted on input
- Possibility to test/try parts of program separately
- Share software in source package form
- Minimize frustration

# Usage

Rather than the default LÖVE storage locations (save directory,
cache, etc), the application uses a folder under _Documents_ to
store projects. Ideally, this is located on removable storage to
enable sharing programs the user writes.

For simplicity and security reasons, the user is only allowed to
access files inside a project. To interact with the filesystem,
a project must be selected first.

## Keys

| Command | Keymap |
| :---------------------------------------------------------------- | :-------------------------------------------- |
| Clear terminal | Ctrl+L |
| Stop project | Ctrl+Shift+S |
| Quit project (stop and close) | Ctrl+Shift+Q |
| Reset application to initial state | Ctrl+Shift+R |
| Exit application | Ctrl+Esc |
| Pause project | Ctrl+Pause |
| Toggle edit/run | F8 |
| **Input** | |
| Move cursor horizontally | / |
| Move cursor vertically | / |
| Go back in command history | PageUp |
| Go forward in command history | PageDown |
| Move in history (if in first/last line) | / |
| Jump to start | Home |
| Jump to end | End |
| Jump to line start | Alt+Home |
| Jump to line end | Alt+End |
| Insert newline | Shift+Enter ⏎ |
| Delete current line | Ctrl+Y |
| Duplicate current line | Ctrl+D |
| Evaluate input | Enter ⏎ |
| **Editor** | |
|        _same as Input, except for:_ | |
| Scroll up | PageUp |
| Scroll down | PageDown |
| Move selection (if in first/last line) | / |
| Move selection | Ctrl+/ |
| Replace selection with input | Enter ⏎ |
|        _additionally_ | |
| Delete selected block | Ctrl+Delete |
| Delete selected block (if input is empty) | Ctrl+Y |
| Wipe input | Ctrl+W |
| Load selected content to input (discards previous content) | Esc |
| Insert selected content into input | Shift+Esc |
| Scroll to start | Ctrl+PageUp |
| Scroll to end | Ctrl+PageDown |
| Scroll up by one line | Shift+PageUp |
| Scroll down by one line | Shift+PageDown |
| Move selection to start | Ctrl+Home |
| Move selecion to end | Ctrl+End |
| Stop editor | Ctrl+Shift+S |
|        _move mode_ | |
| Switch to moving ("pick up" selection) | Ctrl+M |
| Move selection | / |
| Move selection to start | Ctrl+Home |
| Move selecion to end | Ctrl+End |
| Cancel moving | Esc |
| Move line/block to selection and return to normal mode | Enter ⏎ |
|        _search mode_ | |
| Search definitions | Ctrl+F |
| Exit search | Esc |
| Jump to selected definition | Enter ⏎ |

### Projects

A _project_ is a folder in the application's storage which
contains at least a `main.lua` file. Projects can be loaded and
ran. At any time, pressing Ctrl-Shift-Q quits and
returns to the console

- `list_projects()`

List available projects.

- `project(proj)`

Open project _proj_ or create a new one if it doesn't exist.
New projects are supplied with example code to demonstrate the
structure.

- `current_project()`

Print the currently open project's name (if any).

- `run_project(proj?)` / `run(proj?)`

Run either _proj_ or the currently open project if no
arguments are passed.

- `example_projects()`

Copy the included example projects to the projects folder.

- `close_project()`

Close currently opened project.

- `edit(file)`

Open file in editor. If it does not exist yet, a new file will
be created. See [Editor mode](#editor)

### Files

Once a project is open, file operations are available on it's
contents.

- `list_contents()`

List files in the project.

- `readfile(file)`

Open _file_ and display it's contents.

- `writefile(file, content)`

Write to _file_ the text supplied as the _content_ parameter.
This can be either a string, or an array of strings.

- `runfile(file)`

Run _file_ if it's a lua script.

### Editor

If a project is open, the files inside can be edited or new ones
created. Run the `edit()` command to do so.

![edit](./doc/interface/open_edit.apng)

When a file is opened, the editor is scrolled to the end by
default, and entered input will be appended to the end.

![hello](./doc/interface/hello.apng)

To modify an existing line, navigate there with
/. Then load the text by pressing
Esc, make the desired changes, then send it back with
Enter ⏎

![capitalized](./doc/interface/hello_cap.apng)

Happy with the modifications now, we can quit by pressing
Ctrl-Shift-Q

![quit](./doc/interface/quit_editor.apng)

#### Moving

Select the block you want to move and press Ctrl-M.
Move the highlight with / and hit
Enter ⏎ when you found it's new home.

![move1](./doc/interface/move_line.apng)
![move2](./doc/interface/move_block.apng)

#### Searching

Definitions can be searched with Ctrl-F. Pressing
this combination switches to search mode, in which the
definitions are listed, and there's a highlight, which can be
moved as usual. Hitting Enter ⏎ returns to editing,
highlighting the selected definition. To exit search mode
without moving, press Esc.

![search](./doc/interface/search.apng)

[löve2d]: https://love2d.org