×

Discussion Board

Results 1 to 15 of 15

Threaded View

  1. #1
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Asha 311 issue with Graphics.copyArea?

    Hello,

    I'm developing a simple game for J2ME. In game loop thread it uses an offscreen bitmap (Image) for the scrolling background, always first moving the current contents of the bitmap a pixel or a few to the left, then drawing newly visible parts to the right side of the bitmap. In the end of the loop, everything is drawn to the screen via Graphics obtained by GameCanvas.getGraphics() - the background bitmap is drawn first, and then other stuff on top of that.

    This works fine on all the emulators that I have, Asha 310, Nokia 808 and Nokia N81. However, I sent the game to a friend who uses Asha 311, and he complained it crashes the whole device so badly that the battery needs to be removed. I checked on on RDA, and was able to narrow the issue to a copyArea call done to the Graphics object of the background bitmap. The following midlet reproduces the issue after running for a while, even without having a Drawable on screen:

    Code:
    (removed)
    Am I doing something wrong, is copyArea not supposed to be used in a loop like this?

    It's pretty easy to change my code so that instead of scrolling the background bitmap, I'll just draw each new vertical line to the right side of the line drawn last time (jumping back to the left side when running out of space) and then draw the background bitmap to the screen in two parts. This is probably more efficient too. However, would be interesting to know if I'm not supposed to do what I'm doing in the code snippet above, and if anyone else has encountered this issue. According to download stats 311 is one of the more popular S40 devices currently.

    Edit: Changed sleep time from 50 ms to 10 ms, to make the crashing more consistent.
    Edit: Removed code, see later in this thread for the updated version.
    Last edited by TongMuan; 2013-07-28 at 15:08.

Similar Threads

  1. LWUIT TextField issue (Asha FullTouch )
    By bogus40 in forum Mobile Java UI and User Experience
    Replies: 6
    Last Post: 2014-03-21, 08:22
  2. Nokia Asha 501 Emulator - jar size issue
    By Giorg189 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2013-07-16, 18:13
  3. 6600 graphics issue
    By ralabate in forum General Development Questions
    Replies: 0
    Last Post: 2004-07-22, 21:18
  4. Graphics.copyArea() vs Image.getRGB() / Graphics.drawRGB() ?
    By akokchai in forum Mobile Java General
    Replies: 1
    Last Post: 2004-06-23, 04:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×