[Game] Cribbage

Search This thread

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Major update posted today:

All paint routines re-done, nice felt graphic background (stolen from win7)
Help re-done, includes Menu, Help, Context to give help based on game play
Added Win7 card backs and faces, removed a couple of old winmo card backs
Using Win7 and Xp's card faces, instead of pegcards
Card size and text size better fits screen space (drag to size on PC).

Versions for WM2003, WM5, and WM6.5.3 included.
PC Versions for Win32 and Win64 included (msi in zip file)

New Cards SDK (soon to be) added to post number 6, includes new functions (see cards.h)


/*************/

A very long time ago I wrote a One person Crib game for Windows PC. I never really released it into the wild, but did pass it on to many people I knew (attached here as a zipped CribSetup.MSI file).

I decided to convert that code over to Windows mobile.

The first stumbling block was that windows mobile is missing the famous "cards(32).dll" file that I depended on to display the cards on the PC version. However the standard shell comes with a resource dll "pegcards.dll" that contains the card images, and may contain a higher resolution one as well (pegcards.192.dll, for example). So all I needed to do was emulate the cards.dll functions and use the pegcards images to get it to fly.

The attached WMCrib.exe (zipped) is the beta build of that game.
The attached CAB is an installer, that includes shortcuts and help file/link.
Post number 6, has the Cards32.dll for developers

- The PC version uses a right click to do many things, Tap the stock pile on the Mobile version to do the same functions ("Go", "Done"...).

- The existing application searches for pegcards.196.dll, Pegcards.128.dll, pegcards.96.dll and then pegcards.dll in that order, so chooses the highest resolution images available. I noticed that there are different card backs in each set I have here.

This is a beta build, I have tested it on my phone (and run it on my PC for many years), but you may have issues with your device, use at your own risk

Have Fun!
 

Attachments

  • CribGame2003.CAB
    1 MB · Views: 84
  • CribGame653.CAB
    1 MB · Views: 81
  • CribGame5.CAB
    1 MB · Views: 59
  • CribSetup32.zip
    2.1 MB · Views: 45
  • CribSetup64.zip
    2.1 MB · Views: 30
Last edited:

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
A picture is worth a thousand words

Screens (wvga: OmniaII)
 

Attachments

  • Crib1.JPG
    Crib1.JPG
    24.7 KB · Views: 756
  • Crib2.JPG
    Crib2.JPG
    24.6 KB · Views: 436
  • Crib3.JPG
    Crib3.JPG
    23 KB · Views: 323
  • Crib4.JPG
    Crib4.JPG
    26.9 KB · Views: 242
  • Crib5.JPG
    Crib5.JPG
    19.8 KB · Views: 218
  • CribSolitare.JPG
    CribSolitare.JPG
    21.1 KB · Views: 163
  • CribStats.JPG
    CribStats.JPG
    27.8 KB · Views: 167

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Cards32.dll for developers

If you wish to include the standard cards32 functions plus a new extra functions, in your program, include cards.h in your project, and link with the correct cardsxx.lib.
On WinMo move the dll into the devices windows folder.
On PC, save the dll into the application's folder, or to the windows folder.

WATCH OUT that on XP or older there is an existing "Cards32.dll" in the windows folder. Mine should be fine to replace it, but I have not tested this on XP with original card based applications (Hearts, Solitare...). It should allow the "new" cards to be used on thse older XP card games (even when used on non-XP machines). You could even copy cards32.dll into the windows folder on 64 bit machines so that the XP card games will play on Win7 (or Vista)

The header file is well documented.

Cards32.dll for 32 bit desktop use
Cards64.dll for 64 bit desktop use
CardsWinMo2003 for older ARM machines, any ARM code machine will be fine.
CardsWinMo5, and Cards WinMo653 (should be identical ;), for any ARM THUMB machine
 

Attachments

  • CardsSDK.zip
    4.8 MB · Views: 18
Last edited:

thex

Senior Member
Sep 7, 2006
148
7
Can you add an option for us to add our own scores with a penalty of overcounting or under counting to go to the opponent?
 

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Can you add an option for us to add our own scores with a penalty of overcounting or under counting to go to the opponent?

A question to the order of adding the penalty points. If you enter a tally too small (or large), do you score your tally (or the correct tally), and THEN the computer gets your error points? Could affect the winner near the end of the game. Is this order dependant on who is counting first?
 

thex

Senior Member
Sep 7, 2006
148
7
only score your actual points and the opponent gets the error points.
The opponent should score the error points first - just in case of a win.
 

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
I can't get the users hand and crib, the starter, boxes for your tallys, and the SIP on the screen at the same time without the cards getting so small they can't be seen, especially in landscape mode. So I give up on the ability to enter your tally's :(
 

thex

Senior Member
Sep 7, 2006
148
7
what language are you writing this in? I use vb.net and I might be able to help. I wrote tripYzee.

Maybe just a popup box when it comes time to tally your score. Once entered, the popup would go away.
 

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
what language are you writing this in? I use vb.net and I might be able to help. I wrote tripYzee.

Maybe just a popup box when it comes time to tally your score. Once entered, the popup would go away.

Cool, I love that game Thank You!!! I played it for a long time before I noticed that the second hand is double score, and the third hand is triple score. I always used to fill in the first hand first, then zero'ed the third hand (and second) hand on the misses :(

I write in pure old fashioned (native) "C" code.

I can do the popup with the edit controls easy enough, or for that matter place the edit controls directly on the main screen, the problem is with the sip up, and (QVGA) landscape, there is not enough room to see the cards and the edit boxes at the same time. I don't have the numbers in front of me just now, but in testing earlier, I ended up with a very small card size, and I could not even tell the suit let alone the rank.

I could make you tally your hand (and crib), remember them, tap the stock pile, enter your tally(s), tap OK, and then penalize you for making mistakes. But I thought that making you remember your tally(s) was a bit unfair (since you would no longer be able to see the cards).

In a moment I'll post the lastest version on the first post. It sizes the text, gaps and cards a bit better than the original version. Try it in landscape with the sip up, you'll see what I'm talking about.

The existing code resizes the cards, gaps, and text to best fit the client area of the main window (leaving the menu, and 'status' visible), for any possible screen size. This makes it "just work nice" for any OS (2003, 5.x, 6.x, 6.5.x) and resolution (QVGA, VGA, WVGA), in either portrait or landscape. I'd rather not dismiss this feature.

For you to help (to my way of thinking anyway): Design a screen, QVGA (96 dpi) landscape, SIP up, that shows two four card hands, plus the starter, two edit boxes big enough for two digit numbers, and some sort of "OK" button (even in the menu area). Then make sure the same layout will size itself to QVGA portrait, then do the test with the 128 and 192 dpi images and xVGA screen sizes. I'd accept two layouts (portrait and landscape), but not more than two.
 

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Beta 0.3 added to first post.

CRAP!, I just tried it again on my actual device instead of the simulators and have VERY small text, sorry folks, my mistake.

Quick fix v0.3 posted...
 
Last edited:

thex

Senior Member
Sep 7, 2006
148
7
Instead of using the SIP - why not just create 0-9 number buttons along the bottom of the screen? I just want to be able to enter the total value for my hand, then the value for the crib.
After the round, a message pops up asking the user to enter the value for the hand, then the value for the crib (if it is their crib.)
Let the game auto score during play, I just want to count my hand/crib scores, not the round score.

Downloading new version now!
 

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Instead of using the SIP - why not just create 0-9 number buttons along the bottom of the screen? I just want to be able to enter the total value for my hand, then the value for the crib.
After the round, a message pops up asking the user to enter the value for the hand, then the value for the crib (if it is their crib.)
Let the game auto score during play, I just want to count my hand/crib scores, not the round score.

Downloading new version now!

You like this? I only tried it on the QVGA 2003 sim so far....

"=" is enter, You also have to "enter" to show you saw any penalty points.

I don't like the color of the numbers, but I just stole the graphics from the Samsung calculator app.
 
Last edited:

thex

Senior Member
Sep 7, 2006
148
7
Awesome! However it doesn't tell me if I made a mistake.
I added screenshots of the game for my WVGA;

Tally.jpeg - Actually had to use my stylus for this! What about scalable text?
HandOver.jpeg - I purposely scored higher in the hand, 20, it showed the correct score when hitting "=" but then only scored 10 for my hand?

CribUnder.jpeg - when I underscored for the crib, it never showed me the correct score

I seem to be nitpicking it now and I apologize. I have waited since 2001 for a cribbage game for the PPC that allowed me to score and penalized when I was wrong and you have delivered! Guess I am just trying to tweak it for a better user experience.
 

Attachments

  • tally.jpg
    tally.jpg
    28.3 KB · Views: 10
  • HandOver.jpg
    HandOver.jpg
    29.8 KB · Views: 10
  • CribUnder.jpg
    CribUnder.jpg
    30.3 KB · Views: 11

Mach2003

Senior Member
Sep 3, 2008
1,020
88
Kelowna
Awesome! However it doesn't tell me if I made a mistake.
I added screenshots of the game for my WVGA;

Tally.jpeg - Actually had to use my stylus for this! What about scalable text?
HandOver.jpeg - I purposely scored higher in the hand, 20, it showed the correct score when hitting "=" but then only scored 10 for my hand?

CribUnder.jpeg - when I underscored for the crib, it never showed me the correct score

I seem to be nitpicking it now and I apologize. I have waited since 2001 for a cribbage game for the PPC that allowed me to score and penalized when I was wrong and you have delivered! Guess I am just trying to tweak it for a better user experience.

The top line of text should show your tally (and updates as you tap on the keypad) for hand and crib, and the actual score for hand and crib.
After all your hands are counted, if there is a penalty, you need to tap an extra "=" after you have seen the updated info. I'll check it out on my device this morning. Penalty points are added to Computer's "peg" score.

I thought a half card height would be enough for a finger tap, I'll have to test more.

edit:
- I don't have a problem tapping the keypad with my finger, but I made it a bit bigger (using the gap between the starter and the top).
- The top text line seems to be displaying my tally (live as I tap keys) and calculated score fine, I also have the extra tap when I am charged with an error. I also get a beep (or two), then charged with an error.
- I updated the text to: "Hand Tally: xx, Actual: xx, Crib: xx, Actual: xx, Penalty: xx", and removed the crib componants when you don't have a crib to count.

Did you just miss the info on the text line, or is it acting differently for you?
 
Last edited:

thex

Senior Member
Sep 7, 2006
148
7
You are correct, it is there. I was always looking in the bottom one where my score is.
The card sizes were perfect! it was the tally numbers that I had to use the stylus.

I never get any beeps..?? Also, when i tally the crib incorrectly - the score disappears really fast so I don't see the error.

Do you think you will be able to save a game in progress when the application is closed??