Newton gravity simulator
| rules | Fixed version | |
| src | Add switching abillity | |
| compile_executable.bat | Fixed version | |
| gravity_sim.exe | Add switching abillity | |
| Makefile | Fixed version | |
| readme.md | Add switching abillity | |
| screenshot.png | Fixed version | |
Newton gravity simulator
Small game on c + raylib that simulates newton gravity
Building
Linux:
dependencies:
- gcc
- make
- raylib
clone repo:
git clone https://codeberg.org/NeYurii/gravity_simulator.git && cd gravity_simulator
bulding:
make
Windows:
Just install raylib, and run script compile_executable.bat
Usage
Linux:
Run compiled program and give rule file as an argument. Example:
./gravity_sim rules/planet
Windows:
Open rule file with program, or create some extension for rules and register game on them, or drug rule file on executable.
Rule files
Structure:
{
name=[string];
mass=[float];
start_pos=[x],[y]; # Float, 0,0 - center, negative - up or right
start_vec=[x],[y]; # Like start_pos
is_static=[t or f]; # t - cant move, f - can move; default: f
radius=[integer]; # in pixels\
color=[hex]; # 6-digits hex color code\
}
comments or other foreign characters aren`t allowed
parameters separated by ;
examples you can see in rules directory
In-game controls
| Button | Action |
|---|---|
| arrows | move camera |
| RMB + cursor move | move camera |
| r | reset camera |
| wheel | zoom |
| wheel click | reset zoom |
| LMB on planet | focus |
| LMB on void | unfocus |
| TAB | focus next |
| f | toggle focus |
| i | toggle planet parameters displaying |
| t | toggle trajectory display |
| p | toggle bodies display |
| space | pause |
| esc | quit |