Skip to content

Repository files navigation

Compy

A console-based Lua-programmable computer for children based on the 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 (IDE mode)

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

CommandCombination
Clear terminalCtrl+L
Stop projectCtrl+Shift+S
Quit project (stop and close)Ctrl+Q
Reset application to initial stateCtrl+Shift+R
Reset project to initial stateCtrl+Alt+R
Exit applicationCtrl+Esc
Pause projectCtrl+Pause
Toggle edit/runF8
Input
Move cursor horizontally/
Move cursor vertically/
Go back in command historyPageUp
Go forward in command historyPageDown
Move in history (if in first/last line)/
Jump to startHome
Jump to endEnd
Jump to line startAlt+Home
Jump to line endAlt+End
Insert newlineShift+Enter ⏎
Delete current lineCtrl+Y
Duplicate current lineCtrl+D
Evaluate inputEnter ⏎
Editor
same as Input, except for:
Scroll upPageUp
Scroll downPageDown
Move selection (if in first/last line)/
Move selectionCtrl+/
Replace selection with inputEnter ⏎
additionally
Insert input contents before selectionCtrl+Enter ⏎
Insert empty block before current (if input is empty)Shift+Enter ⏎
Delete selected blockCtrl+Delete
Delete selected block (if input is empty)Ctrl+Y
Wipe inputCtrl+W
Load selected content to input (discards previous content)Esc
Insert selected content into inputShift+Esc
Scroll to startCtrl+PageUp
Scroll to endCtrl+PageDown
Scroll up by one lineShift+PageUp
Scroll down by one lineShift+PageDown
Move selection to startCtrl+Home
Move selecion to endCtrl+End
Close editor bufferCtrl+S
Stop editor (close all buffers)Ctrl+Shift+S
move mode
Switch to moving ("pick up" selection)Ctrl+M
Move selection/
Move selection to startCtrl+Home
Move selecion to endCtrl+End
Cancel movingEsc
Move line/block to selection and return to normal modeEnter ⏎
search mode
Search definitionsCtrl+F
Exit searchEsc
Jump to selected definitionEnter ⏎
Edit required file under highlightCtrl+O

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-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

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 return it's contents as a single string.

  • readlines(file)

    Open file and return a string table of it's lines.

  • writefile(file, content)

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

Editor

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

edit

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

hello

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

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

quit

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.

move1move2

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

Usage (playback mode)

love compy.love play <project>

  • <project> is either
    • a .compy package (a zipped project)
    • a folder containing a valid project

Paths will be searched in the following order:

  • for zips:
    • current directory (or absolute path)
    • compy storage directory
  • for folders
    • current directory (or absolute path)
    • compy storage directory
    • projects directory

Keys

CommandCombination
Reset project to initial stateCtrl+Alt+R

About

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

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages