Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program life;
- uses GraphABC;
- type TMatrix = array of array of integer;
- type TColors = array of array of Color;
- type TNames = array[0..140] of String;
- var sizeEnt:integer;
- type list = ^s;
- s = record
- x, y,
- age : integer;
- name : string;
- dead : boolean;
- col : Color;
- next : list;
- procedure create(i, j: integer; n: string; c: Color);
- begin
- x:= i;
- y:= j;
- name:= n;
- age:= 0;
- col:= c;
- dead:= false;
- end;
- procedure createFlower(i, j: integer; c: Color);
- begin
- x:= i;
- y:= j;
- age:= 0;
- col:= c;
- dead:= false;
- end;
- function update(width, height: integer; var l, f: list; names: TNames):list;
- begin
- if NOT(dead) then begin
- inc(age);
- dead:= (0 = Random(round(4000 / age))) AND (age > 50);
- var count:= 0;
- repeat
- inc(count);
- x:= x + Random(3) - 1;
- y:= y + Random(3) - 1;
- if x < 0 then
- x:= 0;
- if x > width then
- x:= width;
- if y < 0 then
- y:= 0;
- if y > height then
- y:= height;
- until (l^.existing(x, y, l)) AND (count > 5);
- update:= l;
- if l^.existing(x, y, f) then begin
- removeOfCoord(x, y, f);
- var dx: list;
- new(dx);
- dx^.create(x, y, names[Random(141)], l^.col);
- dx^.next:= l;
- update:= dx;
- end;
- {
- TextOut(min(WindowWidth, WindowHeight) + 280, 50 + sizeEnt * 20);
- sizeEnt:= sizeEnt + 1;
- }
- end;
- end;
- function existing(x, y: integer; l:list):boolean;
- var dx:list;
- var e:boolean;
- begin
- dx:= l;
- e:= false;
- while dx <> nil do begin
- e:= e OR ((dx^.x = x) AND (dx^.y = y));
- dx:= dx^.next;
- end;
- existing:= e;
- end;
- function updateFlower(width, height: integer; l, e: list; mrx: TMatrix):list;
- begin
- if NOT(dead) then begin
- inc(age);
- dead:= (0 = Random(round(20 / age))) AND (age > 6);
- updateFlower:= l;
- var count: integer;
- if age mod 5 = 0 then begin
- var i, j:integer;
- count:= 0;
- repeat
- count:= count + 1;
- i:= x + Random(11) - 5;
- j:= y + Random(11) - 5;
- until ((i < 0) OR (i > width) OR (j < 0) OR (j > height) OR ((x = i) AND (j = y)) OR NOT existing(i, j, l) OR NOT existing(i, j, e) OR (mrx[i, j] < 600) OR (mrx[i, j] > 1000)) AND (count > 2);
- if (count < 4) AND (i > -1) AND (i < width) AND (j > -1) AND (j < height) AND NOT ((x = i) AND (j = y)) AND NOT existing(i, j, l) AND NOT existing(i, j, e) then begin
- if ((mrx[i, j] > 600) AND (mrx[i, j] < 1000)) then begin
- var x: list;
- new(x);
- x^.createFlower(i, j, l^.col);
- x^.next:= l;
- updateFlower:= x;
- end;
- end;
- end;
- end;
- end;
- procedure draw(SCALE, up, right: integer);
- begin
- var i:= y * SCALE;
- var j:= x * SCALE;
- if (i + up > -1) AND
- (j + right > -1) AND
- (j + right + SCALE < min(WindowHeight, WindowWidth) + 1) AND
- (i + up + SCALE < min(WindowHeight, WindowWidth) + 1) then begin
- SetPenColor(col);
- if SCALE > 1 then begin
- SetBrushColor(col);
- SetBrushStyle(bsSolid);
- Rectangle(j + right, i + up, j + right + SCALE - 1, i + up + SCALE - 1);
- end else
- SetPixel(j + right, i + up, col);
- end;
- end;
- function inform:string;
- begin
- inform:= name + ' - age: ' + age + ' x: ' + x + ' y: ' + y;
- end;
- function informFlower:string;
- begin
- informFlower:= ('Flower - age: ' + age + ' x: ' + x + ' y: ' + y);
- end;
- function add(l:list):list;
- var x: list;
- begin
- new(x);
- x^.next:= l;
- add:= x;
- end;
- function remove(var l:list):list;
- var x, dx:list;
- begin
- x:= l;
- while (x <> nil) AND NOT (x^.dead) do begin
- dx:= x;
- x:= x^.next;
- end;
- if x <> nil then begin
- dx^.next:= x^.next;
- dispose(x);
- end;
- end;
- function removeOfCoord(i, j: integer; var l:list):list;
- var x, dx:list;
- begin
- x:= l;
- if (l <> nil) AND ((l^.x = i) AND (l^.y = j)) then begin
- l:= l^.next;
- dispose(x);
- end;
- while (x <> nil) AND NOT ((x^.x = i) AND (x^.y = j)) do begin
- dx:= x;
- x:= x^.next;
- end;
- if x <> nil then begin
- if (x^.next <> nil) then
- dx^.next:= x^.next
- else
- dx^.next:= nil;
- dispose(x);
- x:= dx^.next;
- end;
- end;
- function removeAll(var l:list):list;
- var x, dx:list;
- begin
- x:= l;
- if (l <> nil) AND (l^.dead) then begin
- l:= l^.next;
- dispose(x);
- end;
- while x <> nil do begin
- while (x <> nil) AND NOT (x^.dead) do begin
- dx:= x;
- x:= x^.next;
- end;
- if x <> nil then begin
- if x^.next <> nil then
- dx^.next:= x^.next
- else
- dx^.next:= nil;
- dispose(x);
- x:= dx^.next;
- end;
- end;
- end;
- procedure removeEverything(l:list);
- var x:list;
- begin
- while l<>nil do begin
- x:= l;
- l:= l^.next;
- dispose(x);
- end;
- end;
- end;
- var
- matrix : TMatrix;
- colors : TColors;
- entities : list;
- flowers : list;
- names: TNames;
- maxFPS:= 15;
- SCALE,
- WINDOW_W,
- WINDOW_H,
- WIDTH,
- HEIGHT,
- up,
- right,
- changeHeight,
- minHeight,
- maxHeight,
- reading,
- antiAlias,
- speed,
- mode: integer;
- fps,
- readed: real;
- pause,
- isWorking: boolean;
- procedure initNames;
- begin
- names[0]:= 'Aaron';
- names[1]:= 'Abraham';
- names[2]:= 'Adam';
- names[3]:= 'Adrian';
- names[4]:= 'Aidan';
- names[5]:= 'Alan';
- names[6]:= 'Albert';
- names[7]:= 'Alejandro';
- names[8]:= 'Alex';
- names[9]:= 'Alexander';
- names[10]:= 'Alfred';
- names[11]:= 'Andrew';
- names[12]:= 'Ashley';
- names[13]:= 'Benjamin';
- names[14]:= 'Bernard';
- names[15]:= 'Blake';
- names[16]:= 'Brandon';
- names[17]:= 'Brian';
- names[18]:= 'Bruce';
- names[19]:= 'Bryan';
- names[20]:= 'Bailey';
- names[21]:= 'Barbara';
- names[22]:= 'Beatrice';
- names[23]:= 'Belinda';
- names[24]:= 'Brianna';
- names[25]:= 'Bridjet';
- names[26]:= 'Brooke';
- names[27]:= 'Cameron';
- names[28]:= 'Carl';
- names[29]:= 'Carlos';
- names[30]:= 'Charles';
- names[31]:= 'Christopher';
- names[32]:= 'Daniel';
- names[33]:= 'David';
- names[34]:= 'Dennis';
- names[35]:= 'Diana';
- names[36]:= 'Dorothy';
- names[37]:= 'Edward';
- names[38]:= 'Elijah';
- names[39]:= 'Eric';
- names[40]:= 'Ethan';
- names[41]:= 'Evan';
- names[42]:= 'Elizabeth';
- names[43]:= 'Ella';
- names[44]:= 'Emily';
- names[45]:= 'Emma';
- names[46]:= 'Erin';
- names[47]:= 'Evelyn';
- names[48]:= 'Francis';
- names[49]:= 'Fred';
- names[50]:= 'Fiona';
- names[51]:= 'Florence';
- names[52]:= 'Freda';
- names[53]:= 'Gabriel';
- names[54]:= 'Gavin';
- names[55]:= 'Geoffrey';
- names[56]:= 'George';
- names[57]:= 'Gerld';
- names[58]:= 'Gilbert';
- names[59]:= 'Gordon';
- names[60]:= 'Graham';
- names[61]:= 'Gregory';
- names[62]:= 'Gloria';
- names[63]:= 'Gabriella';
- names[64]:= 'Gabrielle';
- names[65]:= 'Gladys';
- names[66]:= 'Grace';
- names[67]:= 'Harold';
- names[68]:= 'Harry';
- names[69]:= 'Helen';
- names[70]:= 'Ian';
- names[71]:= 'Isaac';
- names[72]:= 'Isaiah';
- names[73]:= 'Jake';
- names[74]:= 'James';
- names[75]:= 'Jason';
- names[76]:= 'Jayden';
- names[77]:= 'Jeffery';
- names[78]:= 'Jeremiah';
- names[79]:= 'Jesse';
- names[80]:= 'Jesus';
- names[81]:= 'John';
- names[82]:= 'Julia';
- names[83]:= 'Keith';
- names[84]:= 'Kevin';
- names[85]:= 'Kyle';
- names[86]:= 'Katelyn';
- names[87]:= 'Katherine';
- names[88]:= 'Kathryn';
- names[89]:= 'Kayla';
- names[90]:= 'Kaylee';
- names[91]:= 'Kimberly';
- names[92]:= 'Kylie';
- names[93]:= 'Landon';
- names[94]:= 'Lawrence';
- names[95]:= 'Leonars';
- names[96]:= 'Lewis';
- names[97]:= 'Logan';
- names[98]:= 'Louis';
- names[99]:= 'Lucas';
- names[100]:= 'Luke ';
- names[101]:= 'Laura';
- names[102]:= 'Lillian';
- names[103]:= 'Lily';
- names[104]:= 'Linda';
- names[105]:= 'Lorna';
- names[106]:= 'Luccile';
- names[107]:= 'Lucy';
- names[108]:= 'Lynn';
- names[109]:= 'Malcolm';
- names[110]:= 'Martin';
- names[111]:= 'Mason';
- names[112]:= 'Matthew';
- names[113]:= 'Michael';
- names[114]:= 'Maria';
- names[115]:= 'Molly';
- names[116]:= 'Peter';
- names[117]:= 'Philip';
- names[118]:= 'Pamela';
- names[119]:= 'Ryan ';
- names[120]:= 'Rachel';
- names[121]:= 'Rebecca';
- names[122]:= 'Riley';
- names[123]:= 'Rita';
- names[124]:= 'Simon';
- names[125]:= 'Stanley';
- names[126]:= 'Steven';
- names[127]:= 'Tyler';
- names[128]:= 'Taylor';
- names[129]:= 'Trinity';
- names[130]:= 'Victoria';
- names[131]:= 'Violet';
- names[132]:= 'Virginia';
- names[133]:= 'Wallace';
- names[134]:= 'Walter';
- names[135]:= 'William';
- names[136]:= 'Wyatt';
- names[137]:= 'Xavier';
- names[138]:= 'Yvonne';
- names[139]:= 'Zachary';
- names[140]:= 'Romeo';
- end;
- procedure fillMatrix(lu, ru, ld, rd, n: real; k, l: integer);
- var c, cu, cl, cr, cd: real;
- var len, ran: integer;
- begin
- len:= round(n / 2);
- ran:= round(n / WIDTH * 500);
- c:= Random(ran) - ran / 2 + ((lu + ru + ld + rd) / 4);
- cu:= Random(ran) - ran / 2 + ((lu + ru + c) / 3);
- cl:= Random(ran) - ran / 2 + ((lu + ld + c) / 3);
- cr:= Random(ran) - ran / 2 + ((ru + rd + c) / 3);
- cd:= Random(ran) - ran / 2 + ((ld + rd + c) / 3);
- matrix[k + len, l + len]:= round(c);
- matrix[k, l + len]:= round(cu);
- matrix[k + len, l]:= round(cl);
- matrix[k + len, l + round(n)]:= round(cr);
- matrix[k + round(n), l + len]:= round(cd);
- if n > 2 then begin
- fillMatrix(lu, cu, cl, c, len, k, l);
- fillMatrix(cu, ru, c, rd, len, k, l + len);
- fillMatrix(cl, c, ld, cd, len, k + len, l);
- fillMatrix(c, cr, cd, rd, len, k + len, l + len);
- end;
- end;
- procedure passFl(x: integer;l:list);
- var y:integer;
- begin
- y:= 50;
- while l <> nil do begin
- TextOut(x + 280, y, l^.informFlower);
- l:= l^.next;
- y:= y + 20;
- end;
- end;
- procedure updateEnt(l:list);
- begin
- while l <> nil do begin
- entities:= l^.update(WIDTH, HEIGHT, entities, flowers, names);
- l:= l^.next;
- end;
- end;
- procedure updateFl(l:list);
- begin
- while l <> nil do begin
- flowers:= l^.updateFlower(WIDTH, HEIGHT, flowers, entities, matrix);
- l:= l^.next;
- end;
- end;
- procedure drawEnt(l:list);
- begin
- while l <> nil do begin
- l^.draw(SCALE, up, right);
- l:= l^.next;
- end;
- end;
- procedure setPause(p: boolean);
- begin
- pause:= p;
- if pause then
- SetWindowTitle('PAUSE');
- end;
- procedure maxFPSdown();
- begin
- if maxFPS > 1 then
- maxFPS:= maxFPS - 1
- else begin
- setPause(true);
- maxFPS:= 0;
- end;
- end;
- procedure maxFPSup();
- begin
- maxFPS:= maxFPS + 1;
- if pause then setPause(false);
- end;
- procedure movement(step: integer; var vec: integer);
- begin
- vec:= vec + step;
- end;
- procedure toCenter();
- var offset: integer;
- begin
- up:= 0;
- right:= 0;
- offset:= round((min(WindowWidth, WindowHeight) - WINDOW_W) / 2);
- movement(offset, up);
- movement(offset, right);
- end;
- procedure setScale(s: integer);
- var running: boolean;
- begin
- if s > 0 then begin
- running:= true;
- while running do
- if NOT(isWorking) then begin
- SCALE:= s;
- WINDOW_W:= SCALE * WIDTH;
- WINDOW_H:= SCALE * HEIGHT;
- running:= false;
- end;
- end;
- end;
- procedure initEnvironment();
- var i: integer;
- begin
- antiAlias:= 0;
- SetLength(matrix, WIDTH + 1);
- SetLength(colors, WIDTH);
- for i:= 0 to WIDTH - 1 do begin
- SetLength(matrix[i], WIDTH + 1);
- SetLength(colors[i], WIDTH);
- end;
- SetLength(matrix[WIDTH], WIDTH + 1);
- matrix[0, 0]:= Random(1500);
- matrix[0, WIDTH]:= Random(1500);
- matrix[HEIGHT, 0]:= Random(1500);
- matrix[HEIGHT, WIDTH]:= Random(1500);
- fillMatrix(matrix[0, 0],
- matrix[0, WIDTH],
- matrix[HEIGHT, 0],
- matrix[HEIGHT, WIDTH],
- WIDTH, 0, 0);
- setScale(1);
- toCenter();
- end;
- procedure smooth(x, y: integer);
- var delta, count: integer;
- var am: real;
- begin
- count:= 0;
- am:= 0;
- for var i:= -1 to 1 do begin
- for var j:= -1 to 1 do begin
- if (x + i > -1) AND (y + j > -1) AND (x + i < WIDTH + 1) AND (y + j < HEIGHT + 1) then begin
- inc(count);
- am:= am + matrix[x + i, y + j];
- end;
- end;
- end;
- if antiAlias = 2 then
- matrix[x, y]:= round(am / count) + Random(7) - 3
- else begin
- delta:= matrix[x, y] - round(am / count);
- case delta of
- -1..1: delta:= Random(11) - 5;
- end;
- if (delta > 0) then
- matrix[x, y]:= round(matrix[x, y] - Random(delta))
- else
- matrix[x, y]:= round(matrix[x, y] + Random(Abs(delta)));
- end;
- end;
- procedure update();
- begin
- maxHeight:= -1000;
- minHeight:= 1500;
- for var x:= 0 to WIDTH do begin
- for var y:= 0 to HEIGHT do begin
- if antiAlias <> 0 then smooth(x, y);
- if maxHeight < matrix[x, y] then maxHeight:= matrix[x, y];
- if minHeight > matrix[x, y] then minHeight:= matrix[x, y];
- end;
- end;
- end;
- procedure calculateColors();
- var a: real;
- begin
- for var x:= 0 to WIDTH - 1 do begin
- for var y:= 0 to HEIGHT - 1 do begin
- var arithMean:= round((matrix[x, y] + matrix[x + 1, y] + matrix[x, y + 1] + matrix[x + 1, y + 1]) / 4);
- case arithMean of
- -1000..400: begin
- if arithMean < 0 then
- colors[x,y]:= RGB(28, 15, 181)
- else begin
- a:= arithMean / 400;
- colors[x,y]:= RGB(round(28 + 123 * a), round(15 + 207 * a), round(181 + 72 * a));
- end;
- end;
- 401..600: begin
- a:= (arithMean - 400) / 200;
- colors[x,y]:= RGB(round(250 - 10 * a), round(223 - 31 * a), round(133 + 7 * a));
- end;
- 601..1000: begin
- a:= (arithMean - 600) / 400;
- colors[x,y]:= RGB(round(81 - 26 * a), round(232 - 77 * a), round(77 - 16 * a));
- end;
- 1001..1200: begin
- a:= (arithMean - 1000) / 200;
- colors[x,y]:= RGB(round(129 - 26 * a), round(173 - 52 * a), round(180 - 42 * a));
- end;
- 1201..1500: begin
- a:= (arithMean - 1200) / 300;
- colors[x,y]:= RGB(round(248 - 13 * a), round(253 - 8 * a), round(253 - 8 * a));
- end;
- end;
- end;
- end;
- end;
- procedure draw();
- var y:= 0;
- var x:= 0;
- begin
- isWorking:= true;
- while y < WINDOW_H do begin
- x:= 0;
- while x < WINDOW_W do begin
- if (x + up > -1) AND
- (y + right > -1) AND
- (y + right + SCALE < min(WindowHeight, WindowWidth) + 1) AND
- (x + up + SCALE < min(WindowHeight, WindowWidth) + 1) then begin
- SetPenColor(colors[round(y / SCALE), round(x / SCALE)]);
- if SCALE > 1 then begin
- SetBrushColor(colors[round(y / SCALE), round(x / SCALE)]);
- SetBrushStyle(bsSolid);
- Rectangle(y + right, x + up, y + right + SCALE, x + up + SCALE);
- end else
- SetPixel(y + right, x + up, colors[y, x]);
- end;
- x:= x + SCALE;
- end;
- y:= y + SCALE;
- end;
- isWorking:= false;
- end;
- procedure createNewWorld();
- begin
- if reading = 1 then begin
- ClearWindow(clWhite);
- WIDTH:= round(readed);
- HEIGHT:= WIDTH;
- initEnvironment();
- reading:= 2;
- end;
- end;
- procedure changeH(x, y, h: integer);
- begin
- if (x > -1) AND (y > -1) AND (x < WIDTH + 1) AND (y < HEIGHT + 1) then begin
- var v:= matrix[x, y] + h;
- if v > 1501 then
- matrix[x, y]:= 1500
- else
- if v < -1000 then
- v:= -1000
- else
- matrix[x, y]:= v;
- end;
- end;
- procedure initEditingMode();
- begin
- mode:= 0;
- OnMouseMove:= (x, y, mb) -> if mb <> 0 then
- changeH(round((x - right) / SCALE),
- round((y - up) / SCALE),
- (mb * 2 - 3) * -changeHeight);
- OnMouseDown:= nil;
- end;
- procedure initCreatursMode();
- begin
- mode:= 1;
- OnMouseMove:= nil;
- OnMouseDown:= (x, y, mb) -> begin
- var i:= round((x - right) / SCALE);
- var j:= round((y - up) / SCALE);
- if (i > -1) AND
- (j > -1) AND
- (i < WIDTH + 1) AND
- (j < HEIGHT + 1) then begin
- if mb = 1 then begin
- entities:= entities^.add(entities);
- entities^.create(i, j, names[Random(141)], RGB(180, 40, 180));
- end else begin
- flowers:= flowers^.add(flowers);
- flowers^.createFlower(i, j, RGB(200, 200, 100));
- end;
- end;
- end;
- end;
- procedure disposeLists();
- begin
- entities^.removeEverything(entities);
- flowers^.removeEverything(flowers);
- entities:= nil;
- flowers:= nil;
- end;
- procedure KeyDown(key: integer);
- begin
- case key of
- VK_ADD: maxFPSup();
- VK_SUBTRACT: maxFPSdown();
- VK_SPACE: setPause(NOT(pause));
- VK_G: begin
- disposeLists();
- initEditingMode();
- initEnvironment();
- end;
- VK_R: reading:= 0;
- VK_B: begin
- changeHeight:= round(readed);
- reading:= 2;
- end;
- VK_W: createNewWorld();
- VK_O: setScale(SCALE - 1);
- VK_P: setScale(SCALE + 1);
- VK_A: begin
- inc(antiAlias);
- if antiAlias = 3 then
- antiAlias:= 0;
- end;
- VK_M: begin
- inc(mode);
- if mode > 1 then
- mode:= 0;
- if mode = 0 then
- initEditingMode()
- else
- initCreatursMode();
- end;
- VK_D: disposeLists();
- VK_UP: movement(speed, up);
- VK_DOWN: movement(-speed, up);
- VK_RIGHT: movement(-speed, right);
- VK_LEFT: movement(speed, right);
- end;
- end;
- procedure createOpenWindow();
- begin
- SetWindowSize(400, 200);
- SetWindowPos(round(ScreenWidth / 2) - 200, round(ScreenHeight / 2) - 100);
- TextOut(round(WindowWidth / 2 - 60), round(WindowHeight / 2 - 20), 'Enter world size(power of two)');
- read(WIDTH);
- HEIGHT:= WIDTH;
- end;
- procedure initMainFunc();
- begin
- antiAlias:= 0;
- changeHeight:= 50;
- readed:= 0;
- reading:= 2;
- initNames();
- end;
- procedure initMainWindow();
- begin
- SetWindowPos(0, 0);
- Sleep(500);
- initEnvironment();
- Sleep(500);
- SetWindowSize(ScreenWidth, ScreenHeight);
- setScale(1);
- toCenter();
- OnKeyDown:= KeyDown;
- OnMouseDown:= nil;
- OnMouseMove:= (x, y, mb) -> if mb <> 0 then
- changeH(round((x - right) / SCALE),
- round((y - up) / SCALE),
- (mb * 2 - 3) * -changeHeight);
- end;
- procedure info(start: real);
- var s: string;
- begin
- if NOT(pause) then begin
- fps:= 1000 / (Milliseconds - start);
- SetWindowTitle('fps: ' + (Trunc(fps * 100) / 100));
- end;
- s:= 'Anti aliasing mode: ';
- if antiAlias = 2 then
- s:= s + 'Full anti aliasing'
- else
- if antiAlias = 1 then
- s:= s + 'Local anti aliasing'
- else
- s:= s + 'No anti aliasing';
- SetBrushColor(clWhite);
- var m:= min(WindowWidth, WindowHeight);
- TextOut(m + 10, 50, s);
- TextOut(m + 10, 70, 'MaxFPS: ' + maxFPS);
- TextOut(m + 10, 90, 'Brush: ' + changeHeight);
- TextOut(m + 10, 110, 'Size: ' + WIDTH + 'x' + HEIGHT);
- TextOut(m + 10, 130, 'Scale: ' + SCALE);
- TextOut(m + 10, 150, 'Minimal height: ' + minHeight);
- TextOut(m + 10, 170, 'Maximal height: ' + maxHeight);
- TextOut(m + 10, 220, 'SPACE -Pause');
- TextOut(m + 10, 240, 'G -Generation of a new world');
- TextOut(m + 10, 260, 'A -Change the anti aliasing mode');
- TextOut(m + 10, 280, 'R -Read the data');
- TextOut(m + 10, 300, 'B -Assign brush');
- TextOut(m + 10, 320, 'W -Assign world size');
- TextOut(m + 10, 340, '+/- -Controller Max FPS');
- TextOut(m + 10, 360, 'P/O -Controller scaling');
- TextOut(m + 10, 380, 'UP/DOWN/RIGHT/LEFT -Offset the image');
- Line(m, 0, m, m);
- end;
- begin
- var start, finish : real;
- start:= -1;
- speed:= 10;
- pause:= false;
- initMainFunc();
- createOpenWindow();
- Sleep(500);
- initMainWindow();
- Sleep(500);
- while (true) do begin
- finish:= Milliseconds;
- LockDrawing();
- if ((start = -1) OR (1000 / maxFPS < (finish - start))) AND (NOT(pause)) then begin
- start:= Milliseconds;
- Redraw;
- if reading = 0 then begin
- read(readed);
- reading:= 1;
- end else begin
- if reading = 2 then begin
- Window.Clear();
- update();
- calculateColors();
- draw();
- if mode = 1 then begin
- sizeEnt:= 0;
- updateEnt(entities);
- entities^.removeAll(entities);
- updateFl(flowers);
- flowers^.removeAll(flowers);
- drawEnt(flowers);
- drawEnt(entities);
- end;
- info(start);
- end;
- end;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement