?
Solved

Clear piece on the cross

Posted on 2007-03-19
4
Medium Priority
?
234 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 1500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

777 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