Mercurial > repos > tabletprog
diff samples/sdl.tp @ 278:1205c7a43cb4
Add bindings for SDL_ClearError, SDL_GetError, SDL_LoadBMP, SDL_CreateTextureFromSurface and a partial binding for SDL_RendererCopy
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 21 Jul 2014 12:51:38 -0700 |
parents | 2b58eafa360b |
children | eb83863fd33e |
line wrap: on
line diff
--- a/samples/sdl.tp Sun Jul 20 17:30:46 2014 -0700 +++ b/samples/sdl.tp Mon Jul 21 12:51:38 2014 -0700 @@ -9,8 +9,21 @@ (window createRenderer: -1 flags: ((window renderOpts) accelerated)) value: :render { render drawColor!: (sdl r: 0u8 g: 0u8 b: 255u8) render clear - render present - sdl delay: 3000u32 + (sdl loadBMP: "944.bmp") value: :surf { + (surf asTexture: render) value: :tex { + sdl clearError + if: (tex copyTo: render) != 0 { + print: "Failed to copy texture to renderer: " . (sdl getError) . "\n" + } + surf free + render present + sdl delay: 3000u32 + tex destroy + } none: { + surf free + } + } none: { + } render destroy } none: { print: "Failed to create renderer\n"