Hi! Sorry for delay, I had less time than I expected.
On Sunday 04 April 2004 19:45, chromatic wrote: > On Sun, 2004-04-04 at 10:04, Jens Rieks wrote: > > > I think I prefer letting SDL::App be the main entry point for SDL > > > applications, because *something* has to initialize SDL. > > > > So that anyone who wants to use SDL has to subclass from SDL::App? > > No, they just have to use SDL::App or write their own code to call the > NCI subs themselves. Sounds okay. > > Isn't it possible to do it when loading the SDL bytecode? > > Yes, but it's not as easy. Why not? Maybe create a pseudo class SDL::NCI when it does not exists, and attach the NCI PMCs to it as properties? Then it is possible to use get_class nci, "SDL::NCI" getprop nci, "SetVideoMode", nci nci( ... ) > I now think we should put all of the struct layouts in SDL.imc, so > people who want to write their own interface can do so against that, not > SDL::App. The structs can also go into a special class, or maybe everything into a single "SDL::_intern" class. > > I'm not sure if it is a bug, but @LOAD sections are called everytime > > load_bytecode is called. If you load the SDL bytecode twice, all classes > > are registered a second time, which will raise an exception. I'm not sure > > if it is a bug or a future, though. > > There are some other next to "@LOAD" and "@MAIN", but I can not find the > > list at the moment. > > I think that may be a bug, but we could protect against it. Yes. I am using 'find_method I0, "myclass"; if I0 > 1 goto END' in my new files. > > Indeed. But the main surface has to be usable with the same interface > > like every other surface. > > That's true. You're right; let's just return an SDL::Surface from > SDL::App::init() or BUILD() or whatever it is and tell people that this > is the main surface. Okay. > > > We should raise an exception if it does not work, but I have no idea > > > how to do that. > > > > I know how to raise an exception, what I don't know is how to check if a > > NCI function returned NULL. > > I will work on this. I'll prepare an example how to use exceptions. > > > One other design problem I am considering right now is how to hide the > > > difference between a double-buffered and a single-buffered surface. > > > With a single-buffered surface you have to call UpdateRect() on the > > > main surface explicitly. With a double-buffered surface, you only call > > > flip(). > > > > From a game-developer point of view, this should not be hidden. Both are > > different techniques requiring different redraw strategies. > > Different method names for different techniques then? Different > SDL::Surface subclasses for double-buffered and single-buffered? Good idea. What do you think about a hash interface for event handling? newsub key, .Sub, _key_x app["SDLK_x"] = key > -- c jens