{"id":21662842,"url":"https://github.com/ktravis/testris","last_synced_at":"2025-03-20T05:48:59.764Z","repository":{"id":147328438,"uuid":"230471770","full_name":"ktravis/testris","owner":"ktravis","description":"tetris test","archived":false,"fork":false,"pushed_at":"2020-10-17T14:11:46.000Z","size":27703,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T07:27:32.808Z","etag":null,"topics":["gamedev","sdl2","tetris"],"latest_commit_sha":null,"homepage":"https://ktravis.github.io/testris","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ktravis.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":"2019-12-27T15:57:03.000Z","updated_at":"2020-10-17T14:37:31.000Z","dependencies_parsed_at":"2023-07-02T18:46:41.488Z","dependency_job_id":null,"html_url":"https://github.com/ktravis/testris","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/ktravis%2Ftestris","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktravis%2Ftestris/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktravis%2Ftestris/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktravis%2Ftestris/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ktravis","download_url":"https://codeload.github.com/ktravis/testris/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244560373,"owners_count":20472219,"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":["gamedev","sdl2","tetris"],"created_at":"2024-11-25T10:18:20.251Z","updated_at":"2025-03-20T05:48:59.759Z","avatar_url":"https://github.com/ktravis.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# testris\n\n**Play in your browser, [here!](https://ktravis.github.io/testris)**\n\n![title](assets/title-crop.gif)\n\nI made a custom engine on SDL2 for mostly 2d rendering (though 3d is supported, it just doesn't have much work put into it yet). This is a test of a few different systems:\n\n- scenes\n- menus\n- text rendering\n- general mesh rendering\n- shader pipeline\n- very simple serde\n- sound effects\n- sprite sheets/simple animation (working, not currently in use)\n\nFeatures:\n\n- rewind!\n- replay files\n- dynamic window scaling (native)\n\nTODO:\n- set replay filename (native)\n- replay file safety checks\n- replay format compression\n\nKnown issues:\n- some rotational issues with tight spaces\n- web scale canvas with window size\n- web sound effects\n\n## uses\n\n- [stb_image](https://github.com/nothings/stb)\n- [stb_truetype](https://github.com/nothings/stb)\n- shader based on https://www.shadertoy.com/view/Ms3XWH\n- DejaVuSansMono and Ubuntu fonts\n- SDL2 / SDL_mixer\n\n## requirements (native)\n\nC++ (11) compiler, and:\n\n### arch\n\n```shell\npacman -Sy glew mesa sdl2\n```\n\n### debian\n\n```shell\napt install libsdl2-dev libglew-dev\n```\n\n### fedora\n\n```shell\ndnf install glew-devel SDL2-devel\n```\n\n## build\n\n```shell\nmake\nbuild/main\n# or\nmake run\n```\n\n## build for web\n\ndepends on [emscripten/emsdk](https://github.com/emscripten/emsdk)\n\n```shell\nmake wasm\n# output in build/js/\n```\n\n## faq\n\n- Why do this?\n  \n  Implementing an existing game is a great way to isolate the technical/mechanical details. The core creative side - game rules, etc., is already handled. Tetris has simple mechanics, but hides a lot of depth and nuance.\n\n- Why does your C++ look like this?\n\n  I really like C, and I'm not very experienced with C++. Mainly I end up writing C with some slight syntax adjustments, default parameters, and function overloading.\n  \n- Why are you including `.cpp` files directly / using one big header file?\n\n  I'm aware that this isn't the traditional structure of a C++ program. I chose to avoid creating many individual compilation units because a) it's less complex, and b) it compiles from scratch significantly faster - the best-case performance is probably slightly worse, but any potential build caching issues are off the table.\n  \n- Why write engine code when you could be using ____ ?\n\n  I like making the tools that make the product. Being realistic with expectations, this functions as a great learning exercise!\n\n- Why can you rewind?! You can't rewind in tetris...\n\n  Why not! I wanted a simple replay system and as a side effect, game states can be played in reverse.\n  \n- What is that sound that plays when you rewind?\n\n  That's the sound of your [going-back-in-time potion](https://www.youtube.com/watch?v=xSXofLK5hFQ)\n  \n- ... can I turn it off?\n\n  If you must.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktravis%2Ftestris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fktravis%2Ftestris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktravis%2Ftestris/lists"}