2018-01-16 00:35:32 -07:00
# Installing Ubuntu 16.04
2018-01-15 22:45:08 -07:00
2018-01-16 00:35:32 -07:00
Instead of writing all the steps required for installing Ubuntu 16.04, please refer to the link below:
[https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop#0 ](https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop#0 )
# Installing GO
Ubuntu 16.04 has an old version of GO so we need to update it.
To do this we make use of the official PPA provided by the GOLang project:
```
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang
```
This will add a repository with an updated version of GO and install it.
To test if GO is installed properly, type the following into terminal:
```
go version
```
This should provide the following output:
2018-01-15 22:45:08 -07:00
```
2018-01-16 00:35:32 -07:00
go version go1.9.2 linux/amd64
```
Now you can move on to getting Visual Studio Code.
# Install and Setup Visual Studio Code
Visual Studio Code or (VSCode) is an open source code suite developed by Microsoft Corporation under the MIT license. It is available for Windows, MacOS and Linux.
To get VSCode for Ubuntu 16.04, we simply have to download and install the .deb file.
* Open your Web Browser and go to: https://code.visualstudio.com/
* Click the green box in the middle of the screen that says ".deb"
If you are using Firefox, make sure to check the button "Save File"
If you are using Google Chrome, the file should download to your Downloads folder.
Next I recommend getting the "Gdebi Package Installer" since it is the most straight forward way to install a deb package.
```
sudo apt install gdebi-gtk
```
Then open your file manager and go to your downloads folder and:
2018-01-16 00:38:10 -07:00
* Right click the deb file for "code" that you downloaded earlier
2018-01-16 00:35:32 -07:00
* From the context menu choose "Gdebi Package Installer"
* Enter your user password when prompted
* Once Gdebi is finished, you can close the Window
* Now you can open Visual Studio Code from your applications menu
## VSCode GO extension
Now you are ready to get the GO Extension to provide robust functionality for GO in VSCode.
When VSCode is open, press the hotkeys:
```
ctrl+p
```
This will bring down the text navigation command window.
Next let's install the extension by entering the following command:
```
ext install lukehoban.Go
```
Next we need to reload the VSCode window contents.
```
ctrl+shift+p
```
In the command line box, enter the following command:
```
Reload Window
```
This will refresh VSCode and enable any newly installed extensions.
## Using the GO extension
Once the GO Extension is installed, all you have to do now is open an existing .go file and follow the prompt.
Once you open a .go file, a message will appear at the top of the VSCode Window.
2018-01-16 00:42:39 -07:00
It will ask if you want to install the first required tool of the GO extension or to install all.
2018-01-16 00:35:32 -07:00
Make sure you choose "Install all"
This will use go itself to "go get" the required tools required for the extension to function.
You will notice that a terminal output window appears on the bottom of VSCode showing you the progress of the installation.
After this, you are ready to start writing GO applications in VSCode
# Getting Pixel Library
## Ubuntu 16.04
First, make sure *golang* is installed by following the instructions above.
Then run the following command in terminal:
```
go get github.com/faiface/pixel
```
This will place the repository with dev files in:
```
/home/$USER/go/src/github.com/faiface/pixel
```
All that is required to use Pixel now is to simply import it in your go file:
```
import(
"github.com/faiface/pixel"
)
```
Next, we need to get development files for using OpenGL in Ubuntu:
```
sudo apt update
sudo apt install libx11-dev mesa-common-dev libxcursor-dev libxrandr-dev libxinerama-dev libgl1-mesa-dev libxi-dev
```
2018-01-15 22:45:08 -07:00
2018-01-16 00:35:32 -07:00
This allows the Pixel library to make calls to the system and render graphics.
Now you can follow the [Pixel Tutorial ](https://github.com/faiface/pixel/wiki/Creating-a-Window ) on Github