2006. április 7., péntek

How to create a Starfield Simulation


Problem/Question/Abstract:

How to create a Starfield Simulation

Answer:

procedure TForm1.Button1Click(Sender: TObject);
var
  tmp: Integer;
begin
  for tmp := 1 to Num_Stars do {Num_Stars is an Integer value}
    Canvas.Pixels[Random(ClientWidth), Random(ClientHeight)] := clWhite;
end;

And you could get more fancy than that (i.e alter star color / greylevel for brightness, vary star
positions for galaxys).

Nincsenek megjegyzések:

Megjegyzés küldése