×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Canvas or GameCanvas

    Hi
    whiche one is beter and good to use in application : Canvas or GameCanvas ???
    Thanks

  2. #2
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: Canvas or GameCanvas

    what I prefer is canvas rest there is no major difference between the two and many times its all depends on the requirement that let to choose either canvas or game canvas
    Regards,
    Saurabh

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

    Re: Canvas or GameCanvas

    Quote Originally Posted by mahdi68 View Post
    Hi
    whiche one is beter and good to use in application : Canvas or GameCanvas ???
    Thanks
    Well that's depends upon the requirement. You know that Canvas is available to MIDP 1.0 and 2.0 both GameCanvas is however available only to MIDP 2.0. GameCanvas brings convenience to game programming. I believe anyway that newer devices will get faster such speed difference between Canvas and GameCanvas, if any, will not be an issue. If portability is the issue then retain Canvas.

    since GameCanvas extends Canvas, all the Canvas features are available, so also the keyPressed/Released/Repeated methods. About key handling, a getKeyStates() method is also available in GameCanvas, that queries and returns the states of the physical game keys.

    Using GameCanvas is easier to control key events and update the screen as compare to the Canvas. To control key events you just have to use the method getKeyStates() instead of using 3 methods (keyPressed, keyReleased keyRepeated) used in Canvas and to update the screen you just use flushGraphics() method.

    So I would recommend that for the development of the games you should use the Canvas. Since there is no such critical requirement of the repainting and key updation as compare of the games.

    Please check that whether this make some sense to you.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

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

    Re: Canvas or GameCanvas

    I strongly recommend you avoid GameCanvas.

    Canvas uses a purely event-based model (with events like keyPressed() and paint()), which is simple and consistent. GameCanvas allows some non-event operation for access to key states... but only for some keys, so you end up having to use the events anyway (and possibly mixing event and non-event models, which makes for a lot of confusion). GameCanvas's non-event painting relies on creating a buffer image, which can consume memory.

    Occasionally, you find some device that behaves better with one or the other (for example, delivers events relating to incoming calls more promptly, which is important for game developers). In the situation where you need to switch superclass during porting, switching from Canvas to GameCanvas is easy, whereas switching from GameCanvas to Canvas can be very time consuming. So, much better if you develop with Canvas from the beginning.

    Graham.

Similar Threads

  1. Canvas and GameCanvas, which one to use?
    By marazo in forum Mobile Java General
    Replies: 4
    Last Post: 2007-08-16, 13:38
  2. Replies: 3
    Last Post: 2005-08-24, 19:18
  3. Replies: 0
    Last Post: 2005-08-17, 11:03
  4. Strange MIDlet slowdown when use GameCanvas instead Canvas
    By alexey_kr in forum Mobile Java General
    Replies: 1
    Last Post: 2005-05-06, 15:26
  5. Major problem with delegation to Canvas
    By bartekn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2003-10-08, 17:46

Posting Permissions

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