Basic standard graphics

bearophile bearophileHUGS at lycos.com
Fri Nov 12 15:48:28 PST 2010


Adam D. Ruppe:

> I posted a simplified version of the C port to the site:
> 
> http://rosettacode.org/wiki/Image_Noise#D

The indents now are two spaces because RosettaCode asks for shorter lines. I have not compiled the modified version, so you may test if it works still; and you may add the number of frames per second it shows on your computer (you may add a bit of info on your PC too). std.random.uniform is probably very slow if you need just random bits :-) I vaguely remember some Knuth code to generate random bits fast. It may be added to std.random because random bits are a common enough need.

Regarding that SDL wrapper, your code contains lines like (surface = surf):

import sdl.SDL;
auto surface = SDL_SetVideoMode(320, 240, 8, ...);

I thinks this is more dtonic:

import sdl;
auto surface = sdl.SetVideoMode(320, 240, 8, ...);

Or even, probably better for D:

import sdl;
auto surface = sdl.setVideoMode(320, 240, 8, ...);

Bye,
bearophile


More information about the Digitalmars-d mailing list