ARTICLE

Scramble for Pocket PC

Posted by Jigar Desai Articles | Visual Basic 2010 June 08, 2004
This article shows you how to write Scramble for Pocket PC.
Download Files:
 
Reader Level:

While there are lot of examples available for working with .net Compact framework very few are available that show how to use Drawing class with some what limited functionality compared to original GDI+, as you all know in order to fit everything into 32MB things have to be omitted and they are, but we should gracefully accept what is available.

I hope this code sample would help reader to get started with game programming on compact framework, and good part is programming with pocket pc does not look very different from windows application.

Scramble:

Game consists of 5X5 matrix and there are 1-24 numbers randomly placed on board (matrix) and one place is empty. You can move any number to adjacent place or up down if corresponding adjacent or up down place is empty; to finish or win game you have to arrange number in sequence keeping last space in board empty.

GameLogic.vb: encapsulates logic for game Scramble. 

I have used array of integers to define matrix. GameLogic class contains complete logic for game. All you need to do is create instance of game logic in your client application to implement game. 

Class frmScramble: is a form containing user interface for Scramble game.

I have used off-Screen drawing combined with opaque background by overriding OnPaintBackground method of form to produce flicker free and smooth rendering of User interface.  

An important thing to be considered for speed up drawing process is avoid creating brushes and pens in onpaint event, instead of that declare and initialize all brushes and pen at start of program and then use them through out application life. 

As I talked about less functionality in graphics class one of such example is lack of facility to measure string,also absence important methods like DrawArc and DrawPie makes life harder. 

Performance and speed of graphics intensive application should always be tested directly on Device, I have seen lot of performance difference between device and emulator.

share this article :
post comment
 

hello sir,

I m a student of Computer science. My project topic for this yr is on gaming of mobile..which first i tred correctly on normaly in VB.net2008 but when i try the same thing mobile application its giving me error.......how should i load my image in VB.NET 2008 mobile application POCKET DEVICES

Posted by repal shah Sep 11, 2010

helloo..i was saw you'r program and i think is good..i want asking some question..do you have scamble game with the solution..?

Posted by danz frey Mar 12, 2007
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor