Make accounts, service, and result more Nim friendly
This commit is contained in:
parent
3256600653
commit
83a79afb3d
8 changed files with 435 additions and 15 deletions
28
examples/accounts/account_ex.nim
Normal file
28
examples/accounts/account_ex.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import libnx/wrapper/gfx
|
||||
import libnx/wrapper/hid
|
||||
import libnx/wrapper/console
|
||||
import libnx/account
|
||||
import libnx/utils
|
||||
|
||||
proc main() =
|
||||
gfxInitDefault()
|
||||
discard consoleInit(nil)
|
||||
|
||||
echo "\x1b[5;2H" & "Account info:"
|
||||
|
||||
withAccountService:
|
||||
try:
|
||||
let user = getActiveUser()
|
||||
echo "\x1b[6;2HUsername: " & user.username
|
||||
echo "\x1b[7;2HMiiID: " & $user.miiID
|
||||
echo "\x1b[8;2HIconID: " & $user.iconID
|
||||
except AccountError:
|
||||
echo "\x1b[6;2HNo user currently selected!"
|
||||
|
||||
mainLoop:
|
||||
let keysDown = hidKeysDown(CONTROLLER_P1_AUTO)
|
||||
|
||||
if (keysDown and KEY_PLUS.uint64) > 0.uint64:
|
||||
break
|
||||
|
||||
main()
|
||||
1
examples/accounts/account_ex.nim.cfg
Normal file
1
examples/accounts/account_ex.nim.cfg
Normal file
|
|
@ -0,0 +1 @@
|
|||
--path="../../src"
|
||||
|
|
@ -1,30 +1,17 @@
|
|||
import libnx/wrapper/gfx
|
||||
import libnx/wrapper/console
|
||||
import libnx/wrapper/hid
|
||||
import libnx/wrapper/applet
|
||||
|
||||
proc printf(formatstr: cstring) {.importc: "printf", varargs,
|
||||
header: "<stdio.h>".}
|
||||
import libnx/utils
|
||||
|
||||
proc main() =
|
||||
gfxInitDefault()
|
||||
|
||||
discard consoleInit(nil)
|
||||
|
||||
printf("\x1b[16;20HHello World From NIM!")
|
||||
echo "\x1b[17;20HHELLO FROM NIM"
|
||||
while appletMainLoop():
|
||||
hidScanInput()
|
||||
|
||||
mainLoop:
|
||||
let keysDown = hidKeysDown(CONTROLLER_P1_AUTO)
|
||||
|
||||
if (keysDown and KEY_PLUS.uint64) > 0.uint64:
|
||||
break
|
||||
|
||||
gfxFlushBuffers()
|
||||
gfxSwapBuffers()
|
||||
gfxWaitForVsync()
|
||||
|
||||
gfxExit()
|
||||
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue