#!/bin/bash
install_packages g++ cmake make ninja-build libsdl2-dev libogg-dev libvorbis-dev libopenal-dev libalut-dev libfreetype6-dev libglu1-mesa-dev || exit 1

#download
rm -rf master.zip astromenace-master/
wget https://github.com/viewizard/astromenace/archive/refs/heads/master.zip || error 'Failed to download zip!'
unzip master.zip || error 'Failed to unzip'
rm -f master.zip

#build
cd astromenace-master/
cmake . || error 'Failed to run cmake'
make || error 'Failed to run make'
#menu button
echo "[Desktop Entry]
Version=1.1
Type=Application
Name=AstroMenace
Comment=Hardcore 3D space scroll-shooter with spaceship upgrade possibilities.
Icon=$HOME/astromenace-master/share/astromenace_128.png
Exec=$HOME/astromenace-master/astromenace
Categories=Game;
Terminal=false
StartupNotify=true" > ~/.local/share/applications/astromenace.desktop

