Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help by showing how these steps are done! 5. Since the grid size will now be tracked in the settings object, it will be

Please help by showing how these steps are done!

image text in transcribedimage text in transcribed
5. Since the grid size will now be tracked in the settings object, it will be necessary to remove all existing references to that variable and replace them with the reference to the settings object. a. The easiest way to do this is to delete the size variable from the main window header le. b. The .cpp file will have many errors at this point. Each error can be xed by referencing the appropriate variable in the settings file. 6. Now that there is a settings object, this can be used to pass data to the drawing panel. Create a variable for a settings pointer to the drawing panel header file. 7. The value of the settings object pointer can either be set in the drawing panel constructor or through a setter. The easiest way is likely to create a setter for the settings pointer. 8. It will again be necessary to remove all existing references to variables in the drawing panel and replace them with the reference to the settings object pointer. 9. To test, change the default values in the settings object file and open the program. The interval, grid size, and colors should change based on the default values. #pragmaonce =#include "wx/wx. h" #include "DrawingPanel.h" #include class MainWindow : public wxFrame public: MainWindow(); ~MainWindow() ; WXDECLARE_EVENT_TABLE() ; private: wxBoxSizer* sizer; void OnSizeChange(wxSizeEvent& event); DrawingPanel* drawingPanel; // Game board std:: vector> gameBoard; // Grid size int gridSize = 15; // Initialize the game board void initGameBoard() ; // Set the grid size void setGridSize(int newSize); void UpdateStatusBar() ; // int generation; int livingCells; wxStatusBar* statusBar; wxToolBar* toolbar; void OnPlayButton (wxCommandEvent& event) ; void OnPauseButton (wxCommandEvent& event) ; void OnNextButton (wxCommandEvent& event) ; void OnTrashButton(wxCommandEvent& event); int countLivingNeighbors(int row, int col); void nextGeneration() ; wxTimer* m_timer; int m_timerInterval; void OnTimer(wxTimerEvent& event); wxButton* m_playButton; wxButton* m_pauseButton

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions