/** * Called when this view gets the focus. Highlights the view to show to the user * that events go to this view. */ void RGraphicsViewQt::focusInEvent(QFocusEvent* event) { if (getDocumentInterface()!=NULL) { RGraphicsViewQt* other = dynamic_cast<RGraphicsViewQt*>( getDocumentInterface()->getLastKnownViewWithFocus() ); if (other!=NULL) { other->removeFocus(); } getDocumentInterface()->setLastKnownViewWithFocus(this); if (focusFrameWidget!=NULL) { QPalette p = focusFrameWidget->palette(); #ifdef Q_OS_MAC QColor light("#adc2d9"); QColor dark("#adc2d9"); #else QColor light("#2d2d92"); QColor dark("#2d2d92"); #endif p.setColor(QPalette::Light, light); p.setColor(QPalette::Dark, dark); focusFrameWidget->setPalette(p); } RMainWindow* mainWindow = RMainWindow::getMainWindow(); if (mainWindow!=NULL) { mainWindow->notifyViewFocusListeners(this); } } QWidget::focusInEvent(event); }
/* read etc... */ void ivread() { previous_obj = FALSE; if (here(BOOK)) object = BOOK; if (here(BOOK2)) addobj(BOOK2); if (here(BILLBD)) addobj(BILLBD); if (here(CARVNG)) addobj(CARVNG); if (here(MAGAZINE)) addobj(MAGAZINE); if (here(MESSAGE)) addobj(MESSAGE); if (here(OYSTER)) addobj(OYSTER); if (here(POSTER)) addobj(POSTER); if (here(TABLET)) addobj(TABLET); if (previous_obj || object == 0 || dark()) needobj(); else vread(); return; }
void PixServer::drawBrick(QPainter *p ,int i) { //Note, ROOMPIC IS OUR 'TARGET' QColor light(180,180,180); QColor dark(100,100,100); int topSq = board->getNext(N, i); //find 'address' of neighbouring squares int botSq = board->getNext(S, i); int rightSq = board->getNext(E ,i); int leftSq = board->getNext(W, i); QRect rect = board->rect(i); //get our square's rect int x = rect.x(); int y = rect.y(); //Get x,y location of square??? int width, height; int highlight = 2; //Highlighting Distance (pixels)? width = height = rect.width(); p->fillRect(x, y, width, height, light); //By default, fill square w/ Light? no. use dark!!!! bitBlt(&roomPix, x, y, &offPix, x, y, width, height ); //Copy the brick pattern onto the brick if (!board->isBrick(rightSq)) p->fillRect(x + width - highlight, y, highlight, height, dark); //highlight if its an end-brick. if (!board->isBrick(leftSq)) p->fillRect(x, y, highlight, height, light); if (!board->isBrick(botSq)) p->fillRect(x, y + height - highlight, width, highlight, dark); if (!board->isBrick(topSq)) p->fillRect(x, y, width, highlight, light); }
//------------------------------------------------------------------------------ void Canvas::DrawRaisedEdge(PixelRect &rc) { Pen bright(1, Color(240, 240, 240)); this->Select(bright); this->DrawTwoLinesExact(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); Pen dark(1, Color(128, 128, 128)); this->Select(dark); this->DrawTwoLinesExact(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); ++rc.left; ++rc.top; --rc.right; --rc.bottom; }
/* READ etc. */ vread() { int msg; msg = 0; if (dark()) { printf("I see no %s here.\n",probj(object)); return; } switch(object) { case MAGAZINE: msg = 190; break; case TABLET: msg = 196; break; case MESSAGE: msg = 191; break; case OYSTER: if (!toting(OYSTER) || !closed) break; yes(192,193,54); return; default: ; } if (msg) rspeak(msg); else actspk(verb); }
void Canvas::DrawButton(PixelRect rc, bool down) { const Pen old_pen = pen; Color gray = COLOR_LIGHT_GRAY; DrawFilledRectangle(rc, gray); Pen bright(1, LightColor(gray)); Pen dark(1, DarkColor(gray)); Select(down ? dark : bright); DrawTwoLines(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); DrawTwoLines(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1, rc.right - 3, rc.top + 1); Select(down ? bright : dark); DrawTwoLines(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); DrawTwoLines(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2, rc.right - 2, rc.top + 2); pen = old_pen; }
//----------------------------------------------------------------------------- // Purpose: Draw the weapon's crosshair //----------------------------------------------------------------------------- void CWeaponIFMSteadyCam::DrawCrosshair( void ) { BaseClass::DrawCrosshair(); int x, y, w, h; GetOverlayBounds( x, y, w, h ); // Draw the targeting zone around the crosshair int r, g, b, a; gHUD.m_clrYellowish.GetColor( r, g, b, a ); Color gray( 255, 255, 255, 192 ); Color light( r, g, b, 255 ); Color dark( r, g, b, 128 ); Color red( 255, 0, 0, 128 ); DrawArmLength( x, y, w, h, light ); DrawFOV( x, y, w, h, light, dark ); int cx, cy; cx = x + ( w / 2 ); cy = y + ( h / 2 ); // This is the crosshair vgui::surface()->DrawSetColor( gray ); vgui::surface()->DrawFilledRect( cx-10, cy-1, cx-3, cy+1 ); vgui::surface()->DrawFilledRect( cx+3, cy-1, cx+10, cy+1 ); vgui::surface()->DrawFilledRect( cx-1, cy-10, cx+1, cy-3 ); vgui::surface()->DrawFilledRect( cx-1, cy+3, cx+1, cy+10 ); // This is the yellow aiming dot if ( ( m_vecViewOffset.x != 0.0f ) || ( m_vecViewOffset.y != 0.0f ) ) { int ax, ay; ax = cx + m_vecViewOffset.x; ay = cy + m_vecViewOffset.y; vgui::surface()->DrawSetColor( light ); vgui::surface()->DrawFilledRect( ax-2, ay-2, ax+2, ay+2 ); } // This is the red actual dot if ( ( m_vecActualViewOffset.x != 0.0f ) || ( m_vecActualViewOffset.y != 0.0f ) ) { int ax, ay; ax = cx + m_vecActualViewOffset.x; ay = cy + m_vecActualViewOffset.y; vgui::surface()->DrawSetColor( red ); vgui::surface()->DrawFilledRect( ax-2, ay-2, ax+2, ay+2 ); } // This is the purple fov dot if ( m_flFOVOffsetY != 0.0f ) { Color purple( 255, 0, 255, 255 ); int vy = cy + m_flFOVOffsetY; vgui::surface()->DrawSetColor( purple ); vgui::surface()->DrawFilledRect( cx-2, vy-2, cx+2, vy+2 ); } }
void CurveEditor::InitGrid() { auto size = mCurveCanvasWidget->getSize(); auto width = size.width; auto height= size.height; auto inteveralX = width / (gridNumX + 2); auto inteveralY = height / (gridNumY + 2); MyGUI::Colour dark(0.1f, 0.1f, 0.1f); MyGUI::Colour light(0.2f, 0.2f, 0.2f); std::vector<MyGUI::Colour> colors; std::vector<MyGUI::FloatPoint> lines; for (auto i = 1; i <= gridNumX+1; ++i) { lines.push_back(MyGUI::FloatPoint(i*inteveralX, 3)); lines.push_back(MyGUI::FloatPoint(i*inteveralX, height-4)); colors.push_back(i == 1 ? dark : light); colors.push_back(i == 1 ? dark : light); } lines.push_back(MyGUI::FloatPoint(inteveralX - 1, 3)); lines.push_back(MyGUI::FloatPoint(inteveralX - 1, height - 4)); colors.push_back(dark); colors.push_back(dark); for (auto i = 1; i <= gridNumY + 1; ++i) { lines.push_back(MyGUI::FloatPoint(3, i*inteveralY)); lines.push_back(MyGUI::FloatPoint(width - 4, i*inteveralY)); colors.push_back(i == gridNumY + 1 ? dark : light); colors.push_back(i == gridNumY + 1 ? dark : light); } lines.push_back(MyGUI::FloatPoint(3, (gridNumY + 1)*inteveralY + 1)); lines.push_back(MyGUI::FloatPoint(width - 4, (gridNumY + 1)*inteveralY + 1)); colors.push_back(dark); colors.push_back(dark); mCurveLines->setPoints(lines, true); mCurveLines->setColors(colors); for (auto i = 1; i <= gridNumX + 1; i += 2) { MyGUI::TextBox* text = mCurveCanvasWidget->createWidget<MyGUI::TextBox>("TextBox", MyGUI::IntCoord(i * inteveralX + 2, height - 19, 30, 15), MyGUI::Align::Default); text->setFontHeight(14); text->setTextShadow(true); text->setTextShadowColour(MyGUI::Colour::Black); DiString s; s.Format("%.1f", (i - 1) / (float)gridNumX); text->setCaption(s.c_str()); mNumbersX.push_back(text); } }
//-------------------------------------------------------------- void ofApp::draw(){ ofColor dark(40); ofBackgroundGradient(dark, ofColor::black); for (int i = 0; i < particles.size(); i++){ particles[i]->draw(); } panel.draw(); }
/*! Reimplementation from QStyle */ void MetalStyle::polish( QApplication *app) { oldPalette = app->palette(); // we simply create a nice QColorGroup with a couple of fancy // pixmaps here and apply to it all widgets QFont f("times", app->font().pointSize() ); f.setBold( TRUE ); f.setItalic( TRUE ); app->setFont( f, TRUE, "QMenuBar"); app->setFont( f, TRUE, "QPopupMenu"); // QPixmap button( stonedark_xpm ); QColor gold("#B9B9A5A54040"); //same as topgrad below QPixmap button( 1, 1 ); button.fill( gold ); QPixmap background(marble_xpm); QPixmap dark( 1, 1 ); dark.fill( red.dark() ); QPixmap mid( stone1_xpm ); QPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); QPalette op = app->palette(); QColor backCol( 227,227,227 ); // QPalette op(white); QColorGroup active (op.active().foreground(), QBrush(op.active().button(),button), QBrush(op.active().light(), light), QBrush(op.active().dark(), dark), QBrush(op.active().mid(), mid), op.active().text(), Qt::white, op.active().base(),// QColor(236,182,120), QBrush(backCol, background) ); active.setColor( QColorGroup::ButtonText, Qt::white ); active.setColor( QColorGroup::Shadow, Qt::black ); QColorGroup disabled (op.disabled().foreground(), QBrush(op.disabled().button(),button), QBrush(op.disabled().light(), light), op.disabled().dark(), QBrush(op.disabled().mid(), mid), op.disabled().text(), Qt::white, op.disabled().base(),// QColor(236,182,120), QBrush(backCol, background) ); QPalette newPalette( active, disabled, active ); app->setPalette( newPalette, TRUE ); }
int va_dark(va_list pvar) { int fd; user_info *uin; int t; fd = va_arg(pvar, int); uin = va_arg(pvar, user_info *); t = va_arg(pvar, int); return dark( fd, uin, t); }
void NoiseTest::testAverage() { debug(LOG_DEBUG, DEBUG_LOG, 0, "testAverage() begin"); ImageSize size(2000, 2000); DarkNoiseAdapter darknoise(size, 273.13, 100, 1000); ImagePtr dark(new Image<double>(darknoise)); double m = astro::image::filter::mean(dark); debug(LOG_DEBUG, DEBUG_LOG, 0, "mean: %f", m); CPPUNIT_ASSERT(fabs(m - 0.1) < 0.01); io::FITSout out("tmp/darknoise.fits"); out.setPrecious(false); out.write(dark); debug(LOG_DEBUG, DEBUG_LOG, 0, "testAverage() end"); }
//----------------------------------------------------------------------------- // Purpose: Draw the weapon's crosshair //----------------------------------------------------------------------------- void CWeaponCombatLaserRifle::DrawCrosshair( void ) { BaseClass::DrawCrosshair(); // Draw the targeting zone around the crosshair int r, g, b, a; gHUD.m_clrYellowish.GetColor( r, g, b, a ); // Check to see if we are in vgui mode C_BaseTFPlayer *pPlayer = static_cast<C_BaseTFPlayer*>( GetOwner() ); if ( !pPlayer || pPlayer->IsInVGuiInputMode() ) return; // Draw a crosshair & accuracy hoodad int iBarWidth = XRES(10); int iBarHeight = YRES(10); int iTotalWidth = (iBarWidth * 2) + (40 * m_flInaccuracy) + XRES(10); int iTotalHeight = (iBarHeight * 2) + (40 * m_flInaccuracy) + YRES(10); // Horizontal bars int iLeft = (ScreenWidth() - iTotalWidth) / 2; int iMidHeight = (ScreenHeight() / 2); Color dark( r, g, b, 32 ); Color light( r, g, b, 160 ); vgui::surface()->DrawSetColor( dark ); vgui::surface()->DrawFilledRect( iLeft, iMidHeight-1, iLeft+ iBarWidth, iMidHeight + 2 ); vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight-1, iLeft + iTotalWidth, iMidHeight + 2 ); vgui::surface()->DrawSetColor( light ); vgui::surface()->DrawFilledRect( iLeft, iMidHeight, iLeft + iBarWidth, iMidHeight + 1 ); vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight, iLeft + iTotalWidth, iMidHeight + 1 ); // Vertical bars int iTop = (ScreenHeight() - iTotalHeight) / 2; int iMidWidth = (ScreenWidth() / 2); vgui::surface()->DrawSetColor( dark ); vgui::surface()->DrawFilledRect( iMidWidth-1, iTop, iMidWidth + 2, iTop + iBarHeight ); vgui::surface()->DrawFilledRect( iMidWidth-1, iTop + iTotalHeight - iBarHeight, iMidWidth + 2, iTop + iTotalHeight ); vgui::surface()->DrawSetColor( light ); vgui::surface()->DrawFilledRect( iMidWidth, iTop, iMidWidth + 1, iTop + iBarHeight ); vgui::surface()->DrawFilledRect( iMidWidth, iTop + iTotalHeight - iBarHeight, iMidWidth + 1, iTop + iTotalHeight ); }
void CNavigator::paintEvent(QPaintEvent* event) { if (!m_world) { event->accept(); return; } QPainter painter; painter.begin(this); const QRectF rect(QPointF(event->rect().left() + 1, event->rect().top() + 1), QPointF(event->rect().right(), event->rect().bottom())); const float worldWidth = m_world->m_width; const float worldHeight = m_world->m_height; const float landWidth = (rect.width() - worldWidth) / worldWidth; const float landHeight = (rect.height() - worldHeight) / worldHeight; QBrush light(QColor(208, 208, 208)), dark(QColor(128, 128, 128)); int x, y; for (x = 0; x < m_world->m_width; x++) { for (y = 0; y < m_world->m_height; y++) { painter.fillRect(QRectF( rect.left() + (float)x * (landWidth + 1.0f), rect.bottom() - ((float)y * (landHeight + 1.0f)), landWidth, -landHeight).normalized(), m_world->GetLand(x, y) ? dark : light); } } const D3DXVECTOR3 camPos = m_world->m_cameraPos; if (m_world->VecInWorld(camPos)) { painter.fillRect(QRectF( rect.left() + (rect.width() / (worldWidth * (float)MAP_SIZE * (float)MPU)) * camPos.x - 1.5f, rect.bottom() - ((rect.height() / (worldHeight * (float)MAP_SIZE * (float)MPU)) * camPos.z - 1.5f), 3.0f, 3.0f), QBrush(QColor(0, 0, 255))); } painter.end(); event->accept(); }
void drawCube(cv::Mat image, geom::Cube cube){ std::vector<geom::Point2d> points = cube.projectPoints(); cv::Scalar dark(100,100,100); cv::Scalar light(255,255,255); drawFace(image, points[1], points[3], points[7], points[5], dark); drawFace(image, points[7], points[6], points[4], points[5], dark); drawFace(image, points[3], points[7], points[6], points[2], dark); drawFace(image, points[0], points[4], points[6], points[2], light); drawFace(image, points[1], points[3], points[2], points[0], light); drawFace(image, points[1], points[5], points[4], points[0], light); //for (auto point = points.begin(); point != points.end(); ++point) { // cv::circle(image, cv::Point(point->xy[0], point->xy[1]), 5, cv::Scalar(0,255,0), -1); //} }
/* Routine to describe current location */ void describe() { if (toting(BEAR)) rspeak(141); if (dark()) rspeak(16); else if ((g.terse && verb != LOOK) || g.visited[g.loc] % g.abbnum) descsh(g.loc); else desclg(g.loc); if (g.loc == 33 && pct(25) && !g.closing) rspeak(8); if (g.loc == 147 && !g.visited[g.loc]) rspeak(216); return; }
static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect, bool lightColored) { QColor highlight = StyleHelper::highlightColor(lightColored); QColor shadow = StyleHelper::shadowColor(lightColored); QLinearGradient grad(spanRect.topRight(), spanRect.topLeft()); grad.setColorAt(0, highlight.lighter(117)); grad.setColorAt(1, shadow.darker(109)); p->fillRect(rect, grad); QColor light(255, 255, 255, 80); p->setPen(light); p->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0)); QColor dark(0, 0, 0, 90); p->setPen(dark); p->drawLine(rect.topLeft(), rect.bottomLeft()); }
void raised_edge(PixelRect &rc) { Pen bright(1, Color(240, 240, 240)); select(bright); two_lines(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); Pen dark(1, Color(128, 128, 128)); select(dark); two_lines(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); ++rc.left; ++rc.top; --rc.right; --rc.bottom; }
void NoiseTest::testSBIG16803() { debug(LOG_DEBUG, DEBUG_LOG, 0, "testSBIG16803() begin"); ImageSize size(4096, 4096); double darkcurrent = 0.02; double exposuretime = 600; int electrons_per_pixel = 100000; DarkNoiseAdapter darknoise(size, 273.13, darkcurrent * exposuretime, electrons_per_pixel); double expected = darkcurrent * exposuretime / electrons_per_pixel; ImagePtr dark(new Image<double>(darknoise)); double m = astro::image::filter::mean(dark); debug(LOG_DEBUG, DEBUG_LOG, 0, "mean: %f", m); CPPUNIT_ASSERT(fabs(m - expected) < 0.01); io::FITSout out("tmp/sbignoise.fits"); out.setPrecious(false); out.write(dark); debug(LOG_DEBUG, DEBUG_LOG, 0, "testSBIG16803() end"); }
void DeviceWidget::paintEvent(QPaintEvent *) { QPainter painter(this); QColor hilight(style()->standardPalette().window().color().lighter(104)); QColor dark(style()->standardPalette().window().color().darker(100)); if (isDefaultDevice()) { QPen pen(dark.darker(170)); painter.setPen(pen); QLinearGradient grad(width(), 0, width(), height()); grad.setColorAt(0.48, hilight); grad.setColorAt(0.5, dark); hilight.setAlpha(100); dark.setAlpha(100); QLinearGradient grad2(width(), 0, width(), height()); grad2.setColorAt(0.3, hilight); grad2.setColorAt(0.5, dark.darker(105)); grad2.setColorAt(1, dark.darker(115)); QBrush brush(grad); painter.setBrush(brush); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); QBrush brush2(grad2); painter.setBrush(brush2); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); } else { QPen pen(dark.darker(110)); painter.setPen(pen); painter.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2); } }
QColor QColor::light( int factor ) const { if ( factor <= 0 ) // invalid lightness factor return *this; else if ( factor < 100 ) // makes color darker return dark( 10000/factor ); int h, s, v; hsv( &h, &s, &v ); v = (factor*v)/100; if ( v > 255 ) { // overflow s -= v-255; // adjust saturation if ( s < 0 ) s = 0; v = 255; } QColor c; c.setHsv( h, s, v ); return c; }
//-------------------------------------------------------------- void testApp::drawFboTest(){ //we clear the fbo if c is pressed. //this completely clears the buffer so you won't see any trails if( ofGetKeyPressed('c') ){ ofClear(255,255,255, 0); } //some different alpha values for fading the fbo //the lower the number, the longer the trails will take to fade away. // fadeAmnt = 40; // if(ofGetKeyPressed('1')){ // fadeAmnt = 1; // }else if(ofGetKeyPressed('2')){ // fadeAmnt = 5; // }else if(ofGetKeyPressed('3')){ // fadeAmnt = 15; // } //1 - Fade Fbo //this is where we fade the fbo //by drawing a rectangle the size of the fbo with a small alpha value, we can slowly fade the current contents of the fbo. ofFill(); ofColor dark(40,fadeAmnt); ofColor black(0, fadeAmnt); ofBackgroundGradient(dark, black); // ofSetColor(255,255,255, fadeAmnt); // ofRect(0,0,ofGetScreenWidth(),ofGetScreenHeight()); //2 - Draw graphics for (int i = 0; i < particles.size(); i++){ particles[i]->draw(); } }
void Canvas::draw_button(RECT rc, bool down) { Brush gray(Color(192, 192, 192)); fill_rectangle(rc, gray); Pen bright(1, Color(240, 240, 240)); Pen dark(1, Color(128, 128, 128)); select(down ? dark : bright); two_lines(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2, rc.top); two_lines(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1, rc.right - 3, rc.top + 1); select(down ? bright : dark); two_lines(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1, rc.right - 1, rc.top + 1); two_lines(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2, rc.right - 2, rc.top + 2); white_pen(); }
void ContextWidget::useDarkBackground(bool u) { if (u!=darkBackground) { darkBackground=u; QPalette pal=darkBackground ? palette() : parentWidget()->palette(); QColor prevLinkColor; QColor linkCol; if (darkBackground) { QColor dark(32, 32, 32); QColor light(240, 240, 240); QColor linkVisited(164, 164, 164); pal.setColor(QPalette::Window, dark); pal.setColor(QPalette::Base, dark); // Dont globally change window/button text - because this can mess up scrollbar buttons // with some styles (e.g. plastique) // pal.setColor(QPalette::WindowText, light); // pal.setColor(QPalette::ButtonText, light); pal.setColor(QPalette::Text, light); pal.setColor(QPalette::Link, light); pal.setColor(QPalette::LinkVisited, linkVisited); prevLinkColor=appLinkColor; linkCol=pal.color(QPalette::Link); } else { linkCol=appLinkColor; prevLinkColor=QColor(240, 240, 240); } setPalette(pal); artist->setPal(pal, linkCol, prevLinkColor); album->setPal(pal, linkCol, prevLinkColor); song->setPal(pal, linkCol, prevLinkColor); if (viewSelector) { viewSelector->setPalette(pal); } QWidget::update(); } }
void ImageViewer::drawTransparencyGrid() { if(pixmap && pixmap->hasAlphaChannel()) { QPainter painter(pixmap.get()); painter.setCompositionMode(QPainter::CompositionMode_DestinationOver); QColor dark(90,90,90,255); QColor light(140,140,140,255); int xCount, yCount; xCount = pixmap->width() / CHECKBOARD_GRID_SIZE; yCount = pixmap->height() / CHECKBOARD_GRID_SIZE; QRect square(0, 0, CHECKBOARD_GRID_SIZE, CHECKBOARD_GRID_SIZE); bool evenOdd; for(int i = 0; i <= yCount; i++) { evenOdd = (i % 2); for(int j = 0; j <= xCount; j++) { if(j % 2 == evenOdd) painter.fillRect(square, light); square.translate(CHECKBOARD_GRID_SIZE, 0); } square.translate(0, CHECKBOARD_GRID_SIZE); square.moveLeft(0); } painter.fillRect(pixmap->rect(), dark); } }
// // Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp ! // SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) : QDialog(parent) , _ui(new Ui::SettingsDialog), _gui(gui) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); _ui->setupUi(this); QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(32,32)); QString highlightColor(palette().highlight().color().name()); QString altBase(palette().alternateBase().color().name()); QString dark(palette().dark().color().name()); toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(dark).arg(highlightColor).arg(altBase)); toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); layout()->setMenuBar(toolBar); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(accept())); addAction(closeWindowAction); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(Theme::instance()->appNameGUI()); // Add a spacer so config buttonns are right aligned and account buttons will be left aligned auto spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolBar->addWidget(spacer); // Note: all the actions have a '\n' because the account name is in two lines and // all buttons must have the same size in order to keep a good layout QIcon protocolIcon(QLatin1String(":/client/resources/activity.png")); _protocolAction = toolBar->addAction(protocolIcon, tr("Activity") + QLatin1Char('\n')); _protocolAction->setCheckable(true); ProtocolWidget *protocolWidget = new ProtocolWidget; _ui->stack->addWidget(protocolWidget); QIcon generalIcon(QLatin1String(":/client/resources/settings.png")); QAction *generalAction = toolBar->addAction(generalIcon, tr("General") + QLatin1Char('\n')); generalAction->setCheckable(true); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/client/resources/network.png")); QAction *networkAction = toolBar->addAction(networkIcon, tr("Network") + QLatin1Char('\n')); networkAction->setCheckable(true); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); _actions.insert(_protocolAction, protocolWidget); _actions.insert(generalAction, generalSettings); _actions.insert(networkAction, networkSettings); QActionGroup *group = new QActionGroup(this); group->addAction(_protocolAction); group->addAction(generalAction); group->addAction(networkAction); group->setExclusive(true); connect(group, SIGNAL(triggered(QAction*)), SLOT(slotSwitchPage(QAction*))); connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(accountAdded(AccountState*))); connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)), this, SLOT(accountRemoved(AccountState*))); foreach (auto ai , AccountManager::instance()->accounts()) { accountAdded(ai.data()); }
/* Routine to take 1 turn */ void turn() { int i, hint; static int waste = 0; if (newtravel) { /* If closing, then he can't leave except via the main office. */ if (outside(g.newloc) && g.newloc != 0 && g.closing) { rspeak(130); g.newloc = g.loc; if (!g.panic) g.clock2 = 15; g.panic = TRUE; } /* See if a dwarf has seen him and has come from where he wants to go. */ if (g.newloc != g.loc && !forced(g.loc) && g.loc_attrib[g.loc] & NOPIRAT == 0) for (i = 1; i < (DWARFMAX - 1); ++i) if (g.odloc[i] == g.newloc && g.dseen[i]) { g.newloc = g.loc; rspeak(2); break; } g.loc = g.newloc; dwarves(); /* & special dwarf(pirate who steals) */ /* Check for death */ if (g.loc == 0) { death(); return; } /* Check for forced move */ if (forced(g.loc)) { desclg(g.loc); ++g.visited[g.loc]; domove(); return; } /* Check for wandering in dark */ if (g.wzdark && dark() && pct(35)) { rspeak(23); g.oldloc2 = g.loc; death(); return; } /* see if he is wasting his batteies out in the open */ if (outside(g.loc) && g.prop[LAMP]) { waste++; if (waste > 11) { rspeak(324); waste = 0; } } else waste = 0; /* If wumpus is chasing stooge, see if wumpus gets him */ if (g.chase) { g.chase++; g.prop[WUMPUS] = g.chase / 2; move(WUMPUS, g.loc); if (g.chase >= 10) { if (dark()) rspeak(270); pspeak(WUMPUS, 5); death(); return; } } /* check for radiation poisoning. */ g.health += (outside(g.loc)) ? 3 : 1; if (g.health > 100) g.health = 100; if (here(RADIUM) && (g.place[RADIUM] != -SHIELD || ajar(SHIELD))) g.health -= 7; if (g.health < 60) { rspeak(391 + (60 - g.health) / 10); if (g.health < 0) { death(); return; } } if ((g.oldloc == 188) && (g.loc != 188 && g.loc != 189) && (g.prop[BOOTH] == 1)) { move(GNOME, 0); g.prop[BOOTH] = 0; } /* Describe his situation */ describe(); if (!blind()) { ++g.visited[g.loc]; descitem(); } } /* end of newtravel start for second entry point */ /* Check if this location is eligible for any hints. If been here long enough, branch to help section. Ignore "hints" < HNTMIN (special stuff, see database notes. */ for (hint = HNTMIN; hint <= HNTMAX; hint++) { if (g.hinted[hint]) continue; if (g.loc_attrib[g.loc] / 256 != hint - 6) g.hintlc[hint] = -1; g.hintlc[hint]++; if (g.hintlc[hint] >= g.hints[hint][1]) do_hint(hint); } if (g.closed) { if (g.prop[OYSTER] < 0 && toting(OYSTER)) pspeak(OYSTER, 1); for (i = 1; i < MAXOBJ; ++i) if (toting(i) && g.prop[i] < 0) g.prop[i] = -1 - g.prop[i]; } g.wzdark = dark(); if (g.knfloc > 0 && g.knfloc != g.loc) g.knfloc = 0; ++g.turns; i = rand(); if (stimer()) /* as the grains of sand slip by */ return; while (!english()) /* retrieve player instructions */ ; vrbx = 1; objx = objs[1] ? 1 : 0; iobx = iobjs[1] ? 1 : 0; verb = VAL(verbs[vrbx]); do { object = objx ? objs[objx] : 0; iobj = iobx ? iobjs[iobx] : 0; if (object && (objs[2] || iobjs[2])) { pspeak(object, -1); printf(" "); } switch (CLASS(verbs[vrbx])) { case MOTION: motion = verb; domove(); break; case NOUN: bug(22); case ACTION: if (object || iobj) trverb(); else itverb(); break; case MISC: rspeak(verb); if (verb == 51) g.hinted[1] = TRUE; break; default: bug(22); } if (objx) { objx++; if (objs[objx] == 0) objx = 0; } if ((!objx || !objs[objx]) && iobx) { iobx++; if (iobjs[iobx] == 0) iobx = 0; if (iobx && iobjs[1]) objx = 1; } } while (objx || iobx); return; }
//-------------------------------------------------------------- void testApp::drawFboTest(){ //we clear the fbo if c is pressed. //this completely clears the buffer so you won't see any trails if( ofGetKeyPressed('0') ){ ofClear(255,255,255, 0); } //1 - Fade Fbo //this is where we fade the fbo //by drawing a rectangle the size of the fbo with a small alpha value, we can slowly fade the current contents of the fbo. ofFill(); ofColor dark(10,fadeAmnt); ofColor black(0, fadeAmnt); ofBackgroundGradient(dark, black); if(number== 1) { fadeAmnt = 100; } if(number== 2) { fadeAmnt = 60; } if(number== 3) { fadeAmnt = 30; } if(number== 4) { fadeAmnt = 5; } if(number== 5) { fadeAmnt = 10; } if(number== 6) { fadeAmnt = 20; } if(number== 7) { fadeAmnt = 0; } if(number== 8) { fadeAmnt = 20; } if(number== 9) { fadeAmnt = 20; } if(number== 10) { fadeAmnt = 5; } if(number== 12) { fadeAmnt = 100; } // ofRect(0,0,ofGetScreenWidth(),ofGetScreenHeight()); //2 - Draw graphics for (int i = 0; i < bgParti.size(); i++){ bgParti[i]->draw(); } for (int i = 0; i < dwgParti.size(); i++){ dwgParti[i].draw(); } }
int main(void) { DDRD = 255; DDRB |= (1<<0); DDRB |= (1<<1); DDRB |= (1<<2); DDRB |= (1<<3); DDRB &= ~(1<<4); DDRB &= ~(1<<5); PORTD = 0; PORTB &= ~(1<<0); PORTB &= ~(1<<1); PORTB &= ~(1<<2); PORTB &= ~(1<<3); PORTB &= ~(1<<4); PORTB &= ~(1<<5); int knop1,knop2,select=0,kleur=0,tijd=400,a,b,rgb[3]={1,2,4},c; while(1) { knop1 = PINB&(1<<in1); //==16 is hoog knop2 = PINB&(1<<in2); //==32 is hoog if ((knop1==16)&&(knop2==32)) { for (a=0;a<3;a+=1) { for (b=0;b<10;b+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (b=0;b<10;b+=1) { for (a=0;a<3;a+=1) { ledon (7,rgb[a]); waitms (50); dark(); waitms (50); } } for (c=120;c>=0;c-=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } for (c=0;c<=120;c+=20) { ledon (1,1); waitms (c); dark(); ledon (2,2); waitms (c); dark(); ledon (3,4); waitms (c); dark(); ledon (4,1); waitms (c); dark(); ledon (1,2); waitms (c); dark(); ledon (2,4); waitms (c); dark(); ledon (3,1); waitms (c); dark(); ledon (4,2); waitms (c); dark(); ledon (1,4); waitms (c); dark(); ledon (2,1); waitms (c); dark(); ledon (3,2); waitms (c); dark(); ledon (4,4); waitms (c); dark(); } fadein (7,7,500); fadeout(7,7,500); dark(); } else if ((knop1==16)&&(knop2!=32)) { ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); ledon (5,1); ledon (6,2); waitms (tijd); dark(); ledon (5,2); ledon (6,4); waitms (tijd); dark(); ledon (5,4); ledon (6,1); waitms (tijd); dark(); dark(); } else if ((knop1!=16)&&(knop2==32)) { for (kleur=1;kleur<8;kleur+=1) { fadein (7,kleur,700); fadeout(7,kleur,700); waitms(600); } dark(); } else { fadein (7,1,700); fadeout(7,1,700); waitms (600); dark(); } } }
void disable_right_engine(state_t *state){ dark(&state->data, RIGHT_ENGINE); }