Pages: 1
  Print  
Author Topic: Qt "Step" Event?  (Read 1080 times)
Offline (Male) time-killer-games
Posted on: August 05, 2014, 07:24:19 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1166

View Profile Email
I have no idea how to use Qt's wonky, over-complicated (for no reason) event system.

I want to do this every step:
Code: [Select]
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):
Code: [Select]
#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.
« Last Edit: August 05, 2014, 07:47:35 PM by time-killer-games » Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: August 06, 2014, 04:19:39 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Use ENIGMA.
Logged
Offline (Male) time-killer-games
Reply #2 Posted on: August 06, 2014, 11:24:47 AM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1166

View Profile Email
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.
Logged
Offline (Male) time-killer-games
Reply #3 Posted on: August 06, 2014, 09:08:48 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1166

View Profile Email
Alright never mind guys I solved this myself by using Html5 audio instead of using QSound.
Logged
Pages: 1
  Print