Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Clear piece on the cross

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

610 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