Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:37:45+00:00 2026-05-31T13:37:45+00:00

I have some troubles with rendering my canvas. Actually I’m trying to write game

  • 0

I have some troubles with rendering my canvas. Actually I’m trying to write game like space invaders, without using any OpenGL or DirectX. So at the background I have moving sky, and jet moving over it. But the jet is blinding, and sky moves not uniformly. Here’s my code

  sky := TBitmap.Create;
  sky.LoadFromFile('sky.bmp');
  jet := TBitmap.Create;
  jet.LoadFromFile('jet.bmp');
  jet.Transparent := True;

  while True do
  begin
       for k := 0 to sky.Height do
       begin
          for i := -1 to (pbMain.Height div sky.Height) do
          begin
                for j := 0 to (pbMain.Width div sky.Width) do
                begin
                    pbMain.Canvas.Draw(nx, ny, jet);
                    pbMain.Canvas.Draw(j*sky.Width, k + i*sky.Height, sky);
                end;
                Application.ProcessMessages;
          end;
          Sleep(1);
       end;
  end;

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:37:46+00:00Added an answer on May 31, 2026 at 1:37 pm

    You can’t write a standard Windows app like that. You have to do your painting in response to WM_PAINT messages. In Delphi terms this equates to overriding the Paint method of a TWinControl descendent, or perhaps using a TPaintBox and providing an OnPaint event handler. I’m going to assume that you use a TPaintBox.

    If you need to avoid flicker it is common practice to draw to an off-screen bitmap and then show this when you are asked to paint.

    Your application should probably use a timer control to provide a regular pulse. Then, on each pulse, update your off-screen bitmap. Then call Invalidate on your paint box to force a paint cycle.

    The code might look like this:

    procedure TMainForm.RefreshTimerTimer(Sender: TObject);
    begin
      RedrawOffscreenBitmap;
      PaintBox.Invalidate;
    end;
    
    procedure TMainForm.RedrawOffscreenBitmap;
    begin
      //paint to FOffscreenBitmap
    end;
    
    procedure TMainForm.PaintBoxBox(Sender: TObject);
    begin
      PaintBox.Canvas.Draw(0, 0, FOffscreenBitmap);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really have some troubles since 1 week ago. I got errors like this
I'm having nice first days using Yii but have some troubles with getting things
I have some troubles trying to move data from SQL Server 2000 (SP4) to
I have some troubles when using javascript code for Facebook invite friends. Details: User
I have some troubles with memory leaks in JavaScript. I'm using the Leak Memory
I have some troubles re-writing this query to using joins instead of the two
I have some troubles with positioning my label/password field. With this code they both
I have just installed Delphi 2010 and got some troubles with idHTTP component. If
I have some troubles finding the right key in an array: when I have
I have some troubles with Haskell's type system. Situation: Following program is taking list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.