Compare commits
No commits in common. "9c57506cb07f27352c0f254530be9d7ddb5c1076" and "b6fe131231b0670fc9e79f284922d1abe757eb92" have entirely different histories.
9c57506cb0
...
b6fe131231
|
@ -41,6 +41,3 @@ build/
|
||||||
source/*.old
|
source/*.old
|
||||||
source/*.o
|
source/*.o
|
||||||
source/main.c.old
|
source/main.c.old
|
||||||
|
|
||||||
|
|
||||||
*.lst
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
int player = 1; //1 - X 2 - O
|
int player = 1; //1 - X 2 - O
|
||||||
bool win = false;
|
bool win = false;
|
||||||
bool all9 = false;
|
|
||||||
int pressedSquares[9] = {0,0,0,0,0,0,0,0,0};
|
int pressedSquares[9] = {0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
C3D_RenderTarget* top;
|
C3D_RenderTarget* top;
|
||||||
|
@ -175,18 +174,6 @@ void checkWin()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAll9()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < 9; i++)
|
|
||||||
{
|
|
||||||
if(pressedSquares[i] == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
all9 = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
romfsInit();
|
romfsInit();
|
||||||
|
@ -213,7 +200,7 @@ int main(int argc, char **argv) {
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
C2D_TargetClear(top, C2D_Color32(0x00, 0x00, 0x00, 0xFF));
|
C2D_TargetClear(top, C2D_Color32(0x00, 0x00, 0x00, 0xFF));
|
||||||
C2D_TargetClear(bottom, C2D_Color32(0x09, 0x00, 0x00, 0xFF));
|
C2D_TargetClear(bottom, C2D_Color32(0x09, 0x00, 0x00, 0xFF));
|
||||||
if(!win && !all9)
|
if(!win)
|
||||||
{
|
{
|
||||||
C2D_SceneBegin(top);
|
C2D_SceneBegin(top);
|
||||||
drawGridTopScreen();
|
drawGridTopScreen();
|
||||||
|
@ -229,42 +216,27 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(win)
|
C2D_SceneBegin(top);
|
||||||
|
C2D_Text text;
|
||||||
|
C2D_TextBuf buf = C2D_TextBufNew(4096);
|
||||||
|
if(player == 1)
|
||||||
{
|
{
|
||||||
C2D_SceneBegin(top);
|
C2D_TextParse(&text, buf, "O wins!");
|
||||||
C2D_Text text;
|
|
||||||
C2D_TextBuf buf = C2D_TextBufNew(4096);
|
|
||||||
if(player == 1)
|
|
||||||
{
|
|
||||||
C2D_TextParse(&text, buf, "O wins!");
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 200, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
C2D_TextParse(&text, buf, "X wins!");
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 200, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
}
|
|
||||||
C2D_TextBufDelete(buf);
|
|
||||||
C2D_SceneBegin(bottom);
|
|
||||||
}
|
|
||||||
else if(all9)
|
|
||||||
{
|
|
||||||
C2D_SceneBegin(top);
|
|
||||||
C2D_Text text;
|
|
||||||
C2D_TextBuf buf = C2D_TextBufNew(4096);
|
|
||||||
C2D_TextParse(&text, buf, "Draw!");
|
|
||||||
C2D_TextOptimize(&text);
|
C2D_TextOptimize(&text);
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 200, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
C2D_DrawText(&text, C2D_WithColor, 10, 200, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
||||||
C2D_TextBufDelete(buf);
|
|
||||||
C2D_SceneBegin(bottom);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
C2D_TextParse(&text, buf, "X wins!");
|
||||||
|
C2D_TextOptimize(&text);
|
||||||
|
C2D_DrawText(&text, C2D_WithColor, 10, 200, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
||||||
|
}
|
||||||
|
C2D_TextBufDelete(buf);
|
||||||
|
C2D_SceneBegin(bottom);
|
||||||
//press A to restart
|
//press A to restart
|
||||||
if(kHeld & KEY_A)
|
if(kHeld & KEY_A)
|
||||||
{
|
{
|
||||||
player = 1;
|
player = 1;
|
||||||
all9 = false;
|
|
||||||
win = false;
|
win = false;
|
||||||
for(int i = 0; i < 9; i++)
|
for(int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue