Skip to content

Commit

Permalink
Revert "First commit"
Browse files Browse the repository at this point in the history
This reverts commit 07b84fc.
  • Loading branch information
LeandroSQ committed Feb 20, 2024
1 parent 9e1a4bf commit fa3f5b4
Show file tree
Hide file tree
Showing 61 changed files with 1,351 additions and 1,225 deletions.
Binary file added .github/images/Arrow_Down_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Arrow_Left_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Arrow_Right_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Arrow_Up_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Esc_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Mouse_Left_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Mouse_Middle_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Mouse_Right_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Space_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/Z_Key_Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/screenshots/screenshot01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/screenshots/screenshot02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/screenshots/screenshot03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ jobs:
- name: Copy WASM module (Ubuntu)
if: matrix.target == 'web' && matrix.os == 'ubuntu-latest'
run: |
cp ./build/asteroids.wasm ./src/web
cp ./build/asteroids.js ./src/web
cp ./build/asteroids.html ./src/web
cp ./build/sandbox.wasm ./src/web
cp ./build/sandbox.js ./src/web
cp ./build/sandbox.html ./src/web
- name: Deploy to GitHub Pages (Ubuntu)
if: matrix.target == 'web' && matrix.os == 'ubuntu-latest'
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ lib/*/
imgui.ini
compile_commands.json
.DS_Store
src/web/asteroids.*
src/tests
src/web/sandbox.*
.cache
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.18.0)
set(PROJECT_NAME asteroids)
set(PROJECT_NAME sandbox)

function(dump_info)
message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
Expand Down
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# C++ Simple physics engine

Implements a simple physics engine in C++ based on [Verlet integration](https://en.wikipedia.org/wiki/Verlet_integration) and [Verlet constraints](https://en.wikipedia.org/wiki/Verlet_integration#Verlet_constraints).

<center>
<p float="left" align="center">
<img src=".github/screenshots/screenshot01.png" style="width: 48%"/>
<img src=".github/screenshots/screenshot02.png" style="width: 48%"/>
</p>
</center>

<p align="center">
<a href="https://leandrosq.github.io/cpp-physics-sandbox/">Live demo here</a>
</p>

## About

You can check the WEB version [here](https://leandrosq.github.io/cpp-physics-sandbox/). It is a port using WASM generated by Emscripten using WebGL on the browser.

* Restricted only to circles
* Supports gravity
* Supports collisions
* Implements a Quadtree for collision detection
* Supports constraints
* Implements both a circle and a rectangle world constraint
* Supports user interaction
* Dragging
* Spawning
* Explode

## Controls

### Desktop

> <img src=".github/images/Mouse_Left_Key_Dark.png" align="center" height="32"> `Left click` to spawn circles
> <img src=".github/images/Mouse_Right_Key_Dark.png" align="center" height="32"> `Right click` to drag circles
> <img src=".github/images/Mouse_Middle_Key_Dark.png" align="center" height="32"> `Middle click` to explode circles
> <img src=".github/images/Space_Key_Dark.png" align="center" height="32"> `Space bar` to flip the Gravity vector
> <img src=".github/images/Z_Key_Dark.png" align="center" height="32"> `Z` to toggle Gravity ON/OFF
> <img src=".github/images/Arrow_Up_Key_Dark.png" align="center" height="32"> `Up arrow` to increase the Gravity force
> <img src=".github/images/Arrow_Down_Key_Dark.png" align="center" height="32"> `Down arrow` to decrease the Gravity force
> <img src=".github/images/Arrow_Left_Key_Dark.png" align="center" height="32"> `Left arrow` to decrease the Gravity angle
> <img src=".github/images/Arrow_Right_Key_Dark.png" align="center" height="32"> `Right arrow` to increase the Gravity angle
> <img src=".github/images/Esc_Key_Dark.png" align="center" height="32"> `ESC` to exit
<p float="left" align="center">
<span>Other controls included on the GUI can be used with the mouse as demonstrated below.</span>
<img src=".github/screenshots/screenshot03.png" style="width: 48%"/>
</p>

## Project

### Resources

| Name | Description |
| -- | -- |
| [ClangD](https://clangd.llvm.org/) | Language Server for C++ |
| [CMake](https://cmake.org/) | Cross-platform open-source make system |
| [Clang-tidy](https://clang.llvm.org/extra/clang-tidy/) | A clang-based C++ “linter” tool |
| [Clang-format](https://clang.llvm.org/docs/ClangFormat.html) | A tool to format C/C++/Obj-C code |
| [Emscripten](https://emscripten.org/) | Used for the web port, generating the WASM binaries. |
| [Raylib](https://www.raylib.com/) | A simple and easy-to-use library to enjoy videogames programming |
| [Dear ImGui](https://www.github.com/ocornut/imgui) | Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies |
| [Dear ImGui Raylib](https:://github.com/RobLoach/raylib-imgui) | Dear ImGui bindings for Raylib |
| [NES CSS](https://nostalgic-css.github.io/NES.css/) | NES.css is NES-style (8bit-like) CSS Framework. |
| Github Actions | Used for CI/CD |
| Github Pages | Used for hosting the web version |
3 changes: 1 addition & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ endfunction()

# Dependencies
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(SUPPORT_RPRAND_GENERATOR ON)
include_library(raylib 5.0 https://github.com/raysan5/raylib/archive/refs/tags/VERSION.tar.gz)

set(BUILD_RAYLIB_CPP_EXAMPLES OFF CACHE BOOL "" FORCE)
include_library(raylib_cpp 5.0.1 https://github.com/RobLoach/raylib-cpp/archive/refs/tags/vVERSION.tar.gz)

# include_library(raygui 4.0 https://github.com/raysan5/raygui/archive/refs/tags/VERSION.tar.gz)

include_library(dear_imgui docking https://github.com/ocornut/imgui/archive/refs/heads/VERSION.tar.gz)
include_library(dear_imgui 1.90.1 https://github.com/ocornut/imgui/archive/refs/tags/vVERSION.tar.gz)
include_library(rlimgui main https://github.com/raylib-extras/rlimgui/archive/refs/heads/VERSION.tar.gz)
target_compile_definitions(rlimgui PRIVATE NO_FONT_AWESOME)
target_link_libraries(rlimgui dear_imgui raylib)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake --build ./build -j 10
# Check if the previous command succeeded
if [ $? -eq 0 ]; then
echo "Build succeeded"
./build/asteroids
./build/sandbox
else
echo "Build failed"
fi
2 changes: 1 addition & 1 deletion scripts/copy-web-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

find ./build -depth 1 -name 'asteroids.*' -print -exec cp {} src/web \;
find ./build -depth 1 -name 'sandbox.*' -print -exec cp {} src/web \;
2 changes: 1 addition & 1 deletion scripts/linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake --build ./build -j 10
# Check if the previous command succeeded
if [ $? -eq 0 ]; then
echo "Build succeeded... running linter!"
cmake --build ./build --target asteroids_lint
cmake --build ./build --target sandbox_lint
else
echo "Build failed"
fi
2 changes: 1 addition & 1 deletion scripts/server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

npx nodemon --watch build/asteroids.* --exec "sh scripts/copy-web-artifacts.sh" &
npx nodemon --watch build/sandbox.* --exec "sh scripts/copy-web-artifacts.sh" &
npx live-server --port=3000 --no-browser ./src/web &

wait
2 changes: 1 addition & 1 deletion scripts/web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ else
exit 1
fi

cp ./build/web/asteroids.* ./src/web
cp ./build/web/sandbox.* ./src/web
42 changes: 0 additions & 42 deletions src/core/data/dummy-list.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions src/core/data/dummy-list.hpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/core/data/icontainer.hpp

This file was deleted.

117 changes: 0 additions & 117 deletions src/core/data/spatial-hash-grid.cpp

This file was deleted.

Loading

0 comments on commit fa3f5b4

Please sign in to comment.