I am manually wrapping a haptic lib for sdl2 and run into this struct:
typedef struct SDL_HapticDirection
{
Uint8 type;
Sint32 dir[3];
} SDL_HapticDirection;
I guess sdl really wants it to be named type. Is there a simple solution?
(manually wrapping since I cannot get c2nim to install using nimble, since nimble doesnt recognize my nim installation)
I have decided to use backticks like `type` always. So it is consistent and easier to guess for users.
Latest c2nim is smart, it is called 0.9.7, and uses `func`, `object` . Guess it will generate `type`, but I am not sure.
Edit:
You may manually install c2nim, I did that once. But nimble install should work, and c2nim is nice.
typ it is
What do you call "end" in a struct?
I usually change "type" to "kind".
Also, you might want to look at my sdl2 wrapper for nim: https://github.com/Vladar4/sdl2-nim
If yours is "complete" and you have tested it then why not merge the two? EDIT: @Vladar. Is this a case of things happening in 2 places at the same time or am I missing something? Your code looks nice and you have a nice game engine testing it.
Edit: @Vladar It seems that all the wrappers are missing imports. E.g. joystick needs sdl_libname and gamecontroller needs rwops. They are included in the sdl wrapper but that doesnt seem to make them visible to other imports. Or am I just doing it wrong?
jgoodgive: Your code looks nice and you have a nice game engine testing it.
Thanks, I tried to preserve all documentation from sdl2 headers and correctly convert it to nim's documentation comments. If by game engine you mean nimgame, it isn't based on sdl2-nim yet, but this is planned for the future and also might help debugging sdl2-nim itself.
jgoodgive: It seems that all the wrappers are missing imports. E.g. joystick needs sdl_libname and gamecontroller needs rwops. They are included in the sdl wrapper but that doesnt seem to make them visible to other imports. Or am I just doing it wrong?
You supposed to import sdl2/sdl as it includes all headers except sdl_image, sdl_mixer, sdl_net, sdl_ttf and sdl_gfx*, which you import when needed.