Page 1 of 1

Issues relating to threads in delphi

PostPosted: May 12th, 2018, 6:14 pm
by Clintonb
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?

Re: Issues relating to threads in delphi

PostPosted: May 13th, 2018, 12:53 pm
by Kambiz
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.