Given that the program can display colours, might as well go ahead and show how to change those colours. But first, the menu
File | Settings | Help | |
New game | Undo | About Mu Torere... | |
Exit | Show Colour Legend | ||
Change Computer Colour... | |||
Change User Colour... | |||
AI Level | Off | ||
Low | |||
Medium | |||
High | |||
Custom AI Level... |
Step 7.
On changing the colour in the Document;
void CMuTorereDoc::OnSettingsChangeXxxx() | |
Create CColorDialog object. Set dialog flags.
If the colour dialog returns IDOK. { Set the game's colours. Set the application's Xxxx colour. Update View with colour hint. } |
In the View, the Update View function is as follows;
void CMuTorereView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* /*pHint*/) |
If lHint equals the Document's colour hint. { Set the colours in the CInfoDisplay instance. } In all cases, Invalidate the window to re-draw. |
The addition to the View's Draw function is minor (done after the game is drawn);
If the application's m_Display is true, draw the CInfoDisplay instance.
The CinfoDisplay is set up in the View constructor;
Go to the first element in the CInfoDisplay instance. Add _T("Computer") and the application's computer colour to the first element. Add _T("User") and the application's user colour the next element. |
No comments:
Post a Comment