grt-talk
[Top][All Lists]
Advanced

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

[grt-talk] Render window design


From: Nikodemus Siivola
Subject: [grt-talk] Render window design
Date: Tue, 8 Apr 2003 03:40:23 +0300 (EEST)

I've been looking into integrating the SDL and CLX code so that there was a
single render-function, single open-window function, single draw-pixel,
etc. Each would do the right thing depending on the value of
grt::+window-type+ -- either :SDL or :CLX.

This won't get into 0.1, however, since it will require too massive changes
to the CLX code.

Anyways, here's a draft.

As you can see it's pretty much based straight on you SDL code -- only that
the windows and screens are no longer passed explicitly around, which makes
sense if we can only have a single window at a time, and that draw-pixel
has been made responsible for calling refresh-window. These functions will
then internally call the appropriate sdl or clx functions.

function OPEN-WINDOW width height refresh => t

 Opens a new rendering window. Uses either CLX or SDL depending on the
 value of +WINDOW-TYPE+. The window has the width, height and
 refresh-frequency as given.

function DRAW-PIXEL x y color => t

 Draw pixel on buffer of the currently open window. If it has been
 1/refresh-frequency seconds since the last refresh of the
 window, calls REFRESH-WINDOW.

function REFRESH-WINDOW => t

 Makes the image on the window buffer visible on screen.

function CLOSE-WINDOW => t

 Closes the currently open window.

function EVENT-LOOP closure => t

 Enters an event-handling loop, calling the closure regularly
 as long as it returns true. Then still remains in the event handling
 loop, but no longer calls the closure. Must process the following events:
  - window closed
  - q pressed in window

---

But I still have to figure out how to integrate stuff for 0.1. I am tempted
to leave the CLX stuff out of 0.1, and put it back later once it works with
the above scheme. What do you think?

On a cheerier note, the per-pixel *display* speed is constant, so for
complex scenes it will not be a bottleneck even with CLX.

Cheers,

 -- Nikodemus






reply via email to

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