* Fixed off by one error in the number of clicks to finish the game (it can
hardly be odd). * Fixed spelling error Genarate -> Generate. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26941 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
* Copyright 2008, Ralf Schülke, [email protected]. All rights reserved.
|
* Copyright 2008, Ralf Schülke, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PairsView.h"
|
#include "PairsView.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -47,7 +48,7 @@ PairsView::CreateGameBoard()
|
|||||||
if (child->IsHidden())
|
if (child->IsHidden())
|
||||||
child->Show();
|
child->Show();
|
||||||
}
|
}
|
||||||
_GenarateCardPos();
|
_GenerateCardPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ PairsView::_SetPairsBoard()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PairsView::_GenarateCardPos()
|
PairsView::_GenerateCardPos()
|
||||||
{
|
{
|
||||||
_ReadRandomIcons();
|
_ReadRandomIcons();
|
||||||
|
|
||||||
@@ -213,5 +214,3 @@ PairsView::GetIconFromPos(int pos)
|
|||||||
{
|
{
|
||||||
return fRandPos[pos];
|
return fRandPos[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
* Copyright 2008, Ralf Schülke, [email protected]. All rights reserved.
|
* Copyright 2008, Ralf Schülke, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PAIRS_VIEW_H
|
#ifndef PAIRS_VIEW_H
|
||||||
#define PAIRS_VIEW_H
|
#define PAIRS_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
class TopButton;
|
class TopButton;
|
||||||
|
|
||||||
class PairsView : public BView {
|
class PairsView : public BView {
|
||||||
@@ -26,7 +27,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _SetPairsBoard();
|
void _SetPairsBoard();
|
||||||
void _ReadRandomIcons();
|
void _ReadRandomIcons();
|
||||||
void _GenarateCardPos();
|
void _GenerateCardPos();
|
||||||
|
|
||||||
BMessage* fButtonMessage;
|
BMessage* fButtonMessage;
|
||||||
BBitmap* fCard[8];
|
BBitmap* fCard[8];
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "PairsWindow.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
@@ -14,7 +16,6 @@
|
|||||||
|
|
||||||
#include "Pairs.h"
|
#include "Pairs.h"
|
||||||
#include "PairsGlobal.h"
|
#include "PairsGlobal.h"
|
||||||
#include "PairsWindow.h"
|
|
||||||
#include "PairsView.h"
|
#include "PairsView.h"
|
||||||
#include "PairsTopButton.h"
|
#include "PairsTopButton.h"
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ PairsWindow::MessageReceived(BMessage* message)
|
|||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgCardButton:
|
case kMsgCardButton:
|
||||||
if (fIsPairsActive) {
|
if (fIsPairsActive) {
|
||||||
fButtonClicks = fButtonClicks + 1;
|
fButtonClicks++;
|
||||||
|
|
||||||
int32 num;
|
int32 num;
|
||||||
if (message->FindInt32("ButtonNum", &num) < B_OK)
|
if (message->FindInt32("ButtonNum", &num) < B_OK)
|
||||||
@@ -108,11 +109,11 @@ PairsWindow::MessageReceived(BMessage* message)
|
|||||||
<< "\twritten by Ralf Schülke\n"
|
<< "\twritten by Ralf Schülke\n"
|
||||||
<< "\tCopyright 2008, Haiku Inc.\n"
|
<< "\tCopyright 2008, Haiku Inc.\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "You completed the game in " << fButtonClicks + 1
|
<< "You completed the game in " << fButtonClicks
|
||||||
<< " clicks.\n";
|
<< " clicks.\n";
|
||||||
|
|
||||||
BAlert* alert = new BAlert("about", strAbout.String(), "New game",
|
BAlert* alert = new BAlert("about", strAbout.String(),
|
||||||
"Quit game");
|
"New game", "Quit game");
|
||||||
|
|
||||||
BTextView* view = alert->TextView();
|
BTextView* view = alert->TextView();
|
||||||
BFont font;
|
BFont font;
|
||||||
@@ -142,5 +143,3 @@ PairsWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user