Hi there.

I brought this up before as a question - I don't like the lack of 
error-checking around some c wrapper functions (eg, in sdl2 wrappers); but now 
I have a very basic implementation.

Have updated the classic platformer.nim so that it delegates all of its 
SDL2-related error checking over to a new module, safe_sdl2.nim.

My forked and updated version of nim-platformer:

[https://github.com/wizzardx/nim-platformer](https://github.com/wizzardx/nim-platformer)

So instead of eg, code like this:
    
    
    sdlFailIf(not sdl2.init(INIT_VIDEO or INIT_TIMER or INIT_EVENTS)):
      "SDL2 initialization failed"
    

That can now be written as:
    
    
    safe_sdl2.safeInit(INIT_VIDEO or INIT_TIMER or INIT_EVENTS)
    

Inside safe_sdl2 we still do the same checks. We also have a lot of other 
sanity checks in there too, like eg some parameters must not have nil values, 
range checks, etc.

Comments?

Would other people find it useful if I made and uploaded a "safe_sdl2" module?

Reply via email to