Esempio n. 1
0
int main(void) {
    srand(time(0));

    if(!sysInit()) return 1;
    if(!sysLoadFiles()) return 1;

    gameTitle();

    while(!quit) {
        startTimer = SDL_GetTicks();

        sysInput();
        gameLogic();
        drawEverything();

        // Update the screen
        if(SDL_Flip(screen) == -1) return 1;
        
        // Limit the frame rate
        endTimer = SDL_GetTicks();
        deltaTimer = endTimer - startTimer;
        if(deltaTimer < (1000/FPS))
            SDL_Delay((1000/FPS)-deltaTimer);
    }
    gameCleanup();
    sysCleanup();
}
Esempio n. 2
0
int XHServiceBasePrivate::run(bool asService, const std::vector<std::string> &argList)
{
	int argc = argList.size();
    std::vector<char *> argv(argc);	
	std::vector<std::string>  argvData;
	for (int i = 0; i < argc; ++i)
		argvData.push_back(argList[i]);
	for (int i = 0; i < argc; ++i){
		char* c;
		const int len = argvData[i].length();
		c = new char[len + 1];
		strcpy(c, argvData[i].c_str());
		argv[i] = c;
	}

    if (asService && !sysInit())
        return -1;

	q_ptr->createApplication(argc,argv.data());   

    if (asService)
        sysSetPath();

    XHServiceStarter starter(this);
	starter.slotStart();
	// TODO 
    int res = q_ptr->executeApplication();
    if (asService)
        sysCleanup();
    return res;
}
Esempio n. 3
0
int main(int argc, char *argv[]) {
    srand(time(0));

    if(!sysInit()) return 1;
    if(!sysLoadFiles()) return 1;

    gameModeInit();
    menuInit();
    gameTitle();

    while(!quit) {
        startTimer = SDL_GetTicks();

        sysInput();
        gameLogic();
        drawEverything();

        // Update the screen
        SDL_RenderPresent(renderer);
        
        // Limit the frame rate
        endTimer = SDL_GetTicks();
        deltaTimer = endTimer - startTimer;
        if(deltaTimer < (1000/FPS))
            SDL_Delay((1000/FPS)-deltaTimer);
    }
    blockCleanup();
    sysCleanup();
}
Esempio n. 4
0
/*!
    Destroys the object, freeing all allocated resources.

    If the same application is started again it will not find this
    instance.
*/
QtSingleApplication::~QtSingleApplication()
{
    sysCleanup();

    delete d;
}