Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Обновил примеры проектов (examples/)
Browse files Browse the repository at this point in the history
  • Loading branch information
Helltar committed Apr 11, 2015
1 parent 3514095 commit 7029f83
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 65 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions bin/examples/Cubes/src/cubes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
BLOCK_SIZE = 24;

var
R, G, B: integer;
r, g, b: integer;
i, j: integer;

begin
for i := 0 to GetHeight do
begin
for j := 0 to GetWidth do
begin
R := Random(256);
G := Random(256);
B := Random(256);
r := Random(256);
g := Random(256);
b := Random(256);

SetColor(R, G, B);
SetColor(r, g, b);
FillRect(j, i, BLOCK_SIZE, BLOCK_SIZE);

SetColor(255, 255, 255);
Expand Down
23 changes: 2 additions & 21 deletions bin/examples/Space/Space.aproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,8 @@ MIDletName=Space
MIDletVendor=AMPASIDE
MIDletIcon=/icon.png
MIDletDescription=
MIDletInfoURL=http://hello.com
MIDletDeleteConfirm=Заходите на helltar.com
MIDletInstallNotify=Helllo install notify
ExtraOptionsEnabled=1
ExtraOptions=sllllllllllll
=sa
=f
=sa
=f
=fa ;;a s;as
=f:::::::::::
=a
=s
=1
=111111111111111111111111111
==========23423423^^^^^^^^44444444$$$##!!!!
=das
=d
=sa
=da
=sd
MIDletInfoURL=
MIDletDeleteConfirm=

[VERSIONS]
VersMajor=1
Expand Down
24 changes: 12 additions & 12 deletions bin/examples/Space/src/space.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

type
TStar = record
X, Y, Z: integer;
x, y, z: integer;
end;

const
Expand All @@ -21,8 +21,8 @@ TStar = record
sx, sy: integer;

begin
sx := Trunc(Scr_W / 2 + Stars[i].X * 200 / (Stars[i].Z + 200));
sy := Trunc(Scr_H / 2 - Stars[i].Y * 200 / (Stars[i].Z + 200));
sx := Trunc(Scr_W / 2 + Stars[i].x * 200 / (Stars[i].z + 200));
sy := Trunc(Scr_H / 2 - Stars[i].y * 200 / (Stars[i].z + 200));
SetColor(c, c, c);
Plot(sx, sy);
end;
Expand All @@ -35,9 +35,9 @@ TStar = record

for i := 1 to MAX_STARS do
begin
Stars[i].X := Random(Scr_W * 4) - Scr_W * 2;
Stars[i].Y := Random(Scr_H * 4) - Scr_H * 2;
Stars[i].Z := Random(1900);
Stars[i].x := Random(Scr_W * 4) - Scr_W * 2;
Stars[i].y := Random(Scr_H * 4) - Scr_H * 2;
Stars[i].z := Random(1900);
end;

SetColor(0, 0, 0);
Expand All @@ -52,16 +52,16 @@ TStar = record
for i := 1 to MAX_STARS do
begin
SetPix(0);
Stars[i].Z := Stars[i].Z - SPEED * Dt / 1000;
Stars[i].z := Stars[i].z - SPEED * Dt / 1000;

if Stars[i].Z <= -200 then
if Stars[i].z <= -200 then
begin
Stars[i].X := Random(Scr_W * 4) - Scr_W * 2;
Stars[i].Y := Random(Scr_H * 4) - Scr_H * 2;
Stars[i].Z := 1900;
Stars[i].x := Random(Scr_W * 4) - Scr_W * 2;
Stars[i].y := Random(Scr_H * 4) - Scr_H * 2;
Stars[i].z := 1900;
end;

SetPix(trunc(255 - 255 * (Stars[i].Z + 200) / 2100));
SetPix(trunc(255 - 255 * (Stars[i].z + 200) / 2100));
end;

Repaint;
Expand Down
3 changes: 1 addition & 2 deletions bin/examples/Tank/Tank.aproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ MIDletIcon=/icon.png
MIDletDescription=
MIDletInfoURL=
MIDletDeleteConfirm=
ExtraOptionsEnabled=0

[VERSIONS]
VersMajor=1
VersMinor=0
VersBuild=3
VersBuild=0
AutoIncBuildVers=0
File renamed without changes.
36 changes: 18 additions & 18 deletions bin/examples/Tank/src/tank.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,64 @@
Speed = 1;

var
i: integer;
Tank: array [0..3] of Image;
Dir: integer;
X, Y: integer;
x, y: integer;
i: integer;
Key: integer;

begin
for i := 0 to 3 do
Tank[i] := LoadImage('/' + IntegerToString(i) + '.png');

Dir := 0;
X := 32;
Y := 32;
x := 32;
y := 32;

SetColor(0, 0, 0);
FillRect(0, 0, GetWidth, GetHeight);

repeat
FillRect(X, Y, 16, 16);
FillRect(x, y, 16, 16);
Key := GetKeyPressed;

if Key = KE_KEY6 then
begin
Dir := 0;
X := X + Speed;
x := x + Speed;
end
else
if Key = KE_KEY8 then
begin
Dir := 1;
Y := Y + Speed;
y := y + Speed;
end
else
if Key = KE_KEY4 then
begin
Dir := 2;
X := X - Speed;
x := x - Speed;
end
else
if Key = KE_KEY2 then
begin
Dir := 3;
Y := Y - Speed;
y := y - Speed;
end;

if X < 0 then
X := 0;
if x < 0 then
x := 0;

if Y < 0 then
Y := 0;
if y < 0 then
y := 0;

if X > GetWidth - 16 then
X := GetWidth - 16;
if x > GetWidth - 16 then
x := GetWidth - 16;

if Y > GetHeight - 16 then
Y := GetHeight - 16;
if y > GetHeight - 16 then
y := GetHeight - 16;

DrawImage(Tank[Dir], X, Y);
DrawImage(Tank[Dir], x, y);

Repaint;
Delay(20);
Expand Down
13 changes: 6 additions & 7 deletions bin/examples/Tentaculi/src/tentaculi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
S = 12;
N = 8;

procedure Refresh;
begin
Repaint;
Delay(22);
end;

var
i, j: integer;
x, y: real;
Expand Down Expand Up @@ -45,18 +39,23 @@
begin
x := 0.5 * GetWidth;
y := 0.5 * GetHeight;

for i := 2 to N do
begin
SetColor(255, Trunc(255 - 255 * i / N), 255);

tx := x + Cos(j * d + a[i]) * len;
ty := y + Sin(j * d + a[i]) * len;

DrawLine(Trunc(x), Trunc(y), Trunc(tx), Trunc(ty));

x := tx;
y := ty;
end;
end;

Refresh;
Repaint;
Delay(24);
until GetKeyClicked = KE_KEY0;
end.

0 comments on commit 7029f83

Please sign in to comment.