Re: [AD] Platform specific functions in A5 [was Re: Windows Addition for Message Parsing]

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, October 8, 2008 12:16 pm, Evert Glebbeek said:
> Yes, but at the cost of platform portability. In a group where many
> people are on different platforms than Windows, that's something to
> keep in mind.
> We add that functionality to the Windows port. Ok, fine. But what
> makes Windows so special that we add it there? Why can't we have it
> on other platforms too? And if we do, are we going to have
> completely
> non-compatible implementations on those other platforms?
> So before going down that route, stop and consider if there isn't a
> way to do it that services all platforms (well, *nix/X11, Mac OS X
> and Windows anyway). There might not be, but I think the question
> needs to be asked.

A possible compromise would be having all the platform specifics of
window events encapsulated in a union, since I'm sure X11/Win/OSX
events are all too different to force into the same structure:

struct ALLEGRO_WINDOW_MESSAGE {
   union {
#ifdef ALLEGRO_WINDOWS
      struct {
         HWND window;
         UINT message;
         WPARAM wParam;
         HPARAM hParam;
      } win;
#endif
// unix
// osx
   };
};

(well, you get the idea...)

We could have a function to add these messages to an event queue.

There is a problem with this though. Windows requires specific
return codes, different for each message, to be returned from the
wndproc. If you're just firing off events into an event queue and
then letting the default window procedure handle the event, that may
and most likely will be a big problem. So I think the patch stands
as being better than this method.


Something else I'd like to say is, portability is good, but removing
platform specific features only hurts the end user. If a user wants
to make a game for X11 only, so be it. However I myself make every
effort to make my games portable across Windows and Linux (as those
are the two OSs I have access to). Does this mean I don't use any
non-portable code? No. In my current game I'm using Direct3D pixel
shaders. When I get around to the Linux port I will use OpenGL
shaders. Where would I be if those two things weren't possible? Some
portable hacky shader API? No shaders at all?

Every platform has unique features and I think it's reasonable in
some cases to allow access to those features.


Trent :{)>




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/