Pages: 1
Author Topic: Qt "Step" Event?  (24,241 Views)
Offline (Unknown gender) time-killer-games
Guest


Email
Posted on: August 06, 2014, 12:24:19 AM
I have no idea how to use Qt's wonky, over-complicated (for no reason) event system.

I want to do this every step:

void testfunc()
{
        if (test2!=2)
            test1+=1;

        if (test1>=600)
            test2=1;

        if (test2==1)
        {
            sound1.play();
            sound1.setLoops(-1);
            test1=0;
            test2=2;
        }
}


This is my entire cpp (HTML application):

#include <QApplication>
#include "html5applicationviewer.h"
#include <QSound>

int test1;
int test2;
QSound sound1("assets/assets/game.wav");

void testfunc()
{
        if (test2!=2)
            test1+=1;

        if (test1>=600)
            test2=1;

        if (test2==1)
        {
            sound1.play();
            sound1.setLoops(-1);
            test1=0;
            test2=2;
        }
}

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Html5ApplicationViewer viewer;
    viewer.setOrientation(Html5ApplicationViewer::ScreenOrientationAuto);
    viewer.showExpanded();
    viewer.loadFile(QLatin1String("assets/index.html"));
    QSound::play("assets/assets/splash.wav");
    test1=0;
    test2=0;

    return app.exec();
}


I've googled all over. nowhere seems to be giving me a reasonable fix that makes any sense to me. I hate this QTimer and QObject crap  have no idea how to use Timers they're so complicated for no reason.

Please help.
Boobs.
Offline (Unknown gender) TheExDeus

Developer
Joined: Apr 2008
Posts: 1,860
View profile
Reply #1 Posted on: August 06, 2014, 09:19:39 AM
Use ENIGMA.
Offline (Unknown gender) time-killer-games
Guest


Email
Reply #2 Posted on: August 06, 2014, 04:24:47 PM
I can't because Enigma doesn't have a cross-platform WebView control. All I need to know is how to make that code I provided run during every "step" or "update" then there will be absolutely nothing else left to do and I can compile the darn thing on Linux.
Offline (Unknown gender) time-killer-games
Guest


Email
Reply #3 Posted on: August 07, 2014, 02:08:48 AM
Alright never mind guys I solved this myself by using Html5 audio instead of using QSound.
Pages: 1