Changeset 49 for branches/paintbox/Forms/UMainForm.pas
- Timestamp:
- Aug 22, 2019, 9:50:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/paintbox/Forms/UMainForm.pas
r47 r49 23 23 AFullScreen: TAction; 24 24 ActionList1: TActionList; 25 Image1: TImage;26 25 MainMenu1: TMainMenu; 27 26 MenuItem1: TMenuItem; … … 33 32 MenuItem7: TMenuItem; 34 33 MenuItem8: TMenuItem; 34 PaintBox1: TPaintBox; 35 35 StatusBar1: TStatusBar; 36 36 TimerDraw: TTimer; … … 50 50 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 51 51 procedure FormShow(Sender: TObject); 52 procedure Image1MouseLeave(Sender: TObject);53 procedure Image1Resize(Sender: TObject);52 procedure PaintBox1Paint(Sender: TObject); 53 procedure PaintBox1Resize(Sender: TObject); 54 54 procedure TimerDrawTimer(Sender: TObject); 55 55 procedure TimerEngineTickTimer(Sender: TObject); … … 62 62 procedure LoadConfig; 63 63 procedure SaveConfig; 64 procedure EngineRepaint(Sender: TObject); 64 65 public 65 66 PersistentForm: TPersistentForm; … … 125 126 end; 126 127 128 procedure TMainForm.EngineRepaint(Sender: TObject); 129 begin 130 PaintBox1.Repaint; 131 end; 132 127 133 procedure TMainForm.EraseBackground(DC: HDC); 128 134 begin … … 142 148 DoubleBuffered := False; 143 149 Engine := TEngine.Create; 144 Engine. Bitmap := Image1.Picture.Bitmap;150 Engine.OnRepaint := EngineRepaint; 145 151 Core.CoolTranslator1.Language := Core.CoolTranslator1.Languages.SearchByCode('cs'); 146 152 LoadConfig; 147 153 Engine.NewGame; 148 154 Engine.Active := True; 149 Image1Resize(Self); 150 Image1.ControlStyle := Image1.ControlStyle + [csOpaque]; 155 PaintBox1Resize(Self); 156 ControlStyle := ControlStyle + [csOpaque]; 157 PaintBox1.ControlStyle := PaintBox1.ControlStyle + [csOpaque]; 151 158 end; 152 159 … … 205 212 procedure TMainForm.AShowRawImageDescExecute(Sender: TObject); 206 213 begin 207 ShowMessage( Image1.Picture.Bitmap.RawImage.Description.AsString);214 ShowMessage(Engine.Bitmap.RawImage.Description.AsString); 208 215 end; 209 216 … … 244 251 end; 245 252 246 procedure TMainForm. Image1MouseLeave(Sender: TObject);247 begin 248 249 end; 250 251 procedure TMainForm. Image1Resize(Sender: TObject);253 procedure TMainForm.PaintBox1Paint(Sender: TObject); 254 begin 255 PaintBox1.Canvas.StretchDraw(Rect(0, 0, PaintBox1.Width, PaintBox1.Height), Engine.Bitmap); 256 end; 257 258 procedure TMainForm.PaintBox1Resize(Sender: TObject); 252 259 begin 253 260 try 254 261 Engine.Lock.Acquire; 255 Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height);262 Engine.Bitmap.SetSize(PaintBox1.Width, PaintBox1.Height); 256 263 Engine.ResizePlayerFrames; 257 264 finally
Note:
See TracChangeset
for help on using the changeset viewer.