void Clock::draw() const { float colorRed[3] = {1.0, 0.0, 0.0}; float colorWhite[3] = {1.0, 1.0, 1.0}; float colorBlack[3] = {0.0, 0.0, 0.0}; const time_t now = time(0); tm *convertedTime = localtime(&now); int hours = convertedTime->tm_hour % 12; int minutes = convertedTime->tm_min; float hourAngles = 90 - (hours + minutes / 60.0) * (360 / 12); float minuteAngles = 90 - minutes * (360 / 60); // Draw clock border drawCircle(colorRed, 10.0, GL_LINE_LOOP, radius); // Draw clock face drawCircle(colorWhite, 1.0, GL_TRIANGLE_FAN, radius * 0.97); // Draw clock numbers drawNumbers(colorBlack, GLUT_BITMAP_TIMES_ROMAN_24); // Draw hour hand drawHand(hourAngles, colorBlack, 10.0); // Draw minute hand drawHand(minuteAngles, colorBlack, 3.5); }
void drawUI(HexMemoryData* data, PDUI* uiFuncs) { PDVec2 textStart = uiFuncs->getCursorPos(); PDVec2 windowSize = uiFuncs->getWindowSize(); windowSize.y -= textStart.y; if (!data->data) return; const float fontHeight = uiFuncs->getFontHeight(); const float fontWidth = uiFuncs->getFontWidth(); int drawableLineCount = (int)(windowSize.y / fontHeight); float drawableChars = (float)(int)(windowSize.x / fontWidth); // margins between the rows drawableChars -= margins * 3.0f; //int addressTextSize = ((int)fontWidth) * (data->addressSize * 2) + 2; //printf("%d %d\n", addressTextSize, (int)drawableChars); //if (addressTextSize > drawableChars) // return; drawAddresses(data, uiFuncs, drawableLineCount, 8); uiFuncs->setCursorPos(textStart); drawNumbers(data, uiFuncs, drawableLineCount, 8, 76.0f); uiFuncs->setCursorPos(textStart); drawChars(data, uiFuncs, drawableLineCount, 8, 300.0f); }
void drawWindows(sf::RenderWindow & window, vectorObjects & shapes, sf::Text & text) { window.clear(WINDOW_COLOR); window.draw(*shapes.bg); drawNumbers(window, text, shapes.bg->getLocalBounds().height); window.draw(*shapes.hour); window.draw(*shapes.min); window.draw(*shapes.sec); }
void CSolverView::OnDraw(CDC* pDC) { CSolverDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; int shift_x = pDoc->max_row_blocks() * cell_size; int shift_y = pDoc->max_col_blocks() * cell_size; pDC->SetViewportOrg(shift_x, shift_y); // grid drawGrid(pDC, cell_size, 1, RGB(200, 200, 200), pDoc->max_row_blocks(), pDoc->max_col_blocks()); drawGrid(pDC, cell_size, 5, RGB(0, 0, 0)); // numbers drawNumbers(pDC); // field for (size_t y = 0; y < pDoc->rows(); ++y) for (size_t x = 0; x < pDoc->cols(); ++x) drawCell(pDC, cell_size, x, y); }
/** Konstruktor, initialisert die Ziehung mit sechs gezogenen Zahlen @param randomTable Zeiger auf die Zufallstabelle **/ Draw::Draw(Random::Table *randomTable) { drawNumbers(randomTable); }
// ekrana çizen fonksiyon. void DrawScreen::drawWindow(cv::Point& coordinate) { // sayilari ciz drawButtonArea(); drawNumbers(); /* renk degistiren cizgi */ /* uchar*row = frames.ptr<uchar>(300); line(frames, cv::Point(440, 300), cv::Point(460, 460), CV_RGB(255 - row[440], 255 - row[440], 255 - row[440]), 3, 2, 0); // dikey 3. */ // secilen sayilari ekrana basar if (num_color) { putText(frames, numbers, cv::Point(75, 85), 7, 3, NUMBER2_COLOR, 3); } else { putText(frames, numbers, cv::Point(75, 85), 7, 3, NUMBER3_COLOR, 3); } if (coordinate.x != -1 && coordinate.y != -1) { int temp = returnPosition(coordinate.x, coordinate.y); // eger temp 0'dan buyukse ve keyTurn onceden bir tusun ustunde bulunmussa timeCounter artilir if (temp > 0 && temp == keyTurn) { timeCounter++; } // eger temp 0'dan buuykse ama keyTurk tempe esit degilse , ilk kez o numaraya giriyor demektir , timeCounter 1 yapilir ve keyTurn'e temp degeri atanir else if (temp > 0) { keyTurn = temp; timeCounter = 1; } // bunlarin hicbiri olmamissa timeCounter ve keyTurn default degerlerine dondurulur else { keyTurn = -1; timeCounter = 0; } // dairesel progress bar ciz drawProgressBar(temp); // eger timeCounter degeri istenen miktara ulasmissa bu deger artik bir input olmus demektir if (timeCounter >= TIME_COUNTER) { // eger bu deger 11'den kucuk ve 0'dan buyuk ise bu bir rakam demektir , 10'a gore mod alinir if (keyTurn < 11 && keyTurn>0) { keyTurn = keyTurn % 10; printf("Deger %d\n", keyTurn); numbers = numbers + intToString(keyTurn); } // 11 ise iptal butonudur else if (keyTurn == 11) { printf("CANCEL\n"); num_color = true; numbers = ""; } // 12 ise silme butonudur else if (keyTurn == 12) { int lng = numbers.length() - 1; if (lng >= 0) { string str2 = numbers.substr(0, numbers.length() - 1); printf("REMOVE\n"); numbers = str2; } } // 13 ise onaylama butonudur else if (keyTurn == 13) { printf("ONAY\n"); num_color = false; } // timeCounter ve keyTurn degerlerini default degerlerine getir timeCounter = 0; keyTurn = -1; } // marker icin arti isaretini ciz if (temp == -1) { drawObject(coordinate.x, coordinate.y); } } // marker bulunamamissa keyTurn ve timeCounter degerlerini default degerlerine getir else { keyTurn = -1; timeCounter = 0; } }
// ekrana çizen fonksiyon. void DrawScreen::drawWindow(cv::Point& coordinate){ // sayilari ciz drawNumbers(); // secilen sayilari ekrana basar if (num_color) { putText(frames, numbers, cv::Point(105, 51), 5, 3, NUMBER2_COLOR, 3); } else { putText(frames, numbers, cv::Point(105, 51), 5, 3, NUMBER3_COLOR, 3); } if (coordinate.x != -1 && coordinate.y != -1){ int temp = returnPosition(coordinate.x, coordinate.y); // eger temp 0'dan buyukse ve keyTurn onceden bir tusun ustunde bulunmussa timeCounter artilir if (temp > 0 && temp == keyTurn){ timeCounter++; } // eger temp 0'dan buuykse ama keyTurk tempe esit degilse , ilk kez o numaraya giriyor demektir , timeCounter 1 yapilir ve keyTurn'e temp degeri atanir else if (temp > 0){ keyTurn = temp; timeCounter = 1; } // bunlarin hicbiri olmamissa timeCounter ve keyTurn default degerlerine dondurulur else{ keyTurn = -1; timeCounter = 0; } // dairesel progress bar ciz //drawProgressBar(temp); line(frames, cv::Point(100, 65), cv::Point(370, 65), cv::Scalar(255, 255, 255), 6, 2, 0); // progress line line(frames, cv::Point(100, 65), cv::Point((timeCounter/2 * 27) + 100, 65), cv::Scalar(0, ((timeCounter * 10) % 256), (255 - ((timeCounter * 10) % 256))), 6, 2, 0); // progress line // eger timeCounter degeri istenen miktara ulasmissa bu deger artik bir input olmus demektir if (timeCounter >= TIME_COUNTER){ // eger bu deger 11'den kucuk ve 0'dan buyuk ise bu bir rakam demektir , 10'a gore mod alinir if (keyTurn < 10 && keyTurn>0){ keyTurn = keyTurn % 10; printf("Deger %d\n", keyTurn); numbers = numbers + intToString(keyTurn); } // 10 ise iptal butonudur else if (keyTurn == 10){ printf("IPTAL\n"); num_color = true; numbers = ""; } // 11 ise "0" butonudur else if (keyTurn == 11){ printf("Deger 0\n"); numbers = numbers + "0"; } // 12 ise silme butonudur else if (keyTurn == 12){ printf("ONAY\n"); num_color = false; } // timeCounter ve keyTurn degerlerini default degerlerine getir timeCounter = 0; keyTurn = -1; } // marker icin arti isaretini ciz if (temp == -1) { drawObject(coordinate.x, coordinate.y); } } // marker bulunamamissa keyTurn ve timeCounter degerlerini default degerlerine getir else{ keyTurn = -1; timeCounter = 0; } }