unit TestMaze;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls, System.Rtti, FMX.Layouts, FMX.Grid,
FMX.Objects, FMX.ScrollBox, FMX.Memo;
Const
maze :
array [0..377]
of byte = (208, 210, 210, 210, 210, 210, 210, 210,
210, 212, 252, 252, 252, 218, 2, 220, 252, 252, 252, 208, 210, 210, 210,
210, 214, 216, 210, 210, 210, 210, 212, 252, 218, 9, 220, 252, 252, 252,
218, 2, 220, 252, 252, 252, 218, 5, 222, 228, 5, 220, 252, 218, 2, 230, 232,
234, 2, 230, 234, 2, 220, 252, 252, 252, 218, 2, 220, 252, 252, 252, 218, 2,
230, 234, 2, 231, 235, 2, 230, 234, 2, 220, 252, 218, 2, 222, 252, 228, 2,
222, 228, 2, 220, 252, 252, 252, 218, 2, 220, 252, 252, 252, 218, 2, 222,
228, 5, 222, 228, 2, 220, 252, 218, 2, 222, 252, 228, 2, 222, 228, 2, 220,
252, 252, 252, 218, 2, 220, 252, 252, 252, 218, 2, 222, 242, 232, 232, 234,
2, 222, 228, 2, 220, 252, 218, 2, 231, 233, 235, 2, 231, 235, 2, 231, 210,
210, 210, 235, 2, 231, 210, 210, 210, 235, 2, 231, 233, 233, 233, 235, 2,
222, 228, 2, 220, 252, 218, 27, 222, 228, 2, 220, 252, 218, 2, 230, 232,
248, 2, 246, 232, 232, 232, 232, 232, 232, 248, 2, 246, 232, 232, 232, 234,
2, 230, 248, 2, 246, 232, 232, 244, 228, 2, 220, 252, 218, 2, 222, 252, 228,
2, 247, 233, 233, 245, 243, 233, 233, 249, 2, 247, 233, 233, 233, 235, 2,
222, 228, 2, 247, 233, 233, 245, 228, 2, 220, 252, 218, 2, 222, 252, 228, 5,
222, 228, 11, 222, 228, 5, 222, 228, 2, 220, 252, 218, 2, 222, 252, 228, 2,
230, 234, 2, 222, 228, 2, 236, 211, 211, 211, 238, 2, 230, 234, 2, 222, 228,
2, 230, 234, 2, 222, 228, 2, 220, 252, 218, 2, 231, 233, 235, 2, 222, 228,
2, 231, 235, 2, 220, 252, 252, 252, 218, 2, 222, 228, 2, 231, 235, 2, 222,
228, 2, 231, 235, 2, 220, 252, 218, 6, 222, 228, 5, 240, 252, 252, 252, 218,
2, 222, 228, 5, 222, 228, 5, 220, 252, 250, 232, 232, 232, 234, 2, 222, 242,
232, 232, 234, 2, 206, 252, 252, 252, 218, 2, 222, 242, 232, 232, 234, 2,
222, 242, 232, 232, 234, 2, 220);
type
TForm55 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
Procedure LoadMaze;
Procedure Draw(X,Y,C : Integer);
end;
var
Form55: TForm55;
implementation
{$R *.fmx}
procedure TForm55.Draw(X, Y, C: Integer);
var
R : TRectangle;
begin
Y := Y * 16;
X := X * 16;
R := TRectangle.Create(self);
// todo: Mal das richte IMG nehmen...
R.Parent := Self;
R.Position.X := X;
R.Position.Y := Y;
R.Width := 15;
R.Height := 15;
end;
Procedure TForm55.LoadMaze;
var
F :
File;
ROM :
Array[0..4095]
of byte;
i,X,Y,C : Integer;
begin
{
AssignFile(F,'..\..\ROMS\pacman.6j'); // :-)
Reset(F,1);
Blockread(F,ROM[0],4095);
CloseFile(F);
}
Move(Maze[0],ROM[$437],Sizeof(Maze));
X := 0;
Y := 0;
for i:=$437
to $5B1
do
begin
if (ROM[i] > 1)
and (ROM[i] < $30)
then X := X + ROM[I]-2
else begin
Draw(27-Y,X,ROM[I]);
Draw(Y,X,ROM[I]);
end;
inc(X);
if X >= 32
then
begin
inc(Y);
X := 0;
end;
end;
end;
procedure TForm55.Button1Click(Sender: TObject);
begin
LoadMaze;
end;
end.