PDA

View Full Version : Drawing the playfield



marcov
07-04-2006, 09:55 PM
For a small game, I've a simple grid as playfield, so basically a matrix of 2D tiles. (think minesweeper here, though actually it is chainreaction)

What is the easiest way of rendering this playfield in a portable way using the LCL (so no GL/D3D)

I assume something with blitting/copying the tiles to a timage, and then refreshing the image?

What is the portable function to copy an image onto another?

jdarling
07-04-2006, 10:15 PM
For a small game, I've a simple grid as playfield, so basically a matrix of 2D tiles. (think minesweeper here, though actually it is chainreaction)

What is the easiest way of rendering this playfield in a portable way using the LCL (so no GL/D3D)

I assume something with blitting/copying the tiles to a timage, and then refreshing the image?

What is the portable function to copy an image onto another?

How does using the LCL stop you from using D3D or OpenGL? Anyways you can use the TPainbox inside of Lazarus just like you would in Delphi. Make sure that you set the component style to Opaque and that you double buffer the drawing stuff. Other then that its fairly simple, itterate your "Playing Field", draw it to the back buffer, and on the next refresh of the paintbox set the paintboxes canvas pointer to your backbuffer pointer (also remember to set the old pointer to the backbuffer).

If you look at my website I have a sample for Delphi, their is also a version of FPC if I can find it some place :)

marcov
08-04-2006, 01:47 PM
How does using the LCL stop you from using D3D or OpenGL?


Not, but the fact that they are LCL demoes might :-)



If you look at my website I have a sample for Delphi, their is also a version of FPC if I can find it some place :)

Delphi is also good. While I'm not so into graphics, I still know my way in FPC/Delphi :-)