Skip to content

Commit fc00e9c

Browse files
committed
Undo some changes
git-svn-id: https://wii-tac-toe.googlecode.com/svn/tags/0.6@43 bba1cac1-252d-79fd-420d-80adb1f9fa09
1 parent bb57eca commit fc00e9c

File tree

11 files changed

+85
-98
lines changed

11 files changed

+85
-98
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ include $(DEVKITPPC)/wii_rules
1515
# SOURCES is a list of directories containing source code
1616
# INCLUDES is a list of directories containing extra header files
1717
#---------------------------------------------------------------------------------
18-
TARGET := Wii-Tac-Toe
18+
TARGET := $(notdir $(CURDIR))
1919
BUILD := build
2020
SOURCES := source source/grrlib source/libpng/pngu
2121
DATA := data

Wii-Tac-Toe/meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>Wii-Tac-Toe</name>
44
<coder>Crayon</coder>
55
<version>0.6</version>
6-
<release_date>200906010000</release_date>
6+
<release_date>200906120000</release_date>
77
<short_description>Tic-Tac-Toe game</short_description>
88
<long_description>Wii-Tac-Toe is a Tic-Tac-Toe game for the Nintendo Wii. It was programmed in C++ using devkitPro along with GRRLIB.
99

source/game.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ void Game::GameScreen(bool CopyScreen)
231231

232232
// Draw grid content
233233
Symbol *Sign = new Symbol;
234-
u8 x, y;
235-
for(x = 0; x < 3; x++)
234+
for(int x = 0; x < 3; x++)
236235
{
237-
for(y = 0; y < 3; y++)
236+
for(int y = 0; y < 3; y++)
238237
{
239238
Sign->SetPlayer(GameGrid->GetPlayerAtPos(x, y));
240-
Sign->SetLocation(Table[x][y].GetX(), Table[x][y].GetY());
239+
Sign->SetLeft(Table[x][y].GetX());
240+
Sign->SetTop(Table[x][y].GetY());
241241
Sign->Paint();
242242
}
243243
}

source/game.h

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "cursor.h"
99
#include "player.h"
1010
#include "language.h"
11-
#include "types.h"
1211

1312
#define TEXT_SIZE 100
1413

@@ -78,5 +77,48 @@ class Game
7877
u8 AIThinkLoop;
7978
gameMode GameMode;
8079
};
80+
81+
/**
82+
* Class used to defines a pixel location onscreen.
83+
* @author Crayon
84+
*/
85+
class Point
86+
{
87+
private:
88+
u16 x, y;
89+
public:
90+
/**
91+
* Constructor for the Point class.
92+
*/
93+
Point(u16 x, u16 y)
94+
{
95+
this->x = x;
96+
this->y = y;
97+
}
98+
/**
99+
* Get the x position.
100+
*/
101+
u16 GetX()
102+
{
103+
return x;
104+
}
105+
/**
106+
* Get the y position.
107+
*/
108+
u16 GetY()
109+
{
110+
return y;
111+
}
112+
/**
113+
* Set the new position.
114+
* @param[in] x Specifies the x-coordinate.
115+
* @param[in] y Specifies the y-coordinate.
116+
*/
117+
void setLocation(u16 x, u16 y)
118+
{
119+
this->x = x;
120+
this->y = y;
121+
}
122+
};
81123
//---------------------------------------------------------------------------
82124
#endif

source/grid.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ bool Grid::SetPlayer(u8 Player, u8 X, u8 Y)
7373
void Grid::SetPlayerAI(u8 Player)
7474
{
7575
u8 TestBoard[3][3];
76-
u8 x, y;
7776

7877
// Test win
79-
for(x = 0; x < 3; x++)
78+
for(int x = 0; x < 3; x++)
8079
{
81-
for(y = 0; y < 3; y++)
80+
for(int y = 0; y < 3; y++)
8281
{
8382
memcpy(TestBoard, Board, sizeof(TestBoard));
8483
if(TestBoard[x][y] == ' ')
@@ -95,9 +94,9 @@ void Grid::SetPlayerAI(u8 Player)
9594

9695
// Test block
9796
u8 Opponent = (Player == 'X') ? 'O' : 'X';
98-
for(x = 0; x < 3; x++)
97+
for(int x = 0; x < 3; x++)
9998
{
100-
for(y = 0; y < 3; y++)
99+
for(int y = 0; y < 3; y++)
101100
{
102101
memcpy(TestBoard, Board, sizeof(TestBoard));
103102
if(TestBoard[x][y] == ' ')
@@ -145,9 +144,24 @@ u8 Grid::GetPlayerAtPos(u8 X, u8 Y)
145144
*/
146145
void Grid::Clear()
147146
{
148-
memset(Board, ' ', sizeof(Board));
147+
for(int x = 0; x < 3; x++)
148+
{
149+
for(int y = 0; y < 3; y++)
150+
{
151+
Board[x][y] = ' ';
152+
}
153+
}
149154
}
150155

156+
/**
157+
* Return the complete grid.
158+
*/
159+
/*
160+
u8[][] Grid::GetGrid()
161+
{
162+
return Board;
163+
}
164+
*/
151165
/**
152166
* Return the winner.
153167
* @return Winning player.
@@ -223,10 +237,9 @@ bool Grid::IsPlayerWinning(u8 Player)
223237
*/
224238
bool Grid::IsFilled()
225239
{
226-
u8 x, y;
227-
for(x = 0; x < 3; x++)
240+
for(int x = 0; x < 3; x++)
228241
{
229-
for(y = 0; y < 3; y++)
242+
for(int y = 0; y < 3; y++)
230243
{
231244
if(Board[x][y] == ' ')
232245
return false;

source/grid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Grid
2020
void SetPlayerRandom(u8);
2121
void SetPlayerAI(u8);
2222
u8 GetPlayerAtPos(u8, u8);
23+
//u8[][] GetGrid();
2324
u8 GetWinner();
2425
void Clear();
2526
bool IsFilled();

source/object.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@ void Object::SetTop(float Top)
5959
this->Top = Top;
6060
}
6161

62-
/**
63-
* Set the left and top position of the object.
64-
* @param[in] Left Left in pixel.
65-
* @param[in] Top Top in pixel.
66-
* @see SetLeft()
67-
* @see SetTop()
68-
*/
69-
void Object::SetLocation(float Left, float Top)
70-
{
71-
this->Left = Left;
72-
this->Top = Top;
73-
}
74-
7562
/**
7663
* Get the width of the object.
7764
* @see SetWidth()
@@ -145,6 +132,13 @@ void Object::SetVisible(bool Visible)
145132
this->Visible = Visible;
146133
}
147134

135+
/**
136+
* Draw an image on screen.
137+
*/
138+
void Object::Paint()
139+
{
140+
}
141+
148142
/**
149143
* Check if a position is inside the object.
150144
* @param[in] x X position in pixel.

source/object.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Object
2424
bool IsVisible();
2525
void SetLeft(float);
2626
void SetTop(float);
27-
void SetLocation(float, float);
2827
void SetWidth(unsigned int);
2928
void SetHeight(unsigned int);
3029
void SetSize(unsigned int, unsigned int);
@@ -33,7 +32,7 @@ class Object
3332
void SetVisible(bool);
3433
bool IsInside(float, float);
3534
protected:
36-
virtual void Paint() = 0; /**< Draw an image on screen. */
35+
virtual void Paint();
3736

3837
float Left; /**< Specifies the x-coordinate of the upper-left corner of the object. */
3938
float Top; /**< Specifies the y-coordinate of the upper-left corner of the object. */

source/symbol.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
Symbol::Symbol() : Object()
1212
{
13-
Player = 'X';
13+
this->Player = 'X';
1414

1515
ImgO = GRRLIB_LoadTexture(o);
1616
ImgX = GRRLIB_LoadTexture(x);
@@ -45,9 +45,9 @@ void Symbol::Paint()
4545

4646
/**
4747
* Set the current player to draw on the screen.
48-
* @param[in] APlayer Player sign, either X or O.
48+
* @param[in] Player Player sign, either X or O.
4949
*/
50-
void Symbol::SetPlayer(unsigned char APlayer)
50+
void Symbol::SetPlayer(unsigned char Player)
5151
{
52-
Player = APlayer;
52+
this->Player = Player;
5353
}

source/types.h

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)