Results 1 to 11 of 11

Thread: Making 3D controls in QT, implementing a game loop in QT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Making 3D controls in QT, implementing a game loop in QT

    Well, I could do it that way, with individual functions in that one class all scanning for clicks in various areas and against various objects.

    I just thought it would be nice for each object to figure out when it has been clicked itself and have code for handling each case in the implementation of the code for the class of that object. Also, I might want a slider for music and effects volume, and figured it would be nice to be able to use the code already implemented for that... just with a few changes to it to handle the 3D situation.

    The QPushButton has all the nice stuff for being pressed, been released, only setting clicked when the mouse button was pushed and released and code for being checked or not. I would like to be able to use all that.

    If I can get one of the controls classes to work, then getting all the rest to work would be very easy. Sliders, buttons, radio buttons, edit boxes, you name it. It'd be just so much better if I could make implementations of the abstract classes so each work in 3D.

    I prefer having the modularity that comes with each individual class being able to handle its own domain of responsibilities, rather than having one big honking giant class having its tentacles digging into and manipulating everything.

    I will look into the QEventloop class. Thank you for that.
    Last edited by smurrish; 25th April 2006 at 12:33.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Making 3D controls in QT, implementing a game loop in QT

    Quote Originally Posted by smurrish
    Well, I could do it that way, with individual functions in that one class all scanning for clicks in various areas and against various objects.
    What do you mean by scanning for clicks? You just have to emit proper signals from within mousePressEvent of the GLWidget where you'll be checking for collisions of the mouse with various objects.

    I just thought it would be nice for each object to figure out when it has been clicked itself and have code for handling each case in the implementation of the code for the class of that object.
    What if the object has to operate on some data which is external to it? For example different buttons that turn the music on and off. You can't "embed" the music in both of them -- it has to be in an outside object, so it's better to emit a signal and handle the event in the music "handler" object.

    Also, I might want a slider for music and effects volume, and figured it would be nice to be able to use the code already implemented for that... just with a few changes to it to handle the 3D situation.
    You'll have to handle checking the value of the slider yourself anyway, so all that is left to do is to emit a signal with the slider value. You won't be able to reuse much of the code of Qt slider classes.

    The QPushButton has all the nice stuff for being pressed, been released, only setting clicked when the mouse button was pushed and released and code for being checked or not. I would like to be able to use all that.
    But you'll have to check all that yourself anyway. And then you just need to emit proper signals.

    If I can get one of the controls classes to work, then getting all the rest to work would be very easy. Sliders, buttons, radio buttons, edit boxes, you name it. It'd be just so much better if I could make implementations of the abstract classes so each work in 3D.
    The point is that they are implemented in 2D and are very dependent on that. Most of their functionality involves checking the coordinates and handling events. And you won't be able to reuse any of those. The overhead will be much greater than the gain.

    I prefer having the modularity that comes with each individual class being able to handle its own domain of responsibilities, rather than having one big honking giant class having its tentacles digging into and manipulating everything.
    You can implement your own set of "3D widgets" inside the "big honking giant" QGLWidget class, just like it's done with QWidget and widgets or QCanvas and canvas items.

  3. The following user says thank you to wysota for this useful post:

    smurrish (26th April 2006)

  4. #3
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Making 3D controls in QT, implementing a game loop in QT

    Alright. I get you.

    It'll feel more natural to me, I think, when I get used to programming Qt-style.

    I appreciate your patience and time. Thank you.

Similar Threads

  1. QT debug confusion
    By swistak in forum Installation and Deployment
    Replies: 2
    Last Post: 24th September 2008, 19:25

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
  •  
Qt is a trademark of The Qt Company.