Code Monkey home page Code Monkey logo

spaceprogram's Introduction

Space Program

Just simulating the universe

preview

Installation

Only Linux (Ubuntu) is supported at this time.

  • Installing the graphical library SDL2, and some FreeType fonts:
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libfreetype6-dev fonts-dejavu

Compilation

Compiling is done by running make.

Runtime

Try the program by running the command below, with an optional integer argument between 0 and 2:

./spaceprogram.exe

Known issues

SDL2 v2.0.10 causes a drawing bug: rendering something changes the color of a specific pixel of the last drawn object. This bug however is not present in versions 2.0.8 and 2.0.14. Should it arise, uninstall the libsdl2-dev package, then install this one and this one. Finally, libsdl2-image-dev and libsdl2-ttf-dev may need to be updated after that.

Using Docker

Both the compiling and the runtime GUI can be containerized using Docker. If using that, make sure to rebuild the image with each code change. Additionally, Docker Compose is also supported.

Limitations:

  • For now, this only works on Linux.
  • This is not space efficient: the resulting image weights 580 MB (busybox:1.33.1-glibc couldn't be used due to libraries (SDL2) needing to be linked, and static executable failed to build).

With vanilla Docker

Buiding the image:

sudo docker build -t gui-app:1.0 .

Running the containerized GUI (not as root), with runtime arg 2:

sudo docker run \
	--net=host \
	--env=DISPLAY \
	--volume=$HOME/.Xauthority:/root/.Xauthority:rw \
	gui-app:1.0 \
	./spaceprogram.exe 2

With Docker Compose

Buiding the image:

sudo docker-compose build

Running the containerized GUI (not as root):

sudo COMMAND="./spaceprogram.exe 2" HOME=$HOME docker-compose up

Note: $HOME content should be the user home directory, not /root/. Giving said path was necessary on Ubuntu 20.04, but not needed on CentOS 7.

spaceprogram's People

Contributors

carath avatar

Watchers

 avatar

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.