Compare commits
No commits in common. "main" and "beta-0.1" have entirely different histories.
|
@ -35,19 +35,9 @@
|
||||||
*.3dsx
|
*.3dsx
|
||||||
*.elf
|
*.elf
|
||||||
*.cia
|
*.cia
|
||||||
|
*.smdh
|
||||||
|
|
||||||
build/
|
build/
|
||||||
source/*.old
|
source/*.old
|
||||||
source/*.o
|
source/*.o
|
||||||
source/main.c.old
|
source/main.c.old
|
||||||
|
|
||||||
|
|
||||||
*.lst
|
|
||||||
|
|
||||||
#MAC OS
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
makerom
|
|
||||||
bannertool
|
|
||||||
XO-game.*
|
|
BIN
.img/0-3-1.png
BIN
.img/0-3-1.png
Binary file not shown.
Before Width: | Height: | Size: 50 KiB |
BIN
.img/0-3.png
BIN
.img/0-3.png
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB |
3
Makefile
3
Makefile
|
@ -63,7 +63,8 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
LIBS := -lcitro2d -lcitro3d -lctru
|
LIBS := -lctru -lm
|
||||||
|
LIBS := -lcitro2d -lcitro3d -lctru -lm
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
|
|
16
README.md
16
README.md
|
@ -1,19 +1,3 @@
|
||||||
# XO-game
|
# XO-game
|
||||||
|
|
||||||
Hombrew Tic-tac-toe for 3ds
|
Hombrew Tic-tac-toe for 3ds
|
||||||
|
|
||||||
## TO DO:
|
|
||||||
1. Change drawing to image
|
|
||||||
1. Sound effects
|
|
||||||
1. Save statistics
|
|
||||||
1. Multiplayer
|
|
||||||
|
|
||||||
## How to build:
|
|
||||||
1. Install devkitPro for 3ds
|
|
||||||
1. Install makerom
|
|
||||||
1. Clone this repo
|
|
||||||
1. Run `make && ./makerom -f cia -o XO-game.cia -rsf cia.rsf -target t -exefslogo -elf XO-game.elf -icon icon.smdh` in repo directory
|
|
||||||
1. Install cia file on your 3ds
|
|
||||||
|
|
||||||
## Known bugs:
|
|
||||||
1. No icon, banner and music in home menu
|
|
||||||
|
|
BIN
banner.bin
BIN
banner.bin
Binary file not shown.
Binary file not shown.
285
cia.rsf
285
cia.rsf
|
@ -1,285 +0,0 @@
|
||||||
BasicInfo:
|
|
||||||
Title : "XO-game"
|
|
||||||
ProductCode : "CTR-H-XOGA"
|
|
||||||
Logo : Licensed
|
|
||||||
|
|
||||||
RomFs:
|
|
||||||
RootPath : $(APP_ROMFS)
|
|
||||||
|
|
||||||
|
|
||||||
TitleInfo:
|
|
||||||
Category : Application
|
|
||||||
UniqueId : 0x43918
|
|
||||||
|
|
||||||
Option:
|
|
||||||
UseOnSD : true # true if App is to be installed to SD
|
|
||||||
FreeProductCode : true # Removes limitations on ProductCode
|
|
||||||
MediaFootPadding : false # If true CCI files are created with padding
|
|
||||||
EnableCrypt : false # Enables encryption for NCCH and CIA
|
|
||||||
EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
|
|
||||||
|
|
||||||
AccessControlInfo:
|
|
||||||
CoreVersion : 2
|
|
||||||
|
|
||||||
# Exheader Format Version
|
|
||||||
DescVersion : 2
|
|
||||||
|
|
||||||
# Minimum Required Kernel Version (below is for 4.5.0)
|
|
||||||
ReleaseKernelMajor : "02"
|
|
||||||
ReleaseKernelMinor : "33"
|
|
||||||
|
|
||||||
# ExtData
|
|
||||||
UseExtSaveData : false # enables ExtData
|
|
||||||
#ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId
|
|
||||||
|
|
||||||
# FS:USER Archive Access Permissions
|
|
||||||
# Uncomment as required
|
|
||||||
FileSystemAccess:
|
|
||||||
- CategorySystemApplication
|
|
||||||
- CategoryHardwareCheck
|
|
||||||
- CategoryFileSystemTool
|
|
||||||
- Debug
|
|
||||||
- TwlCardBackup
|
|
||||||
- TwlNandData
|
|
||||||
#- Boss
|
|
||||||
- DirectSdmc
|
|
||||||
- Core
|
|
||||||
#- CtrNandRo
|
|
||||||
#- CtrNandRw
|
|
||||||
#- CtrNandRoWrite
|
|
||||||
- CategorySystemSettings
|
|
||||||
#- CardBoard
|
|
||||||
#- ExportImportIvs
|
|
||||||
- DirectSdmcWrite
|
|
||||||
#- SwitchCleanup
|
|
||||||
#- SaveDataMove
|
|
||||||
#- Shop
|
|
||||||
#- Shell
|
|
||||||
#- CategoryHomeMenu
|
|
||||||
#- SeedDB
|
|
||||||
IoAccessControl:
|
|
||||||
#- FsMountNand
|
|
||||||
#- FsMountNandRoWrite
|
|
||||||
- FsMountTwln
|
|
||||||
#- FsMountWnand
|
|
||||||
- FsMountCardSpi
|
|
||||||
- UseSdif3
|
|
||||||
#- CreateSeed
|
|
||||||
- UseCardSpi
|
|
||||||
|
|
||||||
# Process Settings
|
|
||||||
MemoryType : Application # Application/System/Base
|
|
||||||
SystemMode : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB
|
|
||||||
IdealProcessor : 0
|
|
||||||
AffinityMask : 1
|
|
||||||
Priority : 16
|
|
||||||
MaxCpu : 0x9E # Default
|
|
||||||
HandleTableSize : 0x200
|
|
||||||
DisableDebug : false
|
|
||||||
EnableForceDebug : false
|
|
||||||
CanWriteSharedPage : true
|
|
||||||
CanUsePrivilegedPriority : false
|
|
||||||
CanUseNonAlphabetAndNumber : true
|
|
||||||
PermitMainFunctionArgument : true
|
|
||||||
CanShareDeviceMemory : true
|
|
||||||
RunnableOnSleep : false
|
|
||||||
SpecialMemoryArrange : true
|
|
||||||
|
|
||||||
# New3DS Exclusive Process Settings
|
|
||||||
SystemModeExt : Legacy # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
|
|
||||||
CpuSpeed : 804MHz # 268MHz(Default)/804MHz
|
|
||||||
EnableL2Cache : true # false(default)/true
|
|
||||||
CanAccessCore2 : true
|
|
||||||
|
|
||||||
# Virtual Address Mappings
|
|
||||||
IORegisterMapping:
|
|
||||||
- 1ff00000-1ff7ffff # DSP memory
|
|
||||||
MemoryMapping:
|
|
||||||
- 1f000000-1f5fffff:r # VRAM
|
|
||||||
|
|
||||||
# Accessible SVCs, <Name>:<ID>
|
|
||||||
SystemCallAccess:
|
|
||||||
ControlMemory: 1
|
|
||||||
QueryMemory: 2
|
|
||||||
ExitProcess: 3
|
|
||||||
GetProcessAffinityMask: 4
|
|
||||||
SetProcessAffinityMask: 5
|
|
||||||
GetProcessIdealProcessor: 6
|
|
||||||
SetProcessIdealProcessor: 7
|
|
||||||
CreateThread: 8
|
|
||||||
ExitThread: 9
|
|
||||||
SleepThread: 10
|
|
||||||
GetThreadPriority: 11
|
|
||||||
SetThreadPriority: 12
|
|
||||||
GetThreadAffinityMask: 13
|
|
||||||
SetThreadAffinityMask: 14
|
|
||||||
GetThreadIdealProcessor: 15
|
|
||||||
SetThreadIdealProcessor: 16
|
|
||||||
GetCurrentProcessorNumber: 17
|
|
||||||
Run: 18
|
|
||||||
CreateMutex: 19
|
|
||||||
ReleaseMutex: 20
|
|
||||||
CreateSemaphore: 21
|
|
||||||
ReleaseSemaphore: 22
|
|
||||||
CreateEvent: 23
|
|
||||||
SignalEvent: 24
|
|
||||||
ClearEvent: 25
|
|
||||||
CreateTimer: 26
|
|
||||||
SetTimer: 27
|
|
||||||
CancelTimer: 28
|
|
||||||
ClearTimer: 29
|
|
||||||
CreateMemoryBlock: 30
|
|
||||||
MapMemoryBlock: 31
|
|
||||||
UnmapMemoryBlock: 32
|
|
||||||
CreateAddressArbiter: 33
|
|
||||||
ArbitrateAddress: 34
|
|
||||||
CloseHandle: 35
|
|
||||||
WaitSynchronization1: 36
|
|
||||||
WaitSynchronizationN: 37
|
|
||||||
SignalAndWait: 38
|
|
||||||
DuplicateHandle: 39
|
|
||||||
GetSystemTick: 40
|
|
||||||
GetHandleInfo: 41
|
|
||||||
GetSystemInfo: 42
|
|
||||||
GetProcessInfo: 43
|
|
||||||
GetThreadInfo: 44
|
|
||||||
ConnectToPort: 45
|
|
||||||
SendSyncRequest1: 46
|
|
||||||
SendSyncRequest2: 47
|
|
||||||
SendSyncRequest3: 48
|
|
||||||
SendSyncRequest4: 49
|
|
||||||
SendSyncRequest: 50
|
|
||||||
OpenProcess: 51
|
|
||||||
OpenThread: 52
|
|
||||||
GetProcessId: 53
|
|
||||||
GetProcessIdOfThread: 54
|
|
||||||
GetThreadId: 55
|
|
||||||
GetResourceLimit: 56
|
|
||||||
GetResourceLimitLimitValues: 57
|
|
||||||
GetResourceLimitCurrentValues: 58
|
|
||||||
GetThreadContext: 59
|
|
||||||
Break: 60
|
|
||||||
OutputDebugString: 61
|
|
||||||
ControlPerformanceCounter: 62
|
|
||||||
CreatePort: 71
|
|
||||||
CreateSessionToPort: 72
|
|
||||||
CreateSession: 73
|
|
||||||
AcceptSession: 74
|
|
||||||
ReplyAndReceive1: 75
|
|
||||||
ReplyAndReceive2: 76
|
|
||||||
ReplyAndReceive3: 77
|
|
||||||
ReplyAndReceive4: 78
|
|
||||||
ReplyAndReceive: 79
|
|
||||||
BindInterrupt: 80
|
|
||||||
UnbindInterrupt: 81
|
|
||||||
InvalidateProcessDataCache: 82
|
|
||||||
StoreProcessDataCache: 83
|
|
||||||
FlushProcessDataCache: 84
|
|
||||||
StartInterProcessDma: 85
|
|
||||||
StopDma: 86
|
|
||||||
GetDmaState: 87
|
|
||||||
RestartDma: 88
|
|
||||||
DebugActiveProcess: 96
|
|
||||||
BreakDebugProcess: 97
|
|
||||||
TerminateDebugProcess: 98
|
|
||||||
GetProcessDebugEvent: 99
|
|
||||||
ContinueDebugEvent: 100
|
|
||||||
GetProcessList: 101
|
|
||||||
GetThreadList: 102
|
|
||||||
GetDebugThreadContext: 103
|
|
||||||
SetDebugThreadContext: 104
|
|
||||||
QueryDebugProcessMemory: 105
|
|
||||||
ReadProcessMemory: 106
|
|
||||||
WriteProcessMemory: 107
|
|
||||||
SetHardwareBreakPoint: 108
|
|
||||||
GetDebugThreadParam: 109
|
|
||||||
ControlProcessMemory: 112
|
|
||||||
MapProcessMemory: 113
|
|
||||||
UnmapProcessMemory: 114
|
|
||||||
CreateCodeSet: 115
|
|
||||||
CreateProcess: 117
|
|
||||||
TerminateProcess: 118
|
|
||||||
SetProcessResourceLimits: 119
|
|
||||||
CreateResourceLimit: 120
|
|
||||||
SetResourceLimitValues: 121
|
|
||||||
AddCodeSegment: 122
|
|
||||||
Backdoor: 123
|
|
||||||
KernelSetState: 124
|
|
||||||
QueryProcessMemory: 125
|
|
||||||
|
|
||||||
# Service List
|
|
||||||
# Maximum 34 services (32 if firmware is prior to 9.6.0)
|
|
||||||
ServiceAccessControl:
|
|
||||||
- APT:U
|
|
||||||
- ac:u
|
|
||||||
- am:net
|
|
||||||
#- boss:U
|
|
||||||
- cam:u
|
|
||||||
#- cecd:u
|
|
||||||
#- cfg:nor
|
|
||||||
- cfg:u
|
|
||||||
#- csnd:SND
|
|
||||||
- dsp::DSP
|
|
||||||
#- frd:u
|
|
||||||
- fs:USER
|
|
||||||
- gsp::Gpu
|
|
||||||
- gsp::Lcd
|
|
||||||
- hid:USER
|
|
||||||
- http:C
|
|
||||||
- ir:rst
|
|
||||||
- ir:u
|
|
||||||
- ir:USER
|
|
||||||
#- mic:u
|
|
||||||
#- ndm:u
|
|
||||||
#- news:s
|
|
||||||
- nwm::EXT
|
|
||||||
- nwm::UDS
|
|
||||||
- ptm:sysm
|
|
||||||
- ptm:u
|
|
||||||
- pxi:dev
|
|
||||||
- soc:U
|
|
||||||
- ssl:C
|
|
||||||
#- y2r:u
|
|
||||||
|
|
||||||
SystemControlInfo:
|
|
||||||
SaveDataSize: 64KB # Change if the app uses savedata
|
|
||||||
RemasterVersion: 1
|
|
||||||
StackSize: 0x40000
|
|
||||||
|
|
||||||
# Modules that run services listed above should be included below
|
|
||||||
# Maximum 48 dependencies
|
|
||||||
# <module name>:<module titleid>
|
|
||||||
Dependency:
|
|
||||||
ac: 0x0004013000002402
|
|
||||||
act: 0x0004013000003802
|
|
||||||
am: 0x0004013000001502
|
|
||||||
boss: 0x0004013000003402
|
|
||||||
camera: 0x0004013000001602
|
|
||||||
cecd: 0x0004013000002602
|
|
||||||
cfg: 0x0004013000001702
|
|
||||||
codec: 0x0004013000001802
|
|
||||||
csnd: 0x0004013000002702
|
|
||||||
dlp: 0x0004013000002802
|
|
||||||
dsp: 0x0004013000001a02
|
|
||||||
friends: 0x0004013000003202
|
|
||||||
gpio: 0x0004013000001b02
|
|
||||||
gsp: 0x0004013000001c02
|
|
||||||
hid: 0x0004013000001d02
|
|
||||||
http: 0x0004013000002902
|
|
||||||
i2c: 0x0004013000001e02
|
|
||||||
ir: 0x0004013000003302
|
|
||||||
mcu: 0x0004013000001f02
|
|
||||||
mic: 0x0004013000002002
|
|
||||||
ndm: 0x0004013000002b02
|
|
||||||
news: 0x0004013000003502
|
|
||||||
#nfc: 0x0004013000004002
|
|
||||||
nim: 0x0004013000002c02
|
|
||||||
nwm: 0x0004013000002d02
|
|
||||||
pdn: 0x0004013000002102
|
|
||||||
ps: 0x0004013000003102
|
|
||||||
ptm: 0x0004013000002202
|
|
||||||
#qtm: 0x0004013020004202
|
|
||||||
ro: 0x0004013000003702
|
|
||||||
socket: 0x0004013000002e02
|
|
||||||
spi: 0x0004013000002302
|
|
||||||
ssl: 0x0004013000002f02
|
|
|
@ -4,16 +4,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <citro2d.h>
|
#include <citro2d.h>
|
||||||
|
|
||||||
//File io
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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};
|
||||||
int winCount[3] = {0,0,0}; //0 - X 1 - O 2 - Draw
|
|
||||||
bool addedWin = false;
|
|
||||||
|
|
||||||
C3D_RenderTarget* top;
|
C3D_RenderTarget* top;
|
||||||
C3D_RenderTarget* bottom;
|
C3D_RenderTarget* bottom;
|
||||||
|
@ -85,12 +79,10 @@ void drawMoves(int display)
|
||||||
if(display == 1)
|
if(display == 1)
|
||||||
{
|
{
|
||||||
C2D_DrawCircleSolid(50 + (square % 3) * 100, 30 + (square / 3) * 60, 0, 25, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
C2D_DrawCircleSolid(50 + (square % 3) * 100, 30 + (square / 3) * 60, 0, 25, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
||||||
C2D_DrawCircleSolid(50 + (square % 3) * 100, 30 + (square / 3) * 60, 0, 20, C2D_Color32(0x00, 0x00, 0x00, 0xFF));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C2D_DrawCircleSolid(53 + (square % 3) * 106, 40 + (square / 3) * 80, 0, 25, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
C2D_DrawCircleSolid(53 + (square % 3) * 106, 40 + (square / 3) * 80, 0, 25, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
||||||
C2D_DrawCircleSolid(53 + (square % 3) * 106, 40 + (square / 3) * 80, 0, 20, C2D_Color32(0x00, 0x00, 0x00, 0xFF));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +90,6 @@ void drawMoves(int display)
|
||||||
|
|
||||||
void touching(touchPosition touch)
|
void touching(touchPosition touch)
|
||||||
{
|
{
|
||||||
addedWin = false;
|
|
||||||
if(touch.px < 106 && touch.py < 80 && pressedSquares[0] == 0)
|
if(touch.px < 106 && touch.py < 80 && pressedSquares[0] == 0)
|
||||||
{
|
{
|
||||||
pressedSquares[0] = player;
|
pressedSquares[0] = player;
|
||||||
|
@ -146,26 +137,6 @@ void touching(touchPosition touch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void winCountShow()
|
|
||||||
{
|
|
||||||
C2D_Text text;
|
|
||||||
C2D_TextBuf buf = C2D_TextBufNew(4096);
|
|
||||||
char buffer[100];
|
|
||||||
sprintf(buffer, "X wins: %d", winCount[0]);
|
|
||||||
C2D_TextParse(&text, buf, buffer);
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 305, 20, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
sprintf(buffer, "O wins: %d", winCount[1]);
|
|
||||||
C2D_TextParse(&text, buf, buffer);
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 305, 40, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
sprintf(buffer, "Draws: %d", winCount[2]);
|
|
||||||
C2D_TextParse(&text, buf, buffer);
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 305, 60, 0, 0.5f, 0.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
C2D_TextBufDelete(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkWin()
|
void checkWin()
|
||||||
{
|
{
|
||||||
if(pressedSquares[0] == pressedSquares[1] && pressedSquares[1] == pressedSquares[2] && pressedSquares[0] != 0)
|
if(pressedSquares[0] == pressedSquares[1] && pressedSquares[1] == pressedSquares[2] && pressedSquares[0] != 0)
|
||||||
|
@ -200,26 +171,9 @@ void checkWin()
|
||||||
{
|
{
|
||||||
win = true;
|
win = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAll9()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < 9; i++)
|
|
||||||
{
|
|
||||||
if(pressedSquares[i] == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
all9 = true;
|
|
||||||
winCount[2]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
romfsInit();
|
romfsInit();
|
||||||
|
@ -246,25 +200,21 @@ 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();
|
||||||
drawWhoseMove();
|
drawWhoseMove();
|
||||||
drawMoves(1);
|
drawMoves(1);
|
||||||
winCountShow();
|
|
||||||
C2D_SceneBegin(bottom);
|
C2D_SceneBegin(bottom);
|
||||||
drawGridBottomScreen();
|
drawGridBottomScreen();
|
||||||
drawMoves(2);
|
drawMoves(2);
|
||||||
//check if touched
|
//check if touched
|
||||||
if(touch.px != 0 && touch.py != 0)
|
if(touch.px != 0 && touch.py != 0)
|
||||||
touching(touch);
|
touching(touch);
|
||||||
checkAll9();
|
|
||||||
checkWin();
|
checkWin();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if(win)
|
|
||||||
{
|
{
|
||||||
C2D_SceneBegin(top);
|
C2D_SceneBegin(top);
|
||||||
C2D_Text text;
|
C2D_Text text;
|
||||||
|
@ -273,43 +223,20 @@ int main(int argc, char **argv) {
|
||||||
{
|
{
|
||||||
C2D_TextParse(&text, buf, "O wins!");
|
C2D_TextParse(&text, buf, "O wins!");
|
||||||
C2D_TextOptimize(&text);
|
C2D_TextOptimize(&text);
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 10, 0, 3.5f, 3.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));
|
||||||
if(!addedWin)
|
|
||||||
{
|
|
||||||
winCount[1]++;
|
|
||||||
addedWin = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
C2D_TextParse(&text, buf, "X wins!");
|
C2D_TextParse(&text, buf, "X wins!");
|
||||||
C2D_TextOptimize(&text);
|
C2D_TextOptimize(&text);
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 10, 0, 3.5f, 3.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));
|
||||||
if(!addedWin)
|
|
||||||
{
|
|
||||||
winCount[0]++;
|
|
||||||
addedWin = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
C2D_TextBufDelete(buf);
|
C2D_TextBufDelete(buf);
|
||||||
|
|
||||||
}
|
|
||||||
else if(all9)
|
|
||||||
{
|
|
||||||
C2D_SceneBegin(top);
|
|
||||||
C2D_Text text;
|
|
||||||
C2D_TextBuf buf = C2D_TextBufNew(4096);
|
|
||||||
C2D_TextParse(&text, buf, "Draw!");
|
|
||||||
C2D_TextOptimize(&text);
|
|
||||||
C2D_DrawText(&text, C2D_WithColor, 10, 10, 0, 3.5f, 3.5f, C2D_Color32(0xFF, 0xFF, 0xFF, 0xFF));
|
|
||||||
C2D_TextBufDelete(buf);
|
|
||||||
}
|
|
||||||
C2D_SceneBegin(bottom);
|
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