Custom Skin Creation for MicroEmulator

Introduction

Using this information you will be able to customize MicroEmulator to look and behave like the mobile device for which you do your developement.

There is a good tutorial written by Bertil Gralvik Skinning the MicroEmulator. We are directing you to his website for introduction. Here we will just summarize interfaces for your quick reference.

The Skin of MicroEmulator is described in the device.xml file. There are skins for different devices packaged with product distribution so you can rename the existing skin to start a new one. The Device class for a Skin is optional: you only need to provide xml descriptor and images and package them in jar. We have also created the Another Skin collection, however, its images can only be used with the vendor's special permission.

MicroEmulator Skins

  • Default 176x220 Full Screen and 176x176 Normal Canvas, Skin 226x471.
  • Minimum 128x128 Full Screen and 128x96 Normal Canvas, Skin 157x285. microemu-device-minimum.jar
  • Large 240x320 Full Screen and 240x266 Normal Canvas, Skin 292x618. microemu-device-large.jar

Installing Skin in MicroEmulator

  • Start MicroEmulator
  • Menu Options - > Select device
  • Press Add... button and select the archive file containing Skins you want to install

Packing the device Skin

To use a new device you have to pack it in a JAR Java Archive or Zip file (New). You can have more than one device in one archive. MicroEmulator will find .xml files in the archive and will use them as a device descriptors. MicroEmulator will load images from this archive as resources so you will need to keep the directory structure in this archive. Once installed, a skin archive is copied to $home/.microemulator/ directory, and the references to this archive and devices are recorded in the $home/.microemulator/config2.xml file.

Here is the suggested archive directory structure:

    Archive root
        |-- org
        |    `-- microemu
        |           `-- devices
        |                   `-- vendor
        |                         `-- model
        |                             |-- device.xml
        |                             |-- normal.png
        |                             |-- pressed.png

device.xml Elements

The following section describes the mobile device descriptor elements defined in the device.xml file. See Schema for device.xml http://www.microemu.org/2.0.2/device.xsd and XML Schema Documentation.

  • Backwards compatibility xmlns attribute of device identify MicroEmulator device schema version.
    • xmlns="http://www.microemu.org/2.0/"

      Buttons key attr defines its function

    • xmlns="http://www.microemu.org/2.0.2/"

      Buttons name attr defines its function

    The root element for device.xml is device. It contains img images making up the skin, display and fonts definition and finally input descriptor.

  • device Attribute extends

    Allow inheritance for devices. Xml element name plus optional attribute 'name' are unique identifiers for xml descriptor inheritance

    Example:

    <device xmlns="http://www.microemu.org/2.0.2/" name="Extended minimum device, color, pointer, moto like keys" extends="/org/microemu/device/minimum/device.xml">
        <display>
            <iscolor>true</iscolor>
            <numcolors>65536</numcolors>
        </display>
        <input>
            <haspointerevents>true</haspointerevents>
            <softbutton name="SOFT1" keyCode="-21"/>
            <softbutton name="SOFT2" keyCode="-22"/>
        </input>
    </device>
  • system-properties

    System properties. Ignored while running in the applet.

        <system-properties>
            <system-property name="microedition.platform" value="Nokia6230" />
        </system-properties>
  • img
        <img name="normal" src="normal.png"/>

    There are three basic images making up the skin, one for the "normal" untouched device and two "over" and "pressed" for giving feedback to the user at mouse over and click gestures.

  • display

    Define device display capabilities: colors, size and icons

  • fonts

    LCDUI API fonts mapping to system fonts

        <font face="FACE_SYSTEM" style="STYLE_PLAIN" size="SIZE_SMALL">
                <system name="SansSerif" style="plain" size="10"/>
        </font>
  • input

    Describes device input capabilities and buttons positions

  • button and softbutton
        <softbutton name="SOFT1" key="VK_F1" keyCode="-6" alignment="LEFT">
        <button name="SELECT" key="VK_ENTER" keyCode="-5">

    name mandatory attribute (Since 2.0.2) Identify the button function: SOFT1, SOFT2, SELECT, UP, DOWN, LEFT, RIGHT, 0, 1...9

    namekeyButton functionCanvas.getGameAction(keyCode)
    SOFT1VK_F1Left SoftKey
    SOFT2VK_F2Right SoftKey
    SELECTVK_ENTERSelect KeyCanvas.FIRE
    UPVK_UPUpCanvas.UP
    DOWNVK_DOWNDownCanvas.DOWN
    LEFTVK_LEFTLeftCanvas.LEFT
    RIGHTVK_RIGHTRightCanvas.RIGHT
    POUND#
    ASTERISK*
    Button function and keys assignment base on name

    key attribute is the computer keyboard shortcut which is defined as key. The actual key definitions are virtual key codes, which are defined in J2SE's java.awt.event.KeyEvent class. See the J2SE documentation for details. You can use integer value or String representing KeyEvent field name. For multiple key codes use space separated list.

    When schema 2.0 is used this attribute identify button functions.

    Also keyboardChars attribute can be used to define keyboard shortcut. e.g. # and *

    keyCode optional attribute is key code reported to MIDP application (Canvas.keyPressed()).

    The key code values are unique for different hardware types. The MIDP defines the following key codes in the Canvas class KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_STAR, and KEY_POUND.

    Sometime game application is interested in Left SoftKey, Middle SoftKey, Right SoftKey, Select Key. These keys are not so different between devices.

    For example Nokia and Sony-Ericsson phones have this value: Left SoftKey: -6, Right SoftKey: -7, Select Key: -5

    Motorola devices have this value: Left SoftKey: -21, Middle SoftKey: -23, Right SoftKey -22, Select Key: -20

    Motorola iden devices have this value: Left SoftKey: -20, Middle SoftKey: -22, Right SoftKey -21

    more information can be found in J2ME Polish Device Database.

    If keyCode is not specified the value would be selected based on the name attribute.

    Button functionnamekeykeyCode
    Left SoftKeySOFT1VK_F1-6
    Right SoftKeySOFT2VK_F2-7
    Select KeySELECTVK_ENTER-5
    UpUPVK_UP-1
    DownDOWNVK_DOWN-2
    LeftLEFTVK_LEFT-3
    RightRIGHTVK_RIGHT-4
    Default keyCode assignment

    modeChange boolean value. Itentify one button as mode change button for text inputs. By default # but on some phones this can be *

Device class for Skin

The Device class for Skin is optional; it can be introduced by adding class-name element to device.xml

<device>
   <class-name>org.microemu.devices.nokia.n6230.N6230Device</class-name>
   ...
public class N6230Device extends org.microemu.device.Device {

    public N6230Device() {
    }

}