120 likes | 382 Views
Project 1. Tic Tac Toe Assigned Mon, Sep 8, 2003 Due Mon, Sep 15, 2003. Tic Tac Toe. Read the handout . Download the files. TicTacToe.cpp player.h player.cpp set.h point2.h Download the demo. TicTacToe.exe. Tic Tac Toe. Your job is to provide the graphics for The game grid.
E N D
Project 1 Tic Tac Toe Assigned Mon, Sep 8, 2003 Due Mon, Sep 15, 2003
Tic Tac Toe • Read the handout. • Download the files. • TicTacToe.cpp • player.h • player.cpp • set.h • point2.h • Download the demo. • TicTacToe.exe
Tic Tac Toe • Your job is to provide the graphics for • The game grid. • The X’s. • The O’s. • The winning line. • You may also set the background color if you like.
Drawing the Game Grid • The game grid is the traditional 3 x 3 board. • It consists of two horizontal bands and two vertical bands.
Drawing the Game Grid • The 9 empty squares formed by the grid should have length and width equal to cellWidth. • The thickness of the grid lines should be equal to gridWidth.
Drawing the Game Grid • The world coordinates are set up so that the origin (0, 0) is at the lower left corner of the game grid. y gridWidth (0, 0) cellWidth x
Drawing an X • The X should be drawn as a polygon. • It should have squared-off corners.
Drawing an X • The diagonals should be drawn at 45 angles. • Each side of a corner should be equal to ½ of gridWidth. ½ of gridWidth
Drawing an X • The space between the X and the cell edges should be equal to cellPad. cellPad
Drawing an O • The thickness of the O should be gridWidth and the padding should be cellPad. • The O should be round like a circle. • You must use polygons to draw the O.
Drawing the Winning Lines • Horizontal and vertical winning lines are rectangles with length equal to the size of the game grid and width equal to gridWidth. • The diagonal winning lines are similar to the diagonals of the X, but they extend from one corner of the game grid to the other.
Drawing Polygons • Keep in mind that OpenGL assumes that all polygons are convex. • If you try to draw non-convex polygons, the results are unpredictable.