{"id":19225997,"url":"https://github.com/developer239/cpp-starter","last_synced_at":"2025-02-23T10:19:06.276Z","repository":{"id":206715144,"uuid":"717398499","full_name":"developer239/cpp-starter","owner":"developer239","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-21T19:16:49.000Z","size":1398,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-04T21:40:42.498Z","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/developer239.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}},"created_at":"2023-11-11T11:23:06.000Z","updated_at":"2023-11-11T18:14:29.000Z","dependencies_parsed_at":"2023-11-11T20:23:47.596Z","dependency_job_id":"bf0a649a-e059-46e2-bf19-07f82ebcce6d","html_url":"https://github.com/developer239/cpp-starter","commit_stats":null,"previous_names":["developer239/cpp-starter"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Fcpp-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Fcpp-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Fcpp-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer239%2Fcpp-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer239","download_url":"https://codeload.github.com/developer239/cpp-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240298966,"owners_count":19779373,"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-11-09T15:17:01.917Z","updated_at":"2025-02-23T10:19:06.238Z","avatar_url":"https://github.com/developer239.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPP Starter\n\n![master](https://github.com/developer239/cpp-starter/actions/workflows/ci.yml/badge.svg)\n\n## Overview\n\nThe cpp-starter project is designed as a starting point for creating C++ applications.\n\nIt leverages SDL2 for graphical rendering and input handling and provides a modular architecture for\nscalable development.\n\n## Running the Project on Mac\n\n1) Install dependencies:\n\n```bash\n$ brew install cmake ninja sdl2 sdl2_ttf sdl2_image sdl2_mixer\n```\n\n2) Build:\n\n```bash\n$ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=$(brew --prefix)/bin/ninja -G Ninja -S . -B build\n$ cd build\n$ ninja\n$ ctest\n```\n\n3) Run:\n\n```bash\n$  cd build/src/apps/pong\n$ ./AppPong \n```\n\n## Project Structure\n\nThe project is structured into various directories, each serving a specific purpose:\n\n- `src`: The main source directory.\n    - `apps`: Contains individual applications. Example: `pong`.\n    - `packages`: Contains shared libraries or modules. Examples: `core`, `ecs`, `events`.\n\n### App Structure\n\n- Each app, like `pong`, contains its source code, assets, and CMake configurations.\n- Structure inside an app:\n    - `src`: Source files for the application.\n    - `assets`: Game assets like fonts and images.\n\n### Package Structure\n\n- Shared functionalities are grouped into packages under `packages`.\n- Examples include `core` for core functionalities, `ecs` for entity-component systems.\n\n## Creating New Apps and Packages\n\n### Apps\n\n1. To create a new app, add a directory under `src/apps`.\n2. Include a `CMakeLists.txt` in your app directory for build configurations.\n3. Organize your app's source code, assets, and tests within this directory.\n4. Include new app in the src `CMakeLists.txt`.\n\nExample:\n\n```cmake\nset(APP_NAME AppPong)\nset(APP_FOLDER_NAME pong)\n\nset(SOURCES\n        src/main.cpp\n        src/entities/GameObject.h\n        src/strategies/MinimalLoopStrategy.h\n        )\n\nadd_executable(${APP_NAME} ${SOURCES})\n\n# Copy assets\nfile(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/src/apps/${APP_FOLDER_NAME})\n\ntarget_link_libraries(${APP_NAME} Core)\n```\n\n### Packages\n\n1. Create a new package under `packages` for shared functionalities.\n2. Each package should have its own `CMakeLists.txt`.\n3. Include the package in src `CMakeLists.txt`.\n\n## Writing Tests\n\n- Tests are written using GoogleTest and GoogleMock.\n- Each app or package should contain its test files, e.g., `GameObject.test.cpp`.\n- Use `add_test` in `CMakeLists.txt` to include tests in the build process.\n\nIf you want to include tests for your app, add the following to your `CMakeLists.txt`:\n\n```cmake\nset(APP_NAME_TEST ${LIB_NAME}Test)\n\nadd_test(AllTests${LIB_NAME} ${APP_NAME_TEST})\n\nset(SOURCES_TEST\n        src/entities/GameObject.h\n        src/strategies/MinimalLoopStrategy.h\n        src/entities/GameObject.test.cpp\n        src/strategies/MinimalLoopStrategy.test.cpp)\n\nadd_executable(${APP_NAME_TEST} ${SOURCES_TEST})\n\ntarget_link_libraries(${APP_NAME_TEST} PRIVATE\n        gtest\n        gmock\n        gmock_main\n        Core\n        SDL2::SDL2\n        )\n```\n\n![test-preview](./e2e-test-preview.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper239%2Fcpp-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper239%2Fcpp-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper239%2Fcpp-starter/lists"}