summary refs log tree commit diff stats
path: root/examples/sdlex.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2010-02-24 01:04:39 +0100
committerAndreas Rumpf <rumpf_a@web.de>2010-02-24 01:04:39 +0100
commitf41bd71e6152174c3b0819c7549fa431e8a01222 (patch)
tree35bec88bad6f84e9551316888744037e8d15e598 /examples/sdlex.nim
parent6da95ed9ca899db702c6a7b17d2d7db14dbb0de4 (diff)
downloadNim-f41bd71e6152174c3b0819c7549fa431e8a01222.tar.gz
SQLite wrapper
Diffstat (limited to 'examples/sdlex.nim')
-rw-r--r--examples/sdlex.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/sdlex.nim b/examples/sdlex.nim
new file mode 100644
index 000000000..ae7f1b41e
--- /dev/null
+++ b/examples/sdlex.nim
@@ -0,0 +1,26 @@
+# Test the SDL interface:

+

+import

+  SDL

+

+var

+  screen, greeting: PSDL_Surface

+  r: TSDL_Rect

+

+if SDL_Init(SDL_INIT_VIDEO) == 0:

+  screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE or SDL_ANYFORMAT)

+  if screen == nil:

+    write(stdout, "screen is nil!\n")

+  else:

+    greeting = SDL_LoadBmp("backgrnd.bmp")

+    if greeting == nil:

+      write(stdout, "greeting is nil!")

+    r.x = 0'i16

+    r.y = 0'i16

+    discard SDL_blitSurface(greeting, nil, screen, addr(r))

+    discard SDL_flip(screen)

+    SDL_Delay(3000)

+else:

+  write(stdout, "SDL_Init failed!\n")

+

+SDL_Quit()