×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    9

    Creating multiple UI threads in j2me..

    hi,

    I am working on game development, and i need to create multiple UI threads to handle different events.. is it possible to do... i am sure using normal threads its not possible to do.. because the statements that are executed by the normal threads are not displayed even if u passed the same Graphics object..

    Thanks,
    Shiva

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Creating multiple UI threads in j2me..

    There is only one "UI thread", created by the device for you. It delivers all the events. You can create other threads, but I strongly recommend you limit yourself to just one.

    You might like to read this post, and this thread.

    Graham.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    9

    Re: Creating multiple UI threads in j2me..

    @Graham
    thanks for your reply, I gone through the links that you provided.

    But i need to handle different events at single time, like i want to display time in my game i need to handle that event by separate thread I don't want to depend that event on to main UI thread. that's the reason i need multiple threads..

    will you please let me know how to create multiple UI threads..

    thank you,
    Shiva

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Creating multiple UI threads in j2me..

    No, you don't need to use multiple threads. You can (and should) handle everything on one thread (one thread you create, to run along side the event thread). If you use follow the code in the example I pointed you to, you can do exactly what you want. Most commercial games work this way.

    In the sample code, a loop is used to generate paint events at regular intervals, so that the game can run separately from external events like key presses. This is by far the simplest and most reliable technique. You can do exactly what you want this way.

    Graham.

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Creating multiple UI threads in j2me..

    Yeah Graham is perfectly correct and that is the approach that is being strongly recommended.Most of games programmers does the coding like that.Even you should have asked this question like how to manage the various activities in the game?

    Therefore I would rather
    Would rather recommend that you must read the articles on the web and see the code structure of the games over the web. I found this article very helpful and important for your concern.
    This is the article include the both approach like the canvas and gamecanvas.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Multiple threads problem
    By kunlamp in forum Symbian
    Replies: 4
    Last Post: 2009-11-04, 05:34
  2. Multiple threads within one process
    By leejx in forum Symbian
    Replies: 15
    Last Post: 2009-10-14, 08:34
  3. Using the same socket in different/multiple threads, possible?
    By pandakopanda in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2008-02-07, 19:17
  4. multiple threads:how MANY???
    By etamburini in forum Mobile Java General
    Replies: 4
    Last Post: 2003-12-04, 12:14
  5. STDLIB and multiple threads
    By lab1348 in forum Symbian
    Replies: 0
    Last Post: 2003-07-24, 16:08

Posting Permissions

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