Changeset 4 for trunk/UMainForm.pas
- Timestamp:
- Mar 6, 2011, 6:43:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMainForm.pas
r3 r4 19 19 MenuItem2: TMenuItem; 20 20 MenuItem3: TMenuItem; 21 MenuItemShowMap: TMenuItem; 21 22 StatusBar1: TStatusBar; 22 Timer1: TTimer; 23 TimerDraw: TTimer; 24 TimerEngineTick: TTimer; 23 25 procedure FormCreate(Sender: TObject); 24 26 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 25 27 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 28 procedure FormShow(Sender: TObject); 26 29 procedure Image1Resize(Sender: TObject); 27 30 procedure MenuItem2Click(Sender: TObject); 28 31 procedure MenuItem3Click(Sender: TObject); 29 procedure Timer1Timer(Sender: TObject); 32 procedure MenuItemShowMapClick(Sender: TObject); 33 procedure TimerDrawTimer(Sender: TObject); 34 procedure TimerEngineTickTimer(Sender: TObject); 30 35 private 31 { private declarations }32 36 public 33 37 { public declarations } … … 41 45 {$R *.lfm} 42 46 47 uses 48 UMapForm; 49 43 50 { TMainForm } 44 51 45 procedure TMainForm.Timer 1Timer(Sender: TObject);52 procedure TMainForm.TimerDrawTimer(Sender: TObject); 46 53 begin 47 54 try 48 Timer 1.Enabled := False;49 Engine. Tick;55 TimerDraw.Enabled := False; 56 Engine.Draw; 50 57 StatusBar1.Panels[1].Text := IntToStr(TPlayer(Engine.Players[0]).Position.X) + ', ' + 51 58 IntToStr(TPlayer(Engine.Players[0]).Position.Y) + ' ' + 52 59 IntToStr(TPlayer(Engine.Players[0]).Direction); 53 60 finally 54 Timer 1.Enabled := True;61 TimerDraw.Enabled := True; 55 62 end; 63 end; 64 65 procedure TMainForm.TimerEngineTickTimer(Sender: TObject); 66 begin 67 Engine.Tick; 56 68 end; 57 69 … … 59 71 begin 60 72 Engine.Bitmap := Image1.Picture.Bitmap; 61 Image1Resize(Self);62 73 with Engine do begin 63 PlayerCount := 2;74 PlayerCount := 4; 64 75 with TPlayer(Players[0]) do begin 65 76 Keys.Left := 65; 66 Keys.Down := 8 7;77 Keys.Down := 83; 67 78 Keys.Right := 68; 68 Keys.Up := 8 3;79 Keys.Up := 87; 69 80 Keys.Shoot := 69; 70 81 end; 71 82 with TPlayer(Players[1]) do begin 72 83 Keys.Left := 37; 73 Keys.Down := 38;84 Keys.Down := 40; 74 85 Keys.Right := 39; 75 Keys.Up := 40;86 Keys.Up := 38; 76 87 Keys.Shoot := 17; 88 end; 89 with TPlayer(Players[2]) do begin 90 Keys.Left := 76; 91 Keys.Down := 186; 92 Keys.Right := 222; 93 Keys.Up := 80; 94 Keys.Shoot := 186; 95 end; 96 with TPlayer(Players[3]) do begin 97 Keys.Left := 100; 98 Keys.Down := 98; 99 Keys.Right := 102; 100 Keys.Up := 104; 101 Keys.Shoot := 98; 77 102 end; 78 103 end; 79 104 Engine.NewGame; 105 Image1Resize(Self); 80 106 end; 81 107 … … 93 119 end; 94 120 121 procedure TMainForm.FormShow(Sender: TObject); 122 begin 123 end; 124 95 125 procedure TMainForm.Image1Resize(Sender: TObject); 96 126 begin 97 // Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height); 98 Image1.Picture.Bitmap.SetSize(80, 60); 127 Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height); 99 128 Engine.ResizePlayerFrames; 100 129 end; … … 110 139 end; 111 140 141 procedure TMainForm.MenuItemShowMapClick(Sender: TObject); 142 begin 143 MapForm.Show; 144 end; 145 112 146 end. 113 147
Note:
See TracChangeset
for help on using the changeset viewer.