Beispiel #1
0
MainForm::MainForm()
{
    SuspendLayout();

    _humanBoard = gcnew Board();
    _computerBoard = gcnew Board(false);

    _humanPlayer = gcnew HumanPlayer("Þaidëjas", _computerBoard);
    _computerPlayer = gcnew ComputerPlayer("Kompiuteris");


    _scoreboard = gcnew ScoreBoard(_humanPlayer, _computerPlayer, 10, 100);
    _controller = gcnew GameController(_humanPlayer, _computerPlayer, _humanBoard, _computerBoard, _scoreboard);

    _shuffleButton = CreateButton(ShuffleCharacter.ToString(), ButtonBackColor);
    _newGameButton = CreateButton(NewGameCharacter.ToString(), ButtonBackColor);
    _startGameButton = CreateButton(StartGameCharacter.ToString(), ButtonBackColor);

    SetupWindow();
    LayoutControls();

    _scoreboard->GameEnded += gcnew EventHandler(this, &MainForm::OnGameEnded);

    _shuffleButton->Click += gcnew System::EventHandler(this, &MainForm::OnShuffleButtonClick);
    _startGameButton->Click += gcnew System::EventHandler(this, &MainForm::OnStartGameButtonClick);
    _newGameButton->Click += gcnew System::EventHandler(this, &MainForm::OnNewGameButtonClick);

    ResumeLayout();

    StartNewGame();
};
Beispiel #2
0
BOOL CMainWnd::OnCreate(LPCREATESTRUCT lpcs)
{
	if (!MSG_FORWARD_WM_CREATE(CForm, lpcs))
		return FALSE;

	SuspendLayout();
	// Create
	m_ToolList.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOINTEGRALHEIGHT,
		0, 0, 100, 100, TOOLLIST_ID, *this);
	auto chd_ToolList = AddChild(&m_ToolList);
	m_DesignerCtrl.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
		0, 0, 100, 100, DESIGNERCTRL_ID, *this);
	auto chd_DesignerCtrl = AddChild(&m_DesignerCtrl);
	m_ProjTree.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
		0, 0, 100, 100, PROJTREE_ID, *this);
	auto chd_ProjTree = AddChild(&m_ProjTree);
	m_PropView.Create(WS_CHILD | WS_VISIBLE | WS_BORDER,
		0, 0, 100, 100, PROPVIEW_ID, *this);
	auto chd_PropView = AddChild(&m_PropView);
	// m_ToolList
	DockChild(chd_ToolList, CForm::NoTargetOpt(), CForm::DockLeft, 10);
	DockChild(chd_ToolList, CForm::NoTargetOpt(), CForm::DockTop, 10);
	DockChild(chd_ToolList, CForm::NoTargetOpt(), CForm::DockBottom, 10);
	// m_DesignerCtrl
	DockChild(chd_DesignerCtrl, chd_ToolList, CForm::DockLeft, 10);
	DockChild(chd_DesignerCtrl, CForm::NoTargetOpt(), CForm::DockTop, 10);
	DockChild(chd_DesignerCtrl, chd_ProjTree, CForm::DockRight, 10);
	DockChild(chd_DesignerCtrl, CForm::NoTargetOpt(), CForm::DockBottom, 10);
	// m_ProjTree
	DockChild(chd_ProjTree, CForm::NoTargetOpt(), CForm::DockTop, 10);
	DockChild(chd_ProjTree, CForm::NoTargetOpt(), CForm::DockRight, 10);
	DockChild(chd_ProjTree, chd_PropView, CForm::DockBottom, 10);
	// m_PropView
	DockChild(chd_PropView, CForm::NoTargetOpt(), CForm::DockBottom, 10);
	DockChild(chd_PropView, CForm::NoTargetOpt(), CForm::DockRight, 10);
	ResumeLayout();

	m_DesignerCtrl.InitToolList(m_ToolList);

	return TRUE;
}