Preventing TImage from flickering lazarus / 7-LCL ---------------------------------------------------------------------- Leledumbo · 2007-11-16 12:18 I try to make a 2D game with only LCL. I'm using TImage as the sprite, and in order to have the same FPS limit on every machine, I use TTimer to draw the form (and the game objects). But as expected (well, in sprite example the image flickers, too), the sprite flickers and it's really bad. Setting DoubleBuffered property of the form doesn't help. Is there anyway to solve this? Some painting code: Code: [Select] ... procedure TMainForm.FormPaint(Sender: TObject); begin   // Sprite: TImage;   Canvas.Draw(Sprite.Picture.Graphic); end; ... // GameTimer: TTimer; procedure TMainForm.GameTimerTimer(Sender: TObject); begin   FormPaint(nil); end; ... ---------------------------------------------------------------------- antonio · 2007-11-16 12:33 You could have a look at my Banner Example, http://br.geocities.com/antoniog123456/ , where I draw a sprite directly on canvas. It does not flick. ---------------------------------------------------------------------- Leledumbo · 2007-11-16 12:57 Kinda weird, I use the same code (I guess, I'm not at home so I can't see it now), except a call to Canvas.Rectangle. I prefer using Canvas.Clear, could it be the problem? ---------------------------------------------------------------------- antonio · 2007-11-16 13:09 Quote from: "Leledumbo"I prefer using Canvas.Clear, could it be the problem? I don't think so. I tested with Canvas.Clear and it is not better, but does not flick. ---------------------------------------------------------------------- Leledumbo · 2007-11-16 13:15 Well, I guess I have to go home and see it first. I'll be back on monday. ---------------------------------------------------------------------- theo · 2007-11-16 13:57 If you want really flicker - free, do it like this: http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Create_a_c ustom_control_which_draws_itself (Custom control with buffer)