void HermiteSpline::Update(float timeDelta, StateManager* stateMan) { Player* player = (Player*)GetSprite("player"); assert(player != nullptr); //slow it down timeDelta *= .25f; if (currentLERPPercent >= 1) player->flipDirection = true; else if (currentLERPPercent <= 0) player->flipDirection = false; if (!player->flipDirection) currentLERPPercent += timeDelta; else currentLERPPercent -= timeDelta; Vector2 p0 = GetSprite("start")->position; Vector2 p1 = GetSprite("end")->position; Vector2 t0 = GetSprite("p01")->position; Vector2 t1 = GetSprite("p02")->position; player->position = Vector2::HermiteSpline(p0, p1, t0, t1, currentLERPPercent); HandleUI(stateMan); }
void LERPState::Update(float timeDelta, StateManager* stateMan) { Player* player = (Player*)objectList[2]; //slow it down timeDelta *= .25f; if (currentLERPPercent >= 1) player->flipDirection = true; else if (currentLERPPercent <= 0) player->flipDirection = false; if (!player->flipDirection) currentLERPPercent += timeDelta; else currentLERPPercent -= timeDelta; //set player position player->position = Vector2::LERP(objectList[0]->position, objectList[1]->position, currentLERPPercent); HandleUI(stateMan); }
__geta4 void main(void) #endif { DEBUG_FUNC_IN(); uint32_t spiclk; fileTYPE sd_boot_file; HideSplash(); SPI_fast(); // boot message draw_boot_logo(); BootPrintEx("**** MINIMIG-DE1 ****"); BootPrintEx("Minimig by Dennis van Weeren"); BootPrintEx("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others"); BootPrintEx("DE1 port by Rok Krajnc ([email protected])"); BootPrintEx(" "); sprintf(s, "Build git commit: %s", __BUILD_REV); BootPrintEx(s); sprintf(s, "Build git tag: %s", __BUILD_TAG); BootPrintEx(s); BootPrintEx(" "); BootPrintEx("For updates & code see https://github.com/rkrajnc/minimig-de1"); BootPrintEx("For support, see http://www.minimig.net"); BootPrintEx(" "); printf("\r\r**** MINIMIG-DE1 ****\r\r"); printf("Minimig by Dennis van Weeren\r"); printf("Updates by Jakub Bednarski, Tobias Gubener, Sascha Boing, A.M. Robinson & others\r"); printf("DE1 port by Rok Krajnc ([email protected])\r\r"); printf("Build no. "); printf(__BUILD_NUM); //printf(" by "); //printf(__BUILD_USER); printf("\rgit commit "); printf(__BUILD_REV); printf("\rgit tag"); printf(__BUILD_TAG); printf("\r\r"); printf("For updates & code see https://github.com/rkrajnc/minimig-de1\r"); printf("For support, see http://www.minimig.net/\r\r"); spiclk = 100000 / (20*(read32(REG_SPI_DIV_ADR) + 2)); printf("SPI divider: %u\r", read32(REG_SPI_DIV_ADR)); sprintf(s, "SPI clock: %u.%uMHz", spiclk/100, spiclk%100); BootPrintEx(s); printf("%s\r", s); if (!MMC_Init()) FatalError(1); BootPrintEx("SD card found ..."); printf("SD card found ...\r"); if (!FindDrive()) FatalError(2); BootPrintEx("Drive found ..."); printf("Drive found ...\r"); ChangeDirectory(DIRECTORY_ROOT); //eject all disk df[0].status = 0; df[1].status = 0; df[2].status = 0; df[3].status = 0; BootPrintEx("Booting ..."); printf("Booting ...\r"); TIMER_wait(8000); config.kickstart.name[0]=0; SetConfigurationFilename(0); // Use default config LoadConfiguration(0); // Use slot-based config filename // main loop while (1) { HandleFpga(); HandleUI(); } DEBUG_FUNC_OUT(); }