Hi,
Interesting topic! I?d like to try and help jumpstart the discussion with a few specific examples of areas where this discussion could possibly benefit from. They are probably not particularly great examples (I?m biting my tongue here as I write this), but alas? I?m also thinking out loud here! It would be even more awesome if these issues were not actually issues, and something I was just overlooking!
- SDL_Assert.
I really appreciate the work that has been put into this feature ? thanks Ryan and whomever else I might be leaving out! ? and absolutely love using it everywhere. The (admittedly, minor) problem that I?ve found when using it is that it enforces that I link to SDL explicitly (along with the header files).
If you do as I have, and use SDL as the underlying glue of a game engine (library called from the game), and so happen to go the route of wrapping things into functions and methods that are then called from the game ? you run into this minor nuisance, where you need to link to SDL within the game solely for the use of this feature. For me, the solution is obvious: I?d much rather link to SDL and package it with the game to get this feature than to go without it. (I?ve speculated that I could very well just copy the macro and its dependencies into my own project, but I?d much prefer not to).
This is a particularly tricky issue, though, because the assertion, like all the other implementations I?ve seen, rely on a macro. In this case, the macro is basically a special function loop. A very special function it is ? you can read up on the blog post Ryan made in regards to this that you can find in the header comments as to what it helps achieve. Anyhow, point being, if there was a way of better implementing this feature (wrapping it into a function that could be wrapped by another library) ? I?d be all for it. I?m at a loss of knowing if there even is another way, though, due to the ? rather unique constraints here of needing to evaluate any expression. Nor am I sure it is worth the trouble, if there even is another way.
- SDL Logging
Another awesome feature that I sometimes feel like could be in its own library. For the same reasons that I prefaced in #1 ? where I use SDL as the underlying glue in an engine.
- SDL_RenderCopy & floating-point math (perhaps the only sane example I might have :-P)
I recently came across an instance where having the ability to pass floating-point values to the destination rectangle of SDL_RenderCopy could simplify some of the mathematics involved in running animation loops ? where you inevitably run into fractional values during certain key frame intervals, etc. such as translating positions and scaling textures. (Internally, the integers you pass to SDL_RenderCopy are ultimately expressed as floating-point values for input to OpenGL ? not sure about DirectX, but presumably the same occurs?)
Anyhow, onwards to my point ? I quickly came to realize that I could very easily provide my own function prototypes that mimic SDL_RenderCopy by doing the internal work of GL_RenderCopy, all while maintaining compatibility with SDL Textures ? by using the public SDL_GL_Texture API. The only problem was that access to the SDL_Texture and SDL_Renderer structs are prohibited, and thus I lose the ability to use the internal error and callback fields specified therein. Perhaps not a big deal in the end (I might be able to provide my own facilities without much additional work?), but I don?t know, I abandoned the idea because of the internal refactoring work that it could involve on my engine, since everything is expressed as integers.
In closing, I?m not sure how sane it would be for the APIs of any of these examples to be refactored to allow for any of the things I?ve attempted to do while using SDL. But I still feel relatively new to all of this ? I also hope that my reply doesn?t derail things too much?.. it was not my intention at all.
Cheers,
Jeffrey Carpenter <@Jeffrey_Carpenter>
-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1572 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20141230/31bc3131/attachment-0001.bin