Changeset 10
- Timestamp:
- Aug 29, 2016, 5:35:21 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Apps/UClock.pas
r9 r10 13 13 14 14 TAppClock = class(TApp) 15 procedure Run(Task: TTask); override; 16 constructor Create; override; 17 end; 18 19 { TAppClock2 } 20 21 TAppClock2 = class(TApp) 15 22 procedure Run(Task: TTask); override; 16 23 constructor Create; override; … … 36 43 Angle := Frac(Now / (10 * OneSecond)) * 2 * Pi; 37 44 API.DrawLine(Point(120, 120), Point(Trunc(120 + Cos(Angle) * 60), Trunc(120 + Sin(Angle) * 60)), 0); 38 API.Sleep(OneMillisecond * 100);45 API.Sleep(OneMillisecond * 50); 39 46 //API.ReadMessage(Message); 40 47 end; … … 48 55 end; 49 56 57 { TAppClock2 } 58 59 procedure TAppClock2.Run(Task: TTask); 60 var 61 Message: TIPCMessage; 62 WindowId: Integer; 63 Angle: Double; 64 begin 65 Message := TIPCMessage.Create; 66 WindowId := API.WindowCreate; 67 API.WindowSetAttr(300, 200, True); 68 while not Task.Terminated do begin 69 API.WriteText('test2'); 70 API.DrawRect(Rect(260, 160, 380, 280), $ffff80); 71 API.DrawText(Point(210, 110), 'Text', 0); 72 Angle := Frac(Now / (10 * OneSecond)) * 2 * Pi; 73 API.DrawLine(Point(320, 220), Point(Trunc(320 + Cos(Angle) * 60), Trunc(220 + Sin(Angle) * 60)), 0); 74 API.Sleep(OneMillisecond * 300); 75 //API.ReadMessage(Message); 76 end; 77 Message.Free; 78 end; 79 80 constructor TAppClock2.Create; 81 begin 82 inherited Create; 83 Name := 'Clock2'; 84 end; 85 50 86 end. 51 87 -
trunk/Forms/UFormMain.lfm
r9 r10 55 55 end 56 56 end 57 object Timer1: TTimer 58 Interval = 50 59 OnTimer = Timer1Timer 60 left = 180 61 top = 281 62 end 57 63 end -
trunk/Forms/UFormMain.pas
r9 r10 24 24 MenuItem4: TMenuItem; 25 25 PaintBox1: TPaintBox; 26 Timer1: TTimer; 26 27 procedure AExitExecute(Sender: TObject); 27 28 procedure AFullscreenExecute(Sender: TObject); … … 34 35 procedure PaintBox1Paint(Sender: TObject); 35 36 procedure PaintBox1Resize(Sender: TObject); 37 procedure Timer1Timer(Sender: TObject); 36 38 private 39 RedrawPending: Boolean; 37 40 VideoDevice: TDeviceVideoBase; 38 41 SerialDevice: TBaseSerialDevice; … … 66 69 var 67 70 NewApp: TApp; 71 NewApp2: TApp; 68 72 begin 69 73 PaintBox1.ControlStyle := PaintBox1.ControlStyle + [csOpaque]; … … 90 94 NewApp := TAppClock.Create; 91 95 Kernel.Apps.Add(NewApp); 96 97 NewApp2 := TAppClock2.Create; 98 Kernel.Apps.Add(NewApp2); 92 99 end; 93 100 … … 196 203 end; 197 204 205 procedure TFormMain.Timer1Timer(Sender: TObject); 206 begin 207 if RedrawPending then begin 208 PaintBox1.Refresh; 209 RedrawPending := False; 210 end; 211 end; 212 198 213 procedure TFormMain.SerialDeviceReceiveDataSync; 199 214 begin … … 214 229 procedure TFormMain.VideoDeviceRedrawSync; 215 230 begin 216 PaintBox1.Refresh;231 RedrawPending := True; 217 232 end; 218 233 -
trunk/Packages/Kernel/UKernel.pas
r9 r10 18 18 end; 19 19 20 TTimer = class21 Period: TDateTime;22 end;20 // TTimer = class 21 // Period: TDateTime; 22 // end; 23 23 24 24 { TKernel } … … 115 115 NewFile.Name := 'Clock'; 116 116 NewDrive.FileSystem.TopDirectory.Items.Add(NewFile); 117 InitVideo; 117 118 NewFile := TFile.Create; 119 NewFile.Name := 'Clock2'; 120 NewDrive.FileSystem.TopDirectory.Items.Add(NewFile); 121 InitVideo; 118 122 end; 119 123 … … 129 133 SystemFileSystem := SystemDrive.FileSystem; 130 134 AppFile := TFile(SystemFileSystem.TopDirectory.Items.FindByName('Clock')); 135 if Assigned(AppFile) then AppExecute(AppFile) 136 else raise Exception.Create('Cannot start first application'); 137 AppFile := TFile(SystemFileSystem.TopDirectory.Items.FindByName('Clock2')); 131 138 if Assigned(AppFile) then AppExecute(AppFile) 132 139 else raise Exception.Create('Cannot start first application');
Note:
See TracChangeset
for help on using the changeset viewer.