{"id":13731003,"url":"https://github.com/anael-seghezzi/CToy","last_synced_at":"2025-05-08T03:32:45.682Z","repository":{"id":46943075,"uuid":"66404853","full_name":"anael-seghezzi/CToy","owner":"anael-seghezzi","description":"Interactive C live coding environment","archived":false,"fork":false,"pushed_at":"2024-06-11T16:54:55.000Z","size":4020,"stargazers_count":1353,"open_issues_count":4,"forks_count":70,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-11-14T21:38:22.452Z","etag":null,"topics":["livecoding","tcc"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anael-seghezzi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2016-08-23T21:30:37.000Z","updated_at":"2024-11-02T14:59:09.000Z","dependencies_parsed_at":"2024-11-14T21:33:07.390Z","dependency_job_id":"07b44191-5083-43ae-a4ab-96a9a741131f","html_url":"https://github.com/anael-seghezzi/CToy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anael-seghezzi%2FCToy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anael-seghezzi%2FCToy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anael-seghezzi%2FCToy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anael-seghezzi%2FCToy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anael-seghezzi","download_url":"https://codeload.github.com/anael-seghezzi/CToy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252994315,"owners_count":21837398,"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":["livecoding","tcc"],"created_at":"2024-08-03T02:01:22.632Z","updated_at":"2025-05-08T03:32:44.717Z","avatar_url":"https://github.com/anael-seghezzi.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"C-Toy\r\n====\r\n\r\nC-Toy is an interactive C(99) coding environment based on [TCC](http://bellard.org/tcc/).\r\n\r\nSmall, simple, no bullshit. Write cross-platform C code and see the result immediately. No installation or compiler required, download (\u003c4mb), unzip, run CToy and play. Ready for Windows, MacOSX and Linux. Ideal for prototyping, learning, teaching...\r\n\r\nFeatures\r\n--------\r\n\r\n* CToy: program update on file save (use any text editor)\r\n* CToy_player: to publish your project (dynamic update disabled)\r\n* API for window managment, inputs, persistent memory...\r\n* Image processing with [MaratisTCL](https://github.com/anael-seghezzi/Maratis-Tiny-C-library)\r\n* OpenGLES-2\r\n* OpenAL\r\n* Portable pen-tablet support (Wacom, etc)\r\n* Use C-symbols from native dynamic libraries (*.dll etc) : just copy libraries in your_ctoy_path/lib/\r\n* Pre-built Dear-Imgui suport (https://github.com/ocornut/imgui)\r\n* Can also compile your project with other compilers (CMake script for gcc, vs, mingw)\r\n* Emscripten compatible\r\n\r\nDownload\r\n--------\r\n\r\n[- CToy 1.06 Win64](http://anael.maratis3d.com/ctoy/bin/CToy-1.06-WIN-x86_64.zip)\u003cbr\u003e\r\n[- CToy 1.05 MacOSX](http://anael.maratis3d.com/ctoy/bin/CToy-1.05-OSX_10.6-x86_64.zip)\u003cbr\u003e\r\n[- CToy 1.05 Linux64](http://anael.maratis3d.com/ctoy/bin/CToy-1.05-Linux64-x86_64.zip)\u003cbr\u003e\r\n[- [all versions]](http://anael.maratis3d.com/ctoy/bin/)\r\n\r\nRequirement For Linux: OpenAL\r\n\r\nGetting started\r\n---------------\r\n\r\n- Launch CToy\r\n- Open src/main.c using your favorite text editor\r\n- Start coding (samples included)\r\n- Save your file(s) and see the result in realtime\r\n\r\n\u003cp\u003e\u003cimg src=\"http://anael.maratis3d.com/ctoy/doc/preview.gif\" width=\"75%\" height=\"75%\"/\u003e\u003c/p\u003e\r\n\r\nUsage\r\n-----\r\n\r\nC-Toy expects a main file in src/main.c.\u003cbr\u003e\r\nBut instead of the standad C \"main\" function, the entry points are \"ctoy_begin\", \"ctoy_main_loop\" and \"ctoy_end\".\r\n\r\nThe compulsory \"Hello, World!\" program is then (in src/main.c):\u003cbr\u003e\r\n```c\r\n#include \u003cctoy.h\u003e // ctoy API (including frequently used ANSI C libs)\r\n\r\nvoid ctoy_begin() // called at the beginning of the program\r\n{\r\n   printf(\"Hello, World!\\n\");\r\n}\r\n\r\nvoid ctoy_main_loop() // called at every update of the main loop\r\n{}\r\n\r\nvoid ctoy_end() // called at the end of the program\r\n{}\r\n```\r\nEvery time you modify src/main.c or any other file connected to it (directly or recursively included), C-Toy will recompile and restart the program dynamically.\r\n\r\nOne other difference with standard C is the use of persistent memory to maintain a bloc of memory intact between recompiles.\r\nFor example:\r\n\r\n```c\r\n#include \u003cctoy.h\u003e\r\n\r\nvoid *persistent_memory = NULL;\r\n\r\nvoid ctoy_begin()\r\n{\r\n   if (ctoy_t() == 0) {\r\n      persistent_memory = calloc(256, 1); // allocate 256 bytes with zero value\r\n      ctoy_register_memory(persistent_memory); // register persistent memory\r\n   }\r\n   else {\r\n      persistent_memory = ctoy_retrieve_memory(); // retrieve persistent memory\r\n   }\r\n}\r\n\r\nvoid ctoy_main_loop()\r\n{\r\n   int *persistent_counter = (int *)persistent_memory; // access a piece of persistent memory\r\n   (*persistent_counter)++; // do something with the data\r\n   printf(\"persistent_counter = %d\\n\", (*persistent_counter)); // print the content\r\n}\r\n\r\nvoid ctoy_end()\r\n{}\r\n```\r\n(You can store any data that was manually allocated with malloc, it can be an array or a global pointer. Just avoid storing function pointers, as functions addresses may change after recompiles, or update them after calling ctoy_retrieve_memory)\r\n\r\nDocumentation\r\n-------------\r\n\r\nC-Toy API: https://github.com/anael-seghezzi/CToy/blob/master/ressources/include/ctoy.h\u003cbr\u003e\r\nMaratisTCL: https://github.com/anael-seghezzi/Maratis-Tiny-C-library\u003cbr\u003e\r\nOpenGLES2: https://www.khronos.org/registry/OpenGL-Refpages/es2.0/\u003cbr\u003e\r\nOpenAL: https://www.openal.org/documentation/OpenAL_Programmers_Guide.pdf\u003cbr\u003e\r\n\r\nTutorials and examples\r\n----------------------\r\n\r\nWiki: https://github.com/anael-seghezzi/CToy/wiki\r\n\r\nLicense\r\n-------\r\n\r\nCToy is licensed under the zlib/libpng License.\r\n\r\nBuilding CToy from sources (CMake)\r\n----------------------------------\r\n\r\n**Unix:**\r\n\r\n    mkdir Build\r\n    cd Build\r\n    cmake -G \"Unix Makefiles\" ../ -DCMAKE_INSTALL_PREFIX=../bin -DCMAKE_BUILD_TYPE=Release\r\n    make\r\n    make install\r\n\r\n**Windows:**\r\n\r\n    mkdir Build\r\n    cd Build\r\n    cmake -G \"Visual Studio 11 Win64\" ../ -DCMAKE_INSTALL_PREFIX=../bin\r\n\r\n\r\n(libtcc.dll and libtcc.dylib where pre-built from a fork of tcc:\r\n[libtcc-fork](https://github.com/anael-seghezzi/tcc-0.9.26))\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanael-seghezzi%2FCToy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanael-seghezzi%2FCToy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanael-seghezzi%2FCToy/lists"}