{"id":18006241,"url":"https://github.com/matdombrock/turtlelab","last_synced_at":"2025-04-04T11:35:39.084Z","repository":{"id":259207309,"uuid":"873826682","full_name":"matdombrock/turtlelab","owner":"matdombrock","description":"A lofi audio-visual programming toy that can be scripted in multiple real-world languages.","archived":false,"fork":false,"pushed_at":"2024-10-22T08:41:38.000Z","size":4136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T21:29:44.747Z","etag":null,"topics":["graphics","javascript","lua","scheme","toy","turtle"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matdombrock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-16T19:34:53.000Z","updated_at":"2024-10-22T08:41:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"34d581e4-7405-4af6-989d-faf799eab12a","html_url":"https://github.com/matdombrock/turtlelab","commit_stats":null,"previous_names":["matdombrock/turtlelab"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matdombrock%2Fturtlelab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matdombrock%2Fturtlelab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matdombrock%2Fturtlelab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matdombrock%2Fturtlelab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matdombrock","download_url":"https://codeload.github.com/matdombrock/turtlelab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247173006,"owners_count":20896009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphics","javascript","lua","scheme","toy","turtle"],"created_at":"2024-10-30T01:07:01.582Z","updated_at":"2025-04-04T11:35:39.073Z","avatar_url":"https://github.com/matdombrock.png","language":"C","readme":"\n# TurtleLab\nTurtleLab is a lofi audio-visual programming toy that can be scripted in multiple real-world languages. \n\nSupported Languages:\n- Scheme\n- JavaScript\n- Lua\n\n![ss1](doc/ss1.gif)\n![ss2](doc/ss2.gif)\n\n## Turtle Graphics: A Visual Programming Tool\n\n\"Turtle graphics\" is a programming concept that uses a virtual turtle to create drawings or shapes on a screen. The turtle can be controlled by simple commands like \"forward,\" \"rotate,\" \"right,\" and \"left,\" which move the turtle in specific directions.\n\n### Key Concepts:\n\n- Turtle: A virtual object that can be moved around a coordinate system.\n- Commands: Instructions that control the turtle's movements and actions, such as drawing lines, changing colors, or picking up/putting down the pen.\n- Coordinate System: A grid-like system that defines the turtle's position and orientation.\n- Canvas: The drawing surface where the turtle's movements and creations are displayed.\n\n### Why are Turtle Graphics Cool?\n\n- Visual Learning: Turtle graphics provides a visual representation of programming concepts, making it easier to understand.\n- Interactive Programming: Students can experiment with different commands and see the immediate results, fostering creativity and problem-solving skills.\n- Foundation for Advanced Concepts: Turtle graphics can be used as a foundation for learning more complex programming topics like loops, functions, and object-oriented programming.\n\n# Usage\n## CLI\nThe primary way of interacting with TurtleLab is via the CLI. \n```\nUsage: turtle \u003cfile\u003e [options]\nOptions:\n  -l, --lang \u003cscm|js|lua\u003e  Specify the lang - Overrides auto detection\n  -d, --delay \u003cdelay\u003e      Specify the delay between ticks\n  -s, --skipIntro          Skip the intro\n  -t, --hideTurtle         Hide the cursor\n  -o, --noLoop             Do not loop the program\n  -a, --autoClose          Automatically close the program when done\n  -b, --noDebug            Do not show debug messages\n  -g, --noGrid             Do not show the grid\n  -v, --volume \u003cvolume\u003e    Set the volume\n  -m, --mute               Mute the sound\n  -h, --help               Display this help message\n```\n### Example:\n```sh\n./turtle examples/api.js -d 1000 -s\n```\n\n## Window Hotkeys\nWhile the TurtleLab window is running, the following hotkeys are available:\n- **SPACE**       - Pause the turtle\n- **UP ARROW**    - Speed up the turtle\n- **DOWN ARROW**  - Slow down the turtle\n- **LEFT ARROW**  - Move forward one command\n- **RIGHT ARROW** - Move backwards one command \n- **M KEY**       - Mute the audio\n- **ESCAPE**      - Quit TurtleLab\n\n# Scripting\n## JavaScript ([`examples/api.js`](examples/api.js))\n```js\nfunction main() { \n    bg(22,33,44);\n    color(255,255,255);\n    teleport(128,64);\n    down(64);\n    right(64);\n    up(64);\n    left(64);\n    downRight(64);\n    downLeft(64);\n    upLeft(64);\n    upRight(64);\n    goBack(7);\n    rotateCW(64);\n    rotateCCW(32);\n    rotate(0);\n    forward(32);\n    print(\"Hello, world!\");\n}\n```\n\n## Scheme ([`examples/api.scm`](examples/api.scm))\n```c\n(bg 22 33 44)\n(color 255 255 255)\n(teleport 128 64)\n(down 64)\n(right 64)\n(up 64)\n(left 64)\n(down-right 64)\n(down-left 64)\n(up-left 64)\n(up-right 64)\n(go-back 7)\n(rotate-cw 64)\n(rotate-ccw 32)\n(rotate 0)\n(forward 32)\n(print \"Hello, world!\")\n```\n\n## Lua ([`examples/api.lua`](examples/api.lua))\n```lua\nbg(22, 33, 44)\ncolor(255, 255, 255)\nteleport(128, 64)\ndown(64)\nright(64)\nup(64)\nleft(64)\ndownRight(64)\ndownLeft(64)\nupLeft(64)\nupRight(64)\ngoBack(7)\nrotateCW(64)\nrotateCCW(32)\nrotate(0)\nforward(32)\nprint(\"Hello, world!\")\n```\n\n# Script File Metadata\nScripts can contain metadata in their comments. Some meta data is functional and can change the way the program runs. All metadata is optional. \n\n- **`NAME:`** - Sets script name in window title\n- **`OPT:`** - Set default CLI options for this file\n- **`DESC:`** - A short description of the script.\n- **`AUTH:`** - The name and/or contact info of the author.\n\n### Example:\n```\n// NAME: My Script\n// OPT: -d 100 -s\n// DESC: A test script. Runs with 100ms delay and skips startup.\n// AUTH: Leonardo\n```\n\n# API Details\n### `bg r g b`\nSet the background color. Acceptable color values are between 0 and 255.\n\n### `color r g b a?`\nSet the drawing color. Acceptable color values are between 0 and 255. Alpha is optional. \n\n### `forward n`\nMove the turtle forward `n` pixels in the direction it is facing. Direction is determined by the current rotation value. \n\n### `rotate n`\nRotate the turtle to an absolute rotation value. 256 \"rotation units\" makes up a full rotation.\n\n### `rotate_cw n`\nRotate the turtle clockwise `n` \"rotation units\". 256 \"rotation units\" makes up a full rotation.  \n\n### `rotate_ccw n`\nRotate the turtle counter-clockwise `n` \"rotation units\". 256 \"rotation units\" makes up a full rotation.  \n\n### `up n`\nMove the turtle up on the Y axis `n` pixels.\n\n### `down n`\nMove the turtle down on the Y axis `n` pixels.\n\n### `left n`\nMove the turtle left on the Y axis `n` pixels.\n\n### `right n`\nMove the turtle right on the Y axis `n` pixels.\n\n### `down_right n`\nMove the turtle down and right `n` pixels in each direction. \n\n### `down_left n`\nMove the turtle down and left `n` pixels in each direction. \n\n### `up_right n`\nMove the turtle up and right `n` pixels in each direction. \n\n### `up_left n`\nMove the turtle up and left `n` pixels in each direction. \n\n### `teleport x y`\nMove to the given coordinates.\n\n### `go_back n`\nMove the turtle to where it was `n` commands ago. Does not reset the rotation. \n\n# Tips\n- The canvas for drawing on is 256x256 px.\n- Drawing outside of the canvas is generally allowed.\n- `rotate 0` resets the rotation and snaps the turtle sub-position.\n- Set a color with an alpha value of 0 to move without drawing.  \n- The audio synthesis parameters are fed by the turtle coordinates as well as the drawing color. \n- Each subsequent command requires re-running the whole program. So very long program will slow down as they go.\n- Frame delay is displayed in the window title bar. Higher numbers mean your program is running slower. \n\n---\n---\n\n# Build\nInstall the deps listed below and then run the Makefile or build with the shell scripts.\n## macOS build\nDeps;\n```sh\nbrew install sdl2 --build-from-source\n```\nBuild scripts:\n```sh\n./buildLibs.sh\n./buildMac.sh\n```\n\nMakefile:\n```sh\nmake turtle_mac\n```\n\n## Linux build\nDeps:\n```sh\nsudo apt-get update\nsudo apt-get install build-essential libsdl2-dev libxdamage-dev libxcomposite-dev libglew-dev\n```\n\nIf you run into issues installing packages try:\n```sh\nsudo apt-get remove --purge libegl-mesa0\nsudo apt-get clean\nsudo apt-get autoremove\n```\n\nBuild Scripts:\n```sh\n./buildLibs.sh\n./buildLinux.sh\n```\n\nMakefile:\n```\nmake turtle_linux\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatdombrock%2Fturtlelab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatdombrock%2Fturtlelab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatdombrock%2Fturtlelab/lists"}