Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Foreign declaration: SDL_CreateRGBSurface > x i i i i i i i i
- sdlprep =: 3 : 0
- 'width height'=. y
- sdl_init SDL_INIT_EVERYTHING
- appw=:sdl_createwindow 'test window';0;0;width;height;SDL_WINDOW_SHOWN+SDL_WINDOW_ALLOW_HIGHDPI
- appr=:sdl_createrenderer appw;_1;SDL_RENDERER_ACCELERATED+SDL_RENDERER_PRESENTVSYNC
- 'ww wh'=:2}.sdl_getwindowsize appw;(,_1);(,_1)
- 'rw rh'=:2}.sdl_getrendereroutputsize appr;(,_1);(,_1)
- NB. cxm=: rw % ww
- NB. cym=: rh % wh
- smoutput 'window:', (":appw), 'renderer:', (":appr)
- smoutput 'render width:',(":rw),' height:',(":rh)
- smoutput 'window width:',(":ww),' height:',(":wh)
- NB. This needs to be endian-aware at some point
- args=.0;rw;rh;32;16bff0000;16bff00;16bff;16bff000000
- smoutput args
- sfc=: sdl_creatergbsurface args
- NB. Practice structures. PACKING!!! Show printable format name
- pFormat=._3 ic memr (sfc+8),0,8 NB. sdl_surface->format
- format=._2 ic memr pFormat,0,4 NB. sdl_surface->format->format
- smoutput 'pixel format:',(psz sdl_getpixelformatname format)
- EMPTY
- )
- output when running...
- window:140547920885040renderer:140547920929408
- render width:1024 height:768
- window width:1024 height:768
- ┌─┬────┬───┬──┬────────┬─────┬───┬──────────┐
- │0│1024│768│32│16711680│65280│255│4278190080│
- └─┴────┴───┴──┴────────┴─────┴───┴──────────┘
- |domain error: sdl_creatergbsurface
- | sfc=: sdl_creatergbsurface args
- cder''
- 6 1
- The arg in question is the 1024, in a variable called rw, renderer width, but if I call by hand it works i.e. using numbers to set the surface dimensions:
- sdl_creatergbsurface 0;1024;768;32;16711680;65280;255;4278190080
- 140547918948464
- Not sure why it won't take the value of the 'rh' variable?!?!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement