my connnect four program will compile but nothing is displayed just a white screen i know that the code is not finished but i just need help making it display what i have so far

#include<u:\C Plus\LVP\gui_top.h>
#include<u:\C Plus\LVP\matrix.h>
//--------------------------------------------------------------------------------
class ButtonClass {
public:
 ButtonClass(String Text, int X1,int Y1, int X2, int Y2);
 void Paint();
 bool IsHit(int x, int y);
private:
 int MyX1, MyY1, MyX2, MyY2;
 String MyText;
};
//--------------------------------------------------------------------------------
ButtonClass::ButtonClass(String Text, int X1, int Y1, int X2, int Y2)
 : MyText(Text), MyX1(X1), MyY1(Y1), MyX2(X2), MyY2(Y2)
{
}
//--------------------------------------------------------------------------------
void ButtonClass::Paint()
{
 SetColor(BLACK);
 SetFillColor(RED);
 FilledRectangle(MyX1, MyY1, MyX2, MyY2);
 gotoxy((MyX1+MyX2)/2, 5+(MyY1+MyY2)/2);
 SetTextColor(BLUE);
 SetTextSize(20);
 SetTextFont("Arial");
 DrawCenteredText(MyText);
}
//--------------------------------------------------------------------------------
bool ButtonClass::IsHit(int x, int y)
{
 return (x>=MyX1&&x<=MyX2&&y>=MyY1&&y<=MyY2);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
class GridClass {
public:
 GridClass();
 void Paint(matrix<int> Board);
 void MouseClick(matrix<int> Board, int x, int y);
 void InitGrid();
 void Title();
private:
 const int GridDimensionX, GridDimensionY;    // # of Rows/columns in grid
 // Constants for board; must all differ
 const int Empty, Player1, Player2;
   matrix<int> Board(int GridDimensionX, int GridDimensionY, int &Empty);
 int Player, Player1Row, Player1Col, Player2Row, Player2Col;
 bool GameOver;
 int BoxSize;       // Pixels per box
 int LeftMargin;    // Pixels from left
 int TopMargin;    // Pixels from top
 void XYToRowCol(int x, int y, int &Row, int &Col);
 void MarkBox(int Row, int Col, int BoxContents);
 ButtonClass QuitButton;
 ButtonClass RestartButton;
   ButtonClass Column1Button;
};
//--------------------------------------------------------------------------------
GridClass::GridClass()
 : GridDimensionX(10), GridDimensionY(10), Empty(0), Player1(1), Player2(2),
 BoxSize(GetMaxY()/2/GridDimensionX),    // Fill half of y-dimension
 LeftMargin((GetMaxX()-BoxSize*GridDimensionX)/2),
 TopMargin(GetMaxY()/4),
 QuitButton(" I Quit! ",10,10,100,40),
 RestartButton(" Restart ", 100,10, 190,40),
   Column1Button(" Column 1 ",((GetMaxX()-BoxSize*GridDimensionX)/2),((GetMaxY()/4)-40),(((GetMaxX()-BoxSize*GridDimensionX)/2)+90),(((GetMaxY()/4)-40)+5))
{
}
//--------------------------------------------------------------------------------
void GridClass::InitGrid()
/* Post: Grid initialized for a new game */
{
 GameOver=false;
}
//--------------------------------------------------------------------------------
void GridClass::XYToRowCol(int x, int y, int &Row, int &Col)
/* Post: Row and Column corresponding to x, y returned,
 or -1 for if x, y is not on the board          */
{
 int DistFromLeft=x-LeftMargin;
 Col=(DistFromLeft+BoxSize)/BoxSize-1;
 int DistFromTop=y-TopMargin;
 Row=(DistFromTop+BoxSize)/BoxSize-1;
 if(Col<0||Col>=GridDimensionX||Row<0||Row>=GridDimensionX)
      {
   Row=-1;
   Col=-1;
  }
}
//--------------------------------------------------------------------------------
void GridClass::MarkBox(int Row, int Col, int BoxContents)
/* Post: Row, Col box in appropriate color */
{
 SetColor(YELLOW);    // For outline
 SetFillColor(WHITE);
 if (BoxContents==Player1)
  SetFillColor(BLACK);
 else if (BoxContents==Player2)
  SetFillColor(RED);
 FilledRectangle(Col*BoxSize+LeftMargin, Row*BoxSize+TopMargin,
 (Col+1)*BoxSize+LeftMargin,
 (Row+1)*BoxSize+TopMargin);
}
//--------------------------------------------------------------------------------
void GridClass::MouseClick(matrix<int> Board, int x, int y)
{
 int Row, Col;
 if (QuitButton.IsHit(x,y))
 {
  GameOver = true;
  if(MessageBoxYN("Are you sure you want to quit?", "Quit button clicked")==1)
   PostQuitMessage(0);
  else
   InitGrid();
 }   //if QuitButton
 else
  if (RestartButton.IsHit(x,y))
  {
   InitGrid();
   Paint(Board);
  }
  else
  {
   XYToRowCol(x, y, Row, Col);
   if((Row!=-1 && Col!=-1 && Board[Row][Col]!=Player1 && Board[Row][Col]!=Player2 && GameOver==false))
   {
    if ((Board[Row][Col]==Empty)&&(Player=1))
               Board[Row][Col]=Player1;
    else if ((Board[Row][Col]==Empty)&&(Player=2))
             Board[Row][Col]=Player2;
   }    //if invalide move
  else
   MessageBeep(-1);
 }
}
//------------------------------------------------------------------------------
void GridClass :: Title()
{
 SetTextFont("Times New Roman");
 SetTextColor(RED);
 SetTextSize(40);
 gotoxy(GetMaxX()/2, GetMaxY()/10);
 DrawCenteredText("Connect Four");
}
//-------------------------------------------------------------------------------
void GridClass::Paint(matrix<int> Board)
{
 QuitButton.Paint();
 RestartButton.Paint();
   Column1Button.Paint();
 Title();
 SetColor(YELLOW);
 int Row, Col;
 // Draw lines
 for (Col=0; Col<=GridDimensionX; Col++)
  Line(LeftMargin+Col*BoxSize, TopMargin,
  LeftMargin+Col*BoxSize,
  TopMargin+GridDimensionX*BoxSize);
 for (Row=0; Row<=GridDimensionX; Row++)
  Line(LeftMargin, TopMargin+Row*BoxSize,
  LeftMargin+GridDimensionX*BoxSize,
  TopMargin+Row*BoxSize);
 // Color in boxes
 for (Row=0; Row < GridDimensionX; Row++)
  for (Col=0; Col<GridDimensionX; Col++)
   MarkBox(Row,Col,Board[Row][Col]);
 // Display results
 SetTextSize(24);
 if (GameOver==true)
    {
     gotoxy(20,GetMaxY()-100);
   DrawText("Game over!  Score = ");
  }
}
//------------------------------------------------------------------------------
class GuiClass {
 public:
   GuiClass();
   void GuiMouseClick(int x, int y); //Action if mouse click
   void GuiPaint(); //Repaint the entire window
   String Title(); //Return the title for the Window
   private:
   };
   //---------------------------------------------------------------------------
   GuiClass::GuiClass()
   {
   }
   //---------------------------------------------------------------------------
   String GuiClass::Title()
   {
    return ("Connect Four");
   }
   //---------------------------------------------------------------------------
   void GuiClass::GuiMouseClick(int x, int y)
   {
   }
   //---------------------------------------------------------------------------
   void GuiClass::GuiPaint()
   {
   }
   //---------------------------------------------------------------------------
   #include <u:\C PLus\LVP\gui_bot.h>

thanks for your help

what operating system and compiler are you using? Some of the code appears to be MS-Windows 32 api functions, but I don't know what the rest is -- gotoxy() is a TurboC MS-DOS function, there is no such thing for MS-Windows GUI programs.

its windows xp pro using borland c++

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.