https://github.com/pkarnakov/ptoy
Particle toy with bonds and portals
https://github.com/pkarnakov/ptoy
cpp game opengl particles portal webassembly
Last synced: about 2 months ago
JSON representation
Particle toy with bonds and portals
- Host: GitHub
- URL: https://github.com/pkarnakov/ptoy
- Owner: pkarnakov
- License: mit
- Created: 2017-03-18T22:36:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-06-01T20:12:08.000Z (about 1 year ago)
- Last Synced: 2025-06-02T05:53:30.620Z (about 1 year ago)
- Topics: cpp, game, opengl, particles, portal, webassembly
- Language: C++
- Homepage: http://pkarnakov.com/ptoy/
- Size: 1.28 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ptoy
[Play web version](https://pkarnakov.github.io/ptoy/ptoy.html)
| Native | [Web](https://pkarnakov.github.io/ptoy/ptoy.html) |
|:---:|:---:|
|
|
|
Screenshots from older version
| | | |
|:---:|:---:|:---:|
|
|
|
|
## Clone
```
git clone https://github.com/pkarnakov/ptoy.git
```
## Requirements
* Linux or Mac OS X
* C++14 compiler
* CMake (optional)
* emscripten (optional to build WebAssembly)
* SDL2
* glew
## Build
Build with CMake
```
make
```
Build without CMake, using `pkgconf` to find SDL2 and glew
```
make legacy
```
## Run
```
cd build && ./ptoy
```
## Control
### Keyboard
* `r`: switch mouse to *Repulsion* mode
* `a`: switch mouse to *Attraction* mode
* `p`: switch mouse to *Pick* mode
* `f`: switch mouse to *Freeze* mode
* `o`: switch mouse to *Portal* mode
* `b`: switch mouse to *Bonds* mode
* `n`: switch mouse to *No action* mode
* `g`: toggle gravity
* `i`: remove last pair of portals
* `space`: toggle pause
* `q`: quit after pressing 3 times
### Mouse
Click actions depend on the mode selected by keyboard,
all mouse buttons are equivalent.
Mode|Key|Click action
:---|:---:|---
*Repulsion* (default) |`r`| repulsive force
*Attraction* |`a`| attractive force
*Portal* |`o`| draw portals (blue, then orange)
*Pick* |`p`| pick the closest particle
*Freeze* |`f`| freeze/unfreeze particle
*Bonds* |`b`| draw bonds between particles
*No action* |`n`| nothing