PointOfLight wrote:Is there any chance you could post some source for us to take a look at?
The source code spans several files. I trimmed it down as much as I could but it's still quite large to post here. I can upload the binaries of both versions, though, maybe my emulator image is broken? (I tried reinstalling it, but who knows).
PointOfLight wrote:Also, can I infer from what you're saying that you have multiple bitmaps for each button representing the different colors? If so, have you tried viewing the "faulty" one in the emulator outside of your application to see if the PocketPC is simply having a problem displaying the bitmap in general?
Yes, that's correct. Before loading a new game state, the GUI system parses an XML file that contains a "GUI theme" description. This file defines several things such as the filenames of the images used by the widgets. It also defines one or more "Button Types", which specify which images are used for the buttons "normal state", "hovered state", "pressed state" and "disabled state" and the font that must be used for the button's caption. This is the GUI theme file I'm using:
- Code:
<GUITheme>
<Image ID="0" EDGEPacketFilename="SPMData.epk" Filename="soda.bmp"/>
<Image ID="1" EDGEPacketFilename="SPMData.epk" Filename="soda2.bmp"/>
<Image ID="2" EDGEPacketFilename="SPMData.epk" Filename="soda3.bmp"/>
<Image ID="3" EDGEPacketFilename="SPMData.epk" Filename="UpArrow.bmp"/>
<Image ID="4" EDGEPacketFilename="SPMData.epk" Filename="DownArrow.bmp"/>
<Image ID="5" EDGEPacketFilename="SPMData.epk" Filename="MsgBox.bmp"/>
<Image ID="6" EDGEPacketFilename="SPMData.epk" Filename="MsgBoxButton.bmp"/>
<Image ID="7" EDGEPacketFilename="SPMData.epk" Filename="soda4.bmp"/>
<ButtonType ID="0" NormalStateImgID="0" PushedStateImgID="1" HoveredStateImgID="2" DisabledStateImgID="7" FontID="1"/>
<ButtonType ID="1" NormalStateImgID="1" PushedStateImgID="2" HoveredStateImgID="0" DisabledStateImgID="7" FontID="0"/>
<ListBoxType ID="0" UpArrowImgID="3" DownArrowImgID="4" FontID="1" MaxItemsVisible="5" MaxCharsPerItem="30"/>
<StaticTextType ID="0" UsesBackgroundImg="YES" BackgroundImgID="0" FontID="1" HAlign="Left" VAlign="Top" Wrapped="YES"/>
<StaticTextType ID="1" UsesBackgroundImg="NO" FontID="1" HAlign="Left" VAlign="Top" Wrapped="YES"/>
<MessageBoxType ID="0" TitleFontID="1" TextFontID="1"
ButtonsFontID="1" BackgroundImgID="5" ButtonsImgID="6"
ButtonsRelDistTop="70" TitleBarDistTop="10" TitleHAlign="Center" TitleVAlign="Center" MsgRelDistHorz="5" MsgRelDistTop="15"
MsgRelDistBottom="60" MsgHAlign="Center" MsgVAlign="Center" MsgWrapped="YES"/>
</GUITheme>
After the GUI theme file is read, the GUI manager reads yet another file which contains the information for every widget in the game state that is about to be loaded. For example, two buttons might have a different caption but use the same Button Type. This is the GUI file from the game state that is not working:
- Code:
<GUIElements GUIThemeID="0" FontFileID="0">
<GUIElement>
<Ctg>Button</Ctg>
<ID>500</ID>
<TypeID>0</TypeID>
<Parent>0</Parent>
<Corners C1="160" C2="10" C3="320" C4="40"/>
<Text>MAIN MENU</Text>
<Tooltip> </Tooltip>
</GUIElement>
<GUIElement>
<Ctg>Button</Ctg>
<ID>501</ID>
<TypeID>0</TypeID>
<Parent>0</Parent>
<Corners C1="160" C2="60" C3="320" C4="90"/>
<Text>HQ</Text>
<Tooltip> </Tooltip>
</GUIElement>
<GUIElement>
<Ctg>StaticText</Ctg>
<ID>502</ID>
<TypeID>0</TypeID>
<Parent>0</Parent>
<Corners C1="20" C2="400" C3="180" C4="600"/>
<Text>FUNDS:</Text>
</GUIElement>
</GUIElements>
As you can see, both buttons use the same "ButtonType" (TypeID), which is 0. Since I can correctly see one of them, I assume the emulator is not having any trouble in displaying the bitmaps.
Thanks for your help,
--Nacho