{"id":16165362,"url":"https://github.com/gabrielravier/arcade-interface","last_synced_at":"2025-03-18T23:30:39.567Z","repository":{"id":96455684,"uuid":"467923234","full_name":"GabrielRavier/arcade-interface","owner":"GabrielRavier","description":"Sharable interface for our Arcade Epitech project","archived":false,"fork":false,"pushed_at":"2022-04-07T17:41:50.000Z","size":51,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T12:55:59.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GabrielRavier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-03-09T12:45:26.000Z","updated_at":"2022-07-09T20:45:32.000Z","dependencies_parsed_at":"2023-04-30T08:30:36.081Z","dependency_job_id":null,"html_url":"https://github.com/GabrielRavier/arcade-interface","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/GabrielRavier%2Farcade-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielRavier%2Farcade-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielRavier%2Farcade-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabrielRavier%2Farcade-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GabrielRavier","download_url":"https://codeload.github.com/GabrielRavier/arcade-interface/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955668,"owners_count":20374371,"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":[],"created_at":"2024-10-10T02:49:49.185Z","updated_at":"2025-03-18T23:30:39.562Z","avatar_url":"https://github.com/GabrielRavier.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An interface for the Epitech Arcade project\n\nThis interface was designed over the course of a week and a half in order to get the best starting point possible for the arcade project.\n\n## Design\n\nThis library was designed in a way such as to attempt to make it as easy as possible to implement games that work fine in both text and graphics mode.\nThis is why there is such concepts as cells in the library. These are made such that the text mode display libraries can work properly (e.g. in ncurses, one cell is one character on the screen).\n\nPositions calculated in cells or pixels should be easy enough to convert between each other, such as in this example code:\n```cpp\n// This function converts a raw position (i.e. a position as measured in pixels) into a cell position (i.e. a position as measured in cells)\ninline ICore::Vector2u rawPixelPositionToCellPosition(ICore::Vector2u rawPosition, std::uint32_t pixelsPerCell)\n{\n    return {rawPosition.x / pixelsPerCell, rawPosition.y / pixelsPerCell};\n}\n\n// This function converts a cell position to a raw position\ninline ICore::Vector2u cellPositionToRawPixelPosition(ICore::Vector2u cellPosition, std::uint32_t pixelsPerCell)\n{\n    return {cellPosition.x * pixelsPerCell, cellPosition.y * pixelsPerCell};\n}\n\nICore::Vector2u getSquareCenter(ICore::Vector2u squareTopLeftPos, ICore::Vector2u squareSize\n{\n    return {squareTopLeftPos.x + ((squareTopLeftPos.x - squareSize.x) / 2), squareTopLeftPos.y + ((squareTopLeftPos.y - squareSize.y) / 2)};\n}\n```\n\nWe also made the decision of having the game modules only ever be able to interact with the `ICore` interface, such as to prevent any misuse of the `IDisplayModule` interface. The `ICore` interface exposes much of the same interface as `IDisplayModule` (with a few other additions), save for a few functions which cannot be exposed safely (or are redundant). If you want to understand why this decision was made, see such functions as `IDisplayModule::loadTexture`, which was the motivating example for this decision.\n\n## How to implement this interface\n\nThe core application (i.e. the program that loads dynamic libraries and is always present) needs to implement the `ICore` interface.\n\nEach graphics shared library needs have an implementation of the `IDisplayModule` interface, and then implement the `gEpitechArcadeGetDisplayModuleHandle` function, which returns a unique_ptr to such an interface.\n\nEach game shared library needs have an implementation of the `IGameModule` interface, and then implement the `gEpitechArcadeGetGameModuleHandle` function, which returns an `std::unique_ptr` to such an interface.\n\n## Contributing\n\nRandomly talking in PMs on Discord does work in some ways, but using the Github Issues or Pull Requests system would be nice if you have concerns about some part of the interface. This allows these conversations to be public and to see whenever someone does something on the repo by using the GitHub Watch functionality (see the top right of the GitHub page).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielravier%2Farcade-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielravier%2Farcade-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielravier%2Farcade-interface/lists"}