CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Oct 2014
    Posts
    4

    Complete Beginner of C++ Graphics Programming(Help in simple checker game)

    Hi ! I am going to start making a simple checkers game. Could any one give an idea which part to begin with and any good resource that i can learn from? What actually i can do in the initialise and draw functions
    Thanks.

    Code:
    #include"ccc_win.h"
    // main function for the execution of a graphics program
    int ccc_win_main()
    {
      // piece positions on the board
    	const int numRows = 8;
        const int numCols = 8;
    	int board[8][8];  // rowsxcolumns 8x8 square of a checkers board
    	int new_game ;
    	int exit_program;
    
    	// result of the game
    	int result ;
    	do
    	{
          Initialise(board);  // calling Initialise function 
    	  Draw(board); // calling Draw function
    	  result = PlayGame(board); // calling play function 
    
    	  // wait for new game or exit game button click
    	  while (result != new_game && result != exit_program)
    	  {
    		  // get a mouse Click
    	  }
    
    	} while(result == new_game);
    
    	return 0 ;
    }
    
    // Function to initialize the board
    void Initialise(int board)
    {
    
    // to draw a base big 8x8 square with small square drawn alternatively on top of the board
    	PenWidth pen1 = PenWidth(5);
    	PenColour redPen = PenColour(255 , 0,0);
    	PenColour blackPen = PenColour(0,0,0);
    	PenWidth penB = PenWidth(5);
    	BrushColour blackBrush = BrushColour(0,0,0);
    
    
    // Line and points for the line
    	Point origin(0,0);
    	Point p(4 , 3);
    	Point p1(-7,7) , p2(7,7);
    	Line myLine(origin , p);
    	Rectangle square(p1 , p2);
    
    
    // to draw a  black border of the board draw rectangle
    	cwin<< penB << blackBrush << square ;
    
    
    }
    // Function to draw the board
    void Draw(int board)
    {
    
    }
    
    }
    Last edited by VictorN; October 8th, 2014 at 03:19 AM. Reason: Fixed the wrong [code=java] tag

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured