This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2023:projects:gtf0 [2023/09/04 00:28] – [VIEW THE IMAGE] mwinter4 | notes:c4eng:fall2023:projects:gtf0 [2023/09/07 17:56] (current) – [REPOSITORY STEPS] nbutler5 | ||
---|---|---|---|
Line 15: | Line 15: | ||
You can use <wrap hi> | You can use <wrap hi> | ||
You should see 2 files, <wrap hi> | You should see 2 files, <wrap hi> | ||
+ | |||
+ | |||
+ | |||
+ | |||
=====REPOSITORY STEPS===== | =====REPOSITORY STEPS===== | ||
- | =====BUILD THE CODE===== | + | The first step in adding files to the repository is being in the folder where the files you want to add are in. Once you've " |
+ | < | ||
+ | After you've added the files, then you want to commit them. This can be done using the command below. Once the command has been entered it will take you to a nano window. | ||
+ | < | ||
+ | |||
+ | In the nano window you will want to " | ||
+ | < | ||
+ | |||
+ | After exiting and saving the nano window write the following command in the terminal to push your files to the repository server. In the terminal it will show you that the files have been added. | ||
+ | < | ||
+ | |||
+ | To verify you can preform the following commands that will provide info on your " | ||
+ | < | ||
+ | |||
+ | and/or | ||
+ | |||
+ | hg log</ | ||
+ | |||
+ | =====BUILD THE CODE===== | ||
+ | To edit the gtf0 file, you can use the following command: | ||
+ | < | ||
+ | You can scroll down and edit the sizes and colors of various shapes. Keep in mind that a color has to be defined, and every color has to be used, for the make command to work. | ||
=====RUN THE PROGRAM===== | =====RUN THE PROGRAM===== | ||
+ | After you are finished editing the code, and you want to check what it looks like, yo have to compile it with the following command: | ||
+ | < | ||
+ | Then, you can create the gtf0.png with the command: | ||
+ | < | ||
+ | Doing this allows you to copy the image to your public html, which is shown in the next step. If the image already exists, you may have to replace it by typing y when it asks you to overwrite the existing image. | ||
=====VIEW THE IMAGE===== | =====VIEW THE IMAGE===== | ||
Line 49: | Line 79: | ||
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. | 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. | ||
+ | |||
+ | If we scroll down in our code a bit, we'll find the names of all of the colors that were already there across from this peculiar <wrap hi> | ||
+ | |||
+ | Let's add our example color, orange, to this list. We can write something like this: | ||
+ | < | ||
+ | But we haven' | ||
+ | |||
+ | If you've ever worked with colors digitally, whether in photoshop or in HTML/CSS, you may be familiar with the concept of color hex codes. They tend to look something like this: <wrap hi># | ||
+ | |||
+ | This can actually be separated into 3 color values (2 digits each) that mix together. Red, green, and blue. They are written in hexadecimal, | ||
+ | |||
+ | We don't have to spend time mixing values of red, green, and blue until we get our desired colors. We can actually just use Google' | ||
+ | |||
+ | Now I've gone ahead and picked a nice shade of orange, but remember that you can use any color you want (and name it accordingly). Underneath that rainbow gradient bar you'll find a box titled " | ||
+ | |||
+ | But how do we assign this to our orange variable? Well, you might notice that white has values <wrap hi> | ||
+ | |||
+ | Altogether, the line of code should look something like this: | ||
+ | < | ||
+ | orange = gdImageColorAllocate (image, 0xFF, 0x91, 0x14); | ||
+ | </ | ||
+ | Remember to match your spacing to the rest of the code for readability! | ||
+ | |||
+ | Now that we've added our color, we can use it in our code when we start to draw shapes, simply passing it to any function we use as " | ||
====DRAWING A LINE==== | ====DRAWING A LINE==== | ||