Click here to Skip to main content
6,295,667 members and growing! (16,767 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Applications     Intermediate

Bubbles for Pocket PC

By Ramon de Klein

An addictive game for PocketPCs with full source code included.
VC6, eVC 3.0, Windows, Mobile, ATL, Dev
Posted:13 Sep 2000
Views:189,603
Bookmarked:45 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
23 votes for this article.
Popularity: 6.01 Rating: 4.42 out of 5
1 vote, 14.3%
1

2
1 vote, 14.3%
3
1 vote, 14.3%
4
4 votes, 57.1%
5
  • Download source files - 82 Kb
  • Bubbles about dialog

    Introduction

    Bubbles is a board game designed for use on the Pocket PC. The game starts with a board full of colored balls (called bubbles). Adjacent bubbles with the same color can be removed from the board. The more bubbles you remove in a turn, the more points you score. When you clear the entire board you get bonus points.

    Bubbles was my first try to create a Windows CE program for the Pocket PC. It first used MFC, but I switched to ATL pretty early during the project. The game demonstrates how ATL can be used to create Windows CE programs with a small memory footprint.

    Infrared support is one of the most appealing features of Windows CE, so I wanted to enable IrDA support as well. High scores can be transferred between CE devices (or Windows 2000) using IrSockets. It's relatively easy to use and the project contains some wrapper classes to enable IrDA sockets (nonblocking to avoid lockups).

    During the development of this game I noticed that the CE environment isn't as mature as the desktop Win32 environment. STL and WTL are both missing. ATL for Pocket PC isn't as stable as its Win32 counterpart. The emulator locks up when you play several wave files after each other.

    Bubbles game window

    The most annoying bug is in the ATL handling of WM_INITDIALOG. Due to a very trivial error in this piece of code you are forced to override this method (otherwise SHInitDialog won't be called). If you want to call SHInitDialog yourself, then you need to override the method and pretend that you never did (otherwise ATL will call it again with it's own set of arguments). Very annoying and it took me a while, before I figured out that this was wrong.

    Most Pocket PC applications allow only one single instance. If the application is started again it reactivates the first instance of the application. Despite 95% of the Pocket PC programs need this functionality there is no support in the API (or ATL) to accomplish it in an easy way. You need to register your own window class and when the application starts, you need to look for that window class. If it exists, then you need to bring the window to the foreground to activate the application again. Unfortunately, this doesn't work good when your main window wasn't the active window when you deactivated the application (i.e. a dialog was on screen). In that case the main window is activated and this causes some problems. The OK button of the dialog isn't visible. The dialog's OnActivate isn't called, so the SIP (soft input panel) isn't disabled, etc...

    Despite these problems this game can serve as a good starting point for your own games. Game logic is separated from UI and highscore, options and about screens can be easily reused. I started writing a Tetris clone using this template and I hope it can be useful for you as well.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Ramon de Klein


    Member

    Occupation: Web Developer
    Location: Netherlands Netherlands

    Other popular Mobile Development articles:

    • Writing Your Own GPS Applications: Part 2
      In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
    • Writing Your Own GPS Applications: Part I
      What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
    • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
      A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
    • Pocket 1945 - A C# .NET CF Shooter
      An article on Pocket PC game development
    • iPhone UI in Windows Mobile
      It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
    Article Top
    You must Sign In to use this message board.
    FAQ FAQ 
     
    Noise Tolerance  Layout  Per page   
     Msgs 1 to 25 of 35 (Total in Forum: 35) (Refresh)FirstPrevNext
    Generalhow to display a raw bitstream video? Pinmembersandeepp2:35 30 Mar '04  
    GeneralWhat should I do? PinmemberIxCraZee3:36 27 Aug '03  
    Generalstreaming video on Pocket Pc 2002 PinmemberVittoriosi0:32 10 May '03  
    GeneralRe: streaming video on Pocket Pc 2002 PinmemberPaul van der Walt4:46 14 Aug '03  
    GeneralXeXo PinsussXeXo10:33 13 Oct '02  
    GeneraliPAQ & OPENGL??? PinsussXeXo4:21 11 Oct '02  
    GeneralRe: iPAQ & OPENGL??? Pinmemberrex_chen23:54 20 Mar '03  
    GeneralQ]Just sending data to device PinmemberAnonymous21:33 29 May '02  
    GeneralDebug Version - Not working PinmemberAnonymous7:13 3 May '02  
    Generalhow to create setup in eVC++ Application PinmemberAnonymous23:33 25 Feb '02  
    GeneralRe: how to create setup in eVC++ Application Pinmemberemcon4:06 8 Mar '02  
    GeneralRe: how to create setup in eVC++ Application PinmemberSaurabh Soni1:17 11 May '02  
    GeneralRe: how to create setup in eVC++ Application Pinmemberrex_chen23:48 20 Mar '03  
    GeneralRe: how to create setup in eVC++ Application Pinmemberkewal shah0:51 11 Dec '03  
    GeneralI can not print using IrDA port PinmemberXavi0:25 4 Feb '02  
    GeneralRe: I can not print using IrDA port PinmemberAnonymous23:24 18 Apr '02  
    GeneralSH* not found when compiling PinmemberJason Douglas12:42 18 Dec '01  
    GeneralRe: SH* not found when compiling PinmemberArunHarnoor19:10 21 May '02  
    GeneralRe: SH* not found when compiling PinmemberRizKhan20:57 11 Aug '03  
    GeneralRe: SH* not found when compiling Pinmemberjensen22:04 6 Jan '04  
    GeneralCan it work on ipaq? Pinmemberharlem tsai16:31 5 Jun '01  
    GeneralRe: Can it work on ipaq? PinmemberMatt.W.20:20 7 Jun '01  
    GeneralRe: Can it work on ipaq? PinmemberJereymy12:17 7 Nov '01  
    GeneralRe: It works on iPAQ, but MIPS ? Pinmemberchris1093:38 31 Dec '02  
    GeneralWhy don't Build setup for MIPS CPU? Pinmembermartyr16:37 28 May '01  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    PermaLink | Privacy | Terms of Use
    Last Updated: 13 Sep 2000
    Editor: Chris Maunder
    Copyright 2000 by Ramon de Klein
    Everything else Copyright © CodeProject, 1999-2009
    Web15 | Advertise on the Code Project