[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-devel] Redesign?
From: |
Kai Sterker |
Subject: |
[Adonthell-devel] Redesign? |
Date: |
Sun, 17 Aug 2003 11:32:00 +0200 |
Hi folks,
I am wondering whether we might have to change Adonthell's startup
mechanism a little, to allow the OS X target (and possibly others) to
work. Here is, how SDL on OS X does work:
* Replace the application's main method with it's own via preprocessor
magic
* In there, create a new NSApplication
* Start that application's main loop
* From within a callback that indicates that the main loop has just
started, the application's actual main function is called.
That means, everything required to have an SDL app running natively on
OS X happens before a single line of code of that app is executed. Once
the app is finished, SDL quits the whole program. Thus, the two
important lines from the callback above are:
/* Hand off to main application code */
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
I hope you can see why we are getting some difficulties here. Before
initializing SDL Video, the OS X specific initialization has to take
place. Obviously, this should happen just when the sdl gfx backend is
loaded.
However, we expect the gfx::init method to return after doing it's job.
However, that means we cannot start the NSApplication main loop,
otherwise we would only return after that loop is done. But the loop
has to be started for things to work smoothly.
So I am wondering whether it would be possible to make the graphics
stuff the last bit that should get initialized. That way, we could
directly jump to Adonthell's own "main loop" from there, which would
run as long as Adonthell is running. Since this loop would be different
for different editors and test scripts, etc., it could actually just a
small class that holds a callback that implements the actual loop. So
we had something like the following:
* register the app's main loop
* init all backends, gfx last
* gfx backend automatically starts main loop
* once main loop is done, gfx backend is automatically cleaned up
* this returns us to the main method, where the other backends can be
cleaned up
So the question is: if I would try such a design on OS X and it would
work, could we stick to that then? It's a bit more akward than the
current implementation, but I see no other way right now.
Kai
- [Adonthell-devel] Redesign?,
Kai Sterker <=
Re: [Adonthell-devel] Redesign?, Micah J. Cowan, 2003/08/18
Re: [Adonthell-devel] Redesign?, Kenneth Gangstoe, 2003/08/19