Add helloworld example
This commit is contained in:
parent
e0e70d16f3
commit
e36b1f812e
3 changed files with 90 additions and 0 deletions
30
examples/helloworld/helloworld.nim
Normal file
30
examples/helloworld/helloworld.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue