Created
January 31, 2020 01:04
-
-
Save ikeating/42d6287ac163238c82d500d24df2b629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| A simple example of using the gfx library. | |
| CSE 20211 | |
| 9/7/2011 | |
| by Prof. Thain | |
| */ | |
| #include <stdio.h> | |
| #include "gfx2.h" | |
| int main() | |
| { | |
| int ysize = 300; | |
| int xsize = 300; | |
| char c; | |
| // Open a new window for drawing. | |
| gfx_open(xsize,ysize,"Example Graphics Program"); | |
| // Set the current drawing color to green. | |
| gfx_color(0,200,100); | |
| // Draw a triangle on the screen. | |
| gfx_line(100,100,200,100); | |
| gfx_line(200,100,150,150); | |
| gfx_line(150,150,100,100); | |
| while(1) { | |
| // Wait for the user to press a character. | |
| c = gfx_wait(); | |
| // Quit if it is the letter q. | |
| if(c=='q') break; | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment