Esempio n. 1
0
void 
ChessboardFrame::paintNIGGER(void)
{
    wxPaintDC dc(drawPane);
    dc.SetPen( wxPen( wxColor(0,0,0), 1 ) );
    int k = GetVirtualSize().GetWidth()/2 - myCB->getNumCells()/2*CELL_WIDTH;
    int k1 = GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT;

    ButtonSetBomb->SetPosition( wxPoint(GetVirtualSize().GetWidth()/2 + myCB->getNumCells()/2*CELL_WIDTH + CELL_WIDTH*2,  GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT) );
    ButtonShowBomb->SetPosition( wxPoint(GetVirtualSize().GetWidth()/2 + myCB->getNumCells()/2*CELL_WIDTH + CELL_WIDTH*2, GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT+30) );
    ButtonHideBomb->SetPosition( wxPoint(GetVirtualSize().GetWidth()/2 + myCB->getNumCells()/2*CELL_WIDTH + CELL_WIDTH*2, GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT+60) );
    ButtonChangeColors->SetPosition( wxPoint(GetVirtualSize().GetWidth()/2 + myCB->getNumCells()/2*CELL_WIDTH + CELL_WIDTH*2, GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT+90 ) );
    ButtonTimer->SetPosition( wxPoint(GetVirtualSize().GetWidth()/2 + myCB->getNumCells()/2*CELL_WIDTH + CELL_WIDTH*2, GetVirtualSize().GetHeight()/2 - myCB->getNumCells()/2*CELL_HEIGHT+120 ) );

    ButtonSetBomb->Show();
    ButtonShowBomb->Show();
    ButtonHideBomb->Show();
    ButtonChangeColors->Show();
    ButtonTimer->Show();

    Colors color;
    for (unsigned int i = 0; i < myCB->getNumCells(); i++)  {
        for (unsigned int j = 0; j < myCB->getNumCells(); j++)  {
            color = myCB->getCellColor(i,j);
            dc.SetBrush( *getBrushColor(color) );
            dc.DrawRectangle(i*CELL_WIDTH+k, j*CELL_HEIGHT+k1, CELL_WIDTH, CELL_HEIGHT);
            if(!myCB->isBombHidden())  {
                drawBomb();
            }
        }
    }
}
Esempio n. 2
0
void EArrow::paintEvent( QPaintEvent * ) {
    QPointF p1,p2;
    QLineF polyLine;
    QPainter painter( this );

    painter.setRenderHint( QPainter::Antialiasing );
    painter.setPen( QPen( getLineColor(), getLineSize(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) );
    painter.setBrush( getBrushColor() );

    int m_margin = 3;

    if (VERTICAL == getArrowDirection()) {
        p1 = QPointF( width()/2, m_margin );
        p2 = QPointF( width()/2, height()-m_margin );
    } else if (RIGTHBOTTOM == getArrowDirection()) {
        p1 = QPointF( m_margin, m_margin );
        p2 = QPointF( width()-m_margin, height()-m_margin );
    } else if (RIGTHTOP == getArrowDirection()) {
        p1 = QPointF( m_margin, height()-m_margin );
        p2 = QPointF( width()-m_margin, m_margin );
    } else { // HORIZONTAL
        p1 = QPointF( m_margin, height()/2 );
        p2 = QPointF( width()-m_margin, height()/2 );
    }

    polyLine = QLineF( p1, p2 );
    painter.drawLine(polyLine);

    if (LEFT == getArrowMode()) {
        painter.drawPolygon( getHead(p1,p2) );
    } else if (RIGTH == getArrowMode()) {
        painter.drawPolygon(getHead(p2,p1));
    } else if (DOUBLE == getArrowMode()) {
        painter.drawPolygon(getHead(p1,p2));
        painter.drawPolygon(getHead(p2,p1));
    }
}
Esempio n. 3
0
//RIGHT HAND:: treat grab as a mouse click. 
void checkRCursor(int func, hand_h* rhand){
	
	if(isGrab()) {
		rhand->storeHand(getPalm());		//keep the hand movement history

		//first time grab gesture occurs for right hand
		if(!stateGrabR) {	
			//adjust with width and height of the screen
			float* cursor = getCursor();
			cursorX = cursor[0];
			cursorY = cursor[1];
			set_state(1); 
			stateGrabR = true;

		}
		//still in grab gesture
		else{
			//sculpt
			if(func == 1) {
				
				//select a mesh once
				//we don't need this for painting
				set_state(2);
				
				if(switchHand){
					commitScene(rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ());
					recalNormal();
				}
				else{
					
					//grab group of mesh
					if(sListContain(getSelection()) >= 0 ){
						shape = true;
						interpolate(getsList(), rhand->gettranslateX(), 
							rhand->gettranslateY(), rhand->gettranslateZ(), getRotX(), getRotY());
						recalNormal();
					}
					//grab one mesh
					else if(getSelection() >= 0 && getSelection() < getFaceListSize()){
						shape = true;
						interpolate(getSelection(), rhand->gettranslateX(), 
							rhand->gettranslateY(), rhand->gettranslateZ(), getRotX(), getRotY());
						recalNormal();
					}
				}
			}
			//paint
			else if(func ==2){
				if(switchHand){
					commitScene(rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ());
					recalNormal();
				}else{
					if(getSelection() >=0 && getSelection() < getFaceListSize()){
						//printf("selection ->%d\n", getSelection());
						paintMesh(getSelection(), getBrushColor());
					}
				}
			}

			//selection?
			else if(func ==3){
				
			}
		}
	}
	else{
		//just release
		if(stateGrabR){
			//selection list
			//if(selection && getSelection() > 0 && getSelection() < getFaceListSize()){
			//	store_selection(getSelection());
			//}

			stateGrabR = false; 
			rhand->clearHandList();
			setNullSelection(); //show no mesh response when hand released

			//undo
			if(func == 1 && shape) {
				copy_vmmodel(); 
				shape = false;
			}
		}
	}
	

}
Esempio n. 4
0
// 주 글꼴 색 획득
Color CText::getFontColor() {

	return getBrushColor(m_FontBrush);
}