This is an old revision of the document!
Enter your c4eng directory by using the cd command like so:
cd src/fall2023/c4eng/
Now make a directory for the project gtf0 using the mkdir command:
mkdir gtf0
And use cd to enter it.
You can now use the grabit command to get the project files for gtf0:
grabit c4eng gtf0
You can use ls to check that the correct files are there. You should see 2 files, Makefile and gtf0.c.
Depending on your development environment, there are different ways you can view the image. If you're developing on your own system (Raspberry Pi 4, your PC, or some other device), you can simply open the PNG from the folder, or in the terminal use the open command to open gtf0.png.
If you're developing in the lab46 shell, then one of the easiest ways to view the PNG is through the browser after copying it to your ~/public_html folder and making it world-readable.
You can do this with the following set of commands:
cp gtf0.png ~/public_html chmod 0644 ~/public_html/gtf0.png
Once you've copied it to your ~/public_html directory, and made it readable, you can go to the URL lab46.g7n.org/~USERNAME/gtf0.png, where USERNAME is your username, in your browser to view the image.
We can add our own colors to be used in our PNG as well. The first step in doing so is to declare our color as a variable.
At the top of our file, right below int main(), we can see a section with some commented out text that reads “Declare variables”. In the actual code, we can already see some declared colors! For example, there's int white = 0;
So now we know how to declare a color for ourselves. Add another line, and try to maintain the same spacing for readability. You can name your color whatever you'd like, however there are some restrictions for naming variables in C. We should also maintain the same naming conventions that have already been used for readability.
For example, you can add int orange = 0;
Right now, the number you're assigning should just be 0. We will change this later using a number format that's more apt for color assignments.