int EXPORT_THIS d_init_rest(const char *wtitle, int win_w, int win_h, int fullscreen, const char *icon) { int t; videoSetIcon(icon); renderInit(); tpw_cursor_show(0); d->fps.time_at_last_frame = d->fps.time_at_flip = tpw_ticks(); d->fps.time = tpw_ticks() / 1000; t = videoInit(wtitle, win_w, win_h, fullscreen); darnitSetPlatform(0); // renderLineTest(); return t; }
void EXPORT_THIS d_loop() { int time = tpw_ticks(); if (time / 1000 != d->fps.time) { d->fps.frames_last = d->fps.frames_counting; d->fps.frames_counting = 0; d->fps.time = time / 1000; } d->fps.frames_counting++; renderFadeLoop(d); renderTilesheetAnimateAll(); videoLoop(d); inputPoll(d); d->fps.time_at_last_frame = d->fps.time_at_flip; d->fps.time_at_flip = tpw_ticks(); socketConnectLoop(); return; }
void spriteActivate(SPRITE_ENTRY *sprite, int dir) { if (sprite == NULL) return; if (dir < 0 || dir >= 32) dir = 0; if (sprite->spr[dir].tiles < sprite->frame) sprite->frame = 0; sprite->time = tpw_ticks(); sprite->dir = dir; sprite->repeat = 1; renderCalcTileCache(&sprite->cache, sprite->ts, sprite->spr[dir].tile[sprite->frame].tile); return; }
unsigned int EXPORT_THIS d_time_get() { return tpw_ticks(); }