/************************************************************************ Function: display Description: Draws initial static openGL. Sets up buttons, menu, drawing of letters, calls mouse functionality, runs all animations. *************************************************************************/ void display(void) { // Clear the screen and redraw updated stuff glClear(GL_COLOR_BUFFER_BIT); // Draw bonus in background if button pressed // The bonus is psychadelic sqaures that are multicolor, pulsing in the // background drawBonus(); // Morphs the letter if button pressed, else stays as N morphLetter(); // Draw the background for the menu drawMenu(); // This draws the buttons // Always draw base buttons and shadows, but draw over if one is pressed drawButtons(); // Checks if mouse is pressed and records the position mouseCheck(); // Performs button operations depending on mouse position buttonLogic(); // Draw text for buttons drawButtonText(); // Use swap buffers for double buffering glutSwapBuffers(); }
void renderScene() { // Set color and depth clear value glClearDepth(1.f); glClearColor(0.4f, 0.4f, 0.4f, 0.4f); // Enable Z-buffer read and write glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //variables for 3D render shader if(GL20Support) glUseProgram(shaderProg); else glUseProgramObjectARB(shaderProg); setShaderVariables(shaderProg); //Draw everything /*glPushMatrix(); setShaderVariables(shaderProg); drawExampleCube(); glPopMatrix();*/ drawShapes(); //Draw the UI (does not use lighting) if(GL20Support) glUseProgram(noLightProg); else glUseProgramObjectARB(noLightProg); setShaderVariables(noLightProg); draw_xy_grid(20,20,1.0,1.0); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0.0,currentRes[0],0.0,currentRes[1]); setShaderVariables(noLightProg); drawButtons(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); //copy buffer to texture /*glBindTexture(GL_TEXTURE_2D,textureTarget); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, currentRes[0], currentRes[1], 0); texRender.useProgram(); //variables for texture shader //texture unit id is handled in ShowTexture setShaderVariables(texRender.getProgram()); //sets up a few shader variables and draws the texture on a full view quad texRender.render(textureTarget, currentRes, currentRes);*/ }
void MouseUI::draw(wstring state, wstring help, bool originalPosition) { if(originalPosition) ofSetWindowPosition(posX, posY); ofSetColor(255,255,255); fontWS.drawString(state, 0,100); helpWS.drawString(help, 0,125); drawButtons(); }
void startMenu::draw() { if (_ButtFocus == start) { _start.setFocus(true); _options.setFocus(false); _autors.setFocus(false); _quit.setFocus(false); } if (_ButtFocus == option) { _start.setFocus(false); _options.setFocus(true); _autors.setFocus(false); _quit.setFocus(false); } if (_ButtFocus == autors) { _start.setFocus(false); _options.setFocus(false); _autors.setFocus(true); _quit.setFocus(false); } if (_ButtFocus == quit) { _start.setFocus(false); _options.setFocus(false); _autors.setFocus(false); _quit.setFocus(true); } drawButtons(); }
// This callback function gets called by the Glut // system whenever it decides things need to be redrawn. void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3d(0,0,1); drawButtons(); drawShapes(); drawFeedback(); glutSwapBuffers(); }
void APIGrafica::drawMenu() { drawTitleMenu(); drawItens(); drawButtons(); }
void Game::render() { m_window->clear(sf::Color::White); drawButtons(); drawButtonText(); drawHeader(); drawCurrentQuestionNumber(); drawTimeLeftToAnswer(); m_window->display(); }
/** Calls all the methods to draw a complete Dialog * * This method must be called by the subclasses. */ void RainbruRPG::Terminal::Dialog::drawDialog(){ if (visible){ drawEmpty(); drawBorder(); drawShadow(); if (title.length()>0) drawTitle(); drawCaption(); drawButtons(); } }
void InputEvents::setMode(Mode mode) { assert((unsigned)mode < input_config.modes.size()); if (mode == current_mode) return; current_mode = mode; UpdateOverlayMode(); drawButtons(getModeID(), true); }
/** Default constructor */ StyleDialog::StyleDialog(RSStyle &style, QWidget *parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); ui.headerFrame->setHeaderImage(QPixmap(":/images/library.png")); ui.headerFrame->setHeaderText(tr("Define Style")); /* Load window postion */ QByteArray geometry = Settings->valueFromGroup("StyleDialog", "Geometry", QByteArray()).toByteArray(); if (geometry.isEmpty() == false) { restoreGeometry(geometry); } connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(ui.color1Button, SIGNAL(clicked()), this, SLOT(chooseColor())); connect(ui.color2Button, SIGNAL(clicked()), this, SLOT(chooseColor())); /* Initialize style combobox */ ui.styleComboBox->addItem(tr("None"), RSStyle::STYLETYPE_NONE); ui.styleComboBox->addItem(tr("Solid"), RSStyle::STYLETYPE_SOLID); ui.styleComboBox->addItem(tr("Gradient"), RSStyle::STYLETYPE_GRADIENT); ui.styleComboBox->setCurrentIndex(style.styleType); connect(ui.styleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showButtons())); /* Add pushbuttons and labels */ pushButtons.append(ui.color1Button); pushButtons.append(ui.color2Button); labels.append(ui.color1Label); labels.append(ui.color2Label); /* Set pushbuttons visible */ showButtons(); /* Init colors */ for (int i = 0; i < pushButtons.size(); ++i) { if (i < style.colors.size()) { colors[pushButtons[i]] = style.colors[i]; } else { colors[pushButtons[i]] = Qt::white; } } drawButtons(); drawPreview(); }
void FirstRunWindow::draw() { drawInfo(); drawButtons(); drawConnectMessage(); if (modelDriver->getSelectedWindow() == FIRSTWINDOW) { wattron(win, A_BOLD); wattron(win, COLOR_PAIR(HICOLOR)); } Window::draw(); wrefresh(win); }
void StyleDialog::chooseColor() { QPushButton *button = dynamic_cast<QPushButton*>(sender()); if (button == NULL) { return; } QColor color = QColorDialog::getColor(colors[button]); if (color.isValid()) { colors[button] = color; drawButtons(); drawPreview(); } }
void InputEvents::ProcessEvent(unsigned event_id) { assert(event_id != 0); InputEvents::Mode lastMode = getModeID(); int bindex = FindMenuItemByEvent(lastMode, overlay_mode, event_id); if (bindex < 0 || ButtonLabel::IsEnabled(bindex)) InputEvents::processGo(event_id); // experimental: update button text, macro may change the value if (lastMode == getModeID() && bindex > 0) drawButtons(lastMode); }
void InputEvents::ProcessMenuTimer() { if (CommonInterface::main_window.HasDialog()) /* no menu updates while a dialog is visible */ return; if (MenuTimeOut == CommonInterface::GetUISettings().menu_timeout) HideMenu(); // refresh visible buttons if still visible drawButtons(getModeID()); MenuTimeOut++; }
void InputEvents::SetFlavour(const TCHAR *_flavour) { if (flavour == NULL && _flavour == NULL) /* optimised default case */ return; flavour = _flavour; const Mode old_overlay_mode = overlay_mode; UpdateOverlayMode(); if (overlay_mode != old_overlay_mode) /* the overlay_mode has changed, update the displayed menu */ drawButtons(current_mode, true); }
void Screen::draw(bool shouldDrawButtons) { //draw the background // glColor3f(backgroundColor[0], backgroundColor[1], backgroundColor[2]); // drawBox(0, 0, 850, 650); //if the screeen has the tycoon logo on it // if (hasTycoonLogo) { // drawTexture(loadTexture("collegeTycoon.pam"), 100, 10, 650, 150); // } //draw the buttons on the screen if (shouldDrawButtons) drawButtons(0, buttons.size() - 1); }
/* function that draws window with all stuff */ void draw(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); /* draw working window and panel with set of tools */ drawGrid(); drawPanel(mapState.border); glColor3f(0, 0, 0); drawBitmapText("Tools", BITMAPTEXT_X, BITMAPTEXT_Y); drawButtons(); passiveLineMotion(mapState.points_storage, mapState.previous_point, mapState.passive_motion_point); drawEdgeVertices(mapState.points_storage, RADIUS_OF_POINT); drawEdges(mapState.edges_storage); checkSelectedPoint(mapState.points_storage, mapState.passive_motion_point); markSelectedPoint(mapState.previous_point, mapState.selected_point, SIZE_OF_SHINING_CIRCLE); glutSwapBuffers(); glFlush(); }
// This callback function gets called by the Glut // system whenever it decides things need to be redrawn. void display(void) { glClear(GL_COLOR_BUFFER_BIT); // Test lines that draw all three shapes and some text. // Delete these when you get your code working. drawShapes(); drawPoints(); drawButtons(); drawSliders(); glColor3d(1, 1, 1); drawText(300, 10, "CS-3005 - Illustrator"); glutSwapBuffers(); }
void arduinoGrapher::drawGui(){ // ofTranslate(100, 500); drawButtons(); drawResetButton(); drawBaudChangeButton(); ofPushMatrix(); ofTranslate(startButtonX, startButtonY); ofSetRectMode(OF_RECTMODE_CENTER); ofSetHexColor(white); if (insideStartButton(mouseX, mouseY)){ ofRect(0, 0, startButtonW+5, startButtonH+5); }else{ ofRect(0, 0, startButtonW, startButtonH); } ofSetHexColor(offBlack); ofRect(0, 0, startButtonW-5, startButtonH-5); ofSetHexColor(white); verdana20.drawString(recievingData?"Stop":"Start", -45, 10); ofSetRectMode(OF_RECTMODE_CORNER); ofPopMatrix(); if (drawBaudPane){ drawBaudGui(); } ofPushMatrix(); ofTranslate(850, graphY+graphH+30); ofSetHexColor(darkGrey); verdana.drawString("Current baud rate: "+ofToString(serial.baudRate), 0, 0); verdana.drawString("Current buffer size: "+ofToString(serial.messages.size()), 0, 24); ofPopMatrix(); }
void InputEvents::setMode(Mode mode) { assert((unsigned)mode < input_config.modes.size()); if (mode == current_mode) return; if (current_mode == MODE_PAN) /* disable pan mode before displaying the normal menu; leaving pan mode enabled would be confusing for the user, and doesn't look consistent */ LeavePan(); current_mode = mode; UpdateOverlayMode(); drawButtons(current_mode, true); }
void ReflowPage::redrawAll() { FlashGraphics flash(_panel); // fade out (it's asynchronous and takes about a second) fadeAndClear(); // draw the lot drawButtons(flash,GuiButtons,sizeof(GuiButtons)/sizeof(GuiButtons[0])); drawTemperatureIcon(flash); drawSelection(true); drawProfile(flash); drawAxes(flash); // lights back on _panel.setBacklight(FULL_BRIGHTNESS); }
bool ItemView::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { Gtk::Allocation allocation = get_allocation(); int width = allocation.get_width(); int height = allocation.get_height(); //draw bottom shadow cr->set_source_rgb(0.9, 0.9, 0.9); cr->paint(); //make room for content height -= 1; //update clear notification button layout updateClearNotificationButtonLayout(width, height); fontTime.set_size(FONT_SIZE * PANGO_SCALE); fontTitle.set_size(FONT_SIZE * PANGO_SCALE); fontDescription.set_size(FONT_SIZE_SMALL * PANGO_SCALE); cr->set_antialias(Cairo::ANTIALIAS_NONE); drawBackground(cr, width, height); cr->set_antialias(Cairo::ANTIALIAS_DEFAULT); //draw objects drawTime(cr, width, height); drawTitle(cr, width, height); drawDescription(cr, width, height); drawReminderIcon(cr, width, height); //update buttons layout according to selection state and description position updateButtonsLayout(width, height, rectDescription.get_y(), rectDescription.get_height()); //draw buttons drawButtons(cr, width, height); return true; }
void CColossNormal::run() { getInput(); scaleButtons(); drawButtons(); if(!getBoss()) { drawScore(); } tweenBlock(); // Check for block collision hasBlockFinished(); glGraphics->Draw(this); CColoss::run(); // Call to super function // Boss interface functionality manageBossInterface(); }
void ControlPage::redrawAll() { FlashGraphics flash(_panel); // fade out (it's asynchronous and takes about a second) fadeAndClear(); // draw the lot flash.drawBitmap(Rectangle(20,20,91,24),FlashInfo::CONTROL::OFFSET,FlashInfo::CONTROL::LENGTH); drawButtons(flash,GuiButtons,sizeof(GuiButtons)/sizeof(GuiButtons[0])); drawSelectionAndCheck(flash,true); _p.redraw(_panel); _i.redraw(_panel); _d.redraw(_panel); // lights back on _panel.setBacklight(FULL_BRIGHTNESS); }
void NoiseGen::mainLoop() { bool quit = false; bool refresh = true; //int cursor = 0; //bool viewcontrol = false; // int viewcontrolunits = 12; // how many units moved when in view control bool mapDrag = false; sf::Vector2i mapDragOffset; //debug //std::cout << "SCREEN :" << IMAGE_SIZE*IMAGE_SCALE+RIGHT_MARGIN_WIDTH << "," << IMAGE_SIZE*IMAGE_SCALE+BOTTOM_MARGIN_HEIGHT << std::endl; while(!quit) { sf::Event event; screen->clear(); //check for right mouse button release if dragging if(mapDrag && !sf::Mouse::isButtonPressed(sf::Mouse::Right)) { mapDrag = false; xpos = xpos - (sf::Mouse::getPosition(*screen).x - mapDragOffset.x); ypos = ypos - (sf::Mouse::getPosition(*screen).y - mapDragOffset.y); refresh = true; } else if(mapDrag) refresh = true; //create, populate, and display map image if(refresh) { if(sf::Mouse::isButtonPressed(sf::Mouse::Right) && mapDrag) { int x_off = sf::Mouse::getPosition(*screen).x - mapDragOffset.x; int y_off = sf::Mouse::getPosition(*screen).y - mapDragOffset.y; createMapImage(xpos - x_off, ypos - y_off); } else createMapImage(xpos, ypos); refresh = false; } //DRAW OBJECTS drawMap(); drawSliders(); drawButtons(); drawCoordinates( sf::Vector2i(IMAGE_SCALE*IMAGE_SIZE + 12, 300)); //debug draw mouse coordinates /* std::stringstream mpos; mpos << "(" << sf::Mouse::getPosition(*screen).x << "," << sf::Mouse::getPosition(*screen).y << ")"; sf::Text mposTXT(mpos.str(), font, 12); mposTXT.setColor(sf::Color(200,0,0)); screen->draw(mposTXT); */ //handle input while(screen->pollEvent(event)) { //if resize event happened if(event.type == sf::Event::Resized) { screen->setSize( sf::Vector2u(IMAGE_SCALE*IMAGE_SIZE + RIGHT_MARGIN_WIDTH, IMAGE_SCALE*IMAGE_SIZE + BOTTOM_MARGIN_HEIGHT)); continue; } //pass event to sliders if(updateSliders(&event)) refresh = true; //WINDOW CLOSE EVENT if(event.type == sf::Event::Closed) quit = true; // MOUSE EVENTS if(event.type == sf::Event::MouseButtonPressed) { //LEFT MOUSE BUTTON if(event.mouseButton.button == sf::Mouse::Left) { for(int i = 0; i < int(buttons.size()); i++) { if(buttons[i]->mouseIn()) { switch(i) { case 0: N_MODE = SIMPLEX; break; case 1: N_MODE = PERLIN; break; case 2: if(terrainmode) terrainmode = false; else terrainmode = true; break; case 3: exportToTXT(); break; case 4: exportToIMAGE(); break; case 5: randomPosition(); break; case 6: /* defaultSettings(); updateSliders(NULL); refresh = true; */ reloadDefaultSettings(); break; default: break; } refresh = true; } } } else if(event.mouseButton.button == sf::Mouse::Right) { sf::Vector2i m_pos = sf::Mouse::getPosition(*screen); if(m_pos.x >= 0 && m_pos.x <= mapTexture->getSize().x && m_pos.y >= 0 && m_pos.y <= mapTexture->getSize().y) { mapDrag = true; mapDragOffset = m_pos; refresh = true; } } } // KEYBOARD EVENTS if(event.type == sf::Event::KeyPressed) { //escape to quit if(event.key.code == sf::Keyboard::Escape) { quit = true; } else if(event.key.code == sf::Keyboard::Q) { /* defaultSettings(); std::cout << "loaded default settings\n"; initTerrainSlider(); // memory leak? std::cout << "initialized terrain slider\n"; updateSliders(NULL); std::cout << "updated sliders\n"; */ reloadDefaultSettings(); refresh = true; } else if(event.key.code == sf::Keyboard::F1) { segment newseg; newseg.value = 254; newseg.red = rand()%256; newseg.green = rand()%256; newseg.blue = rand()%256; terSlider->addSegment(&newseg); } else if(event.key.code == sf::Keyboard::F5) { xpos = 10; ypos = 10; refresh = true; } else if(event.key.code == sf::Keyboard::W) {ypos = ypos - IMAGE_SIZE/2; refresh = true;} else if(event.key.code == sf::Keyboard::S) {ypos = ypos + IMAGE_SIZE/2; refresh = true;} else if(event.key.code == sf::Keyboard::A) {xpos = xpos - IMAGE_SIZE/2; refresh = true;} else if(event.key.code == sf::Keyboard::D) {xpos = xpos + IMAGE_SIZE/2; refresh = true;} } } //draw screen screen->display(); } //save settings after mainloop quit saveSettings(); }
void SlideNavmesh::draw(const float* view, const float zoom, bool highlight) { if (!visible(view)) return; drawCorner(!m_expanded); if (!m_expanded) return; glPushMatrix(); glTranslatef(m_pos[0],m_pos[1],0); // drawDropShadow(0,0, m_dim[0],m_dim[1], highlight ? 2 : 1); /* if (highlight) glColor4ub(255,255,255,128); else glColor4ub(255,255,255,96);*/ setcolor(COL_BACK); // drawBG(0,0,m_dim[0],m_dim[1]); glPushMatrix(); glTranslatef(PADDING_SIZE,PADDING_SIZE,0); drawBoundary(m_scene.boundary, m_scene.nboundary, zoom); // Draw navmesh if (m_drawGraph) navmeshDraw(m_scene.nav, zoom); // Draw Agent int aflags = 0; if (m_drawCorner) aflags |= AGENTDRAW_CORNER; if (m_drawCorridor) aflags |= AGENTDRAW_CORRIDOR; if (m_drawVisited) aflags |= AGENTDRAW_VISITED; NavmeshAgent* ag = &m_scene.agents[0]; agentTrailDraw(ag, m_scene.nav, zoom); agentDraw(ag, m_scene.nav, aflags, zoom); // Actual if (m_drawDelta) { glLineWidth(2.0f*zoom); setcolor(COL_DARK); drawarrow(ag->pos[0],ag->pos[1], ag->pos[0]+ag->vel[0], ag->pos[1]+ag->vel[1],0.1f); } glPopMatrix(); drawButtons(); /* setcolor(clerp(COL_DIM,COL_BACK,128)); glPointSize(1.0f); glLineWidth(1.0f); // drawtext(PADDING_SIZE,PADDING_SIZE/2, 0.07f, "M A S T E R P L A N"); const float ts = 0.07f; float sx; float x = PADDING_SIZE; float y = PADDING_SIZE/3; sx = x; drawtext(x,y, ts, "Corner"); x += 0.7f; drawtext(x,y, ts, "Corridor"); x += 0.7f; drawtext(x,y, ts, "Mesh"); x += 0.7f; glBegin(GL_LINES); glVertex2f(x,y+ts*1.5f); glVertex2f(sx,y+ts*1.5f); glEnd(); x += 0.5f; sx = x; drawtext(x,y, ts, "Straight"); x += 0.7f; drawtext(x,y, ts, "Smooth"); x += 0.7f; drawtext(x,y, ts, "Drunk"); x += 0.7f; glBegin(GL_LINES); glVertex2f(x,y+ts*1.5f); glVertex2f(sx,y+ts*1.5f); glEnd(); */ glPopMatrix(); }
void Town::depositWithdrawl(int choice) { Party &party = *_vm->_party; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; int gold, gems; if (choice) { gold = party._bankGold; gems = party._bankGems; } else { gold = party._gold; gems = party._gems; } for (uint idx = 0; idx < _buttons.size(); ++idx) _buttons[idx]._sprites = &_icons2; _buttons[0]._value = Common::KEYCODE_o; _buttons[1]._value = Common::KEYCODE_e; _buttons[2]._value = Common::KEYCODE_ESCAPE; Common::String msg = Common::String::format(Res.GOLD_GEMS, Res.DEPOSIT_WITHDRAWL[choice], XeenEngine::printMil(gold).c_str(), XeenEngine::printMil(gems).c_str()); screen._windows[35].open(); screen._windows[35].writeString(msg); drawButtons(&screen._windows[35]); screen._windows[35].update(); sound.stopSound(); File voc("coina.voc"); bool flag = false; do { switch (townWait()) { case Common::KEYCODE_o: flag = false; break; case Common::KEYCODE_e: flag = true; break; case Common::KEYCODE_ESCAPE: break; default: continue; } if ((choice && !party._bankGems && flag) || (choice && !party._bankGold && !flag) || (!choice && !party._gems && flag) || (!choice && !party._gold && !flag)) { party.notEnough(flag, choice, 1, WT_2); } else { screen._windows[35].writeString(Res.AMOUNT); int amount = NumericInput::show(_vm, 35, 10, 77); if (amount) { if (flag) { if (party.subtract(true, amount, choice, WT_2)) { if (choice) { party._gems += amount; } else { party._bankGems += amount; } } } else { if (party.subtract(false, amount, choice, WT_2)) { if (choice) { party._gold += amount; } else { party._bankGold += amount; } } } } if (choice) { gold = party._bankGold; gems = party._bankGems; } else { gold = party._gold; gems = party._gems; } sound.playSound(voc); msg = Common::String::format(Res.GOLD_GEMS_2, Res.DEPOSIT_WITHDRAWL[choice], XeenEngine::printMil(gold).c_str(), XeenEngine::printMil(gems).c_str()); screen._windows[35].writeString(msg); screen._windows[35].update(); } // TODO } while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE); for (uint idx = 0; idx < _buttons.size(); ++idx) _buttons[idx]._sprites = &_icons1; _buttons[0]._value = Common::KEYCODE_d; _buttons[1]._value = Common::KEYCODE_w; _buttons[2]._value = Common::KEYCODE_ESCAPE; }
void SWTrack::drawInfobar(QPainter *pnt) { pnt->fillRect(QRect(0, 0, wWid-2, tHei), QColor(0, 0, 0, 200)); drawButtons(pnt); TrTrackR *trk = rEvent->pTrTrack(tID); if (!trk) return; int mfit = (0 <= fID && fID < NPAR) ? fitPar[fID] : 0; if (mfit <= 0) return; TString hpat; for (int i = 0; i < NLAY; i++) { if (lyrSta[i] == LSTA_HITY) hpat += "Y"; else if (lyrSta[i] == LSTA_HITT) hpat += "O"; else hpat += "_"; } pnt->setPen(Qt::white); drawText(pnt, 28, 10, Form("Track [%d]", tID)); drawText(pnt, 100, 10, Form("nHit: %d", trk->GetNhits())); drawText(pnt, 170, 10, Form("nHitXY: %d", trk->GetNhitsXY())); drawText(pnt, 270, 10, Form("fPat: %s", hpat.Data())); drawText(pnt, 28, 30, Form("Fit %d", fitPar[fID])); drawText(pnt, 100, 30, Form("chi2/Ndf (X): %.2f/%d", trk->GetChisqX(mfit), trk->GetNdofX(mfit))); drawText(pnt, 270, 30, Form("chi2/Ndf (Y): %.2f/%d", trk->GetChisqY(mfit), trk->GetNdofY(mfit))); drawText(pnt, 100, 50, Form("rigidity: %.2f", trk->GetRigidity(mfit))); drawText(pnt, 270, 50, Form("errRinv: %.2f", trk->GetErrRinv(mfit))); int ifc = focusStatus/FOCUS_DOBJ/2-1; if ((focusStatus & FOCUS_DOBJ) && ifc >= 0) { int iht = getFocusHid(); TrRecHitR *hit = trk->GetHit(iht); if (hit) { char cf1 = (hit->OnlyY()) ? 'G' : '_'; char cf2 = (hit->checkstatus(AMSDBc::USED)) ? 'T' : '_'; int lay = hit->GetLayer(); drawText(pnt, 40, 70, Form("Hit [%d]", iht)); drawText(pnt, 90, 70, Form("TkID: %d", hit->GetTkId())); drawText(pnt, 180, 70, Form("Flag: %c%c", cf1, cf2)); drawText(pnt, 250, 70, Form("Residual: %.4f %.4f", trk->GetResidualO(lay, mfit).x(), trk->GetResidualO(lay, mfit).y())); } else if (abs(lyrSta[ifc]) > 10) { int tkid = lyrSta[ifc]; int nclx = 0, ncly = 0, nhit = 0, nhtt = 0, nhtg = 0; for (int i = 0; rEvent && i < rEvent->nTrCluster(); i++) { TrClusterR *cls = rEvent->pTrCluster(i); if (!cls || cls->GetTkId() != tkid) continue; if (cls->GetSide() == 0) nclx++; else ncly++; } for (int i = 0; rEvent && i < rEvent->nTrRecHit(); i++) { TrRecHitR *hit = rEvent->pTrRecHit(i); if (!hit || hit->GetTkId() != tkid) continue; nhit++; if (hit->checkstatus(AMSDBc::USED)) nhtt++; else if (hit->OnlyY()) nhtg++; } drawText(pnt, 40, 70, "Ladder"); drawText(pnt, 90, 70, Form("TkID: %d", tkid)); drawText(pnt, 170, 70, Form("nClsX/Y: %d/%d", nclx, ncly)); drawText(pnt, 270, 70, Form("nHit/T/G: %d/%d/%d", nhit, nhtt, nhtg)); } } }
static msg_t notepadThread(void *param) { GEventMouse *pem; GEventGWinButton *peb; GHandle ghc; (void)param; /* Get the display dimensions */ swidth = gdispGetWidth(); sheight = gdispGetHeight(); font = gdispOpenFont("UI2"); /* Initialize the mouse */ geventListenerInit(&gl); ginputGetMouse(0); initButtons(); /* Configure the GIF decoder with the toolbar Icon images */ gdispImageSetMemoryReader(&toolbarImageFilmstrip, toolbarIcons); gdispImageOpen(&toolbarImageFilmstrip); /* Set clip to the entire screen */ gdispSetClip(0, 0, swidth, sheight); /* Clear the screen with the window background * Also, draw the title bars */ gdispClear(nCurColorScheme.winBgColor); gdispDrawBox(0, 0, swidth, sheight, nCurColorScheme.titleBarColor); gdispFillArea(0, 0, swidth, NPAD_TITLEBAR_HEIGHT, nCurColorScheme.titleBarColor); gdispDrawStringBox(NPAD_TITLETEXT_START_X, NPAD_TITLETEXT_START_Y, swidth, NPAD_TITLEBAR_HEIGHT, NPAD_TITLETEXT_STR, font, nCurColorScheme.titleTextColor, justifyLeft); /* Create the drawing window, draw its border */ gdispDrawBox(NPAD_DRAWING_AREA_START_X - 1, NPAD_DRAWING_AREA_START_Y - 1, NPAD_DRAWING_AREA_WIDTH + 2, NPAD_DRAWING_AREA_HEIGHT + 2, nCurColorScheme.drawingWinBorder); nDrawingArea = gwinCreateWindow(NULL, NPAD_DRAWING_AREA_START_X, NPAD_DRAWING_AREA_START_Y, NPAD_DRAWING_AREA_WIDTH, NPAD_DRAWING_AREA_HEIGHT); /* Create the bottom status bar console */ ghc = gwinCreateConsole(NULL, NPAD_STATUSBAR_START_X, NPAD_STATUSBAR_START_Y, NPAD_STATUSBAR_WIDTH, NPAD_STATUSBAR_HEIGHT, font); gdispImageDraw(&toolbarImageFilmstrip, NPAD_STATUSBAR_ICON_START_X, NPAD_STATUSBAR_ICON_START_Y, NPAD_ICON_WIDTH, NPAD_ICON_HEIGHT, NPAD_ICON_START(12), 0); gwinSetBgColor(ghc, nCurColorScheme.winBgColor); gwinSetColor(ghc, Black); gstatusConsole = gwinGetConsoleStream(ghc); /* draw the buttons */ gwinSetColor(nDrawingArea, Black); gwinSetBgColor(nDrawingArea, White); gwinClear(nDrawingArea); gwinClear(ghc); drawButtons(); drawVButtons(); chprintf(gstatusConsole, "Welcome to ChibiOS/GFX Notepad demo."); ncoreSpawnDrawThread(nDrawingArea, gstatusConsole); while(TRUE) { pem = (GEventMouse *) geventEventWait(&gl, TIME_INFINITE); /* button pressed... */ if (pem->type == GEVENT_GWIN_BUTTON) { peb = (GEventGWinButton *)pem; if (peb->button == H(btnNew)) { // Reset all the settings selColorIndex = 0; selPenWidth = 0; ncoreSetMode(NCORE_MODE_DRAW); gwinSetColor(nDrawingArea, Black); gwinSetBgColor(nDrawingArea, White); // Refresh the buttons drawButtons(); drawVButtons(); gwinClear(nDrawingArea); chprintf(gstatusConsole, "\nScreen Cleared."); } else if (peb->button == H(btnOpen)) { chprintf(gstatusConsole, "\nFile Open not implemented."); } else if (peb->button == H(btnSave)) { chprintf(gstatusConsole, "\nFile Save not implemented."); } else if (peb->button == H(btnPencil)) { ncoreSetMode(NCORE_MODE_DRAW); drawVButtons(); chprintf(gstatusConsole, "\nPencil Tool Selected."); } else if (peb->button == H(btnEraser)) { ncoreSetMode(NCORE_MODE_ERASE); drawVButtons(); chprintf(gstatusConsole, "\nEraser Tool Selected."); } else if (peb->button == H(btnFill)) { ncoreSetMode(NCORE_MODE_FILL); drawVButtons(); chprintf(gstatusConsole, "\nFill Tool Selected."); } else if (peb->button == H(btnClose)) { break; } } } gwinDestroyWindow(ghc); // No need to destroy the buttons as they are statically allocated gdispCloseFont(font); ncoreTerminateDrawThread(); gdispImageClose(&toolbarImageFilmstrip); return 0; }
void InputEvents::UpdatePan() { drawButtons(getModeID(), true); }