View previous topic :: View next topic |
Author |
Message |
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Nov 13, 2008 6:30 pm Post subject: |
|
|
The special initialization for Mac that was recently checked in is, unfortunately, not yet handled automatically. You need to handle it explicitly. Modify your code to look like this (based on a sample doob gave me):
Code: |
module sdltest;
import tango.io.Stdout;
import derelict.sdl.sdl;
import derelict.sdl.macinit.SDLMain;
void main()
{
macInit(1, ["main".ptr]);
DerelictSDL.load();
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
Stdout("error: SDL_Init").newline;
return;
}
if (pool)
pool.release;
if (sdlMain)
sdlMain.release;
}
|
This is a hack for now. I want to automate it so that it's handled from within DerelictSDL.load, but it will require some changes in doob's code. Without a Mac for me to test on, it makes the code-test cycle a bit cumbersome as I need to rely on others to test it (unless, of course, someone with a Mac wants to volunteer). I hope it will be taken care of in the near future. I'll be sure to post an announcement here when it is so that you can drop the hack and go back to the original version of your code. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Fri Nov 14, 2008 5:59 am Post subject: |
|
|
"macInit" should take the arguments that is recived as the arguments to "main", c style. I don't know how to do this automatically without hijacking the "main" function, perhaps there are API functions to get the argumetns. I guess that the calls to the release functions can be moved to "DerelictSDL.unload" or something like that.
Please let me know if there is something specific I can do or test to help out. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Nov 14, 2008 7:45 am Post subject: |
|
|
doob wrote: | "macInit" should take the arguments that is recived as the arguments to "main", c style. I don't know how to do this automatically without hijacking the "main" function, perhaps there are API functions to get the argumetns. |
Realistically, I don't see that the command line is necessary at all. It's not used by any of the Cocoa initialization, that I can see. The only use that's made of it is in the 'application' function, where the filenames of double-clicked or dragged-&-dropped documents are appended. This is a convenience, only.
For now, that can all be removed, hence removing the dependency on passing a command line arg at all. Then things should just work without any intervention from the client.. However, if someone wants support for dragged-&-dropped or double-clicked files in the future, that can easily be added in with a special global.
Quote: | I guess that the calls to the release functions can be moved to "DerelictSDL.unload" or something like that. |
Absolutely. Should be the last thing that happens. As such, the sdlMain and pool variables should be private to the SDLMain module.
Quote: | Please let me know if there is something specific I can do or test to help out. |
I'm going to give a shot at removing the uneeded cruft. But I can't test it. So if you don't mind, once I've got something I think should work, I'll hand it off to you for testing. Then if anything's broken, you can tweak it until it works as it should.
Sound OK to you? _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Fri Nov 14, 2008 9:03 am Post subject: |
|
|
Yeah sounds good. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Nov 14, 2008 6:52 pm Post subject: |
|
|
For the benefit of anyone following this thread, we've made some progress. Cleanup is now handled automatically, so you don't need to make calls to sdlMain.release or pool.release in your own code. And while macinit no longer accepts any arguments (so you don't have to pass it a command line), you still need to call it manually. There were some errors when calling it from DerelictSDL.load. Hopefully, we'll be able to get around that shortly. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Sat Nov 15, 2008 6:54 am Post subject: |
|
|
I've fixed the problem now, everything is handle automatically. No need to call any extra mac specific functions. |
|
Back to top |
|
|
michael
Joined: 23 Aug 2006 Posts: 13
|
Posted: Sat Nov 15, 2008 11:03 am Post subject: |
|
|
Just wanted to say that it's working fine here now without the mac specific stuff.
Thank you guys for the nice work!
~Michael |
|
Back to top |
|
|
|
|
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
|