Issues relating to threads in delphi

Please discuss general Delphi programming topics here.

Issues relating to threads in delphi

Postby Clintonb » May 12th, 2018, 6:14 pm

I built a program that basically copies the game concept of starcraft wherr you can click and drag the map and then draws that area of the map. I had an issue that when it was reading user inpit it wasnt drawing and vice versa. I solved this by putting the drawing code in a ttimer. It worked but i wanted to try a thread. The main thread handles an input and drawingthread draws into memory and then synchronizes with thr main thread when it has something to draw.

This worked great when compiling in delphi but the minute i close delphi and run it from the program folder it runs 400% slower and the graphics now lag. If i run it from delphi again it still lags but if i build it again it works fine again. Its bizarre and driving me crazy. Has anyone experienced anything lile this?
Clintonb
Member
Member
 
Posts: 1
Joined: May 12th, 2018, 5:53 pm

Re: Issues relating to threads in delphi

Postby Kambiz » May 13th, 2018, 12:53 pm

You didn't mention which version of Delphi you use. Also, by drawing the graphic into memory, do you mean a bitmap memory or just raw RGB data? What do you use to render the graphic into the screen? GDI, GDI+, OpenGL, or DirectX?

Of course, if you could provide some sample codes, it would be more helpful.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron