Пример #1
0
void Time_now(void) {
	/* =================================================== */
	time_t x = time(NULL );

	memcpy(&_tym, (struct tm *) localtime(&x), sizeof(struct tm));

	_reinit();
}
Пример #2
0
void Time_new_year(TimeInt year) {
	/* =================================================== */

	year = yearto4digit(year);
	_tym.tm_year = (int) year - 1900;
	_reinit();
	Time_set_doy(1);

}
Пример #3
0
void Time_next_day(void) {
	/* =================================================== */
	/* set current day to tomorrow, change year if needed */

	if ((TimeInt) _tym.tm_yday == last_doy) {
		_tym.tm_year++;
		_reinit();
	} else {
		Time_set_doy(++_tym.tm_yday);
	}

}
Пример #4
0
void Time_set_year(TimeInt year) {
	/* =================================================== */
	/* sets the internal yearday and year to match year */
	/* makes sure the month and month-day are correct for */
	/* yearday.
	 * DOES NOT change current doy.  Use new_year() for that.
	 */

	year = yearto4digit(year);

	if (year == _yearto4digit_t())
		return;

	_tym.tm_year = (int) year - 1900;
	_reinit();
	_tym.tm_mday = (int) doy2mday((TimeInt) _tym.tm_yday);
	_tym.tm_mon = (int) doy2month((TimeInt) _tym.tm_yday);
	_remaketime();

}
Пример #5
0
/*
**      Game loop.
*/
void    GameEngine::start()
{
    while (_window.isOpen())
    {
        if (_gameStarted)
        {
            if (GAME_OVER(_character.getSprite().getPosition().x))
            {
                if (_gameOver())
                {
                    _window.close();
                    return;
                }
                else
                    _reinit();
            }
            _handleEvents();
            _moveSprites();
            _update();
        }
        else
            _displayStartMenu();
    }
}