A Dullard's Guide

Information on development, Silverlight, HD DVD, HDi, and whatever else Amy feels is missing from the interblags.

Blackjack, Silverlight 1.0 Edition, Part I

Blackjack, Silverlight 1.0 Edition, Part I

  • Comments 3

One of my favorite HDi apps was blackjack, so I have been just itching to turn it into a Silverlight application.  Now, this one wasn't quite so easy.  My goal in writing blackjack for HDi originally was to take advantage of the timing element and remove as many references to style as possible from the script.  So, in turning this into a Silverlight app, I found myself putting a lot of markup references back into the script.  When the application first starts and a reference to the container is first obtained, all required UI references are cached in the UI object in blackjack.js.

The original application assumed a high definition screen resolution of 1920x1080.  And, while many of you might have this resolution or better, it is not the majority.  One of the challenges of web development is making sure your application works on a variety of platforms and browsers.  Of course using the Silverlight solves a lot of these problems for you.  But you still need to be considerate of screen resolutions.  As of January 2008, 86% of internet users had a screen resolution of 1024x768 or higher.  With that in mind, I reduced the width of my application to 1024 pixels and shrunk the other assets accordingly.

One of the things I kept in this application was the debug trace script and exception handling.  You could of course rely on Internet Explorer script debugging if you would like.  But, personally, I'm not a fan of those error alerts and I like having them neatly displayed on the page.

It seemed much more appropriate to enable the mouse for this game rather than navigating buttons using the arrow keys.  You'll notice that the buttons have events for MouseLeftButtonDown (clicking), MouseEnter (mousing over), and MouseLeave (mousing out).

This version does not have any animations, which in all honesty makes it rather lame as you could just as easily turn this into an DHTML/JavaScript app.  But, I'm working on adding the storyboards and fancy animations which hopefully will be ready for posting soon!

Launch Blackjack

Launch Blackjack

Attachment: SL_Blackjack.zip
  • Hello,

    Visiting the demo URL shows this exception:

    ParserError- Unknown attribute Ignorable on element Canvas.

    File: Page.xaml, line 6 character 164

  • sorry - I was using Blend 2.5 to modify the xaml and there's an attribute in there that shouldn't be.  I will update the linked page on monday.  the attached project is correct, though

  • Very nice. I lost, but it's still very nice :)

Page 1 of 1 (3 items)