Results 1 to 2 of 2

Thread: Amateur Qt question about movement of an object

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Amateur Qt question about movement of an object

    Hello, I'm new here, and I know that I'm probably gonna sound lame, but... I have some urgent homework to finish.

    So it's basically billiards in Qt. Our teacher made an example of moving circles in Java, so I tried to adapt parts of the code from Java to C++ in Qt.

    So I basically have two classes besides the billiards class in Qt.

    I'm sorry it's in spanish but you basically get the idea from the code.

    So, what I'm basically doing with bola.h (ball) is a class to create a ball (just the object) with coordinates x and y for center, and radio for radius.

    DX and DY are the directions in X and Y.

    BolaVisual (VisualBall) is a class to represent graphically the ball and make some functions about its movement. My problem is that I haven't been able to represent the ball graphically in the main window. And I still have to make it move and bounce back when it hits either the borders of the green square or other balls.

    The balls that appear when you Run the thing are just drawEllipse's of how the thing should look.

    Can you guys help me with the display problem and the movement? I just need it to move in straight lines I mean... The direction change is already programmed in the bolaVisual.cpp I think.

    Any help would be appreciated. I attached the .cpp's, the .h's and the .pro

    Thanks in advance!
    Attached Files Attached Files

Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Using QSA: A very basic question
    By yogeshm02 in forum Newbie
    Replies: 3
    Last Post: 26th January 2006, 07:34

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.