{"id":13732263,"url":"https://github.com/ggabriel96/lasso","last_synced_at":"2025-04-22T19:14:33.234Z","repository":{"id":46903448,"uuid":"166915877","full_name":"ggabriel96/lasso","owner":"ggabriel96","description":"A generic game loop implementation in C++","archived":false,"fork":false,"pushed_at":"2023-11-12T22:11:58.000Z","size":240,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T19:14:27.513Z","etag":null,"topics":["cpp","game-development","game-loop"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ggabriel96.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-01-22T02:48:47.000Z","updated_at":"2025-02-18T05:42:48.000Z","dependencies_parsed_at":"2022-09-12T07:24:36.521Z","dependency_job_id":"c75c4c13-f43f-4e8d-b8fe-8657d700da49","html_url":"https://github.com/ggabriel96/lasso","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/ggabriel96%2Flasso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggabriel96%2Flasso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggabriel96%2Flasso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggabriel96%2Flasso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ggabriel96","download_url":"https://codeload.github.com/ggabriel96/lasso/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306629,"owners_count":21408926,"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":["cpp","game-development","game-loop"],"created_at":"2024-08-03T02:01:50.928Z","updated_at":"2025-04-22T19:14:33.211Z","avatar_url":"https://github.com/ggabriel96.png","language":"C++","funding_links":[],"categories":["GameProgramming"],"sub_categories":[],"readme":"# lasso\n\nA generic game loop implementation in C++ based on\n[Fix Your Timestep!](https://gafferongames.com/post/fix_your_timestep/)\n\nlasso is at early stages of design and development and is subject to\nincompatible changes. All feedback is welcome and appreciated!\nDetailed documentation is being built on the\n[wiki](https://github.com/ggabriel96/lasso/wiki).\n\n# Getting started\n\nThis project supports the [Meson](https://mesonbuild.com/) build system,\nso you may want to install it (although it is not required). A legacy\n[`CMakeLists.txt`](CMakeLists.txt) still exists, but is not\n*actively* maintained.\nA compiler with\n[Concepts TS](https://en.cppreference.com/w/cpp/experimental/constraints)\nsupport (e.g. GCC 6 or above with options `-std=c++2a` and `-fconcepts`)\nis required to use lasso. Then, having Meson installed,\nrun the following commands at the root of this project:\n\n```sh\nmeson build\ncd build \u0026\u0026 meson install\n```\n\nAlternatively, you may just put [`lasso.h`](include/lasso.h) somewhere in\nthe source tree of your project.\n\n## Using lasso\n\nThe `meson install` command above will put (install) it at `/{prefix}/lasso/`\n(relative to the default Meson\n[paths](https://mesonbuild.com/Builtin-options.html)).\nOn Linux, that is `/usr/local/include/lasso/`.\nThen you just need to have `/usr/local/include/` in your header search path\nand you are ready to `#include \u003classo/lasso.h\u003e`.\nConversely, if you have somehow put [`lasso.h`](include/lasso.h) in your\nsource tree, you need to `#include \"lasso.h\"`.\n\nlasso knows how to call into your game via the C++ concept below:\n\n```cpp\ntemplate\u003ctypename T\u003e concept bool GameLogic =\nrequires (T logic,\n          LoopStatus const \u0026status,\n          duration const \u0026delta) {\n    { logic.init() } -\u003e void;\n    { logic.simulate(status, delta) } -\u003e void;\n    { logic.render(status, delta) } -\u003e void;\n    { logic.is_done() } -\u003e bool;\n    { logic.terminate() } -\u003e void;\n};\n```\n\nThat means you need a `class` or `struct` that implements the\nfollowing member functions:\n\n- `void init();`, which is called once right before the loop starts and you\n  can use it to initialize anything you need (beyond the constructor of your\n  class);\n- `void simulate(LoopStatus const \u0026, duration const \u0026);`,\n  which is called if `delta` or more nanoseconds have passed since the last\n  call to advance your simulation (input, physics, AI, etc.);\n- `void render(LoopStatus const \u0026, duration const \u0026);`,\n  which is called once in every iteration to render what has been simulated;\n- `bool is_done();`, which is called once in every iteration to\n  determine whether the loop should terminate;\n- `void terminate();`, which is called once right after the loop ends and you\n  can use it to clean up anything you need (additionally to what will be\n  done in the destructor of your class).\n\nAdditional member functions may be added to GameLogic\nand its existing ones might be modified in the future.\nThere are no constraints on other member functions or\nvariables that the class may have.\nExamples of classes implementing this concept can be seen in the\n[examples folder](examples/), especially the [`Game.h`](examples/Game.h).\nand [`Game.cpp`](examples/Game.cpp) blueprints.\n\nAfter having implemented your class (let us call it `T`),\nrunning it is as simple as:\n\n```cpp\nT t;\n// ...\nlasso::MainLoop{}.run(t); // or pass in T{} directly\n```\n\n## Building the examples\n\nThe [Simple and Fast Multimedia Library (SFML)](https://github.com/SFML/SFML)\nmust be installed to compile and run an [example](examples/).\nIf you want to enable the compilation of the examples, you may run:\n\n```sh\nmeson build -Dexamples=true\ncd build \u0026\u0026 ninja\n```\n\nor, after having initially run Meson and while at the `build/` directory:\n\n```sh\nmeson configure -Dexamples=true\nninja\n```\n\nIn order for an example to locate [`Roboto-Regular.ttf`](examples/data/fonts/)\nand hence render text, you must run the compiled executable from either the\nbuild or the [`examples/`](examples/) directory (or set any of them as the\nworking directory in your IDE; preferably the build one).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggabriel96%2Flasso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fggabriel96%2Flasso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggabriel96%2Flasso/lists"}