nim-libnx/examples/helloworld/helloworld.nim
Joey Yakimowich-Payne e36b1f812e Add helloworld example
2018-06-19 20:50:47 +09:00

30 lines
584 B
Nim

import libnx/gfx
import libnx/console
import libnx/hid
import libnx/applet
proc printf(formatstr: cstring) {.importc: "printf", varargs,
header: "<stdio.h>".}
proc main() =
gfxInitDefault()
discard consoleInit(nil)
printf("\x1b[16;20HHello World From NIM!")
echo "\x1b[17;20HHELLO FROM NIM"
while appletMainLoop():
hidScanInput()
let keysDown = hidKeysDown(CONTROLLER_P1_AUTO)
if (keysDown and KEY_PLUS.uint64) > 0.uint64:
break
gfxFlushBuffers()
gfxSwapBuffers()
gfxWaitForVsync()
gfxExit()
main()