Results 1 to 7 of 7

Thread: Just for fun game

  1. #1
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Just for fun game

    Hi guys,
    I developed a game in my leisure time. The game named 'shooting balls' is not so complex and is develped using qt4. Also I took help from qtssistance. This is just version1 and I thought to add more functionalities later.

    Please comment.

    1) Run the application.
    2) Press 'N'
    3) Hit the balls on mouse press and get 100 points on successful and loose 40 points if unsuccessful.
    Attached Files Attached Files

  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: Just for fun game

    It's very nice, but a little hard to hit those balls .
    Maybe you can make something that eats them .

    Regards

  3. #3
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Just for fun game

    Hey vermarajeev,
    How do you compile? I'm on Unix and when I run:
    qmake -project
    qmake
    make

    The compiler returns me a hole bunch of errors..

    ++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SHARED -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o ball.o ball.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SHARED -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o glwidget.o glwidget.cpp
    glwidget.cpp:23:20: error: QtOpenGL: No such file or directory
    In file included from glwidget.cpp:29:
    glwidget.h:29:21: error: QGLWidget: No such file or directory
    glwidget.h:37: error: expected class-name before ‘{’ token
    glwidget.h:37: warning: ‘class GLWidget’ has virtual functions but non-virtual destructor
    glwidget.cpp: In constructor ‘GLWidget::GLWidget(QWidget*)’:
    glwidget.cpp:36: error: class ‘GLWidget’ does not have any field named ‘QGLWidget’
    glwidget.cpp:36: error: ‘QGL’ has not been declared
    glwidget.cpp:36: error: ‘QGLFormat’ was not declared in this scope
    glwidget.cpp:45: error: ‘connect’ was not declared in this scope
    glwidget.cpp:48: error: ‘setAttribute’ was not declared in this scope
    glwidget.cpp:49: error: ‘setMinimumSize’ was not declared in this scope
    glwidget.cpp: In destructor ‘GLWidget::~GLWidget()’:
    glwidget.cpp:62: error: ‘makeCurrent’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget::initializeGL()’:
    glwidget.cpp:67: error: ‘GL_SMOOTH’ was not declared in this scope
    glwidget.cpp:67: error: ‘glShadeModel’ was not declared in this scope
    glwidget.cpp:69: error: ‘glClearColor’ was not declared in this scope
    glwidget.cpp:70: error: ‘glClearDepth’ was not declared in this scope
    glwidget.cpp:72: error: ‘GL_DEPTH_TEST’ was not declared in this scope
    glwidget.cpp:72: error: ‘glEnable’ was not declared in this scope
    glwidget.cpp:73: error: ‘GL_LEQUAL’ was not declared in this scope
    glwidget.cpp:73: error: ‘glDepthFunc’ was not declared in this scope
    glwidget.cpp:75: error: ‘GL_PERSPECTIVE_CORRECTION_HINT’ was not declared in this scope
    glwidget.cpp:75: error: ‘GL_NICEST’ was not declared in this scope
    glwidget.cpp:75: error: ‘glHint’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget:aintEvent(QPaintEvent*)’:
    glwidget.cpp:106: error: no matching function for call to ‘QPainter::begin(GLWidget* const)’
    /usr/include/qt4/QtGui/qpainter.h:98: note: candidates are: bool QPainter::begin(QPaintDevice*)
    glwidget.cpp:108: error: ‘GL_ALL_ATTRIB_BITS’ was not declared in this scope
    glwidget.cpp:108: error: ‘glPushAttrib’ was not declared in this scope
    glwidget.cpp:109: error: ‘GL_PROJECTION’ was not declared in this scope
    glwidget.cpp:109: error: ‘glMatrixMode’ was not declared in this scope
    glwidget.cpp:110: error: ‘glPushMatrix’ was not declared in this scope
    glwidget.cpp:111: error: ‘GL_MODELVIEW’ was not declared in this scope
    glwidget.cpp:114: error: ‘qglClearColor’ was not declared in this scope
    glwidget.cpp:115: error: ‘GL_SMOOTH’ was not declared in this scope
    glwidget.cpp:115: error: ‘glShadeModel’ was not declared in this scope
    glwidget.cpp:116: error: ‘GL_DEPTH_TEST’ was not declared in this scope
    glwidget.cpp:116: error: ‘glEnable’ was not declared in this scope
    glwidget.cpp:117: error: ‘GL_CULL_FACE’ was not declared in this scope
    glwidget.cpp:118: error: ‘GL_LIGHTING’ was not declared in this scope
    glwidget.cpp:119: error: ‘GL_LIGHT0’ was not declared in this scope
    glwidget.cpp:122: error: ‘width’ was not declared in this scope
    glwidget.cpp:122: error: ‘height’ was not declared in this scope
    glwidget.cpp:124: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
    glwidget.cpp:124: error: ‘GL_DEPTH_BUFFER_BIT’ was not declared in this scope
    glwidget.cpp:124: error: ‘glClear’ was not declared in this scope
    glwidget.cpp:125: error: ‘glPopAttrib’ was not declared in this scope
    glwidget.cpp:127: error: ‘glPopMatrix’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget::createBalls(int)’:
    glwidget.cpp:158: error: ‘width’ was not declared in this scope
    glwidget.cpp:159: error: ‘height’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget::animate()’:
    glwidget.cpp:184: error: ‘rect’ was not declared in this scope
    glwidget.cpp:186: error: ‘update’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget::setupViewport(int, int)’:
    glwidget.cpp:192: error: ‘glViewport’ was not declared in this scope
    glwidget.cpp:194: error: ‘GL_PROJECTION’ was not declared in this scope
    glwidget.cpp:194: error: ‘glMatrixMode’ was not declared in this scope
    glwidget.cpp:195: error: ‘glLoadIdentity’ was not declared in this scope
    glwidget.cpp:196: error: ‘glOrtho’ was not declared in this scope
    glwidget.cpp:197: error: ‘GL_MODELVIEW’ was not declared in this scope
    glwidget.cpp: In member function ‘void GLWidget::showText(const QString&, const QColor&)’:
    glwidget.cpp:216: error: ‘update’ was not declared in this scope
    make: *** [glwidget.o] Error 1

    dunno what's up with this, but it might be some package I need...

    Regards nikau

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Just for fun game

    You shouldn't call qmake -project. Or if you have to, add QT+=opengl line to the resulting project file.

  5. #5
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Just for fun game

    I actually had added "QT += opengl" for the last post. I also tried downloading the zip again, unpacking and running qmake and make in the dir... I think there are less errors now, but there are still alot.. Did you develope this on win?

    output from make:

    MainWindow.cpp:3:24: error: mainwindow.h: No such file or directory
    MainWindow.cpp:102:2: warning: no newline at end of file
    MainWindow.cpp:6: error: ‘MainWindow’ has not been declared
    MainWindow.cpp:6: error: ISO C++ forbids declaration of ‘MainWindow’ with no type
    MainWindow.cpp: In function ‘int MainWindow()’:
    MainWindow.cpp:8: error: invalid use of ‘this’ in non-member function
    MainWindow.cpp:9: error: ‘setCentralWidget’ was not declared in this scope
    MainWindow.cpp:20: error: ‘m_glWidget’ was not declared in this scope
    MainWindow.cpp:23: error: ‘connect’ was not declared in this scope
    MainWindow.cpp:34: error: ‘tr’ was not declared in this scope
    MainWindow.cpp:39: error: ‘scoreLCD’ was not declared in this scope
    MainWindow.cpp:51: error: ‘levelLCD’ was not declared in this scope
    MainWindow.cpp:59: error: ‘actions’ was not declared in this scope
    MainWindow.cpp:59: error: ‘NewGame’ was not declared in this scope
    MainWindow.cpp:62: error: ‘setWindowTitle’ was not declared in this scope
    MainWindow.cpp: At global scope:
    MainWindow.cpp:66: error: ‘MainWindow’ is not a class or namespace
    MainWindow.cpp: In function ‘void keyPressEvent(QKeyEvent*)’:
    MainWindow.cpp:68: error: ‘actions’ was not declared in this scope
    MainWindow.cpp:73: error: ‘Action’ was not declared in this scope
    MainWindow.cpp:73: error: expected `;' before ‘a’
    MainWindow.cpp:74: error: ‘a’ was not declared in this scope
    MainWindow.cpp:76: error: ‘NewGame’ was not declared in this scope
    MainWindow.cpp:77: error: ‘slotNewGame’ was not declared in this scope
    MainWindow.cpp: At global scope:
    MainWindow.cpp:87: error: ‘MainWindow’ is not a class or namespace
    MainWindow.cpp: In function ‘void slotBallShooted(int)’:
    MainWindow.cpp:88: error: ‘scoreLCD’ was not declared in this scope
    MainWindow.cpp: At global scope:
    MainWindow.cpp:91: error: ‘MainWindow’ is not a class or namespace
    MainWindow.cpp: In function ‘void slotLevel(int)’:
    MainWindow.cpp:92: error: ‘levelLCD’ was not declared in this scope
    MainWindow.cpp: At global scope:
    MainWindow.cpp:94: error: ‘MainWindow’ is not a class or namespace
    MainWindow.cpp: In function ‘void slotNewGame()’:
    MainWindow.cpp:96: error: ‘score’ was not declared in this scope
    MainWindow.cpp:97: error: ‘scoreLCD’ was not declared in this scope
    MainWindow.cpp:98: error: ‘level’ was not declared in this scope
    MainWindow.cpp:99: error: ‘levelLCD’ was not declared in this scope
    MainWindow.cpp:100: error: ‘m_glWidget’ was not declared in this scope
    make: *** [MainWindow.o] Error 1

    I'll look into it when I get home and post if I find a solution

    Enjoy today! Make more nice applications

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Just for fun game

    Check the file naming convention. You are probably experiencing a case-insensitive to case-sensitive filesystem transition problem (Windows is case insensitive while unix is case sensitive so "MainWindow" and "mainwindow" are two different files for it).

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

    nikau (13th December 2007)

  8. #7
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Thumbs up Re: Just for fun game

    Only a few changes had to be made... here is the source code that compiled on my system..

    thx for helping, great game by the way,,, I gave up on the last ball in lvl 2.. They are very hard to hit...

    Regards nikau
    Attached Files Attached Files

Similar Threads

  1. QGraphicsView and game programming
    By ball in forum Newbie
    Replies: 5
    Last Post: 9th January 2007, 21:14
  2. Game mouse movement
    By chaosgeorge in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2006, 23:41
  3. Scroll large image in game
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2006, 23:06
  4. Making 3D controls in QT, implementing a game loop in QT
    By smurrish in forum Qt Programming
    Replies: 10
    Last Post: 26th April 2006, 04:37

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.