Motorola C550, C450, C370 technical manual Sprite Methods

Page 57

8

Gaming API and Sound

The creation of the raw frames follows these standards:

Frames must be equally sized, all being of the frame width (fWidth) and height (fHeight) defined in the constructor parameters. They may be laid out in the image horizontally, vertically, or as a grid. The width of the source image must be an integer multiple of the frame width. The height of the source image must be an integer multiple of the frame height.

The frames in the source image will have raw frame numbers as follows:

The frames are numbered like words are read on a page; left-to-right, then top- to-bottom. The top-left frame is numbered 0. If there is a frame to its right, this frame is numbered 1, and so on, across the first row of frames. If there is a second row of frames, the number of the left-most frame in this row is one greater than the right-most frame in the preceding row. The table below is a diagrammatic depiction:

0

1

. . .

N – 1

 

 

 

 

N

N + 1

. . .

2N – 1

 

 

 

 

2N

2N + 1

. . .

 

 

 

 

 

. . .

. . .

. . .

. . .

 

 

 

 

(M – 1) * N

((M-1)* N ) + 1

. . .

(M * N ) – 1

 

 

 

 

So the total number of frames is M * N, where:

N = (image width) / (frame width)

M = (image height) / (frame height)

At the time of creation, all Sprites have a default frame sequence corresponding to the raw frame numbers. This can be modified with setFrameSequence(). At construction time, the Sprite's position will be set to (0,0), the depth will be set to 0, and the Sprite will be visible. The Sprite shall behave as if the image used in creation were cached. If a mutable image is used to create the Sprite, the Sprite's appearance should not reflect changes to mutable source image.

public Sprite(Sprite s) – Creates a new Sprite from another Sprite. Create a copy of a Sprite. All attributes (raw frames, position, frame sequence, current frame, visibility) of the source Sprite should be reflected in the new Sprite. Any subsequent updates to the source Sprite after the creation of the second Sprite should not be reflected in the second Sprite.

Sprite Methods

The Sprite class implements the following methods:

public void setPosition(int x, int y) – Set Sprite's x,y position. The x, y position is relative to whatever object the sprite is associated with or drawn on.

57

Image 57
Contents Technical Manual Table of Contents Lcdui JAD Attributes Purpose IntroductionAudience DisclaimerReferences Definitions, Abbreviations, Acronyms Revision HistoryDate Name Reason Acronym DescriptionDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformNetworking Description DisplayFile & RMS Java VMDeveloping and Packaging J2ME Applications Guide to Development in J2MEIntroduction to Development Page OTA Procedure InstallationDownloading Applications Program and Data space notes Java Application Installer/De-Installer Jaid Starting ApplicationsExiting Applications Error Checks Launching Web Session for Http DownloadDownloading MIDlets XML Screen Renderings BombMan is back, now on your Taichi series of handsets Taichi handset New Games MIDlet Lifecycle Application ManagementMIDlet Suite Installation MIDlet Suite De-installation DestroyApp MIDlet Suite UpdatingCaller Purpose MethodStartApp or the pauseApp Using startApp MIDlet Control of MIDlet State Transitions Java SystemPage Network Connections Network APIClass Descriptions URL Format IOException when it detects a time-out conditionTCP Sockets UDP SocketsImplementation Notes Network API Description LcduiLcdui Gaming API and Sound Functional DescriptionClass Hierarchy BackgroundMusic Class Using BackgroundMusicBackgroundMusic Methods Gaming API containing a sound APIGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Class ImageUtil FieldsImageUtil Methods RgbData Using ImageUtilPalleteImage Class PalleteImage ConstructorPalleteImage Methods Public void setTransparentIndexint index throws Using PalleteImagePlayField Class Using Static and Animated TilesUsing Sprites Defining View WindowsPlayField Constructor 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Class Using SoundEffectSprite Class SoundEffect MethodsAnimation Frames Sprite DrawingSprite Constructor Sprite Methods Page Public final void drawGraphics g throws Using Sprite FileFormatNotSupportedExceptionSprites Max Midi Extension Support Java Gaming Sound APIFileFormatNotSupportedException Constructors Java Gaming Sound APIVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name Class Description Record Management SystemCode Examples RecordStoreCaveats TipsPhonebook Access API Phonebook AccessSample of code to create object of PhoneBookRecord class Phonebook Access API PermissionsSimmemory Sample of code for calling of ‘getMaxEmailLength ’ method Sample of code for calling of ‘isPrimaryint speedNo’ method Sample of code for calling of ‘getNumberCategories’ method Sample of code for calling of ‘setCategoryView’ method Sample of code for calling of ‘getUsedRecords’ method Int index = ReceivedRecord.getRecord1 Intelligent Keypad Text Entry API ITAPKey Mapping for the C370, C450, and C550 Appendix a Key MappingCenter Select END Available Memory Appendix B Memory Management CalculationAppendix C Online FAQC370, C450, and C550 Spec Sheets Appendix D Spec SheetsMotorola Developer Information Tools DocumentationReferences Purchase Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb