simple display (from: GUI library for D)

bearophile bearophileHUGS at lycos.com
Fri Apr 8 17:30:31 PDT 2011


Adam D. Ruppe:

> My only concern is I don't want Phobos to depend on Xlib unless
> the module is actually imported. I don't think it will be a problem,
> but if it means a hello world won't run on a text only machine, that
> won't be ok.

I agree.


> But, I don't
> really like using a tuple for this - a regular struct makes it
> a little clearer what's going on, and can be made more efficient.

OK. (But for this module I think usage simplicity is more important than raw speed. Users that need more performance or more features are going to use something else and better. The idea here is to keep simple the things that are simple).


> (In the other thread, Nick suggested making it a simple uint
> internally, using property functions to emulate other outside
> faces. I like that.)

OK.


> > I suggest something like this, to swap the two image buffers
> 
> That's not really what you're doing there - display actually
> pops up a new window and waits for the user to close it.

Indeed, I was suggesting to open the window at the top of the program, and at the bottom of the program to swap the two buffers and show the drawn one.


> > Plus maybe some image.event(); reader with callbacks...
> 
> What would it do?

Read the events, like window closing, key pressed, mouse movements, etc. Take a look at Processing API, for ideas.

There are many situations where a simple built-in graphics is useful. Beside the example of Processing (that has anti-aliasing), there are many programs/small games that need just some 2D graphics:
http://rosettacode.org/wiki/Animate_a_pendulum

Bye,
bearophile


More information about the Digitalmars-d mailing list