Solved

Clear piece on the cross

Posted on 2007-03-19
4
227 Views
Last Modified: 2010-04-05
I'm making a Chinese chess program,  called XiangQi. the pieces are put on the crosses, not in square, this is different from internatinal chess... when dragging a piece to another cross, how to clear the old piece?

type cross used to define each crosses on the board:
type

 Cross=(None,A9,B9,C9,D9,E9,F9,G9,H9,I9,
                  A8,B8,C8,D8,E8,F8,G8,H8,I8,
                  A7,B7,C7,D7,E7,F7,G7,H7,I7,
                  A6,B6,C6,D6,E6,F6,G6,H6,I6,
                  A5,B5,C5,D5,E5,F5,G5,H5,I5,
                  A4,B4,C4,D4,E4,F4,G4,H4,I4,
                  A3,B3,C3,D3,E3,F3,G3,H3,I3,
                  A2,B2,C2,D2,E2,F2,G2,H2,I2,
                  A1,B1,C1,D1,E1,F1,G1,H1,I1,
                  A0,B0,C0,D0,E0,F0,G0,H0,I0);

....

I want to make a procedure like:
procedure ClearCross(cr: Cross);

to clear the old piece on the old cross, we can re-draw the background, but the problem is that not all the background are the same, see demo here: http://www.xerp.cn/cc/project1.exe
in this demo, when I drag a piece away, the background will be cleared, we need to draw something to make it look like the original look, see the blank board here: http://www.xerp.cn/cc/xqboard.bmp

Any ideas? tks
0
Comment
Question by:adm_adamlee
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 18746846
1 way would be to copy what is under the cross before you put the piece on it, then when you move the piece off, just repaint what you saved.
0
 
LVL 1

Author Comment

by:adm_adamlee
ID: 18753297
Looks a good idea, I will try that first.
0
 
LVL 1

Author Comment

by:adm_adamlee
ID: 18753538
before dragging a piece away, we can not copy the background under the piece, because it is overwritten, what you will copy is the piece itself.
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 18754274
What I am suggesting is you take a copy before any pieces are placed on teh board, that way, you have the true background of it kept.
another way would be to keep a copy of the entire board (but empty) in another bitmap, then just copy from that.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question