Click here to Skip to main content
11,805,035 members (57,900 online)
Click here to Skip to main content

Bubbles for Pocket PC

, 13 Sep 2000 CPOL 226.5K 563 59
Rate this:
Please Sign up or sign in to vote.
An addictive game for PocketPCs with full source code included.

Bubbles about dialog


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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ramon de Klein
Web Developer
Netherlands Netherlands
No Biography provided

You may also be interested in...

Comments and Discussions

Questionhow to display a raw bitstream video? Pin
sandeepp30-Mar-04 1:35
membersandeepp30-Mar-04 1:35 
QuestionWhat should I do? Pin
IxCraZee27-Aug-03 2:36
memberIxCraZee27-Aug-03 2:36 
Generalstreaming video on Pocket Pc 2002 Pin
Vittoriosi9-May-03 23:32
memberVittoriosi9-May-03 23:32 
GeneralRe: streaming video on Pocket Pc 2002 Pin
Paul van der Walt14-Aug-03 3:46
memberPaul van der Walt14-Aug-03 3:46 
GeneralXeXo Pin
XeXo13-Oct-02 9:33
sussXeXo13-Oct-02 9:33 
QuestioniPAQ & OPENGL??? Pin
XeXo11-Oct-02 3:21
sussXeXo11-Oct-02 3:21 
AnswerRe: iPAQ & OPENGL??? Pin
rex_chen20-Mar-03 22:54
memberrex_chen20-Mar-03 22:54 
GeneralQ]Just sending data to device Pin
Anonymous29-May-02 20:33
memberAnonymous29-May-02 20:33 
GeneralDebug Version - Not working Pin
Anonymous3-May-02 6:13
memberAnonymous3-May-02 6:13 
Questionhow to create setup in eVC++ Application Pin
Anonymous25-Feb-02 22:33
memberAnonymous25-Feb-02 22:33 
AnswerRe: how to create setup in eVC++ Application Pin
emcon8-Mar-02 3:06
memberemcon8-Mar-02 3:06 
GeneralRe: how to create setup in eVC++ Application Pin
Saurabh Soni11-May-02 0:17
memberSaurabh Soni11-May-02 0:17 
GeneralRe: how to create setup in eVC++ Application Pin
rex_chen20-Mar-03 22:48
memberrex_chen20-Mar-03 22:48 
GeneralRe: how to create setup in eVC++ Application Pin
kewal shah10-Dec-03 23:51
memberkewal shah10-Dec-03 23:51 
GeneralI can not print using IrDA port Pin
Xavi3-Feb-02 23:25
memberXavi3-Feb-02 23:25 
GeneralRe: I can not print using IrDA port Pin
Anonymous18-Apr-02 22:24
memberAnonymous18-Apr-02 22:24 
GeneralSH* not found when compiling Pin
Jason Douglas18-Dec-01 11:42
memberJason Douglas18-Dec-01 11:42 
GeneralRe: SH* not found when compiling Pin
ArunHarnoor21-May-02 18:10
memberArunHarnoor21-May-02 18:10 
GeneralRe: SH* not found when compiling Pin
RizKhan11-Aug-03 19:57
memberRizKhan11-Aug-03 19:57 
GeneralRe: SH* not found when compiling Pin
jensen6-Jan-04 21:04
memberjensen6-Jan-04 21:04 
QuestionCan it work on ipaq? Pin
harlem tsai5-Jun-01 15:31
memberharlem tsai5-Jun-01 15:31 
AnswerRe: Can it work on ipaq? Pin
Matt.W.7-Jun-01 19:20
memberMatt.W.7-Jun-01 19:20 
The iPAQ uses Intels StrongARM processor. Compile for (ARM).
Cool | :cool:

Accept that some days you are the pigeon and some days the statue.
AnswerRe: Can it work on ipaq? Pin
Jereymy7-Nov-01 11:17
memberJereymy7-Nov-01 11:17 
AnswerRe: It works on iPAQ, but MIPS ? Pin
chris10931-Dec-02 2:38
memberchris10931-Dec-02 2:38 
QuestionWhy don't Build setup for MIPS CPU? Pin
martyr28-May-01 15:37
membermartyr28-May-01 15:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151002.1 | Last Updated 14 Sep 2000
Article Copyright 2000 by Ramon de Klein
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid