Motorola C370, C550, C450 technical manual Public final void drawGraphics g throws

Page 59

8

Gaming API and Sound

public void setVisible(boolean visible) – Set visibility status. If setVisible(false) is called, the Sprite will not be drawn by draw(Graphics) until setVisible(true) is called.

public boolean isVisible() – Get visibility status. The method returns

boolean indicating whether the Sprite will be drawn by draw(Graphics).

public final void draw(Graphics g) throws

NullPointerException – Draw the Sprite. Draw current frame of Sprite to Graphics instance g at location currently set in Sprite. Sprite will be drawn only if isVisible()= true.

public void setFrameSequence(int[] seq) throws ArrayIndexOutOfBoundsException – Set the sequence of frames to cycle through with next/prevFrame. All Sprites have a default sequence as described in the constructor. This method allows for the creation of an arbitrary sequence from the original frameset. The methods nextFrame(), prevFrame(), getFrame(), and setFrame(int) all operate on the frame sequence. Passing in null causes the sequence to revert to the default sequence defined in the constructor. The parameter seq is an array of integers, where each integer is a reference to a frame in the original raw frameset, that is, the frames from left to right on the original image.

public int[] getFrameSequence() – Get the current frame sequence. Returns the frame sequence set with setFrameSequence(int[]) or, if none has been set, return the default frame sequence for this Sprite. Each entry in the array is an index to the original raw frameset, that is, the frame numbering as described in the constructor.

public void

setImage(javax.microedition.lcdui.Image img,

int fWidth, int fHeight) throws NullPointerException,

IllegalArgumentException – Change the image used for the Sprite. Replaces the current raw frames of the Sprite with a new set of raw frames. See the constructor Sprite(Image, int, int) for information on how the frames are created from the image. Changing the image for the Sprite could change the number of raw frames. If the new frame set has as many or more raw frames than the previous frame set, then:

The current frame will be unchanged;

If a custom frame sequence has been defined (using setFrameSequence(int[])), it will remain unchanged. If no custom frame sequence is defined (i.e. the default frame sequence is in use), the default frame sequence will be updated to be the default frame sequence for the new frame set. In other words, the new default frame sequence will include all of the frames from the new raw frame set, as if this new image had been used in the constructor.

If the new frame set have less frames than the previous frame set, then:

The current frame will be reset to frame 0;

59

Image 59
Contents Technical Manual Table of Contents Lcdui JAD Attributes Disclaimer IntroductionPurpose AudienceReferences Acronym Description Revision HistoryDefinitions, Abbreviations, Acronyms Date Name ReasonDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformJava VM Description DisplayNetworking File & RMSIntroduction to Development Developing and Packaging J2ME ApplicationsGuide to Development in J2ME Page Downloading Applications OTA ProcedureInstallation Program and Data space notes Exiting Applications Java Application Installer/De-Installer JaidStarting Applications Downloading MIDlets Error ChecksLaunching Web Session for Http Download 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 conditionImplementation Notes TCP SocketsUDP Sockets Network API Description LcduiLcdui Class Hierarchy Gaming API and SoundFunctional Description Gaming API containing a sound API Using BackgroundMusicBackgroundMusic Class BackgroundMusic MethodsGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Methods ImageUtil ClassImageUtil Fields RgbData Using ImageUtilPalleteImage Methods PalleteImage ClassPalleteImage Constructor Public void setTransparentIndexint index throws Using PalleteImagePlayField Class Using Static and Animated TilesPlayField Constructor Using SpritesDefining View Windows 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Methods Using SoundEffectSoundEffect Class Sprite ClassSprite Constructor Animation FramesSprite Drawing Sprite Methods Page Public final void drawGraphics g throws Sprites Using SpriteFileFormatNotSupportedException Java Gaming Sound API Java Gaming Sound APIMax Midi Extension Support FileFormatNotSupportedException ConstructorsVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name RecordStore Record Management SystemClass Description Code ExamplesCaveats 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 SheetsReferences Purchase Motorola Developer Information ToolsDocumentation Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb