Skip to content
Gravity simulator in SDL
C Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This program is designed to simulate planets/particles in two dimensional space. It's written in C using OpenGL and SDL.

The goal of this project was to recreate my original Gravity Simulator in C. With C being much closer to the hardware, better performance will be achieved.


Make sure you have sdl2, make, and gcc installed on your computer.


git clone
cd gravity-simulator

The program will begin compiling. Once compilation has finished, the binary will be in the build/ folder. In order to run the program, type ./build/main. Assuming you're on a Unix machine. It's only been tested on Arch Linux. Modification of the SDL and OpenGL header paths may be required to execute on other systems.

The program currently doesn't have much functionality. To change the initial locations of the planets, you'll have to edit src/main.c and recompile.


Jordan Lord


MIT License

Copyright (c) 2016 Jordan Lord

You can’t perform that action at this time.