SettlersView

The main game window.  SettlersView houses all of the UI elements in the game, maintaining them when the size of the main window changes, or when a user initiates a total UI resize event.  SettlersView is built on top of wxSettlersGLCanvas, which means that all of the UI and OpenGL display comes together in one place, cleanly separated through inheritance.

Derived From

wxSettlersGLCanvas

Project

Cities3D

Include

SettlersView.h

Summary
The main game window.
The SettlersView constructor.
The SettlersView destructor.
The wxWidgets event table declaration.
Creates the MessageUI, the ControlsUI, and the TurnUI.
Creates all of the PlayerUIs and the BankUI
Creates all of the BuildUIs by reading the BuildData provided by the loaded RuleSets.
Initializes all UI objects.
Executes a total UI resize.
Resizes the window.
The std::list of UI elements.

Public

Summary
The SettlersView constructor.
The SettlersView destructor.
The wxWidgets event table declaration.

Constructors

SettlersView

SettlersView(wxWindow *parent, 
const wxWindowID id = -1,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxT("SettlersView"),
wxInt32 *attrib = NULL)

The SettlersView constructor.  Calls the base class wxSettlersGLCanvas with all of the parameters.  Adds OnInitializeUI as a receiver of the eventInitializeUI Event via the Controller.  Adds OnTotalUIResize as a receiver of the eventTotalUIResize Event.

Parameters

parentThe parent window (must not be NULL).
idThe id for message handling.
posThe starting position.
sizeThe starting size.
styleThe window style, using wxWindow parameters.
nameThe name.
attribStarting OpenGL implementation attributes.

Destructor

~SettlersView

~SettlersView()

The SettlersView destructor.  Removes the OnTotalUIResize receiver of the eventTotalUIResize Event.

Variables

DECLARE_EVENT_TABLE

The wxWidgets event table declaration.

Private

Summary
Creates the MessageUI, the ControlsUI, and the TurnUI.
Creates all of the PlayerUIs and the BankUI
Creates all of the BuildUIs by reading the BuildData provided by the loaded RuleSets.
Initializes all UI objects.
Executes a total UI resize.
Resizes the window.
The std::list of UI elements.

Functions

InitializeControls

void InitializeControls(UI *&uiMessage)

Creates the MessageUI, the ControlsUI, and the TurnUI.

Parameters

uiMessageA pointer that should be set to the created MessageUI.

InitializePlayers

void InitializePlayers(const GamePtr &game)

Creates all of the PlayerUIs and the BankUI

Parameters

gameThe current Game object.

InitializeBuild

void InitializeBuild(UI *uiMessage)

Creates all of the BuildUIs by reading the BuildData provided by the loaded RuleSets.

Parameters

uiMessageA pointer to the MessageUI.  Used as an anchor for the BuildUIs.

Game Event Functions

OnInitializeUI

void OnInitializeUI(GamePtr game)

Initializes all UI objects.  Creates each of the UI objects by calling the initialize functions.  Repositions them all immediately so they show up on the screen in the correct locations.  Calls eventPlayerUI to have the PlayerUIs and the BankUI update themselves.  Removes OnInitializeUI as a receiver of the eventInitializeUI Event.  Calls OnTotalUIResize with the resize value stored in the ConfigDatabase.

Parameters

gameThe current Game object.

OnTotalUIResize

void OnTotalUIResize(float fPercent)

Executes a total UI resize.  Hides all UI elements, but records whether they were visible or not.  Calls TotalUIResize on each of them with the given resize percent.  Reshows all UI elements that were visible.

Parameters

fPercentThe total ui resize percentage.  Ranges from 1.0 to 2.0 inclusive.

Event Message Handling

OnSize

void OnSize(wxSizeEvent &event)

Resizes the window.  Repositions every UI element so it is located properly on the screen.

Parameters

eventThe size event.

Variables

mUIList

UIList mUIList

The std::list of UI elements.

SettlersView(wxWindow *parent, 
const wxWindowID id = -1,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxT("SettlersView"),
wxInt32 *attrib = NULL)
The SettlersView constructor.
~SettlersView()
The SettlersView destructor.
void InitializeControls(UI *&uiMessage)
Creates the MessageUI, the ControlsUI, and the TurnUI.
Displays game-related messages to the user.
Displays a set of buttons for user turn actions.
Still volatile.
void InitializePlayers(const GamePtr &game)
Creates all of the PlayerUIs and the BankUI
Displays game information for one player.
Displays stacks of remaining bank cards.
void InitializeBuild(UI *uiMessage)
Creates all of the BuildUIs by reading the BuildData provided by the loaded RuleSets.
Displays a possible action for the player.
RulesCore
A repository of all things rules-related.
void OnInitializeUI(GamePtr game)
Initializes all UI objects.
An interface for custom-drawn main screen UI elements.
void OnTotalUIResize(float fPercent)
Executes a total UI resize.
void OnSize(wxSizeEvent &event)
Resizes the window.
UIList mUIList
The std::list of UI elements.
Renders all game objects in OpenGL.
Cities3D is a cross-platform implementation of the board game Settlers of Catan with all expansions, including Seafarers, and Cities & Knights.
A generic implementation of the Observer design pattern.
The communication mechanism between the View and the Model.
Still volatile.
A Singleton class that handles configuration options for the application.