Coder Social home page Coder Social logo

doohl / cosmic-explorer Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 1.0 1.34 MB

A simple 2D solar system explorer written in C++, powered by SDL and ImGui

License: GNU General Public License v3.0

C++ 80.41% C 0.23% CMake 15.88% HTML 3.48%
cpp orbital-simulation imgui game webassembly emscripten

cosmic-explorer's Introduction

Cosmic Explorer

Build Status

Cosmic Explorer is a simple 2D Solar System renderer and explorer written in C++. It is powered by the ImGUI interface library.

The project now has a WebAssembly build target! Feel free to check out the program without compiling it here.

UI example

Building the Code

This project uses CMake for build file generation. Building is currently only tested against Linux and Windows.

Linux

You need to install the SDL2 and cmake packages using your distro's package manager. For example, on Ubuntu and Debian:

$ apt install libsdl2-dev cmake

Use cmake to generate a makefile and compile. Example:

$ mkdir build && cd build
$ cmake ..
$ make

OR:

$ cmake --build .

Windows

Visual Studio 2019

You must have SDL2 installed in Visual Studio's default lib, include, bin directories (or anywhere that the cmake/FindSDL2.cmake script is able to find it in). You may simply open the repository with Visual Studio 2019 and run automated cmake generation, then set the root CMakeLists.txt as build target.

Optionally, you may use the "Developer Command Prompt for VS 2019" shortcut to generate and compile in the command-line:

mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..

Building:

ninja

The pre-packaged VS Code settings demonstrate a working commandline configure-and-build setup.

MSYS / MinGW32

Instructions similar to Linux, with the exception that you will want to override the cmake default build system:

$ mkdir build && cd build
$ cmake -G "MSYS Makefiles" ..

You will need to install SDL2 64-bit. Example on MSYS:

$ pacman -S mingw-w64-x86_64-SDL2
$ mingw32-make

Emscripten (WASM)

This project supports a WASM compile target. You must have the Emscripten suite installed and configured to build to WASM.

emconfigure cmake ..
emmake make
emmake make install

Unit Testing

Unit tests use doctest. To run, you may do:

$ cd bin
$ ./tests/vec2
$ ./tests/entity
...

OR, through CTests:

$ make test ARGS=-j4
$ ctest . j4

cosmic-explorer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ford442

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.