<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

    
	<channel>

	<title>Qt DevNet forums: Game Development</title>
	<link>http://qt-project.org/forums/viewforum/17/</link>
	<description>RSS feed for latest threads in Game Development</description>
	<copyright>Copyright 2012 Qt Developer Network</copyright>
	<docs>http://www.rssboard.org/rss-specification</docs>
	<generator>ExpressionEngine v2.3.1 http://expressionengine.com/</generator>
	<lastBuildDate>Tue, 08 May 2012 20:29:30 GMT</lastBuildDate>
	<atom:link href="http://qt-project.org/feeds/forum/17" rel="self" type="application/rss+xml" />

    

	
        <item>
            <title>QGLWidget vsync Mac</title>
            <link>http://qt-project.org/forums/viewthread/17321</link>
            <author>piciji</author>
            <description><![CDATA[I am using CGLSetParameter(CGLSetCurrentContext(), kCGLCPSwapInterval, &amp;amp;val ) to activate vsync. It works but only for a few seconds. The animation is smooth at 60 fps for 3 &#8211; 5 seconds. Afterwards the framerate drops to 48 &#8211; 50 fps for a fraction of a second and runs smooth for the next few seconds and so on. You can notice this stutter in fps and video scrolling. In my opinion its more a Qt and not opengl problem, because in fullscreen all is fine. The only difference to the windowed display is the showFullScreen() call on the widget.

	Anyone an idea what is causing this? I am using a QTimer based event loop.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/17321</guid>
            <pubDate>Thu, 17 May 2012 22:02:33 GMT</pubDate>
        </item>
	
        <item>
            <title>Stuck in loading page For Game</title>
            <link>http://qt-project.org/forums/viewthread/17188</link>
            <author>AhWoon92</author>
            <description><![CDATA[May i know how to do the loading page for my game?
do i need to use the element loader?
any references i can take a look?
Thanks]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/17188</guid>
            <pubDate>Mon, 14 May 2012 04:52:36 GMT</pubDate>
        </item>
	
        <item>
            <title>How to create board with block elements</title>
            <link>http://qt-project.org/forums/viewthread/17158</link>
            <author>AhWoon92</author>
            <description><![CDATA[I have the block elements but it wont appear on the screen.
any reference or suggestion to it?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/17158</guid>
            <pubDate>Sat, 12 May 2012 03:33:31 GMT</pubDate>
        </item>
	
        <item>
            <title>how to use joystick in Qt?</title>
            <link>http://qt-project.org/forums/viewthread/17133</link>
            <author>lesner</author>
            <description><![CDATA[Hi everyone, I’m a new hand in qml, and my english is very poor.
Is there any library for Qt to access a joystick?
I want to use joystick to control some component in my project, but don&#8217;t know how to do it.
The platform is window 7, and every library I found in google is for linux.

	can anyone help, please
Thanks!]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/17133</guid>
            <pubDate>Fri, 11 May 2012 12:18:07 GMT</pubDate>
        </item>
	
        <item>
            <title>Generating 9x9 tiles/blocks with random images and create a board</title>
            <link>http://qt-project.org/forums/viewthread/17124</link>
            <author>AhWoon92</author>
            <description><![CDATA[May i know how to generate tiles/blocks with 6 images randomly and also generate a board for it?
i using qml and js&#8230;
i need help urgently because my deadline coming soon.
i have tried several times yet cant work. resources from samegame.qml also cant work for me.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/17124</guid>
            <pubDate>Fri, 11 May 2012 07:31:12 GMT</pubDate>
        </item>
	
        <item>
            <title>Brick Breaker, Need help on moving the panel and the ball</title>
            <link>http://qt-project.org/forums/viewthread/16888</link>
            <author>Aubrey12</author>
            <description><![CDATA[Hi there

	We&#8217;ve received an assignment to create a basic brick breaker game. I am very new to qt and I&#8217;m struggling on finding a way how to move the panel over the screen, as well as the bouncing and moving of the ball. The rest I am able to do.

	Can anyone help me with this please?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16888</guid>
            <pubDate>Thu, 03 May 2012 15:00:55 GMT</pubDate>
        </item>
	
        <item>
            <title>unessesary repaint how to avoid</title>
            <link>http://qt-project.org/forums/viewthread/16589</link>
            <author>rafal_p</author>
            <description><![CDATA[hello,
changing tab(QTabWidget) to another tab cause repaint view  twice. 
on that view i have OGLWidget with complicated charts and changing tab this is very horrible  because of paint routine double called.

	i checked my application   for any update, repaint occurences also all of events working fine except this above.
it will be gratefull to know how the problem should be resolved.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16589</guid>
            <pubDate>Tue, 24 Apr 2012 07:30:21 GMT</pubDate>
        </item>
	
        <item>
            <title>QtGameEnabler and QGraphicsView</title>
            <link>http://qt-project.org/forums/viewthread/16532</link>
            <author>q8phantom</author>
            <description><![CDATA[Hi

	I have a simple question

	Is it possible to use QtGameEnabler to improve the QGraphicsView perfomance

	If yes, then how will I do that

	If no, what are the best tips and tricks to improve the QGraphicsView, specially if am using QGraphicsLineItem with some blur effect, and that line have to move with the touch or mouse location with it&#8217;s clicked!

	Basically, that what am working on &#8211; http://www.youtube.com/watch?v=a5c3YOLc2bQ

	Your help is appreciate]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16532</guid>
            <pubDate>Sat, 21 Apr 2012 22:55:55 GMT</pubDate>
        </item>
	
        <item>
            <title>Moving Objects in a Game</title>
            <link>http://qt-project.org/forums/viewthread/16300</link>
            <author>Isabelle91</author>
            <description><![CDATA[I am making a game which I need some objects to be moving in a similar manner to the balls in the game Zuma, how do I do this? I already have a graphic which is a twisty river, the objects should move following the flow of the river. I am new to QT language and require all the help I can get. Thank you.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16300</guid>
            <pubDate>Thu, 12 Apr 2012 10:03:35 GMT</pubDate>
        </item>
	
        <item>
            <title>Creating bullet collision objects fromQGLSceneNode</title>
            <link>http://qt-project.org/forums/viewthread/16172</link>
            <author>FreddeB</author>
            <description><![CDATA[Hello,

	I&#8217;m fairly new to the bullet physics engine. I&#8217;m trying to create a method for creating a btCollisionShape from a QGLSceneNode.

	From what I understand is that I need to extract the Geometry Data and the transformation for each node in the NodeTree of QGLSceneNode.. ? or ?

	I also understand that a collision shape should not exceed more than 100+ vertices .. soo the method should be able to simply the mesh..

	Does anyone have any experiance in this topic ? Any input is very much appreciated :)

	/Fredrik]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16172</guid>
            <pubDate>Sun, 08 Apr 2012 12:05:00 GMT</pubDate>
        </item>
	
        <item>
            <title>Asteroids Game, need help moving ship</title>
            <link>http://qt-project.org/forums/viewthread/16137</link>
            <author>Krovlar</author>
            <description><![CDATA[Hello all,

	I have a school group project to create an Asteroids game. We&#8217;ve managed to get most of the game going by following tutorials and messing with the code. Sadly however most of my group has given up at this point as we can&#8217;t figure out a few fundamental problems. As such I was wondering if you fine people could help me with the main problem, moving the ship. I have a theory, but I&#8217;m not sure of the math behind it.

	My theory:
I draw the ship, which is a polygon triangle, inside a QRect. The ship already turns using the left and right arrows keys, and it changes a parameter called angle. If I can find a mathematical equation to change the center coordinates of the QRect, based on the current angle, then it should work just fine.

	I&#8217;ll have to figure out exactly how to do that, like for every second of holding down the up arrow the ship would move ____ distance or something, but this should at least get the ship moving around the screen.

	I can&#8217;t include the full code in here, at it&#8217;s several files and is kind of long, so I&#8217;ve just included the file that I feel is most important. The rest of the program, ready to run, is in the zip file linked at the bottom of the post. Please if you have a chance help, this is due Monday and I don&#8217;t think we&#8217;re going to make it. Thank you.

	//Sets the angle of the ship
void CannonField::setAngle&#40;int angle&#41;
&#123;
&amp;nbsp; &amp;nbsp; if &#40;currentAngle == angle&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;
&amp;nbsp; &amp;nbsp; currentAngle = angle;
&amp;nbsp; &amp;nbsp; update&#40;cannonRect&#40;&#41;&#41;;
&amp;nbsp; &amp;nbsp; emit angleChanged&#40;currentAngle&#41;;
&#125;
&amp;nbsp;
void CannonField::paintEvent&#40;QPaintEvent * /* event */&#41;
&#123;
&amp;nbsp; &amp;nbsp; QPainter painter&#40;this&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; if &#40;gameEnded&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; painter.setPen&#40;Qt::black&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; painter.setFont&#40;QFont&#40;&amp;quot;Courier&amp;quot;, 48, QFont::Bold&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; painter.drawText&#40;rect&#40;&#41;, Qt::AlignCenter, tr&#40;&amp;quot;Game Over&amp;quot;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; paintCannon&#40;painter&#41;;
&amp;nbsp; &amp;nbsp; if &#40;isShooting&#40;&#41;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; paintShot&#40;painter&#41;;
&amp;nbsp; &amp;nbsp; if &#40;!gameEnded&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; paintTarget&#40;painter&#41;;
&#125;
&amp;nbsp;
void CannonField::paintCannon&#40;QPainter &amp;amp;painter&#41;
&#123;
&amp;nbsp; &amp;nbsp; //setPen determines if there is an outline I believe.
&amp;nbsp; &amp;nbsp; painter.setPen&#40;Qt::NoPen&#41;;
&amp;nbsp; &amp;nbsp; //setBrush determines color.
&amp;nbsp; &amp;nbsp; painter.setBrush&#40;Qt::blue&#41;;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; painter.save&#40;&#41;;
&amp;nbsp; &amp;nbsp; //Translate the coordinates to that the center of the play
&amp;nbsp; &amp;nbsp; //field is (0, 0)
&amp;nbsp; &amp;nbsp; painter.translate&#40;width&#40;&#41;/2, height&#40;&#41;/2&#41;;
&amp;nbsp; &amp;nbsp; //Rotates the ship
&amp;nbsp; &amp;nbsp; painter.rotate&#40;&#45;currentAngle&#41;;
&amp;nbsp; &amp;nbsp; //creates the dimensions for Polygon
&amp;nbsp; &amp;nbsp; QPolygon polygon;
&amp;nbsp; &amp;nbsp; polygon &amp;lt;&amp;lt; QPoint&#40;&#45;10, 0&#41; &amp;lt;&amp;lt; QPoint&#40;10, 0&#41; &amp;lt;&amp;lt; QPoint&#40;0, &#45;20&#41;;
&amp;nbsp; &amp;nbsp; //draws the ship
&amp;nbsp; &amp;nbsp; painter.drawPolygon&#40;polygon&#41;;
&amp;nbsp; &amp;nbsp; painter.restore&#40;&#41;;
&#125;
&amp;nbsp;
QRect CannonField::cannonRect&#40;&#41; const
&#123;
&amp;nbsp; &amp;nbsp; //cannonRect should be around the ship, as a
&amp;nbsp; &amp;nbsp; //sort of hit box and way to move the ship.
&amp;nbsp; &amp;nbsp; QRect result&#40;0, 0, 500, 500&#41;;
&amp;nbsp; &amp;nbsp; //we should use something like this to move the box
&amp;nbsp; &amp;nbsp; //and our ship would automatically move with it, since
&amp;nbsp; &amp;nbsp; //it would always paint inside the box
&amp;nbsp; &amp;nbsp; result.moveBottomLeft&#40;rect&#40;&#41;.bottomLeft&#40;&#41;&#41;;
&amp;nbsp; &amp;nbsp; return result;
&#125;
&amp;nbsp;
QRect CannonField::targetRect&#40;&#41; const
&#123;
&amp;nbsp; &amp;nbsp; //QRect is set up for the target/asteroid, and it starts at the bottom
&amp;nbsp; &amp;nbsp; //left corner, and is 20 wide and 10 high.
&amp;nbsp; &amp;nbsp; QRect result&#40;0, 0, 20, 10&#41;;
&amp;nbsp; &amp;nbsp; //It is moved from it&apos;s center by a certain amount.
&amp;nbsp; &amp;nbsp; result.moveCenter&#40;QPoint&#40;target.x&#40;&#41;, height&#40;&#41; &#45; 1 &#45; target.y&#40;&#41;&#41;&#41;;
&amp;nbsp; &amp;nbsp; return result;
&#125;


	Link to the QT4 Project, Rar format [box.com]]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16137</guid>
            <pubDate>Fri, 06 Apr 2012 17:06:33 GMT</pubDate>
        </item>
	
        <item>
            <title>Game on Qt/QML &#45; Video</title>
            <link>http://qt-project.org/forums/viewthread/16110</link>
            <author>tiagocc0</author>
            <description><![CDATA[Hi,

	I&#8217;ve been playing around with QML and did a video showing where I got thus far.
I&#8217;m tweaking the code, I&#8217;ve just recently found this:
http://cdumez.blogspot.com.br/2010/12/expose&#45;nested&#45;c&#45;models&#45;to&#45;qml.html

	And I&#8217;m remodeling my code based on it.
Is this a good approach to expose the spaceships to QML?

	I&#8217;ve already used it on my work to expose files on a very dynamic list where those files are processed (going from 0% to 100%) and the list is constantly updated. It went smoothly.

	Here&#8217;s the video:
(small) http://vimeo.com/34609995 
(large) http://vimeo.com/couchmode/purpleorangegames/videos/sort:date/34609995

	Thank you for your attention!]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/16110</guid>
            <pubDate>Fri, 06 Apr 2012 03:19:54 GMT</pubDate>
        </item>
	
        <item>
            <title>QImage/QPixmap not initialized in Symbian device, working fine on desktop</title>
            <link>http://qt-project.org/forums/viewthread/15539</link>
            <author>Karunesh</author>
            <description><![CDATA[Hi

	I am trying to draw a few images using QPainter in a QGLWidget (like in the overpainting example), but the images are not initialized when doing so for a N8 device whereas it is fine with the desktop as the target. 

	I am doing something like this for initialization:
QPoint position;
QImage gameImage;
&amp;nbsp;
bool imageIsLoaded = gameImage.load&#40;QString&#40;&amp;quot;../Start/Textures/Cube.png&amp;quot;&#41;&#41;;
if&#40; !imageIsLoaded &#41; 
&amp;nbsp; &amp;nbsp; qDebug&#40;&#41; &amp;lt;&amp;lt; &amp;quot;Image aint loaded&amp;quot;; &amp;nbsp; &amp;nbsp;// turns out the image is not loaded


	I have also tried using QPixmap, and it too does not work. But I am using QPixmaps as my textures (loaded into GLuints using bindTexture), and these work fine. I have verified that the image is in the folder I provided in the QString. 

	Has anyone drawn images this way in a QGLWidget? Is there some other way to draw images so that they can be used as controls in a game? Any comments are welcome.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/15539</guid>
            <pubDate>Mon, 19 Mar 2012 08:16:23 GMT</pubDate>
        </item>
	
        <item>
            <title>resizing QGL Widget</title>
            <link>http://qt-project.org/forums/viewthread/15475</link>
            <author>supergnu</author>
            <description><![CDATA[I don&#8217;t know how to properly resize my openGL viewport when the widgetsize is changed. it somehow works when i initially call myWidget&#45;&amp;gt;resize() &#8211; but once the widget is shown on screen, resize doesn&#8217;t work anymore.

	here is my code:

	int main &#40;int argc, char **argv&#41; &#123;
&amp;nbsp;QApplication app&#40;argc, argv&#41;;
&amp;nbsp;QGLFormat glFormat;
&amp;nbsp;glFormat.setVersion&#40;4,2&#41;;
&amp;nbsp;glFormat.setProfile&#40; QGLFormat::CompatibilityProfile&#41;;
&amp;nbsp;
&amp;nbsp;QGLWidget* render_qglwidget = new MyWidget&#40;glFormat&#41;;
&amp;nbsp;
&amp;nbsp;glContext = &#40;QGLContext *&#41; render_qglwidget&#45;&amp;gt;context&#40;&#41;;
&amp;nbsp;glContext&#45;&amp;gt;makeCurrent&#40;&#41;;
&amp;nbsp;render_qglwidget&#45;&amp;gt;show&#40;&#41;;
&amp;nbsp;render_qglwidget&#45;&amp;gt;resize&#40;720, 486&#41;;
&amp;nbsp;return app.exec&#40;&#41;;
&#125;


	And in MyWidget (that inherits from QGLWidget&#41; i have:

	void MyWidget::resizeGL&#40;int w, int h&#41;&#123;
&amp;nbsp;glViewport&#40;0,0,w,h&#41;;
&#125;
&amp;nbsp;
void MyWidget::paintGL&#40;&#41;&#123;
&amp;nbsp;glBegin&#40;GL_TRIANGLES&#41;;
&amp;nbsp; glVertex3f&#40;1,0,0&#41;;
&amp;nbsp; glVertex3f&#40;0,1,0&#41;;
&amp;nbsp; glVertex3f&#40;0,0,1&#41;;
&amp;nbsp;glEnd&#40;&#41;;
&#125;


	so &#8211; what i would expect is to see a white triangle, with one corner in the middle of the window, one in the top&#45;middle of the window and one in the right&#45;middle of the window. when the window opens, this is exactly the case (so the glViewport function seems to work) but when i start resizing the window, the triangle stays exactly the same size (i ould expect it to scale together with the window) although glViewport is called with new values and also paintGL is called

	What am I missing?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/15475</guid>
            <pubDate>Fri, 16 Mar 2012 18:33:40 GMT</pubDate>
        </item>
	
        <item>
            <title>Problem in compiling, QGraphicsScene::setActiveWindow() not accepting a QGLWidget subclass</title>
            <link>http://qt-project.org/forums/viewthread/15460</link>
            <author>Karunesh</author>
            <description><![CDATA[I had a QGLWidget subclass as the graphics class, which I now want to be used as a single window in a QGraphicsScene in order to accomodate the menu. 

	It looks like this:
GLWindow class
#ifndef GLWINDOW_H
#define GLWINDOW_H
&amp;nbsp;
#include &amp;lt;things&amp;gt;
class GLWindow : public QGLWidget , public QGraphicsProxyWidget // tried QGraphicsWidget too.
&#123;
&amp;nbsp; &amp;nbsp; Q_OBJECT
public:
&amp;nbsp; &amp;nbsp; GLWindow&#40;QWidget *parent = 0&#41;; 
&amp;nbsp; &amp;nbsp; ~GLWindow&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; void resizeGL&#40;int width, int height&#41;;
&amp;nbsp; &amp;nbsp; void initializeGL&#40;&#41;;
&amp;nbsp; &amp;nbsp; void paintGL&#40;&#41;;
&amp;nbsp;
// Other functions, signals/slots etc.
// .............................
&#125;;
#endif // GLWINDOW_H


	main.cpp
#include &amp;lt;QtGui/QApplication&amp;gt;
#include &amp;quot;glwindow.h&amp;quot;
#include &amp;lt;QDebug&amp;gt;
#include &amp;lt;QGraphicsScene&amp;gt;
#include &amp;lt;QGraphicsView&amp;gt;
#include &amp;lt;QGraphicsProxyWidget&amp;gt;
&amp;nbsp;
int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
&amp;nbsp; &amp;nbsp; QApplication a&#40;argc, argv&#41;;
&amp;nbsp; &amp;nbsp; GLWindow w;
&amp;nbsp;
// ...............THIS WORKS.........................
//#ifndef Q_WS_MAEMO_5
// &amp;nbsp; &amp;nbsp;w.showMaximized();
//#else
// &amp;nbsp; &amp;nbsp;w.showFullScreen();
//#endif
&amp;nbsp; &amp;nbsp; 
//...............But This Does not...................
&amp;nbsp; &amp;nbsp; QGraphicsScene scene;
&amp;nbsp; &amp;nbsp; scene.setActiveWindow&#40;w&#41;;
&amp;nbsp; &amp;nbsp; //scene.setActiveWindow((dynamic_cast&amp;lt;QGraphicsProxyWidget*&amp;gt;)(w)); // ... did not work
&amp;nbsp; &amp;nbsp; QGraphicsView view&#40;&amp;amp;scene&#41;;
&amp;nbsp; &amp;nbsp; view.showMaximized&#40;&#41;;
&amp;nbsp;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; return a.exec&#40;&#41;;
&#125;


	I understand that the setActiveWindow() [doc.qt.nokia.com] method requires a QGraphicsWidget object, but I still am not able to compile after subclassing QGraphiscWidget (and QGraphicsProxyWidget). Trying to dynamic_cast my QGLWidget subclass did not work either. The error is something like:
	
		..\main.cpp:22: error: no matching function for call to &#8216;QGraphicsScene::setActiveWindow(GLWindow&amp;amp;)&#8217;
	

	I also tried modifying the constructor declaration for GLWindow class as:
GLWindow&#40;QWidget *parent = 0, QGraphicsProxyWidget *parent = 0&#41;;


	but still no progress. (I dont think I should be doing this, but there was no harm in trying!)

	Appreciate any help from someone who already has done this. Any comments are welcome.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/15460</guid>
            <pubDate>Fri, 16 Mar 2012 12:33:42 GMT</pubDate>
        </item>
	

	</channel>
</rss>
