static void setupLoadingScreen(void) { unsigned int i; int w = pie_GetVideoBufferWidth(); int h = pie_GetVideoBufferHeight(); int offset; boxHeight = h / 40.0; offset = boxHeight; boxWidth = w - 2.0 * offset; barRightX = w - offset; barRightY = h - offset; barLeftX = barRightX - boxWidth; barLeftY = barRightY - boxHeight; starsNum = boxWidth / boxHeight; starHeight = 2.0 * h / 640.0; if (!stars) { stars = (STAR *)malloc(sizeof(STAR) * starsNum); } for (i = 0; i < starsNum; ++i) { stars[i] = newStar(); } }
void Starfield::draw() { clear_screen(0); foreach (Star& star, stars) { if (star.z <= movementSpeed) { star = newStar(); } else { const int scrX = star.x / static_cast<signed>(star.z) + scr_width / 2; const int scrY = star.y / static_cast<signed>(star.z) + scr_height / 2; const Uint8 drawColor = color + ((star.z / 16) & 0x1F); drawStar(scrX, scrY, drawColor, VGAScreen); star.z -= movementSpeed; } } if (!helpText.empty()) { if (showHelp) drawHelp(); else JE_outText(4, 4, "F1: Help", 1, 0); } if (messageDisplayTime > 0) { JE_outText(JE_fontCenter(message, TINY_FONT), 4, message, fadeColors(messageDisplayTime, MESSAGE_TIME, 2, 8, 11), 4); --messageDisplayTime; } pattern->step(speed, speed2); }
//loadbar update void loadingScreenCallback(void) { const PIELIGHT loadingbar_background = WZCOL_LOADING_BAR_BACKGROUND; const uint32_t currTick = wzGetTicks(); unsigned int i; if (currTick - lastTick < 50) { return; } lastTick = currTick; /* Draw the black rectangle at the bottom, with a two pixel border */ pie_UniTransBoxFill(barLeftX - 2, barLeftY - 2, barRightX + 2, barRightY + 2, loadingbar_background); for (i = 1; i < starsNum; ++i) { stars[i].xPos = stars[i].xPos + stars[i].speed; if (stars[i].xPos >= barRightX) { stars[i] = newStar(); stars[i].xPos = 1; } { const int topX = barLeftX + stars[i].xPos; const int topY = barLeftY + i * (boxHeight - starHeight) / starsNum; const int botX = MIN(topX + stars[i].speed, barRightX); const int botY = topY + starHeight; pie_UniTransBoxFill(topX, topY, botX, botY, stars[i].colour); } } pie_ScreenFlip(CLEAR_OFF_AND_NO_BUFFER_DOWNLOAD);//loading callback // dont clear. audio_Update(); }
bool GuiderOneStar::UpdateCurrentPosition(usImage *pImage, FrameDroppedInfo *errorInfo) { if (!m_star.IsValid() && m_star.X == 0.0 && m_star.Y == 0.0) { Debug.AddLine("UpdateCurrentPosition: no star selected"); errorInfo->starError = Star::STAR_ERROR; errorInfo->starMass = 0.0; errorInfo->starSNR = 0.0; errorInfo->status = _("No star selected"); return true; } bool bError = false; try { Star newStar(m_star); if (!newStar.Find(pImage, m_searchRegion, pFrame->GetStarFindMode())) { errorInfo->starError = newStar.GetError(); errorInfo->starMass = 0.0; errorInfo->starSNR = 0.0; errorInfo->status = StarStatusStr(newStar); m_star.SetError(newStar.GetError()); throw ERROR_INFO("UpdateCurrentPosition():newStar not found"); } // check to see if it seems like the star we just found was the // same as the original star. We do this by comparing the // mass m_massChecker->SetExposure(pFrame->RequestedExposureDuration()); double limits[3]; if (m_massChangeThresholdEnabled && m_massChecker->CheckMass(newStar.Mass, m_massChangeThreshold, limits)) { m_star.SetError(Star::STAR_MASSCHANGE); errorInfo->starError = Star::STAR_MASSCHANGE; errorInfo->starMass = newStar.Mass; errorInfo->starSNR = newStar.SNR; errorInfo->status = StarStatusStr(m_star); pFrame->SetStatusText(wxString::Format(_("Mass: %.0f vs %.0f"), newStar.Mass, limits[1]), 1); Debug.Write(wxString::Format("UpdateGuideState(): star mass new=%.1f exp=%.1f thresh=%.0f%% range=(%.1f, %.1f)\n", newStar.Mass, limits[1], m_massChangeThreshold * 100, limits[0], limits[2])); m_massChecker->AppendData(newStar.Mass); throw THROW_INFO("massChangeThreshold error"); } // update the star position, mass, etc. m_star = newStar; m_massChecker->AppendData(newStar.Mass); const PHD_Point& lockPos = LockPosition(); if (lockPos.IsValid()) { double distance = newStar.Distance(lockPos); UpdateCurrentDistance(distance); } pFrame->pProfile->UpdateData(pImage, m_star.X, m_star.Y); pFrame->AdjustAutoExposure(m_star.SNR); errorInfo->status.Printf(_T("m=%.0f SNR=%.1f"), m_star.Mass, m_star.SNR); } catch (wxString Msg) { POSSIBLY_UNUSED(Msg); bError = true; pFrame->ResetAutoExposure(); // use max exposure duration } return bError; }