Results 1 to 9 of 9

Thread: Use of QCoreApplication

  1. #1
    Join Date
    Aug 2006
    Posts
    83

    Default Use of QCoreApplication

    Hi,

    I'm writing a game for a project in school and it has to work in multiplayer... I'm not sure of one thing and I would like to hear your opinion. For the graphics part I'm using Irrlicht engine (that part I have almost finished) and for the network part I'm using Qt. I have written the server successfully and it's time for the network part of the game (from the user side of the game).
    Here comes the part where I need your help... For long I didn't know which library to use for tcp/ip protocol so I have written the whole game based on Irrlicht engine (and std) library only. I have written a small library (the library is actually not .lib and .dll but simple .cpp and .h meant to be integrated in code) for the user part which contains a lot of signals/slots used for the right occasion and it contains qtcpsocket objects and all the stuff used for communication... and now I have to merge this code with the rest of the code. The problem is that I want to use those signals/slots from the library with my code but I want the game to know as little about qt as possible....

    I use irrlichts main event loop so I don't want to use Qt's... For using signals/slots I have to use Q_OBJECT macro. What do you suggest ? Is there a way to use qt as limited as possible (only signals, slots, and not having to extend QObject for every class in game and using QCoreApplication object...) without having to write a .pro file for the whole game (in that case the library would have to be in .lib and .dll form) ??

    I hope that I made any sense in this post...

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Use of QCoreApplication

    Using QTcpSocket will not work without a Qt event loop. It an asynchronous object, much like QFtp and QHttp.
    The main reason you cannot use it is that QTcpSocket uses internallu a QTimer, which definitely needs an event loop to work.

    I suggest writing the network part using platform depending API.


    Regards

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

    Default Re: Use of QCoreApplication

    Personally I wouldn't use Qt just for its network capabilities (at least unless I needed a portable solution).

  4. #4
    Join Date
    Aug 2006
    Posts
    83

    Default Re: Use of QCoreApplication

    The main thing why I decided to use Qt and irrlicht is because I need something that works on Linux, WIndows and Mac,...

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

    Default Re: Use of QCoreApplication

    BSD sockets should work everywhere... I don't know what irrlicht is, but maybe you could get rid of it? And seriously you can try to merge those two event loops. Start by reading QAbstractEventDispatcher docs.
    Last edited by wysota; 14th May 2007 at 23:36.

  6. #6
    Join Date
    Aug 2006
    Posts
    83

    Default Re: Use of QCoreApplication

    I can't get rid off irrlicht because it is a 3d engine I need to implement my game. I have solved the problem with porting my code into qt code and integrating irrlicht and its device within a QWidget. I fixed the event loops by studying the above link. Tnx for the help.

  7. #7
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Use of QCoreApplication

    Quote Originally Posted by moowy View Post
    I can't get rid off irrlicht because it is a 3d engine I need to implement my game. I have solved the problem with porting my code into qt code and integrating irrlicht and its device within a QWidget. I fixed the event loops by studying the above link. Tnx for the help.
    Whoaaa! You managed to integrate Irrlicht into a QWidget? I was wondering if anyone would try this someday... Could you please send me this part of the code? Or tell me when your game will be available and where?

    @wysota : Irrlicht is a great open source cross-platform 3d engine.
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: Use of QCoreApplication

    Quote Originally Posted by fullmetalcoder View Post
    @wysota : Irrlicht is a great open source cross-platform 3d engine.
    Yes, I know that now. I made my homework after writing the post.

  9. #9
    Join Date
    Aug 2006
    Posts
    83

    Default Re: Use of QCoreApplication

    My game will be available through berlios ( I think. I will post the link ) probably by the end of the next week. This is a project (made by me and my two schoolmates and it will be completely opensource and later development will be made.

    U need something like this code I attached to integrate. This code is from irrlicht's official forum.
    Attached Files Attached Files
    Last edited by moowy; 18th May 2007 at 08:51.

Similar Threads

  1. QTcpServer in a QCoreApplication
    By xgoan in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2007, 10:19
  2. QCoreApplication!!!!
    By fellobo in forum Qt Programming
    Replies: 6
    Last Post: 17th January 2007, 00:56
  3. QCoreApplication problem
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2006, 20:18
  4. QCoreApplication And QSqlDatabase
    By ball in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 07:58
  5. QCoreApplication question
    By barnabyr in forum Newbie
    Replies: 5
    Last Post: 24th March 2006, 19:38

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.