underware-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Underware-devel] MAFApplication & MAFWindow


From: Vincent Caron
Subject: [Underware-devel] MAFApplication & MAFWindow
Date: Thu, 18 Dec 2003 21:50:03 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4

Hello,

  I've worked on a MAFApplication and MAFWindow application, starting
from the 'MVC code style' of Pong from Loïc. Quickly packaged here:

  http://mksp.zerodeux.net/underware-0.1.8.tar.gz


Quick guide :

  - I've pasted some glue code from NGL to help for Win32 entry point
portability (I plan a win32 build very soon to check everything compiles
fine)

  - it is based on a '1 application = 1 window' model from SDL, which
shows from the GetWindow() method. However video code has been deported
at maximum to MAFWindow, and the MAF user should not rely on the window
being unique and global.

  - Controllers are registered from the application with AddController()

  - the event loop works not exactly the same : input events are fed to
controllers immediatly, while rendering events are fed to inputs
continuously (with still a framerate limit). Which means that
controllers and view are really asynchronous : it's complex on purpose,
I hope to stress the programming model this way.


And now for MAFWindow :

  - Views are registered from the window with AddView().
MAFView::Render() now passes the MAFWindow handle; they don't have to
muck with the VIDEO_RESIZE event to know the window dimension for instance.

  - everything else is rather straight forward

--

The visible difference in Pong is the new main.cpp with some trivial
code to create and run the application. The functionnal code from
PongGame.cpp has moved to PongApplication.cpp (ie. Load()).

Something _really_ visible is that it's really broken. I have too many
questions in my head about this MVC model implementation and the link to
event management to know how to fix it. Things that worry me :

  - where do you manage global keybindings ? I hacked a standalone
'PongKeyboardHandler : public MAFController' for that purpose, I'm not
sure it 's the right way to go.

  - resize handling and geometry bookkeeping in
PongPaddleModel/Controller does not look like a good idea. Actually the
mouse event should come with its context, ie. the MAFWindow*. Maybe
something to tweak with higher level MAF event types.

  - I'm not sure the window dimension should be kept in PongSceneModel,
what if I want to render it to different window ? That's why I
copy/pasted the Resize() code into the Render() one, using the
dimensions from the MAFWindow* parameter. Perf note: even a low-level
glViewPort call is 'gratis' if the dimension actually did not change
from the last rendering pass.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]