Skip to content

Game Development

What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
871 Topics 4.1k Posts
  • Question about OpenGL queries

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, Do you mean glGenQueries ? If so, you'll find it in the QOpenGLExtraFunctions class. If not, can you link to the documentation of that function ?
  • Beginner for the Qt and Game Programming

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    VRoninV
    For mobile games (and similar) the QML book is a great start. for dektop/console games I'd start from Unreal Engine rather than Qt itself
  • How to select multiple GridLayout cells with mouse

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    GTDevG
    Hi, you can create a custom QML item for each cell, capable of displaying a letter and handling clicks with a MouseArea. For example: CellItem.qml: import QtQuick 2.5 Rectangle { id: cell width: 50 height: 50 property signal clicked property alias text: textItem.text Text { id: textItem anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: cell.clicked() } } When having multiple cells in your grid then, use the text property and clicked signal to implement your game logic: Item { // just some dummy item, use GridLayout or position cells however you like id: cells CellItem { id: cell1 text: "H" onClicked: cells.handleClick(cell1.text) } CellItem { id: cell2 text: "I" onClicked: cells.handleClick(cell2.text) } function handleClick(letter) { // handle clicks on letters of grid, the line below prints the clicked letter console.log("Letter Clicked: "+letter) } } For creating QML-based games, you can also have a look at V-Play Engine. It offers components to make mobile game development easier as well as game network/multiplayer services or plugins for e.g. advertisements or push notifications. To learn more about game development with V-Play, please see the available the open-source game examples and tutorials. Especially the 2048 puzzle game or Juicy Squash match-3 game are a good fit for the type of game you want to make. Cheers, GTDev
  • Drawing chess board and handling click event

    Solved
    9
    0 Votes
    9 Posts
    9k Views
    S
    @GTDev I can download it now! The problem has been solved! The download service is not available when I try to download it the first time...
  • Trouble Converting Mouse into Player Object

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    SGaistS
    So if I understand you correctly, you'd like to have an item locked on your mouse cursor to move around for your game, while the cursor itself is hidden. Correct ?
  • KeyEvent on StackedWidget

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    SGaistS
    You're welcome ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
  • 3D model search engine

    2
    0 Votes
    2 Posts
    2k Views
    M
    I'm going to introduce STLFinder. STLFinder, is basically a search engine for 3d models. It has more than 2 millions 3d models indexed from more than 25 repositories. It has many useful features for searching models through filter options. It has a collections section where each user can create its own set of 3d models and group them by some criteria. You can even share it with the community. Also, it keeps track of the models visited and show you an Historial of the 3d models visited once you need to see it again. The main purpose of the search engine is to be a handy tool for those whose are looking for 3d models for 3d printing, 3d games, virtual reality, augmented reality and 3d design. [image: prusa_i3_hephestos_3d_models_STL_Finder.png] [image: prusa_i3_parts_3d_models_STL_Finder.png]
  • 0 Votes
    4 Posts
    2k Views
    johngodJ
    Any way, if all you want to do is create a image file from the window and if you using QOpenGLWidget I just remember I have done it before, check the following snipet that you can adatp to your needs: void XXXXX::SaveImageAs() { QString filename; filename = QFileDialog::getSaveFileName( this, tr("Save File"), getenv( "HOME" ), tr(" Image (*.png)") ); //getenv( "HOME" ), fileformat ); if( !filename.endsWith( ".png" ) ) { filename.append( ".png" ); } QPixmap pixmap( size() ); render( &pixmap ); QImage image = grabFramebuffer(); QImageWriter imageWriter( filename, "png" ); //imageWriter.setQuality(100); if( imageWriter.canWrite() ) { imageWriter.write(image); } else { QMessageBox::warning( this, tr("Save Image"), tr("Error saving image.") ); } }
  • Qt3D physics aspect

    Unsolved
    5
    0 Votes
    5 Posts
    3k Views
    L
    @SGaist: haha "aspect"... Nice. I've seen that and it's really cool though. QtPhysics is interesting! I have stumbled upon it but in my confusion I've thought it was for the old Qt3D. But you're right it says Qt3D 2.x. I will give this a shot! Thank you both! :)
  • Jahshaka VR Alpha 0.3.0 Release

    Unsolved
    2
    0 Votes
    2 Posts
    975 Views
    I
    We still have a bit of a ways to go but progress is being made. We will have another release very soon with full support for Unity-like shaders, less entropy as it relates to perceived VR behavior and more. Feel free to play around on your os of choice and report back any issues or suggestions. Thanks.
  • Qt3D: Scale in screen coordinate

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    D
    Any idea?
  • Qt Gamepad documentation

    Unsolved
    22
    0 Votes
    22 Posts
    12k Views
    X
    @xiuscut said in Qt Gamepad documentation: connectedChangedEvent also remenber "QT += gamepad" in .pro and #include <QtGamepad/QGamepad>
  • QTimeLine skips the first frame

    Unsolved qtimeline rpg-game animation
    2
    0 Votes
    2 Posts
    898 Views
    tom8oeT
    I think you need to set your start frame to 0 not 1. timeLine->setFrameRange(0, 4);
  • The program has unexpectedly stop + segmentation fault

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    N
    @koahnig thanks a lot. My problem is solved. I also clear the list at each iteration (since its size will never be greater than 1), that way I'm sure that all the elements are valid. You are also right about the memory thing, I suspected that when I first ran my code with some qDebug but I couldn't spot what I was doing wrong. Again thanks a lot.
  • Qt over game

    16
    0 Votes
    16 Posts
    11k Views
    QT-static-prgmQ
    Hi @Radek i know it's a little bit old this topic, but hopefully you found a solution and can share it with us. I'm currently working on an overlay, but it does not work to be painted over an fullscreen game
  • Binding QOpenGLTexture to Depth attachment of QOpenGLFramebufferObject

    Unsolved
    1
    1 Votes
    1 Posts
    686 Views
    No one has replied
  • Loop Run

    16
    0 Votes
    16 Posts
    6k Views
    johngodJ
    From my experience, QML timer is all but accurate betwen plataforms. I have experienced significant speed diferencies between linux and windows, wich makes the game characters move with very diferent speeds on diferent plataforms. This can be a problem and make the game unplayable. Iinitially I tought that Timer was just a QTimer exposed to QML, but has AFAIK thet are not related at all. QTimer seems to provide a much better accuracy, so what I did was to created a new c++ class that uses QTimer, and expose it to QML. In the end, I got a MyTimer qml entity with similar Timer sintaxe, but with much better results.
  • Query on Qt OpenGL ES 2.0 support

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    matthew.kuiashM
    @dalishi I'm a little confused by the question. Maybe I need another cup of tea! Right, so I write OpenGL code in Qt (TBH I use my own libraries much of the time) but the concept is that Qt is a kind of "superset" of the OpenGL system supporting programmable shaders. That is, you will find things in there, such as the above, that do not work in ES2. However, they are still "expressible" because they work on other platforms e.g. desktop, and Qt is cross platform. The OGL functions work on both desktop and mobile. You are not restricted to using ES2 and Qt does a fair amount of levelling the ground for you (take the tediums with precision in shaders). None-the-less it is important that you, the coder, make sure your code uses the correct features on the correct platform. Does this help?
  • How to animate drawing a complex path in Qt

    Solved
    5
    0 Votes
    5 Posts
    2k Views
    S
    Thank you @matthew-kuiash It is a good solution for my problem. Although the QtQuick uses new backend (QQuickItem) not old one (QPainter). If you can get a solution with QQuickItem It will be perfect. For now I can use QQuickPaintedItem for using your good solution in QtQuick environment. Thanks again :)
  • Modifying Images

    Moved Unsolved qimage qpixmap qgraphicspixmap qgraphicsscene qgraphicsview
    9
    0 Votes
    9 Posts
    6k Views
    A
    What do you think about this? int length = this->boundingRect().width(); length = (int)(((double)length * (double)value) / 100.0); QPixmap pix(this->boundingRect().width() - length, this->boundingRect().height()); pix.fill(Qt::transparent); QPainter p; p.begin(&pix); p.fillRect(pix.rect(), QColor(0, 0, 0, 120)); p.end(); gauge->setPixmap(pix); gauge->setPos(pos().x()+length, pos().y()); It works fine and the effect is the same as on example pixtures above.