<?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 2013 Qt Project</copyright>
	<docs>http://www.rssboard.org/rss-specification</docs>
	<generator>ExpressionEngine v2.3.1 http://expressionengine.com/</generator>
	<lastBuildDate>Sun, 19 May 2013 03:52:40 GMT</lastBuildDate>
	<atom:link href="http://qt-project.org/feeds/forum/17" rel="self" type="application/rss+xml" />

    

	
        <item>
            <title>Big Issue with Qt key inputs for gaming</title>
            <link>http://qt-project.org/forums/viewthread/28888</link>
            <author>Dynamite101</author>
            <description><![CDATA[I have been learning Programming for 12 months and while learning Qt decided this is the library i also want to use for game dev. I use PyQt so im not sure if this problem is present with Qt on C++. Firstly i made a small demo with a sprite that responds to key inputs. I sub classed QWidget and reimplimented its PaintEvent. The issue is this: my sprite can move left or right based on a key press, but when, say a key is pressed and held to keep moving left, it moves left once, stops for a split second, then keeps moving left. This pause in between the press has a horrible, non fluid effect for gaming and controls. I then did a quick space invaders clone  and its hell to dodge the enemy fire. 

	I decided to quickly try the same demo using the QGraphicsView classes. Sadly the same issue is present with the key inputs. When held, there is still that delay before it starts responding. So quick shifts in movement is impossible. Before i started learning Qt i tried this same demo with another library and the key inputs were spot on.

	Im wondering if anything can be done about this? Other than say static board games, it will be impossible to make fast dynamic games using Qt it seems. Im wondering if this is just a PyQt issue, or is it also present in C++? could someone please check? Can anyone please tell me If this is a bug that can be fixed, or are we stuck with it?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28888</guid>
            <pubDate>Sat, 15 Jun 2013 13:59:17 GMT</pubDate>
        </item>
	
        <item>
            <title>Qt server&#45;client game, clients communicate?</title>
            <link>http://qt-project.org/forums/viewthread/28671</link>
            <author>comanderv</author>
            <description><![CDATA[hello,

	I&#8217;m coding a simple small game. I have a server app and a client app. When started, the client app connects to server via QTcpSocket and establishes connections, it then sends login and pass that server checks in database (MySql &#8211; irrelevant for this disscusion). Till now it&#8217;s all good but after the client is verified, and kinda logged in, it then receives a map ID that it&#8217;s currently at and the map loads. The fun part begins now. I want all clients to &#8220;see&#8221; each other on the map (there&#8217;s a small avatar like thingy that i animate while &#8220;walking&#8221; around the map). 
To do so i can either:

	1) use the TCP connections with server: client sends server info that it changed position on map, the server then sends that info to all the other clients on the same map so that the other clients app can display the change,
 &#8211; using TCP would be rather slow, wouldn&#8217;t it ?
 &#8211; plus server would be under heavy TCP attack all the time, and would still have to redirect all the packets it gets. It could crash easily this way, right?

	2) use TCP to connect clients that are on the same map (same map ID) together. That would require at least a couple of sockets oppened, one for each client on the same map. It would take most of the traffic that server would have to deal with if 1), but then again it would give clients a handfull of work.
 &#8211; lets say a client has oppened 10 sockets for his peers on the map and sends each of them data on his position change, would that work efficiently given i have a thread for each socket ?

	3) after the TCP connection is established and all the data receive i could create a p2p network with clients on the same map (same map ID) and then they would communicate with each other, right? would that be possible in qt? if so, how can I create such a p2p network?

	4) i was thinking about using VPN but i have no idea how to create a vpn server and how to handle clients in it. i know qt has some VPN libraries based on openVPN but that&#8217;s all. if using VPN would be a good way to handle clients communications please do tell where can i read and learn more about it.

	5) another interesting idea i had was VLAN (multicasting all the data on UDP channels), hamachi ofcourse, but for non&#45;commercial usage it only enables up to 5 clients in the network. So is there a way to code something similar like hamachi in qt? or would that require raw C++ ?

	6) i was reading about UDP punching but in this scenario i think mutlicasting is out of the question. So with low reliability of UDP this could cause some problems.

	7) Here comes your idea, if you have any

	I would be very gratefull for any opinions on this matter. I&#8217;m almost decided on 2) but VPN or VLAN would be highly welcomed if i knew how to handle them,

	I&#8217;m not native or fluent english speaker so please forgive me for any misspellings, grammar mistakes or talking nonsense,
as we say in my country &#8220;thank you from the mountain&#8221; (thank you in advance),
regards]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28671</guid>
            <pubDate>Sun, 09 Jun 2013 16:08:57 GMT</pubDate>
        </item>
	
        <item>
            <title>Making a custom QML type element or just use regular elements</title>
            <link>http://qt-project.org/forums/viewthread/28534</link>
            <author>shry.harsh</author>
            <description><![CDATA[I am making a game. There are two characters in the game like &#8216;hero&#8217; and &#8216;enemy&#8217;.  I have made separate classes of them. Should I declare a new custom type for each character like

	import QtQuick 1.1
import hero 1.0
Hero&#123;
power:100
energy:100
image:&#8221;/src/hero.png&#8221;
&#125;

	or just use a regular element like

	import QtQuick 1.1
Image&#123;
source:hero.getImgSource()      //method declared in hero class
&#125;

	So, I am in confusion to make a new element or just use the existing one and use the C++ bindings with QML. Is there any other approach to do so?

	Thanks in advance&#8230;]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28534</guid>
            <pubDate>Wed, 05 Jun 2013 23:25:44 GMT</pubDate>
        </item>
	
        <item>
            <title>I am in search of Developer. Who can develop game for Blackberry 10 and Playbook?</title>
            <link>http://qt-project.org/forums/viewthread/28419</link>
            <author>DimaOrlov</author>
            <description><![CDATA[I am in search of Developer.
I have interesting idea.
Who can develop a game for the Blackberry  10 and Playbook??
dimaorlov.com@mail.ru
http://www.linkedin.com/profile/view?id=51987387]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28419</guid>
            <pubDate>Mon, 03 Jun 2013 13:39:26 GMT</pubDate>
        </item>
	
        <item>
            <title>Any GLSL and Qt tutorial?</title>
            <link>http://qt-project.org/forums/viewthread/28204</link>
            <author>jiangcaiyang</author>
            <description><![CDATA[I want to learn more about GLSL with Qt because with the pace of Qt for Android and iOS, GLSL especially GLSLv2 becomes increasingly important. Unfortunately, I can find little about documentation and tutorials about this. Any help?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28204</guid>
            <pubDate>Mon, 27 May 2013 16:43:31 GMT</pubDate>
        </item>
	
        <item>
            <title>Qt for mobile</title>
            <link>http://qt-project.org/forums/viewthread/28198</link>
            <author>totoby</author>
            <description><![CDATA[Hey people

	(First of all, sorry if there are some errors about what i&#8217;m writing, my english is not that good ^^)

	Ok, so i plan to make a game on Android (and iOS later), and i&#8217;m a great fan of Qt. But is there any advantages to work with java, for Android?

	I know, that Qt is now on Android, but can we see any bad things by developing game in Qt on android compared with java? It seems not, but i want to be sure

	Thank you :)]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/28198</guid>
            <pubDate>Mon, 27 May 2013 14:14:14 GMT</pubDate>
        </item>
	
        <item>
            <title>Using qt widgets as texture in 3D</title>
            <link>http://qt-project.org/forums/viewthread/27903</link>
            <author>belab</author>
            <description><![CDATA[Inspired by the wolfenqt demo with the browser walls I wanted to embed widgets into a game with min. effort using qt for the game ui to prevent from writing an own ui framework and getting all the comfort of qt. Here are my essentials so far:
	
		design ui (of course with qtdesigner)
		create 3d geometries for in game ui, planes, spheres, whatever&#8230;
		render widgets to geometry textures
		pass input events (mouse, key) to 3d widgets and ray picking using mapped texture coords
Code:
&amp;nbsp; &amp;nbsp; widget = new Form&#40;0, this&#41;; // ui from designer
&amp;nbsp; &amp;nbsp; this&#45;&amp;gt;setMouseTracking&#40;true&#41;;
&amp;nbsp; &amp;nbsp; scene = new QGraphicsScene;
&amp;nbsp; &amp;nbsp; scene&#45;&amp;gt;addWidget&#40;widget&#41;;
&amp;nbsp; &amp;nbsp; // connect to ui updates
&amp;nbsp; &amp;nbsp; connect&#40; scene, SIGNAL&#40;changed&#40;const QList&amp;lt;QRectF&amp;gt;&amp;amp;&#41;&#41;, this, SLOT&#40; updateTexture&#40;const QList&amp;lt;QRectF&amp;gt;&amp;amp;&#41;&#41; &#41;;
.
.
void GlWidget::updateTexture&#40; const QList&amp;lt;QRectF&amp;gt;&amp;amp; &#41;
&#123;
&amp;nbsp; &amp;nbsp; QPainter painter&#40; &amp;amp;&#40;cube.pixmap&#41; &#41;;
&amp;nbsp; &amp;nbsp; scene&#45;&amp;gt;render&#40; &amp;amp;painter &#41;; // render ui updates to texture
&amp;nbsp; &amp;nbsp; cube.texture = bindTexture&#40;cube.pixmap&#41;;
&amp;nbsp; &amp;nbsp; updateGL&#40;&#41;;
&#125;
void GlWidget::mouseMoveEvent&#40;QMouseEvent *event&#41;
&#123;
&amp;nbsp; &amp;nbsp; QVector3D rayOrg;
&amp;nbsp; &amp;nbsp; QVector3D rayDir;
&amp;nbsp; &amp;nbsp; getMousePickRay&#40;event&#45;&amp;gt;localPos&#40;&#41;, rayOrg, rayDir&#41;;
&amp;nbsp; &amp;nbsp; QVector2D texCoords;
&amp;nbsp; &amp;nbsp; if&#40; cube.intersect&#40;rayOrg, rayDir, texCoords&#41;&#41;
&amp;nbsp; &amp;nbsp; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QPointF scenePos&#40;texCoords.x&#40;&#41;*widget&#45;&amp;gt;width&#40;&#41;, texCoords.y&#40;&#41;*widget&#45;&amp;gt;height&#40;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QGraphicsSceneMouseEvent mouseEvent&#40;QEvent::GraphicsSceneMouseMove&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mouseEvent.setWidget&#40;this&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mouseEvent.setScenePos&#40;scenePos&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mouseEvent.setLastScenePos&#40;scenePos&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mouseEvent.setAccepted&#40;false&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QApplication::sendEvent&#40; scene, &amp;amp;mouseEvent &#41;;
&amp;nbsp; &amp;nbsp; &#125;
.
.
.

I wrote a small demo on top of the simple qt opengl texture mapping example with putting it all together while keeping it small.
https://github.com/belab/widgetTo3dTexture]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27903</guid>
            <pubDate>Fri, 17 May 2013 23:12:07 GMT</pubDate>
        </item>
	
        <item>
            <title>[SOLVED] app.setOverrideCursor() takes too much cpu</title>
            <link>http://qt-project.org/forums/viewthread/27899</link>
            <author>ritschratsch</author>
            <description><![CDATA[Hiho, everybody again :)

	I&#8217;m programming a strategy game with the Irrlicht 3D Engine, and use QT for the interface.
For showing the player if he would select a unit by left click, the cursor changes as soon as it is over a unit.
It works very well if I just move the cursor over one unit.
But if I have a bunch of units in a row and move the camera eg. from the left to the right and pass all these units, the camera movement slows down a little bit because the cursor has to change very often.

	I declared the cursors as follows:

	QCursor * blue = new QCursor&#40;*&#40;new QPixmap&#40;&amp;quot;../media/interface/cursor_blue.gif&amp;quot;&#41;&#41;&#41;;
QCursor * green = new QCursor&#40;*&#40;new QPixmap&#40;&amp;quot;../media/interface/cursor_green.gif&amp;quot;&#41;&#41;&#41;;
QCursor * yellow = new QCursor&#40;*&#40;new QPixmap&#40;&amp;quot;../media/interface/cursor_yellow.gif&amp;quot;&#41;&#41;&#41;;


	and change it with:
app.setOverrideCursor&#40;*blue&#41;;


	or yellow or green.

	As I can see its only a pointer and the images should already have been loaded so why does the game slows down?
Is there a better way to acchieve what I want?

	Thanks in advance and best regards

	Ritschratsch]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/27899</guid>
            <pubDate>Fri, 17 May 2013 18:03:44 GMT</pubDate>
        </item>
	
        <item>
            <title>Best way to create multi&#45;textured terrain</title>
            <link>http://qt-project.org/forums/viewthread/26938</link>
            <author>eggsmatter</author>
            <description><![CDATA[Hi,

	I have a heightmap that I&#8217;ve generated and have implemented to render a terrain. So far, I can only apply one texture to it. My question is, what is the best way to assign varying textures and render them? I will want to blend textures as well but that can come later. I just need to learn how to render more than one. Searching online certainly has a lot of examples but many are either outdated or conflicting. Most render in immediate mode without shaders. GLSL is something I&#8217;m trying to comprehend as well. 

	The following code has been adapted from the Qt OpenGL tutorial. [qt&#45;project.org] 

	In glwidget.cpp::initializeGL()
&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; glEnable&#40;GL_DEPTH_TEST&#41;;
&amp;nbsp; &amp;nbsp; glEnable&#40;GL_CULL_FACE&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; const float bgColor&#91;4&#93; = &#123;.7, .8, 1.0, 1.0&#125;;
&amp;nbsp; &amp;nbsp; glClearColor&#40;bgColor&#91;0&#93;, bgColor&#91;1&#93;, bgColor&#91;2&#93;, bgColor&#91;3&#93;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; camera = world&#45;&amp;gt;initCamera&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.addShaderFromSourceFile&#40;QGLShader::Vertex, &amp;quot;:/vertexShader.vsh&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.addShaderFromSourceFile&#40;QGLShader::Fragment, &amp;quot;:/fragmentShader.fsh&amp;quot;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.link&#40;&#41;;
&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; texture0 = bindTexture&#40;QPixmap&#40;&amp;quot;:/textures/grassb512.bmp&amp;quot;&#41;&#41;;


	And the rendering occurs in glwidget.cpp::paintGL()
&amp;nbsp; &amp;nbsp; vMatrix.rotate&#40;180.0f, 0.0f, 0.0f, 1.0f&#41;;
&amp;nbsp; &amp;nbsp; vMatrix.rotate&#40;yRot, 0.0f, 1.0f, 0.0f&#41;;
&amp;nbsp; &amp;nbsp; vMatrix.translate&#40;camera&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.bind&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.setUniformValue&#40;&amp;quot;mvpMatrix&amp;quot;, pMatrix * vMatrix * mMatrix&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.setUniformValue&#40;&amp;quot;texture&amp;quot;, 0&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; glActiveTexture&#40;GL_TEXTURE0&#41;;
&amp;nbsp; &amp;nbsp; glBindTexture&#40;GL_TEXTURE_2D, texture0&#41;;
&amp;nbsp; &amp;nbsp; glActiveTexture&#40;0&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.setAttributeArray&#40;&amp;quot;vertex&amp;quot;, world&#45;&amp;gt;vertices.constData&#40;&#41;&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.enableAttributeArray&#40;&amp;quot;vertex&amp;quot;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.setAttributeArray&#40;&amp;quot;textureCoordinate&amp;quot;, world&#45;&amp;gt;textures.constData&#40;&#41;&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.enableAttributeArray&#40;&amp;quot;textureCoordinate&amp;quot;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; QString log = shaderProgram.log&#40;&#41;;
&amp;nbsp; &amp;nbsp; if &#40;!log.isEmpty&#40;&#41;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qDebug&#40;&amp;quot;%s&amp;quot;, qPrintable&#40;log&#41;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; glDrawArrays&#40;GL_TRIANGLES, 0, world&#45;&amp;gt;vertices.size&#40;&#41;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; shaderProgram.disableAttributeArray&#40;&amp;quot;vertex&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.disableAttributeArray&#40;&amp;quot;textureCoordinate&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; shaderProgram.release&#40;&#41;;


	As you may be able to tell, I have a class &#8220;world&#8221; which exposes an array of vertices as well as an array of textures to the rendering method (I also have an array of normals etc.) 
It would be nice to bind the textures in the world class but I don&#8217;t see how they&#8217;d be exposed to the rendering method. The only solution that comes to mind is to have the world class generate vertex and texture arrays per texture and then process them in the paintGL method but, what happens when I start adding objects: trees structures people? What happens when I need to blend two textures across mutliple polygons?

	Is there logic I can perform in the shaders? 

	A link to a perinent and up&#45;to&#45;date reference would be great or just some lucid step in the right direction. Thanks! 

	I am developing in:
Qt Creator 2.5.0 
Based on Qt 4.8.2 (64 bit)

	Built on Aug 7 2012 at 11:47:27  
running on Linux Debian Wheezy/experimental. 

	The OpenGL specs are mesa which is a little bit behind the current openGL standards.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26938</guid>
            <pubDate>Fri, 19 Apr 2013 18:38:52 GMT</pubDate>
        </item>
	
        <item>
            <title>If I build a game in Qt for android and iOS can i include objective C toolkits in it like game center?</title>
            <link>http://qt-project.org/forums/viewthread/26681</link>
            <author>Periphery</author>
            <description><![CDATA[I want to build a game for both android and iOS but I&#8217;m afraid I wont be able to make it fully functional as if I were to just build one in objetive C. So can I use toolkits from android and or iOS in Qt? or can I make it in Qt and add them in later with a different software?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26681</guid>
            <pubDate>Sat, 13 Apr 2013 07:56:13 GMT</pubDate>
        </item>
	
        <item>
            <title>qt3d tank example: projection of click position</title>
            <link>http://qt-project.org/forums/viewthread/26561</link>
            <author>AJOM566</author>
            <description><![CDATA[Hi,
I played around with the qt3d tank example and found that when creating new tanks, they are not exactly placed at the position I double clicked. This is only true for the middle of the plane but not for the edges. At the edges there is a shift which depends on the distance to the middle of the plane. I could not find any obvious errors when looking at the code.

	Any ideas?

	link to tank example:
http://qt.gitorious.org/qt/qt3d/trees/1ce13f86c7066721ce80258d6a89baccc4030066/examples/qt3d/tank]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26561</guid>
            <pubDate>Tue, 09 Apr 2013 19:59:01 GMT</pubDate>
        </item>
	
        <item>
            <title>QT release build defining both _DEBUG and NDEBUG and causing issued with PhysX</title>
            <link>http://qt-project.org/forums/viewthread/26478</link>
            <author>DavidJames</author>
            <description><![CDATA[Hello, I am trying to build an editor that links with my game engine and I am running into this issue. In PhysX I get this error: “Exactly one of NDEBUG and _DEBUG needs to be defined by preprocessor” when I build the project in release mode. The debug build works fine. So for some reason the release build is defining both NDEBUG and _DEBUG for some reason.

	I should also add that I am using a VS2012 build of QT, but I get the same error when I build with the VS2010 version.

	Also I am forced to use QT 4.8.4, because when I try to compile with 5.0.1 I get a bunch of OpenGL redefinition errors, but I am fine working with 4.8.4.

	Thanks,
David]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26478</guid>
            <pubDate>Sun, 07 Apr 2013 00:16:46 GMT</pubDate>
        </item>
	
        <item>
            <title>[Solved] Two Concerns</title>
            <link>http://qt-project.org/forums/viewthread/26240</link>
            <author>solrachet</author>
            <description><![CDATA[Hello, everyone! I hope I&#8217;m not out of line by asking for this kind of help.

	I&#8217;m trying to create a client/server application. The server is looking really good. I used the FortuneServer example to get it to start listening&#8230; But, I noticed that each time the server is ran, the port it listens on changes&#8230;

	void MainWindow::beginListening&#40;&#41;&#123;
&amp;nbsp; &amp;nbsp; QNetworkConfigurationManager manager;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; if &#40;manager.capabilities&#40;&#41; &amp;amp; QNetworkConfigurationManager::NetworkSessionRequired&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Get saved network configuration
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QSettings settings&#40;QSettings::UserScope, QLatin1String&#40;&amp;quot;QtProject&amp;quot;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; settings.beginGroup&#40;QLatin1String&#40;&amp;quot;QtNetwork&amp;quot;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; const QString id = settings.value&#40;QLatin1String&#40;&amp;quot;DefaultNetworkConfiguration&amp;quot;&#41;&#41;.toString&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; settings.endGroup&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // If the saved network configuration is not currently discovered use the system default
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QNetworkConfiguration config = manager.configurationFromIdentifier&#40;id&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;&#40;config.state&#40;&#41; &amp;amp; QNetworkConfiguration::Discovered&#41; !=
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QNetworkConfiguration::Discovered&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; config = manager.defaultConfiguration&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; networkSession = new QNetworkSession&#40;config, this&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addText&#40;&amp;quot;Opening network session.&amp;quot;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //statusLabel&#45;&amp;gt;setText(tr(&amp;quot;Opening network session.&amp;quot;));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; networkSession&#45;&amp;gt;open&#40;&#41;;
&amp;nbsp; &amp;nbsp; &#125; else &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sessionOpened&#40;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&#125;
&amp;nbsp;
void MainWindow::sessionOpened&#40;&#41;
&#123;
&amp;nbsp; &amp;nbsp; // Save the used configuration
&amp;nbsp; &amp;nbsp; if &#40;networkSession&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QNetworkConfiguration config = networkSession&#45;&amp;gt;configuration&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QString id;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;config.type&#40;&#41; == QNetworkConfiguration::UserChoice&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; id = networkSession&#45;&amp;gt;sessionProperty&#40;QLatin1String&#40;&amp;quot;UserChoiceConfiguration&amp;quot;&#41;&#41;.toString&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; id = config.identifier&#40;&#41;;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QSettings settings&#40;QSettings::UserScope, QLatin1String&#40;&amp;quot;QtProject&amp;quot;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; settings.beginGroup&#40;QLatin1String&#40;&amp;quot;QtNetwork&amp;quot;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; settings.setValue&#40;QLatin1String&#40;&amp;quot;DefaultNetworkConfiguration&amp;quot;&#41;, id&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; settings.endGroup&#40;&#41;;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
//! [0] //! [1]
&amp;nbsp; &amp;nbsp; tcpServer = new QTcpServer&#40;this&#41;;
&amp;nbsp; &amp;nbsp; if &#40;!tcpServer&#45;&amp;gt;listen&#40;&#41;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QMessageBox::critical&#40;this, tr&#40;&amp;quot;Server&amp;quot;&#41;,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tr&#40;&amp;quot;Unable to start the server: %1.\n&amp;quot;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .arg&#40;tcpServer&#45;&amp;gt;errorString&#40;&#41;&#41;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; close&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
//! [0]
&amp;nbsp; &amp;nbsp; QString ipAddress;
&amp;nbsp; &amp;nbsp; QList&amp;lt;QHostAddress&amp;gt; ipAddressesList = QNetworkInterface::allAddresses&#40;&#41;;
&amp;nbsp; &amp;nbsp; // use the first non&#45;localhost IPv4 address
&amp;nbsp; &amp;nbsp; for &#40;int i = 0; i &amp;lt; ipAddressesList.size&#40;&#41;; ++i&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &#40;ipAddressesList.at&#40;i&#41; != QHostAddress::LocalHost &amp;amp;&amp;amp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ipAddressesList.at&#40;i&#41;.toIPv4Address&#40;&#41;&#41; &#123;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ipAddress = ipAddressesList.at&#40;i&#41;.toString&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp; &amp;nbsp; &#125;
&amp;nbsp;
&amp;nbsp; &amp;nbsp; // if we did not find one, use IPv4 localhost
&amp;nbsp; &amp;nbsp; if &#40;ipAddress.isEmpty&#40;&#41;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ipAddress = QHostAddress&#40;QHostAddress::LocalHost&#41;.toString&#40;&#41;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addText&#40;tr&#40;&amp;quot;The server is running on\nIP: %1\nPort: %2&amp;quot;&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .arg&#40;ipAddress&#41;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .arg&#40;tcpServer&#45;&amp;gt;serverPort&#40;&#41;&#41;&#41;;
//! [1]
&#125;


	There is the beginListening function, with which I shoved the configure code in (the constructor method from the FortuneServer example, pretty much) and then there&#8217;s the SessionOpened function that gets called afterwards. I&#8217;ve read, reread, and triple read the code and I can&#8217;t seem to figure out how it does whatever it does. I just know that it does. XD Now, to run a server that is to serve multiple clients, I can&#8217;t have the server&#8217;s port change every time it&#8217;s ran&#8230; Is there a way to get the server to listen on a specific port, every time?

	And my second question is a little more broader&#8230; I&#8217;m used to 2D programming in VB using the Picture Box control and DirectX&#8230; Is there an equivalent method I could use with Qt? Obviously, I don&#8217;t want to use DirectX, so maybe OpenGL? Idk, I don&#8217;t need help as much as I need to be pushed in the right direction to achieve my goals.

	Thanks for anyone who responds. :D]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26240</guid>
            <pubDate>Fri, 29 Mar 2013 22:34:03 GMT</pubDate>
        </item>
	
        <item>
            <title>Qt graphics &#45; view framework use CPU to render, not GPU?</title>
            <link>http://qt-project.org/forums/viewthread/26214</link>
            <author>jiangcaiyang</author>
            <description><![CDATA[I wonder, Qt graphics &#8211; view framework use CPU to render, not GPU, and all the implementation below this would follow this rule.
Is it true?
You know that game needs real time rendering. I worry that a bullet system&#40; i.e. a large quantity of bullet in a scene, and boundary detect&#41; could means a sharp drop in FPS, if I use Qt graphics &#8211; view framework.]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26214</guid>
            <pubDate>Fri, 29 Mar 2013 04:11:11 GMT</pubDate>
        </item>
	
        <item>
            <title>Filippakoc_mechanic_pacman_demo</title>
            <link>http://qt-project.org/forums/viewthread/26206</link>
            <author>Dcqt</author>
            <description><![CDATA[Downloaded the pacman game from below site
http://sourceforge.net/projects/pacmanlike/?source=dlp
i want to redirect the game to my own window(QWidget).

	can anybody help?]]></description>
            <guid isPermaLink="false">http://qt-project.org/forums/viewthread/26206</guid>
            <pubDate>Thu, 28 Mar 2013 20:52:07 GMT</pubDate>
        </item>
	

	</channel>
</rss>