Solved

Clear piece on the cross

Posted on 2007-03-19
4
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

691 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