Results 1 to 6 of 6

Thread: Right approach for moving animated objects

  1. #1
    Join Date
    Nov 2012
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Right approach for moving animated objects

    Hi everybody!

    I am working on my first QT project in my free time. I want to create a simple game. I would like to have a static image as the background and I want to let objects appear on the screen from different sides of the window, the objects would move around and the user has to click all of them.

    So far I got this to work with QGraphicsScene and QGraphicsView. At this moment the moving objects are simple PNG images. Now I want to switch the PNG images to something more spectacular like GIF animations or even better would be some video loops. However, now I wonder if I have chosen the wrong base to build on, as for example QMovie I can only use through QLabel and QGraphicsProxyWidget. Anyway, although I got the animated GIF to run this way, it's a mess to handle the transparency of the animated GIF's background, as one has to set mask and update the picture for every frame of the animation.

    Now I wonder, what would be the "state of the art" way to get photorealistic objects move around the screen in QT(for example let a video recorded dog run across the screen), yet I need to be able to track mouse clicks on every object. I even don't know if there is something like transparency in video files...

    I hope you could catch the idea and someone could enlighten me.

    Andy

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Right approach for moving animated objects

    Can you use qml?? it has better performance for game and easier. Especially if use QT5, because it renders with openGL

  3. #3
    Join Date
    Nov 2012
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Right approach for moving animated objects

    Thanks for your suggestion. In fact, I am not restricted by anything, except by myself. I have never before heard about QML(in fact QT Creator offers a project template, I never thought about what it was), I will have a look into it.
    Just for information, my plan is to have a program running on a Windows PC.

  4. #4
    Join Date
    Nov 2012
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Right approach for moving animated objects

    Please, someone! What would be the best approach to let running video objects fly around the screen? Give me at least some Qt classnames to look at.

  5. #5
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    658
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Right approach for moving animated objects

    small suggestion ..
    what about QPropertyAnimation on Graphicsitem ..? will it be useful ..

    check animation/easing example ..
    "Behind every great fortune lies a crime" - Balzac

  6. #6
    Join Date
    Nov 2012
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Right approach for moving animated objects

    Thank you for this hint. The QPropertyAnimation class might help and thanks to you I just looked up Google for a QGraphicsItem video, which I somehow did not even consider before(looked for something more specific) and found the example multimedia/videographicsitem. Haveing a look at it, I think the example has the key to my needs, although it seems like videos there are getting handeled on a frame by frame basis.

    Yet, I wonder if this is the way to go to get good performance. I remember a QT example which shows a comparison of Qt to Qt with OpenGL, which somehow happen to look much better in Qt, whereas OpenGL seems to be the higher performance choice.

Similar Threads

  1. Replies: 0
    Last Post: 24th May 2010, 12:19
  2. Replies: 3
    Last Post: 9th January 2010, 15:47
  3. QGraphicsView and fast moving objects
    By deMarco in forum Qt Programming
    Replies: 4
    Last Post: 26th February 2009, 11:07
  4. what is the best approach
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2007, 09:02
  5. Replies: 7
    Last Post: 18th July 2006, 21:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.