×

Discussion Board

Results 1 to 5 of 5

Hybrid View

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    9

    Question The screen is always centered on the image

    How can I do it using Qt creator? I want make 2D game and I need that the screen will be always centered on the image and image will move.
    Because when the image reach maximum screen width it is no longer visible on the screen.

  2. #2
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: The screen is always centered on the image

    I would anchor your image to the horizontal centre of the screen and animate the background and other elements. Are you using QML?

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    9

    Re: The screen is always centered on the image

    Yes I am using QML. I already solve this with following code:

    Timer{

    id: timer

    interval: 20

    running: true
    repeat: true

    onTriggered: {
    screen.x = -image.x + 320

    }
    But it needs some optimalization because when image moves quickly the movement is not smooth and lag.
    I will try to solve it using OpenGL.

  4. #4
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: The screen is always centered on the image

    I realise this thread is starting to get old now but I remembered this:
    http://forumnokia.adobeconnect.com/p6xkwcroh3l/
    It's a webinar exactly about this and they get 60FPS by almost entirely using QML, apart from C++ for Audio, collision detection of a funny shape, and IAP IIRC.
    So if you are listening there are some tips!

  5. #5
    Registered User
    Join Date
    Feb 2013
    Posts
    9

    Re: The screen is always centered on the image

    Thanks, be sure to peruse it when I have more time.

Similar Threads

  1. how to put an image on screen
    By saaa_persistent in forum Symbian User Interface
    Replies: 10
    Last Post: 2009-03-20, 04:02
  2. List element images centered ?
    By rp@memeticdesign.de in forum Mobile Java General
    Replies: 0
    Last Post: 2007-10-04, 09:00
  3. images and text not centered
    By dbristow in forum General Messaging
    Replies: 1
    Last Post: 2004-10-29, 09:09
  4. LABEL is not centered in a DIALOG?
    By geran in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-08-27, 16:34
  5. Alert image not centered on nokia phones
    By glschwar in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2003-10-21, 10:15

Posting Permissions

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