Esempio n. 1
0
void lt_hack_draw (xstuff_t * XStuff, double currentTime, float frameTime)
{
	static float times[10] = { 0.03f, 0.03f, 0.03f, 0.03f, 0.03f,
		0.03f, 0.03f, 0.03f, 0.03f, 0.03f
	};
	static int timeindex = 0;
#define BENCHMARK 1
#ifdef BENCHMARK
	static int a = 1;
#endif

	if (frameTime > 0)
		times[timeindex] = frameTime;
	else
		times[timeindex] = elapsedTime;

#ifdef BENCHMARK
	elapsedTime = 0.027;
#else
	elapsedTime = 0.1f * (times[0] + times[1] + times[2] + times[3] + times[4] + times[5] + times[6] + times[7] + times[8] + times[9]);

	timeindex++;
	if (timeindex >= 10)
		timeindex = 0;
#endif

	computerCheck();

	draw ();

#ifdef BENCHMARK
//	if (a++ == 1000)
//		exit(0);
#endif
}
Esempio n. 2
0
bool dataFetch::editComputerDb(const int &id, const string &name, const int &year, const string &type, const bool &wasBuilt, const string &info)
{
    QSqlQuery query(db);
    computers computerCheck(name,year, type, wasBuilt);
    string comm = "UPDATE Computers SET cName=\"" + name + "\", yearCreated=" + to_string(year) + ", type=\"" + type + "\", wasbuilt=" + to_string(wasBuilt) + ", cInfo=\""+ info + "\" WHERE c_id = " + to_string(id);
    QString command = QString::fromStdString(comm);
    query.prepare(command);
    query.exec();
    return true;
}
Esempio n. 3
0
bool dataFetch::computerAlreadyOnList(const computers& computer)
{

    QSqlQuery query(db);

    query.exec("SELECT * FROM Computers WHERE cIsDeleted is 0");

    bool onList = false;

    //Checks if computer is already in the DB, sets onList = true if it is.
    while(query.next())
    {
        string name = query.value("cName").toString().toStdString();
        int yearCreated = query.value("yearCreated").toUInt();
        string type = query.value("type").toString().toStdString();
        bool wasBuilt = query.value("wasBuilt").toUInt();

        computers computerCheck(name, yearCreated, type, wasBuilt);
        if (computerCheck == computer)
            return onList = true;
    }
    return onList;
}