|
|
|
Name: CECards Download: CECard060199.zipWhat is it: A Cards DLL for CE. Draw, Drag, BlockDrag. Has the QCards and Cards.dll interfaces. There is also sample code for VBCE programmers. Although the block drag API does not yet work for VBCE, due to it's inability to pass array's through the DECLARE statement. A work around will be published in the next release.
Features: Release Notes: This is an early beta of the CECard.DLL. The CARDS.DLL type functions have not be fully tested yet. In the next release there will also be a sample program for VBCE What is in this release?
Known Bugs:
CECard.DLL What is CECard.DLL? CECard.DLL is a dynamic link library that simplifies the creation of card games for the WindowsCE. The API is based on very popular QCCards.dll and Cards.dll interfaces. It has been developed to enable the WinCE developer to more easily (eh?) write card games.
CECard.DLL gives you easy access to more than 40 card-game specific functions and procedures. It supports two card decks, 6 card backs and one user defined custom card back. This lib supports all the functions to DrawCards, RemoveCards, and Drag individual cards and blocks of cards. It uses the built-in card bitmaps so the ultimate file size of your application is small. It also handles the background bitmap replacement for you.
Functions from the standard CARDS.DLL CECard.DLL contains two different sets of Card drawing functions. It has a long list of functions as outlined in this document. However, it also contains 3 functions typically found in the CARDS.DLL on standard Win95/98/NT machines. These functions are cdtInit, cdtDraw, cdtDrawExt, cdtTerm, and cdtAnimate.
cdtInit is used to initialize the CECard.DLL for the 'cdt' functions
cdtTerm is used to terminate the CECard.DLL functions
cdtDraw is used to draw and remove cards
cdtDrawExt is used to draw and remove cards using a size you select
cdtAnimate is used to animate the backs of the cards. These functions are documented at the end of this document. These functions are independent of the other functions in the CECard.DLL. Therefore, you can use these functions without using InitializeDeck, etc To use these functions you use the direct resource numbers in the pegcards.dll. These functions do not do any special drawing, dragging, or card effects. They also only provide single card deck functions. REMEMBER: You can use both the CARDS.DLL interface and the CECard.DLL interface at the same time. But you must initialize each interface, using each initialization function, before you use it. Use cdtInit for the CARDS.DLL interface and InitializeDeck for the CECards.DLL interface. NOTE : This DLL is NOT intended to be used multi-threaded. i.e. it is not thread-safe.Writing Card Games Writing a card game is a frustrating process especially if you need to do all of the graphics management yourself. With this library you can concentrate on the game and not on the drawing code. Using CECard.DLL You will need to include the file CECard.h in your C/C++ program and link with the CECard.lib link library. When drawing and locating items, CECard.DLL uses the MM_TEXT mapping mode (default or only mapping mode for WindowsCE). This means the screen coordinate system is pixel-based, where the top-left corner of your window is at x, y point 0, 0. The X and Y values increase as you move to the right (X-direction) and down (Y-direction). This is the only coordinate system that WindowsCE supports (natively).
CECard.DLL provides you two decks of cards to work with. If you need any more decks than that in one game, then you will have to improvise your own work-around. The cards are referenced by their number. Numbers range from 1 to 113, and are arranged as follows: 1 to 52 Deck 1 53 to 104 Deck 2 105 to 110 WindowsCE Cardback cards 111 A card image with an 'X' on it (used to indicate a discard location) 112 A card image with an 'O' on it (used to indicate a deal pile location) 113 A card image with a gray background
If you just need one deck in your game, you can ignore numbers 53 to 104. The easiest way to keep track of what you are doing is to create a Deck array of your own, and fill it with the numbers 1 through 52 (or 104 if you are using 2 decks). int Deck [53]; int I; for( i = 1; i <= 52; i++) { Deck(i) = i } Then you can go ahead and shuffle the array, if that s what you want.int i, j, k; for ( i = 1; i <= 10; i++) { for ( j = 1; j <= 52; j++) { k = ((int)(Rnd(52)) + 1); //The rnd function is provided in the CECard.DLL Temp = Deck[j]; Deck[j] = Deck[k]; Deck[k] = Temp; } } The implementation of the Rnd function in CECard.DLL looks like this. // return an integral random number in the range 1 - n) int Rnd(int n) { return ((Random() % n) + 1); } You can now make calls to CECard.DLL by referencing your array. For example, in the WM_LBUTTONDOWN message handler.. DealCard (hwnd , Deck[1], x, y); This will deal the first card in your array on to window 'hwnd' with the top corner of the card at location x, y in pixel coordinates relative to the top-left corner of your window (hwnd). These are some of the basic values used by the static lib: This defines the 'pegcard.dll' card width in pixels. #define CARDWIDTH 29 This defines the 'pegcard.dll' card height in pixels. #define CARDHEIGHT 41 This defines the offset in pixels of cards which are stacked on top of one another. This value is can be altered by an API call. All card offset's are in the Y (up/down) direction only. This value is used to determine if a point is in the top region of a card. #define OFFSET 10 This defines the whether the card is to be dealt FACEUP or FACEDOWN. #define FACEUP TRUE #define FACEDOWN FALSE This defines the color of the card. #define RED 1 #define BLACK 2 This defines suit of the card. #define CLUBS 1 #define DIAMONDS 2 #define HEARTS 3 #define SPADES 4 CECard.DLL individual card properties Internal to the library there is a structure associated with each card which maintains information about card properties. These include:
The card number is the reference of the card. The cards are numbered 1 through 113 and 200. 1 to 52 is the first deck. 53 to 104 is the second deck. Card numbers 105 to 110 are cardbacks that are supplied by the pegcards resource DLL. Card number 200 is a card back that the developer can supply from the application resource instance. This is done using the SetCustomBack API. Card numbers 110 to 113 are specialty cards to indicate the deal pile ( 'O' ), discard pile ( 'X' ), and a ghost card (' '). You can use these card numbers where you see the 'nCard' reference in the function call. For example in GetCardSuit(1) the return value will be the suit (Clubs) for the 1 card (Ace). 2) CardColor You can determine a card's color by calling the function GetCardColor(nCard). Black cards return a value of 1, Red cards return a value of 2. #define RED 1 #define BLACK 2 3) CardSuit You can determine a card's suit by calling the function GetCardSuit(nCard), passing it the number of the card you are interested in. Clubs return 1, Diamonds return 2, Hearts return 3, Spades return 4. #define CLUBS 1 #define DIAMONDS 2 #define HEARTS 3 #define SPADES 4 4) CardValue You can determine a card's face value by calling the function GetCardValue(nCard). For the face cards an Ace returns 1, a Jack returns 11, a Queen returns 12, and a King returns 13.
5) CardX You can determine a card's x location by calling GetCardX(nCard). This will return its current location relative to 0 in the window. This value is originally set (and reset) to -200. This value is modified automatically when the DealCard API is used or manually when SetCardX(nCard, xPt) API is used. Note that if you reset the x position manually, you must use the DrawCard API to have the card appear at the new location. 6) CardY You can determine a card's x location by calling GetCardY(nCard). This will return its current location relative to 0 in the window. This value is originally set (and reset) to -200. This value is modified automatically when the DealCard API is used or manually when SetCardY(nCard, yPt) API is used. Note that if you reset the x position manually, you must use the DrawCard API to have the card appear at the new location. 7) CardStatus (Faceup or Facedown) This is a Boolean value (TRUE or FALSE) which is initially set to TRUE. This defines the whether the card is to be dealt FACEUP or FACEDOWN. When a card is dealt or drawn, it will be faceup by default. You can determine a card's status with the Function GetCardStatus(nCard) which returns either TRUE or FALSE. You can change a card's status between faceup and facedown by using the Function SetCardStaus(nCard, bValue) where bValue is TRUE for faceup, and FALSE for facedown. #define FACEUP TRUE #define FACEDOWN FALSE To deal a card facedown, simply set its status to FALSE, and deal or draw it: SetCardStatus (nCard, FACEDOWN) or SetCardStatus(nCard, FALSE) The image used for the will is set by the SetCurrentBack API with one of the values. #define CARDBACK1 1 #define CARDBACK2 2 #define CARDBACK3 3 #define CARDBACK4 4 #define CARDBACK5 5 #define CARDBACK6 6 Cardback7 is only available if you have used the SetCustomBack API to set a custom card back. Otherwise the card back used will be CARDBACK1. #define CARDBACK7 7 8) CardBlocked You use the card blocked flag to determine if a card is free for dragging or not. If the card has another card on top of it then the card blocked flag should be set to blocked (TRUE). When a card is dealt, and another is moved on top of it by you or by the player, this value should be set to TRUE for the lower card by calling AdjustCardBlocked (nCard, TRUE). A card must be marked as blocked in order for the hit testing and card intersection testing to work correctly. If the card is blocked flag is not set correctly, then card dragging might provide strange results. You can determine if a card is blocked by using the GetCardBlocked(nCard) API. 9) CardDisabled You can deny interaction with a card by setting it's disabled flag to TRUE. This will disable dragging with this card. This can be done by calling SetCardDisabled(nCard, TRUE). The card can be enabled again by calling SetCardDisabled(nCard, FALSE). 10) User1 This is a BOOL value (TRUE or FALSE) for use by the developer. You can set this value by calling SetUser1(nCard, bValue) where bValue is either TRUE or FALSE. You can obtain its present value by calling the GetUser1(nCard) function. 11) User2, User3, User4 The values for User2, User3 and User4 are all integer types. They are provided for the developer to use to store application data. These can be used to determine if you are using cards in a multiple deck card game. They are set by calling SetUser2(nCard, nValue), SetUser3(nCard, nValue) and SetUser4(nCard, nValue), where nValue is an integer. There values are obtained by calling the GetUser2(nCard), GetUser3(nCard) and GetUser4(nCard) functions. CECard.DLL API In order to use the CECard.DLL API, include the file "cecard.h" in your project and link to the CECard.DLL static library. The API functions can be grouped into the following:
Card Initialization Functions BOOL InitializeDeck(HWND); void DestroyDeck(HWND); void SetDefaultValues(void); void SetCurrentBack(int); void SetCustomBack(HBITMAP ); void SetOffSet(int); BOOL InitializeDeck(HWND hwnd); This is the initialization function for the library. Call this function ONCE to set up the internal card values and device contexts. This function loads the 'pegcards.dll', initializes internal states and creates background device contexts. You can make this call in the WM_CREATE message.
Calling values: HWND hwnd The hwnd of the window your application will be drawing on.
Return value: TRUE if the structures initialized correctly, FALSE if not. You do not need to call DestroyDeck(hwnd) if it fails. void DestroyDeck(HWND hwnd); This function should be called in the WM_CLOSE message of your application. This function cleans up (destroys) any internal resources it was using
Calling values: HWND hwnd The hwnd of the window your application will be drawing on.
Return value: Nothing. void SetDefaultValues(void); This function will reset all internal card values back to their default values. Use this when dealing a new deck of cards, for example.
Calling values: Nothing.
Return value: Nothing. void SetCurrentBack(int nIndex); This function should be called to set the cardback you wish to use when the card is drawn FACEDOWN. Call SetCurrentBack(nIndex), where (nIndex) is one of: #define CARDBACK1 1 #define CARDBACK2 2 #define CARDBACK3 3 #define CARDBACK4 4 #define CARDBACK5 5 #define CARDBACK6 6 #define CARDBACK7 7 You may call SetCurrentBack(nIndex) any number of times to change card backs during your game, but remember to re-draw any previously dealt face-down cards to reflect the new choice. Note that CARDBACK7 will use a developer defined cardback that has been previously set with SetCustomBack.
Calling values: int nIndex The index value of the cardback you wish to use.
Return value: Nothing. void SetCustomBack(HBITMAP hbmBack); This function is used to set a custom bitmap as your own card back. The bitmap should be CARDHEIGHT and CARDWIDTH in size. If it isn't you will see strange results. You must load and manage the bitmap handle yourself, so don't destroy it before your application done.
Calling values: HBITMAP hbmBack A handle to the bitmap to use.
Return value: Nothing. void SetOffSet(int nValue) To use the static library dragging functions for a block of cards in your game, you must deal cards in vertical columns as in Windows Solitaire. By default, cards should be dealt in a column which is where each card is offset by 10 pixels in the Y direction. To use a different vertical use this function to make sure that the dragging functions work correctly.
Calling values: Int nValue New pixel offset value. This must be less that CARDHEIGHT.
Return value: Nothing. Card Drawing Functions void DrawCard(HWND hwnd, int nCard, int nx, int ny); void DealCard(HWND hwnd, int nCard, int nx, int ny); void DrawSymbol(HWND hwnd, int nCard, int nx, int ny); void DrawBack(HWND hwnd, int nValue, int nx, int ny); void RemoveCard(HWND hwnd, int nCard); void DrawCard(HWND hwnd, int nCard, int nx, int ny); This is the quickest and easiest way to draw a card onto a window. Call it with the window hwnd, the number of the card to draw (1 - 113), and the x, y location. The DrawCard function does not update or modify any of the card's internal data members, such as its x or y location. To use the static library dragging functions for a single or block of cards in your game, you must use the DealCard API.
Calling values: HWND hwnd A handle to window to draw on. Int nCard The number of the card to draw. Int nx The X coordinate to draw the card at. Int ny The Y coordinate to draw the card at.
Return value: Nothing. void DealCard(HWND hwnd, int nCard, int nx, int ny); The DealCard function works like the DrawCard function. It also updates the card's X and Y properties to the location you deal the card. And finally, it retains a copy of that portion of the screen which lies behind the card. This is allows for the background to be updated correctly when dragging cards. You must use the DealCard API if you are going to drag cards around on the screen. If you change the background of the window after you have used DealCard you should RemoveCard on all the cards on the screen, Refresh the background, and re-DealCard all of the cards. This will update all of the background images that your cards are covering.
Calling values: HWND hwnd A handle to window to draw on. Int nCard The number of the card to draw. Int nx The X coordinate to draw the card at. Int ny The Y coordinate to draw the card at.
Return value: Nothing. void DrawSymbol(HWND hwnd, int nCard, int nx, int ny); This function draws the basic X, O and blank card (ghostcard) symbols. Valid values are 1 for an X, 2 for an O, and 3 for the place-holder. Do not use this function if you plan to drag these cards, use the DealCard function. #define CE_CARDX 111 #define CE_CARDO 112 #define CE_CARDGHOST 113 .
Calling values: HWND hwnd A handle to window to draw on. Int nCard The number of the card to draw. Int nx The X coordinate to draw the card at. Int ny The Y coordinate to draw the card at.
Return value: Nothing. void DrawBack(HWND hwnd, int nValue, int nx, int ny); This function draws one of the seven cardback designs at the location x, y. Cardback numbers (nValue) 1 through 6 are taken from the pegcard.dll. Cardback number (nValue) 7 is a developer defined custom card back (if available). NOTE: You can also use card numbers 105 to 110 in the DealCard or DrawCard function with their status set to FACEDOWN if you want to draw a group of cards with the cardback showing. This allows you to manipulate 5 facedown cards in the same way you can the other regular cards. The DrawBack function only draws a picture of the selected cardback on the screen. You can also use cards 105 through 109 to display a pile of cards that dwindles as the user clicks on the pile, as in Windows Solitaire. To achieve this effect, first set the card status of card numbers 105 through 110 to FACEDOWN. Then DealCard the "O" symbol on your form. Then DealCard 105 directly on top of it. Then DealCard 106 through 110, each time offsetting the y by +2. This creates a nice 3-D stack effect.
Calling values: HWND hwnd A handle to window to draw on. Int nValue The number of the cardback to draw. Int nx The X coordinate to draw the card at. Int ny The Y coordinate to draw the card at.
Return value: Nothing. void RemoveCard(HWND hwnd, int nCard); This function removes the card from the window provide it was dealt with the DealCard function and it is not blocked. This function will restore the background bitmap. This function does not modify the X and Y values of the card however. You should modify those values, using SetCardX and SetCardY, if you are removing the card from play.
Calling values: HWND hwnd A handle to window to draw on. Int nCard The number of the card to draw.
Return value: Nothing. Card Information Functions int GetCardColor(int nCard); int GetCardSuit(int nCard); int GetCardValue(int nCard); BOOL GetCardStatus(int nCard); void SetCardStatus(int nCard, BOOL bStatus); BOOL GetCardBlocked(int nCard); void AdjustCardBlocked(int nCard, BOOL bValue); BOOL IsCardDisabled(int nCard); void SetCardDisabled(int nCard, BOOL bValue); int GetCardX(int nCard); void SetCardX(int, int); int GetCardY(int nCard); void SetCardY(int, int); BOOL GetUser1(int nCard); int GetUser2(int nCard); int GetUser3(int nCard); int GetUser4(int nCard); void SetUser1(int nCard, BOOL bValue); void SetUser2(int nCard, int nValue); void SetUser3(int nCard, int nValue); void SetUser4(int nCard, int nValue); int CECardVersion(); int GetCardColor(int nCard); This function returns the color of the card specified. It returns 1 for a black card, 2 for a red card. This defines the color of the card. #define RED 1 #define BLACK 2 Calling values: Int nCard The number of the cardback to draw.
Return value: Returns the card color or 0 for undefined (Cardback's and placeholders for example). int GetCardSuit(int nCard); This function returns the suit of the card specified. It returns 1 for Clubs, 2 for Diamonds, 3 for Hearts, 4 for Spades. This defines suit of the card. #define CLUBS 1 #define DIAMONDS 2 #define HEARTS 3 #define SPADES 4 Calling values: Int nCard The number of the cardback to draw.
Return value: Returns the card suit or 0 for undefined (Cardback's and placeholders for example). int GetCardValue(int nCard); This function returns the numeric value of nCard. Aces have a value of 1, Twos have a value of 2, right up to King which has a value of 13.
Calling values: Int nCard The number of the cardback to draw.
Return value: Returns the card suit or 0 for undefined (Cardback's and placeholders for example). BOOL GetCardStatus(int nCard); void SetCardStatus(int nCard, BOOL bStatus); These get and set respectively, the current faceup/facedown status of a card. All cards are initialized with a Status of FACEUP. Cards with a status of FACEDOWN will be dealt and handled as FACEDOWN card with the current cardback being drawn in place of the card face. bStatus is one of: #define FACEUP TRUE #define FACEDOWN FALSE Calling values: Int nCard The card to modify. BOOL bStatus The FACEUP or FACEDOWN status of the card.
Return value: bStatus in the case of GetCardStatus. BOOL GetCardBlocked(int nCard); void AdjustCardBlocked(int nCard, BOOL bValue); These get and set respectively, the current CardBlocked status of a card. To determine if a card is blocked by another card call GetCardBlocked. When you drop or deal a card on top of another card you must block (AdjustCardBlocked(nCard, TRUE)) the card you underneath. Then unblock the card on top AdjustCardBlocked(nCard, FALSE)).This is an important property if you will be doing any dragging. When initializing a drag event, the drag functions first checks for any unblocked cards under the mouse cursor. If it finds one, it will return the number of that card. This initiates a Single drag operation. If it doesn't find one, it then determines if it is in the top 10 (or user defined OffSet) pixels of any other card, including blocked cards. If it is, it returns the number of that card. This initiates a Block drag operation. You must maintain your card stacks blocked and unblocked status. Therefore, when creating a row or pile of cards, only the topmost card should have an CardBlocked value of FALSE. Remove a block on a card by calling AdjustCardBlocked(nCard, FALSE). Set the CardBlocked status on a card by calling AdjustCardBlocked(nCard, TRUE).
Calling values: Int nCard The number of the cardback to draw. BOOL bValue The X coordinate to draw the card at.
Return value: Nothing. BOOL IsCardDisabled(int nCard); void SetCardDisabled(int nCard, BOOL bValue); You can get and set the CardDisabled property using these functions. Even when cards are played to their top, final locations, they can be dragged down again and replaced on the lower piles. If you do not want "finished" cards to be replayed like that in your game, you can set their Disabled property to TRUE with SetCardDisabled(nCard, TRUE). Then the user will no longer be able to drag them back down into play.
Calling values: HWND hwnd A handle to window to draw on. Int nValue The number of the cardback to draw. Int nx The X coordinate to draw the card at. Int ny The Y coordinate to draw the card at.
Return value: Nothing. int GetCardX(int nCard); void SetCardX(int nCard, int x); int GetCardY(int nCard); void SetCardY(int nCard, int y); Use these functions to get and set the x and y location properties for a card. These are pixel coordinates based on 0, 0 in the top left corner of the window. Note that these functions do not move the cards to the new location
Calling values: Int nCard The number card value to change. Int x The X coordinate to draw the card at. Int y The Y coordinate to draw the card at.
Return value: Nothing. BOOL GetUser1(int nCard); int GetUser2(int nCard); int GetUser3(int nCard); int GetUser4(int nCard); void SetUser1(int nCard, BOOL bValue); void SetUser2(int nCard, int nValue); void SetUser3(int nCard, int nValue); void SetUser4(int nCard, int nValue); You can use these functions to get and set values of your choosing which you wish to associate with any of your cards. User1 is a Boolean TRUE and FALSE value. User2, User3 and User4 are all Integer types. These functions can be used to track cards for multi-deck games.
Calling values: Int nCard The number of the card to modify. BOOL nValue TRUE or FALSE. Int nValue an integer value.
Return value: BOOL or int int CECardVersion(void); You can use this to determine which version of the DLL you are using. This value begins an 1 and increases sequentially.
Calling values: None
Return value: Int value indicating the version number of the DLL. Card Dragging Functions int InitDrag(HWND hwnd, int nx, int ny); void AbortDrag (void); void DoDrag(HWND hwnd, int nx, int ny); int EndDrag (HWND hwnd, int nx, int ny); void BlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); int EndBlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); void ReturnDrag(HWND hwnd, int nCard, int nx, int ny); void ReturnBlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); int InitDrag(HWND hwnd, int nx, int ny); Use this function in a WM_LMOUSEDOWN event to start a drag operation. The function searches through all cards to determine if the mouse cursor is over any card whose CardBlocked property is FALSE. If it finds one, it returns the number of that card. If it does not find one, it searches through all the cards in the deck to see if the mouse lies in the top 10 (or User-Defined OffSet) pixels of any card, blocked or not. If it does, it returns the number of that card. By checking the CardBlocked property of this returned card, you can tell if the user wants to carry out a single drag or a block drag. If InitDrag returns a value of 0, the mouse is not currently located over any card. The InitDrag function should always be followed by a corresponding AbortDrag, an EndDrag or an EndBlockDrag call. This is due to that fact that InitDrag "captures" all mouse input, and requires one of these corresponding calls to release the capture. The values nx and ny are the current mouse coordinates.
Calling values: HWND hwnd A handle to window to draw on. Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: Int nCard Value of the card the mouse is over or 0 if none. void AbortDrag (void); This function ends any drag operation started by an InitDrag call. AbortDrag releases the mouse which is captured by InitDrag.
Calling values: None.
Return value: None. void DoDrag(HWND hwnd, int nx, int ny); Use this function to do the actual drag operation which was initiated by InitDrag API call. DoDrag moves the current card, selected by the InitDrag API call, to its new location. Values nx and ny are the current mouse coordinates.
Calling values: HWND hwnd A handle to window to draw on. Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: None. void BlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); You use the BlockDrag function to perform a block drag operation. Use the function after a drag operation has been started with a call to InitDrag. It requires an array containing a list of cards to be dragged. The function also requires the number of cards to be dragged and the current mouse coordinates.
Calling values: HWND hwnd A handle to window to draw on. Int CardList[] An array containing a list of cards to drag Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: None. int EndDrag (HWND hwnd, int nx, int ny); The EndDrag function ends a single card drag operation and returns the number of the card that the card was dropped on. It searches the deck for any card which overlaps the Source Card and whose CardBlocked property is FALSE. If it finds one, it returns the number of that card. The function also releases the mouse which was captured by the InitDrag call.
Calling values: HWND hwnd A handle to window to draw on. Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: Int nCard Number of the card dropped on. int EndBlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); The EndBlockDrag function ends a block drag operation which was initiated by an InitDrag call. The function searches through the deck for any card which overlaps the Source Card and whose IsBlocked property is FALSE. If it finds one, it returns the number of that card. The function also releases the mouse which was captured by the InitDrag call. The function requires a list of the cards being dragged in the form of an array. The function also requires the number of cards being dragged and the current mouse position.
Calling values: HWND hwnd A handle to window to draw on. Int CardList[] An array containing a list of cards to drag Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: Int nCard Number of the card dropped on. void ReturnDrag(HWND hwnd, int nCard, int nx, int ny); This function snap drags the card (nCard) to the location nx, ny along a straight line from its current location. Return drag can be used for returning cards to their original location after an invalid drag operation.
Calling values: HWND hwnd A handle to window to draw on. Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: None. void ReturnBlockDrag(HWND hwnd, int CardList[], int nNumCards, int nx, int ny); This function drags a block of cards to the location nx, ny along a straight line from their current location. It can be used to return a block of cards to their original.
Calling values: HWND hwnd A handle to window to draw on. Int CardList[] An array containing a list of cards to drag Int nx The X coordinate of the mouse position. Int ny The Y coordinate to of the mouse position.
Return value: None. Functions from Cards.DLL BOOL cdtInit(int *dx, int *dy)
void cdtTerm()
BOOL cdtDraw(HDC hdc, int x, int y, int cd, int mode)
The cd parameter controls which card is drawn. If the faces are shown, use the values 0 through 51 to represent each card. For example the defines are IDA(ce)CLUBS through IDK(ing)SPADES #define IDACLUBS 1
#define IDKSPADES 52
BOOL cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int cd, int mode)
BOOL cdtAnimate(HDC hdc, int cd, int x, int y, int ispr)
This page was last updated on 06/04/99. |
|
Feedback mailto:ppcdev@conduits.com |