Demos for J2ME SDK Mobile
|
06-25-2021, 11:12 AM
Post: #32
|
|||
|
|||
RE: Demos for J2ME SDK Mobile
(06-25-2021 10:59 AM)java gamer Wrote: How To Add A Background Image ? Use dedomil.josesk.features.RLoader.loadImage(String source) method to load you Image and store it inside a javax.microedition.lcdui.Image variable Like: Code: Image background = RLoader.loadImage("YourImageFile.png"); And use javax.microedition.lcdui.Graphics.drawImage(Image img, int x, int y, int anchor) method inside paint(Graphics g) method into dedomil.yourgame.Game method, before any other command, to draw your background Like that: Code: g.drawImage(background, 0, 0, 0); IMPORTANT: Load EVERY resources, including Images, before anything, i recommend using the Constructor for that, NEVER load the image just before drawing it in the same mothod Never do that: Code: public void paint(Graphics g){ Do that: Code: Image background = RLoader.loadImage("YourImageFile.png"); Or Code: Image background; [size=xx-small]Signature[/size] [URL=https://www.exophase.com/user/JoseskVolpe/][IMG]https://card.exophase.com/2/0/45687.png?1612237163[/IMG][/URL] [align=justify][size=x-small][b]OwO ¿¿¿What is this??? *wags tail* Take my beret plz 7w7 ~[/b][/size][/align] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 10 Guest(s)