×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    FullCanvas vs GameCanvas

    Hi all,
    Im developing a small game where I use the whole screen to display the contents.
    The main class extends from GameCanvas and either in the Sun Java Wireless Toolkit Emulator and Nokia Series S40 emulator works fine and the whole screen is used but I then try on a Nokia 6630 and Nokia N70 and a blank space appears in the bottom of the screen.

    I thought it is due to I extend from GameCanvas instead of com.nokia.mid.ui.FullCanvas, am I right?
    I want to test the game in many phones so: How I can I choose in real time if my main class should extend from FullCanvas or GameCanvas?

    Thanks a lot

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Re: FullCanvas vs GameCanvas

    You can use Class.forName(). If it doesn't throw a ClassNotFoundException it means the class is supported. But some phones poke into the jar during installation and others try to load all classes at startup, and these phones might have problems with you including both versions.

    shmoove

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    Re: FullCanvas vs GameCanvas

    Thank you for your quick reply.
    I thought about Class.forName() and catching ClassNotFoundException, but my problem is that the main class should extend from GameCanvas or FullCanvas. So for example, once I know that FullCanvas is supported how can I tell the main class to extend from that class instead of the general GameCanvas.
    I think the only solution is having the class twice in one extends from FullCanvas and in the other one from GameCanvas, but the rest of the code remains exactly the same.

    Is there a different way to do this avoiding that code-duplication?

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Re: FullCanvas vs GameCanvas

    Quote Originally Posted by jilko
    Thank you for your quick reply.
    I thought about Class.forName() and catching ClassNotFoundException, but my problem is that the main class should extend from GameCanvas or FullCanvas. So for example, once I know that FullCanvas is supported how can I tell the main class to extend from that class instead of the general GameCanvas.
    I think the only solution is having the class twice in one extends from FullCanvas and in the other one from GameCanvas, but the rest of the code remains exactly the same.

    Is there a different way to do this avoiding that code-duplication?
    The code that does the same doesn't have to be in the Canvas subclass. With a little refactoring you can only duplicate the bare-bones Canvas functionality (constuctor, event callbacks), and move the rest of the code to a separate class.

    shmoove

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    18

    Re: FullCanvas vs GameCanvas

    Are you sure of using GameCanvas or FullCanvas?
    I'm using Canvas and always work fine.

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    Re: FullCanvas vs GameCanvas

    My real problem is that Nokia FullCanvas is a subclass of MIDP Canvas and I definetely need to use GameCanvas, but with GameCanvas its impossible to display the contents in fullscreen mode, so there is the problem.

  7. #7
    Registered User
    Join Date
    Apr 2007
    Posts
    18

    Re: FullCanvas vs GameCanvas

    Try to use Canvas and its method Canvas.setFullScreenMode(true);

Similar Threads

  1. 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
  2. Capturing screen for use on other gameCanvas
    By brianpegan in forum Mobile Java General
    Replies: 0
    Last Post: 2004-03-29, 19:35
  3. Know how to use FullCanvas?
    By sufkarlic in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-09-13, 16:34
  4. 7650 and 3650 Canvas and FullCanvas memory
    By marcilgen in forum Mobile Java General
    Replies: 5
    Last Post: 2003-07-08, 12:24
  5. FullCanvas question
    By marcilgen in forum Mobile Java General
    Replies: 1
    Last Post: 2002-11-04, 08:33

Posting Permissions

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