Skip to content

Instantly share code, notes, and snippets.

@sidvishnoi
Last active April 5, 2017 08:20
Show Gist options
  • Save sidvishnoi/726105762244586ec3be4c1882461703 to your computer and use it in GitHub Desktop.
Save sidvishnoi/726105762244586ec3be4c1882461703 to your computer and use it in GitHub Desktop.
Sets up graphics.h for Ubuntu, based on libxbgi
# see the libxbgi project here: http://libxbgi.sourceforge.net/
# #include <graphics.h> in your code
# usage (to compile):
# for gcc, use: ggcc filename.c
# for g++, use: ggpp filename.cpp
# if you want to use delay(int milliseconds) command with g++, create a macro in your source code:
# #define delay(t) sleep(t/1000)
# install dependencies
sudo apt-get install libx11-dev -y
sudo apt-get install make -y
sudo apt-get install build-essential -y
# download and install libxbgi
wget https://dl.dropbox.com/s/bss9o6ss077yhf1/xbgi-364.tar.gz
tar -zxvf xbgi-364.tar.gz
cd xbgi-364/src
make
sudo make install
# create ggcc and gg++ alias functions
sudo echo '' >> ~/.bashrc
sudo echo 'ggcc() {gcc -std=c99 $1 /usr/lib/libXbgi.a -lX11 -lm}' >> ~/.bashrc
sudo echo 'ggpp() {g++ $1 /usr/lib/libXbgi.a -lX11 -lm}' >> ~/.bashrc
echo "Success."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment