void CBarBitmapWin32::DrawChar(int left, int top, char ch) { if (ch>='0' && ch<='9') DrawDigit(left, top, ch); else if ((ch>='A' && ch<='Z') || (ch>='a' && ch<='z')) DrawLetter(left, top, ch); }
VOID CDigitCtrl :: OnPaint() { CPaintDC dc(this); // Fill background black dc.FillSolidRect(&dc.m_ps.rcPaint, m_lBackColor); // Draw the digit DrawDigit(&dc); }
void niku_draw(int value, bool force_white) { int clkframe = (game.counter % 30) <= 10; if (game.frozen || player->inputs_locked || force_white) clkframe = 0; draw_sprite(NIKU_X, NIKU_Y, SPR_NIKU_CLOCK, clkframe); int mins = (value / 3000); // the game runs at 50 fps int secs = (value / 50) % 60; int tens = (value / 5) % 10; DrawNumber(NIKU_X, NIKU_Y, mins); DrawTwoDigitNumber(NIKU_X+36, NIKU_Y, secs); DrawDigit(NIKU_X+56, NIKU_Y, tens); draw_sprite(NIKU_X+30, NIKU_Y, SPR_NIKU_PUNC); }
void kwxLCDDisplay::DoDrawing( wxDC *dc ) { wxString buf; buf.Printf( "%s", mValue.c_str() ); while( buf.Replace( "..", ". ." ) ); char current; char next; int buflen = buf.Len(); int ac = buflen - 1; int c = 0 ; while (c < mNumberDigits) //numero cifre display { ac >= 0? current = buf.GetChar( ac ): current = ' '; ac >= 0 && ac < buflen - 1? next = buf.GetChar( ac + 1 ): next = ' '; if( current == '.' ) ac-- ; else { wxDigitData *data = new wxDigitData; data->value = current; data->comma = false; if( next == '.' ) { data->comma = true; } DrawDigit( dc, c, data ); ac--; c++ ; delete data; } } }
void wxLCDWindow::DoDrawing(wxDC* dc) { wxString buf; buf.Printf(wxT("%s"), m_value.c_str()); while (buf.Replace(wxT(".."), wxT(". ."))); char curr; char next; int buflen = buf.Len(); int ac = buflen - 1; for (int c = 0; c < m_numDigit; c++) { ReadString: ac >= 0? curr = buf.GetChar(ac): curr = wxT(' '); ac >= 0 && ac < buflen - 1? next = buf.GetChar(ac + 1): next = wxT(' '); if (curr == wxT('.')) { ac--; goto ReadString; } wxDigitData *data = new wxDigitData; data->value = curr; data->comma = false; if (next == wxT('.')) { data->comma = true; } DrawDigit(dc, c, data); ac--; delete data; } }
void DrawTwoDigitNumber(int x, int y, int num) { DrawDigit(x+0, y, num/10); DrawDigit(x+8, y, num%10); }
void PassiveLagTest() { int frames = 0, seconds = 0, minutes = 0, hours = 0, framecnt = 1, done = 0; u16 pressed, lsd, msd, pause = 0; ImagePtr back, circle; back = LoadImage(WHITEIMG, 0); if(!back) return; back->w = 320; back->h = 240; circle= LoadImage(CIRCLEIMG, 0); if(!circle) return; circle->r = 0x00; circle->g = 0x00; circle->b = 0xff; LoadNumbers(); while(!done && !EndProgram) { if(!pause) { frames ++; framecnt ++; if(framecnt > 8) framecnt = 1; } if(IsPAL) { if(frames > 49) { frames = 0; seconds ++; } } else { if(frames > 59) { frames = 0; seconds ++; } } if(seconds > 59) { seconds = 0; minutes ++; } if(minutes > 59) { minutes = 0; hours ++; } if(hours > 99) hours = 0; StartScene(); DrawImage(back); DrawString(32, 8, 0, 0, 0, "hours"); DrawString(104, 8, 0, 0, 0, "minutes"); DrawString(176, 8, 0, 0, 0, "seconds"); DrawString(248, 8, 0, 0, 0, "frames"); // Counter Separators DrawDigit(80, 16, 0, 0, 0, 10); DrawDigit(152, 16, 0, 0, 0, 10); DrawDigit(224, 16, 0, 0, 0, 10); // Circles 1st row circle->x = 16; circle->y = 56; if(framecnt == 1) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(36, 68, 0xff, 0xff, 0xff, 1); circle->x = 96; circle->y = 56; if(framecnt == 2) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(116, 68, 0xff, 0xff, 0xff, 2); circle->x = 176; circle->y = 56; if(framecnt == 3) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(196, 68, 0xff, 0xff, 0xff, 3); circle->x = 256; circle->y = 56; if(framecnt == 4) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(276, 68, 0xff, 0xff, 0xff, 4); // Circles 2nd row circle->x = 16; circle->y = 136; if(framecnt == 5) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(36, 148, 0xff, 0xff, 0xff, 5); circle->x = 96; circle->y = 136; if(framecnt == 6) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(116, 148, 0xff, 0xff, 0xff, 6); circle->x = 176; circle->y = 136; if(framecnt == 7) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(196, 148, 0xff, 0xff, 0xff, 7); circle->x = 256; circle->y = 136; if(framecnt == 8) { circle->b = 0; circle->r = 0xff; } else { circle->b = 0xff; circle->r = 0; } DrawImage(circle); DrawDigit(276, 148, 0xff, 0xff, 0xff, 8); // Draw Hours lsd = hours % 10; msd = hours / 10; DrawDigit(32, 16, 0, 0, 0, msd); DrawDigit(56, 16, 0, 0, 0, lsd); // Draw Minutes lsd = minutes % 10; msd = minutes / 10; DrawDigit(104, 16, 0, 0, 0, msd); DrawDigit(128, 16, 0, 0, 0, lsd); // Draw Seconds lsd = seconds % 10; msd = seconds / 10; DrawDigit(176, 16, 0, 0, 0, msd); DrawDigit(200, 16, 0, 0, 0, lsd); // Draw Frames lsd = frames % 10; msd = frames / 10; DrawDigit(248, 16, 0, 0, 0, msd); DrawDigit(272, 16, 0, 0, 0, lsd); EndScene(); ControllerScan(); pressed = Controller_ButtonsDown(0); if (pressed & PAD_BUTTON_B) done = 1; if (pressed & PAD_BUTTON_X && pause) { frames = hours = minutes = seconds = 0; framecnt = 1; } if (pressed & PAD_BUTTON_A) pause = !pause; if ( pressed & PAD_BUTTON_START ) { DrawMenu = 1; HelpData = PASSIVELAG; } } FreeImage(&back); FreeImage(&circle); ReleaseNumbers(); }
void CWndDmm::DisplayValue(CSettings::DmmMeasure *pDmmMeas, bool isErr, int position, bool redraw, bool refreshValue) { float value = pDmmMeas->fValue; int type = pDmmMeas->Type; char newDisplay[12]; bool negative = value < 0; value = abs(value); if (isErr) { newDisplay[0]=' '; newDisplay[1]=' '; newDisplay[2]='E'; newDisplay[3]='r'; newDisplay[4]='r'; } else if(pDmmMeas->Enabled == CSettings::DmmMeasure::_Off) { newDisplay[0]=' '; newDisplay[1]=' '; newDisplay[2]='o'; newDisplay[3]='f'; newDisplay[4]='f'; } else { BIOS::DBG::sprintf( newDisplay, " %04f", value ); newDisplay[0] = negative ? '-' : ' '; } // Setup disaplay according to position int width=8; int size=30; int space=1; int x=36; int y=70; int scale=2; switch(position) { case 0: // Main => keep init values break; case 1: // Value1 width = 4; size = 10; space = 1; x=51; y=18; scale = 1; break; case 2: // Value2 width = 4; size = 10; space = 1; x=186; y=18; scale = 1; break; default: _ASSERT( !!!"Invalid position" ); } bool refreshAll = (redraw || type != values[position][5]); if(refreshAll) { // Label BIOS::LCD::Bar( x+((size/2+width)+4*space), y, x+4*size+8*width+16*space, y+14*scale, CWndDmm::cClr ); CUtils::Print( x+((size/2+width)+4*space), y, CWndDmm::cLabel, CWndDmm::cOff, scale, CSettings::getTypeText(Settings.Dmm.Mode)[type]); } if(refreshAll || refreshValue) { y+=14*scale+2*space; // Value int i; const char* pDisplay = newDisplay; for (i=0; i < 5; i++) { int nDigit = *pDisplay; if(nDigit == 0) { // End of string nDigit = ' '; } else { if ((i < 4) && (pDisplay[1] == '.')) { nDigit |= 128; pDisplay++; } pDisplay++; } if(redraw || nDigit != values[position][i]) { if(i == 0) { // Minus sign if(nDigit == '-') { _DrawMinus( x, y+width/2+size+2*space-1, width, size/2+width, CWndDmm::cOn ); } else { _DrawMinus( x, y+width/2+size+2*space-1, width, size/2+width, CWndDmm::cOff ); } } else { // Other digits DrawDigit(x, y, width, size, space, nDigit, CWndDmm::cOn, CWndDmm::cOff); } values[position][i] = nDigit; } if(i == 0) { x+=((size/2+width)+3*space+scale*space); } else if(i == 4) { x+=(size+width+4*space+scale*space); } else { x+=(size+2*width+7*space); } } if(refreshAll) { // Unit BIOS::LCD::Bar( x, y, x+24*scale, y+14*scale, CWndDmm::cClr ); CUtils::Print( x, y, CWndDmm::cOn, CWndDmm::cClr, scale, CSettings::getTypeSuffix(Settings.Dmm.Mode)[type]); values[position][5] = type; } } }