[Answered] Animations in a window

I’m planning on making a small app, which draws some “real-time” images in a window.

On the old Mac, I’d probably do a “write directly to screen”.

On Mac OS X, the slow way would be to create a NSBitmapImageRep and update the display once per frame using [self setNeedsDisplay:YES]; -the quicker way would likely be to use an OpenGLView.

My animated content could be compared to a starfield, a movie or a game with sprites.

What’s the preferred way to do this in a BWindow ?

You could start by using the drawing functions of BWindow (documented in HaikuBook and BeBook).
There’s also BDirectwindow which supposedly gives you direct access to the graphics card frame buffer (according the HaikuBook).

2 Likes

You can use BMessageRunner to call drawing animation frames at specific rate.

1 Like

Excellent - I think BDirectwindow is for me. :slight_smile:

Thank you, I’ll very likely do that. :slight_smile: