January, 2008

Posts
  • CarlosAg Blog

    Backgammon and Connect4 for Windows Mobile

    • 5 Comments

    During the holidays my wife and I went back to visit our families in Mexico City where we are originally from. Again, during the flights I had enough spare time to build a couple of my favorite games, Backgammon and Connect4.

    I've already built both games for Windows using Visual Basic 5 almost 11 years ago but as you would imagine I was far from feeling proud of the implementation. So this time I started from scratch and ended up with what I think are better versions of them (still not the best code, but pretty decent for just a few hours of coding). In fact the AI for the Backgammon version is a bit better and the Connect4 is faster and more suited for a Mobile device.

    You can go with your PDA/Smartphone to http://www.carlosag.net/mobile/ to install both games or just click the images below to take you to the install page of each of them. Enjoy and feel free to add any feedback/features as comments to this blog post.

    The one thing I learned during the development of these versions is that you do want to download the Windows Mobile 6 SDK if you are going to target that version (which is what my cell phone has), since it will add new Visual Studio 2005 Project Templates and new Emulator images which will help you a lot. For example I was trying to use buttons in my forms, and testing it in Pocket PC worked, but as soon as I tried them in my cell phone it crashed with a NotSupportedException. When I installed the SDK and switched to target that platform, Visual Studio immediately warned me that my platform didn't supported buttons which was great.

    Bottom line I'm more and more amazed of how easy it is to build games in Windows Mobile and the things you can achieve with both Windows Mobile and the .NET Compact Framework.

  • CarlosAg Blog

    Looking for an Icon Editor?

    • 6 Comments

    If you are like me and every now and then develop applications that you want to create an icon for, and you don't have the money to spend on a nice commercial tool (or rather spend it in Halo 3, RockBand or Guitar Hero III), then you probably face the problem that tools don't tend to support saving bitmaps as icons.

    In the past I was using the old icon editor that came with mhh… was it Visual Basic 3? and life use to be good cause back then, icons were mostly used at 16 colors and you mostly cared for 16x16 or 32x32 sizes and the tool was decent for those scenarios. But now that icons can use thousands of colors and that you can use up to size of 256x256 it's certainly not a professional look icon when all you have is a 32x32 16 colors icon.

    So then I decide that I was going to build my own icon editor and started coding it in managed code, at the middle of it I was looking over the internet for the icon format and sure enough I was reading all the details of the format, headers, API's, etc, when suddenly searching for a specific struct yield a result that basically stopped me from doing any more code.

    Basically there is a sample in MSDN that has all the support that I need.

    It supports creating an icon, adding multiple formats to it such as 16x16 - 16 color, or 48x48-24bit color, up to 128x128-32bit color. It then allows you to import a bitmap into them and mark the transparent colors (XOR Mask and AND Mask) and everything. Additionally supports extracting icons from files, although I'm sure it could do a better job with PNG compressed files and other stuff, it's still million times better than my old icon editor.

    Nice thing it even comes with the source code in C++ in case you are interested on learning more about icon files.

    The article is from September 1995, but its still great.

    http://msdn2.microsoft.com/en-us/library/ms997538.aspx

    The code and executable can be downloaded from here:

    http://download.microsoft.com/download/win95/utility/1.0/w9xxp/en-us/4493.exe

    Disclaimer: I do not know how good or bad is the source code nor I pretend to recommend it against any other commercial tool, I'm just saying that its good enough for my "hobbyist" projects and you might find it useful.

Page 1 of 1 (2 items)