FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DerelictSDL2 Is In

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Feb 17, 2012 1:24 pm    Post subject: DerelictSDL2 Is In Reply with quote

For those interested, I've just pushed an SDL2 binding to the Derelict 3 repo. It's implemented against the mercurial repo revision #6284 (hg-6284:1893d507ba42). I can verify that it compiles and loads on Windows. Some caveats, though.

First, it likely won't load on Mac. I have no idea what the paths are for SDL2.

Second, I did not implement certain C headers related to threading (SDL_atomic.h, SDL_mutex.h and SDL_thread.h), since D has built-in thread/mutex support. I will happily add them (or accept pull requests) if necessary. Nor did I implement any of SDL_syswm.h, primarily because it's a mess of platform-specific versions, embedded structs, and whatnot. I will get to it eventually, but I think it's going to take some puzzling over. I also ignored everything that was irrelevant to D. If there is anything important missing, please let me know.

Finally, I had to comment out five functions that failed to load from the DLL I compiled. I haven't looked at investigated what's going on beyond verifying the function name strings were correct. The functions are:

SDL_AudioDeviceConnected
SDL_RedetectInputDevices
SDL_GetNumInputDevices
SDL_GetInputDeviceName
SDL_IsDeviceDisconnected

And that's it. I don't know when I'll get a chance to put this to some use to see if it works, so if anyone gets to it soonish I'd love to know if it works as expected. I'm sure there are bound to be mistakes. I was half asleep through most of it.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Sat Feb 18, 2012 5:37 am    Post subject: Reply with quote

I miss something like that in types.d:
Code:

alias Uint32 SDL_RendererFlags;

enum {
    SDL_RENDERER_SINGLEBUFFER = 0x00000001,
    SDL_RENDERER_PRESENTCOPY = 0x00000002,
    SDL_RENDERER_PRESENTFLIP2 = 0x00000004,
    SDL_RENDERER_PRESENTFLIP3 = 0x00000008,
    SDL_RENDERER_PRESENTDISCARD = 0x00000010,
    SDL_RENDERER_PRESENTVSYNC = 0x00000020,
    SDL_RENDERER_ACCELERATED = 0x00000040,
    SDL_RENDERER_SOFTWARE = 0x00000001,
}


edit:
And what is with the SDL_image extension? I hope i must not implement them itself. ^^
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Feb 18, 2012 8:27 am    Post subject: Reply with quote

mutable wrote:
I miss something like that in types.d:
Code:

alias Uint32 SDL_RendererFlags;

enum {
    SDL_RENDERER_SINGLEBUFFER = 0x00000001,
    SDL_RENDERER_PRESENTCOPY = 0x00000002,
    SDL_RENDERER_PRESENTFLIP2 = 0x00000004,
    SDL_RENDERER_PRESENTFLIP3 = 0x00000008,
    SDL_RENDERER_PRESENTDISCARD = 0x00000010,
    SDL_RENDERER_PRESENTVSYNC = 0x00000020,
    SDL_RENDERER_ACCELERATED = 0x00000040,
    SDL_RENDERER_SOFTWARE = 0x00000001,
}



Yeah, I overlooked that. THanks. But, I think you're looking at an older version of the SDL headers. Currently, it looks [url = http://hg.libsdl.org/SDL/file/d88e5195dee3/include/SDL_render.h#l63]like this[/url].

Quote:

edit:
And what is with the SDL_image extension? I hope i must not implement them itself. ^^


I'm only one man! I'll get to it when I can.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Sat Feb 18, 2012 8:35 am    Post subject: Reply with quote

aldacron wrote:
Quote:

edit:
And what is with the SDL_image extension? I hope i must not implement them itself. ^^


I'm only one man! I'll get to it when I can.
And you're doing an awesome job!
Back to top
View user's profile Send private message
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Sat Feb 18, 2012 8:51 am    Post subject: Reply with quote

aldacron wrote:

Yeah, I overlooked that. THanks. But, I think you're looking at an older version of the SDL headers. Currently, it looks [url = http://hg.libsdl.org/SDL/file/d88e5195dee3/include/SDL_render.h#l63]like this[/url].


Yeah, i copied it from my own SDL 2 Wrapper, sorry i'm not up to date. Smile

aldacron wrote:

I'm only one man! I'll get to it when I can.

No offense meant. I'm happy if you find time to do. Wink
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Feb 18, 2012 9:19 am    Post subject: Reply with quote

I've just made another rather important push to the repo. I had totally overlooked the init & quit stuff in SDL.h. Now that it's all in, I can verify that it all compiles and creates an OpenGL window successfully. Please let me know if anything else turns up missing or borked.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Sat Feb 18, 2012 1:42 pm    Post subject: Reply with quote

Up until now it looks good, no bugs found until yet. Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group