Question: void DrawingPanel::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); wxGraphicsContext* context = wxGraphicsContext::Create(dc); if (!context) { wxSize panelSize = GetSize(); int panelWidth = panelSize.GetWidth(); int panelHeight = panelSize.GetHeight();
void DrawingPanel::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); wxGraphicsContext* context = wxGraphicsContext::Create(dc); if (!context) { wxSize panelSize = GetSize(); int panelWidth = panelSize.GetWidth(); int panelHeight = panelSize.GetHeight(); int cellWidth = panelWidth / Grid_Size; int cellHeight = panelHeight / Grid_Size; context->SetPen(*wxBLACK_PEN); for (int row = 0; row < Grid_Size; ++row) { for (int col = 0; col < Grid_Size; ++col) { // Check the state of the cell if (gameBoard[row][col]) { context->SetBrush(*wxLIGHT_GREY_BRUSH); // Living cell } else { context->SetBrush(*wxWHITE_BRUSH); // Dead cell } int x = col * cellWidth; int y = row * cellHeight; context->DrawRectangle(x, y, cellWidth, cellHeight); } } delete context; } }1>C:\FSU\PP1\conway-s-game-of-life-12-24-ADiaz4\GameOfLife\DrawingPanel.cpp(70,21): error C2065: 'gameBoard': undeclared identifier
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
