I want to make some kind of "life-emulation", where generations of "Pixel-beings" can procreate the next.
So I want the program to be able to run in the "background", while the user can do something else.
I have cut and pasted something of a start, but is this a good way to do something like this?
Any suggestions of improvements or alternatives will be greatly apreciated. :)
The code so far:
(Of course it also need some buttons and other kind of control.)
So I want the program to be able to run in the "background", while the user can do something else.
I have cut and pasted something of a start, but is this a good way to do something like this?
Any suggestions of improvements or alternatives will be greatly apreciated. :)
The code so far:
SuperStrict Global TankWidth:Int=255,TankHeight:Int=255 Global CanvasWidth:Int=400, CanvasHeight:Int=300 Global ButtonHeight:Int=32, BorderSize:Int=16 Global EWindow:TGadget=CreateWindow("Evolution", 100,100,CanvasWidth+2*BorderSize,CanvasHeight+ButtonHeight+2*BorderSize) Global ECanvas:TGadget=CreateCanvas(BorderSize,BorderSize,CanvasWidth,CanvasHeight,EWindow) Global x:Int=0 Global y:Int=0 Global t:Int,u:Int ActivateGadget ECanvas Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_MOUSEENTER HideMouse Case EVENT_MOUSELEAVE ShowMouse Case EVENT_MOUSEMOVE x=EventX() y=EventY() Case EVENT_GADGETPAINT End Select SetGraphics CanvasGraphics (ECanvas) Cls For t=0 To Tankwidth-1 For u=0 To TankHeight-1 SetColor (Rnd(0,255),Rnd(0,255),Rnd(0,255)) Plot t,u Next Next DrawRect x,y,40,40 Flip RedrawGadget(ECanvas) Forever
(Of course it also need some buttons and other kind of control.)