Recent

Author Topic: dc windowless??  (Read 4957 times)

jw

  • Full Member
  • ***
  • Posts: 126
dc windowless??
« on: April 14, 2010, 06:00:56 pm »
Been trying to port a program written in vb to free pascal and with alot of code and re-codeing and pascal versions I still can't match the speed of vb.  The vb code used a library for animated gifs saying it was DC Windowless.


What I'm finding in free pascal is all graphics eventually end up on the form.canvas.  So if there's 100 sprites running each updateing their timage then it ends up translating to a canvas redraw.  No matter what a change of any control on the from ends up refreshing the form.canvas.

So I tried useing a new form for each sprite, this helped alot because all the sprites were running on a little form and their animations weren't triggering a refresh on the main form which fits the whole screen.  I guess that's dc windowless.  Even though this helped it causes the windows file csrss.exe to use a lot of cpu power and mem so while it appears my program is useing less mem and cpu and running faster it's really just moveing it's resource usage in csrss.exe.  I suppose csrss.exe is doing it's job since it's supposed to cordinate multiple forms.

I guess what I'm asking is there a way to create a second form with only it's canvas and none of the other properties associated with a form?  I just need a way to update only portions of the screen without redrawing the whole screen.   

 

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: dc windowless??
« Reply #1 on: April 15, 2010, 09:07:56 am »
Don't use TImage for sprites. TImage works best for static images. Look for any game library (there are A LOT of them), they usually have optimized sprites drawing.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: dc windowless??
« Reply #2 on: April 15, 2010, 03:55:40 pm »
You can draw everything in TBitmap and then draw that 1 time on canvas of anything. This is a manual way to do double buffering, fast and flickerless.

jw

  • Full Member
  • ***
  • Posts: 126
Re: dc windowless??
« Reply #3 on: April 15, 2010, 05:17:36 pm »
leledumbo

I think your right I've looked a little at allegro game library.

I've gone to the lowest denominator with the LCL useing only draw commands and stretching all sprites on startup for the fastest rendering but still can't seem to get enough speed.   I use nothing but the form canvas and tcustombitmaps. 

user137
ya been trying the stuff suggested but even the sprites demo in the lazarus examples directory is to cpu intensive.

 

TinyPortal © 2005-2018