PDA

View Full Version : Just for fun game



vermarajeev
30th April 2007, 14:35
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.

marcel
1st May 2007, 09:31
It's very nice, but a little hard to hit those balls :).
Maybe you can make something that eats them :).

Regards

nikau
11th December 2007, 22:40
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::paintEvent(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

wysota
11th December 2007, 22:56
You shouldn't call qmake -project. Or if you have to, add QT+=opengl line to the resulting project file.

nikau
12th December 2007, 08:32
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 :D

wysota
12th December 2007, 11:30
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).

nikau
13th December 2007, 22:52
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 :)