コード例 #1
0
ファイル: wySpriteBatchNode.cpp プロジェクト: Adoni/WiEngine
void wySpriteBatchNode::visit() {
	if(!m_visible)
		return;

	// should push matrix to avoid disturb current matrix
	glPushMatrix();

	// if grid is set, prepare grid
	if(m_grid != NULL && m_grid->isActive()) {
		m_grid->beforeDraw();
		transformAncestors();
	}

	// transform for myself
	transform();

	// check clip
	if(m_hasClip)
		doClip();

	// draw self
	draw();

	// restore
	if(m_hasClip)
		glDisable(GL_SCISSOR_TEST);

	// if grid is set, end grid
	if(m_grid != NULL && m_grid->isActive()) {
		m_grid->afterDraw(this);
	}

	// pop matrix
	glPopMatrix(); 
}
コード例 #2
0
ファイル: wySkeletalSprite.cpp プロジェクト: JMQCode/WiEngine
void wySkeletalSprite::visit() {
    if(!m_visible)
        return;

    // sync bone state
    if(m_rootBone)
        syncBoneStates(m_rootBone);

    // should push matrix to avoid disturb current matrix
    glPushMatrix();

    // if grid is set, prepare grid
    // if not, transform self
    bool hasGrid = m_grid != NULL && m_grid->isActive();
    if(hasGrid) {
        m_grid->beforeDraw();
    } else {
        transform();
    }

    // check clip
    if(m_hasClip)
        doClip();

    // visit slot sprites by display list sequence
    wySkeleton::SlotPtrList& slotDisplayList = m_skeleton->getSlotDisplayList();
    for(wySkeleton::SlotPtrList::iterator iter = slotDisplayList.begin(); iter != slotDisplayList.end(); iter++) {
        wySlot* slot = *iter;
        wySlot::State& state = slot->getState(this);
        wySpriteEx* sprite = state.sprite;
        if(sprite) {
            // should push matrix for every slot sprite
            glPushMatrix();

            // transform until to this node
            sprite->transformAncestorsUntil(this);
            sprite->transform();

            // draw this sprite
            sprite->draw();

            // pop matrix
            glPopMatrix();
        }
    }

    // restore
    if(m_hasClip && gDirector)
        gDirector->popClipRect();

    // if grid is set, end grid
    if(hasGrid) {
        m_grid->afterDraw(this);
    }

    // pop matrix
    glPopMatrix();
}
コード例 #3
0
ファイル: Boonas.cpp プロジェクト: fuag15/boonas_modeler
Boonas::Boonas(int argc, char** argv)
{
	cursor = 0;
	orig = new LNHHolder();
	temp = 0;
	colorValue = 0;
	Transformation matrix;
	
	if(argc < 3)
	{
		return;
	}
	if(strcmp(argv[1], "polygon") == 0) // DONE
	{
		polygon(argc, argv); // default the color to a grey, or a blue
	}
	else if(strcmp(argv[1], "polygonC") == 0)
	{
		polygonC(argc, argv);
	}
	else if(strcmp(argv[1], "assemble") == 0) // DONE
	{
		assemble(argc, argv);
	}
	else if(strcmp(argv[1], "transform") == 0) //WORKS
	{
		loadFile(argv[2]); // loads the data into a LNHHolder 
		matrix = parseParams(3, argc, argv, matrix); 
		doMult(matrix); // applies the matrix transformation
		writeFile(argv[2]); // writes file;
	}
	else if(strcmp(argv[1], "create") == 0) // WORKS
	{
		loadFile(argv[3]);
		matrix = parseParams(4, argc, argv, matrix);
		doMult(matrix);
		writeFile(argv[2]);
	}
	else if(strcmp(argv[1], "extrude") == 0) // WORKS
	{
		loadFile(argv[2]);
		doExtrude(argv[4], argv[3]); // extrudes argv 3 distance
	}
	else if(strcmp(argv[1], "clip") == 0) // clip, file, inpolies, outpolies, normalx normaly normalz, pointx, pointy, pointz
	{
		loadFile(argv[2]);
		//doClip(argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
		doClip(argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9]);
	}
	else if(strcmp(argv[1], "rot") == 0) // rot infile outfile vectorx, y, z pointx, y, z, divisions, degrees
	{
		loadFile(argv[2]);
		doRotate(argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
		writeFile(argv[3]);
	}
	return;
}
コード例 #4
0
ファイル: wyNode.cpp プロジェクト: nbolabs/WiEngine
void wyNode::visit() {
    if(!m_visible)
        return;

    // should push matrix to avoid disturb current matrix
    glPushMatrix();

    // if grid is set, prepare grid
    // if not, transform self
    bool hasGrid = m_grid != NULL && m_grid->isActive();
    if(hasGrid) {
        m_grid->beforeDraw();
    } else {
        transform();
    }

    // check clip
    if(m_hasClip)
        doClip();

    // draw children whose z order is less than zero
    for(int i = 0; i < m_children->num; i++) {
        wyNode* n = (wyNode*)wyArrayGet(m_children, i);
        if(n->m_zOrder < 0)
            n->visit();
        else
            break;
    }

    // draw self
    draw();

    // draw children whose z order is larger than zero
    for(int i = 0; i < m_children->num; i++) {
        wyNode* n = (wyNode*)wyArrayGet(m_children, i);
        if(n->m_zOrder >= 0)
            n->visit();
    }

    // restore
    if(m_hasClip && gDirector)
        gDirector->popClipRect();

    // if grid is set, end grid
    if(hasGrid) {
        m_grid->afterDraw(this);
    }

    // pop matrix
    glPopMatrix();
}
コード例 #5
0
void PrintDialog::storeValues()
{
	getOptions(); // options were not set get last options with this hack

	m_doc->Print_Options.printer = PrintDest->currentText();
	m_doc->Print_Options.filename = QDir::fromNativeSeparators(LineEdit1->text());
	m_doc->Print_Options.toFile = outputToFile();
	m_doc->Print_Options.copies = numCopies();
	m_doc->Print_Options.outputSeparations = outputSeparations();
	m_doc->Print_Options.separationName = separationName();
	m_doc->Print_Options.allSeparations = allSeparations();
	if (m_doc->Print_Options.outputSeparations)
		m_doc->Print_Options.useSpotColors = true;
	else
		m_doc->Print_Options.useSpotColors = doSpot();
	m_doc->Print_Options.useColor = color();
	m_doc->Print_Options.mirrorH  = mirrorHorizontal();
	m_doc->Print_Options.mirrorV  = mirrorVertical();
	m_doc->Print_Options.useICC   = ICCinUse();
	m_doc->Print_Options.doClip   = doClip();
	m_doc->Print_Options.doGCR    = doGCR();
	m_doc->Print_Options.prnEngine= printEngine();
	m_doc->Print_Options.setDevParam = doDev();
	m_doc->Print_Options.useDocBleeds  = docBleeds->isChecked();
	m_doc->Print_Options.bleeds.Top    = BleedTop->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Left   = BleedLeft->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Right  = BleedRight->value() / m_doc->unitRatio();
	m_doc->Print_Options.bleeds.Bottom = BleedBottom->value() / m_doc->unitRatio();
	m_doc->Print_Options.markLength = markLength->value() / m_doc->unitRatio();
	m_doc->Print_Options.markOffset = markOffset->value() / m_doc->unitRatio();
	m_doc->Print_Options.cropMarks  = cropMarks->isChecked();
	m_doc->Print_Options.bleedMarks = bleedMarks->isChecked();
	m_doc->Print_Options.registrationMarks = registrationMarks->isChecked();
	m_doc->Print_Options.colorMarks = colorMarks->isChecked();
	m_doc->Print_Options.includePDFMarks = usePDFMarks->isChecked();
	if (OtherCom->isChecked())
	{
		m_doc->Print_Options.printerCommand = Command->text();
		m_doc->Print_Options.useAltPrintCommand = true;
	}
	else
		m_doc->Print_Options.useAltPrintCommand = false;
#ifdef HAVE_CUPS
	m_doc->Print_Options.printerOptions = PrinterOpts;
#else
	m_doc->Print_Options.printerOptions = QString();
#endif
	m_doc->Print_Options.devMode = DevMode;
}
コード例 #6
0
ファイル: tmouse.cpp プロジェクト: cout/consoletelnet
void TMouse::doMouse() {
	INPUT_RECORD InputRecord;
	DWORD Result;
	InputRecord.EventType = KEY_EVENT; // just in case
	while(InputRecord.EventType != MOUSE_EVENT) {
		if (!ReadConsoleInput(hConsole, &InputRecord, 1, &Result))
			return; // uh oh!  we don't know the starting coordinates!
	}
	if(InputRecord.Event.MouseEvent.dwButtonState == 0) return;
	if(!(InputRecord.Event.MouseEvent.dwButtonState &
		FROM_LEFT_1ST_BUTTON_PRESSED)) {
		Clipboard.Paste();
		return;
	}

	COORD screen_start = {0, 0};
    COORD start_coords = InputRecord.Event.MouseEvent.dwMousePosition;
	COORD end_coords = start_coords;
	BOOL done = FALSE;
	
	// init vars
	doMouse_init();
	int normal_bg = ini.get_normal_bg();
	int normal_fg = ini.get_normal_fg();
	if(normal_bg == -1) normal_bg = 0;		// FIX ME!!  This is just a hack
	if(normal_fg == -1) normal_fg = 7;
	normal = (normal_bg << 4) | normal_fg;
	inverse = (normal_fg << 4) | normal_bg;

	// make screen all one attribute
	FillConsoleOutputAttribute(hStdout, normal, ConsoleInfo.dwSize.X *
		ConsoleInfo.dwSize.Y, screen_start, &Result);
	
	while(!done) {

		switch (InputRecord.EventType) {
		case MOUSE_EVENT:
			switch(InputRecord.Event.MouseEvent.dwEventFlags) {
			case 0: // only copy if the mouse button has been released
				if(!InputRecord.Event.MouseEvent.dwButtonState) {
					doClip(start_coords, end_coords);
					done = TRUE;
				}
				break;
				
			case MOUSE_MOVED:
				end_coords = InputRecord.Event.MouseEvent.dwMousePosition;
				move_mouse(start_coords, end_coords);					
				break;
			}
			break;
		// If we are changing focus, we don't want to highlight anything
		// (Paul Brannan 9/2/98)
		case FOCUS_EVENT:
			return;			
		}
		
		WaitForSingleObject(hConsole, INFINITE);
		if (!ReadConsoleInput(hConsole, &InputRecord, 1, &Result))
			done = TRUE;
		
	}

	doMouse_cleanup();
}
コード例 #7
0
ファイル: wyScrollableLayer.cpp プロジェクト: Adoni/WiEngine
	virtual void visit() {
		/*
		 * Here we do optimization in drawing scrollable children,
		 * child whose rect is outside of wyScrollableLayer is skipped
		 * to improve frame rate
		 */

		// if not visible
		if(!m_visible)
			return;

		// should push matrix to avoid disturb current matrix
		glPushMatrix();

		// if grid is set, prepare grid
		if(m_grid != NULL && m_grid->isActive()) {
			m_grid->beforeDraw();
			transformAncestors();
		}

		// transform for myself
		transform();

		// check clip
		if(m_hasClip)
			doClip();

		// parent is scrollable layer
		wyScrollableLayer* sl = (wyScrollableLayer*)m_parent;

		// parent size
		float pW = m_parent->getWidth();
		float pH = m_parent->getHeight();

		// draw children whose z order is less than zero
		for(int i = 0; i < m_children->num; i++) {
			wyNode* n = (wyNode*)wyArrayGet(m_children, i);
			if(n->getZOrder() < 0) {
				// get child bound relative to scrollable layer
				float w = n->getWidth();
				float h = n->getHeight();
				float x = n->isRelativeAnchorPoint() ? (n->getPositionX() - w * n->getAnchorX()) : n->getPositionX();
				float y = n->isRelativeAnchorPoint() ? (n->getPositionY() - h * n->getAnchorY()) : n->getPositionY();
				x += m_positionX;
				y += m_positionY;

				// check bound, if intersected, visit this child
				if(x + w > 0 && pW > x && y + h > 0 && pH > y) {
					// set flag so it will be notified when it is invisible
					wyUserData& ud = n->getUserData();
					ud.b = false;

					// visit it
					n->visit();
				} else {
					wyUserData& ud = n->getUserData();
					if(!ud.b) {
						sl->invokeOnScrollableChildNotVisible(n);
						ud.b = true;
					}
				}
			} else
				break;
		}

		// draw self
		draw();

		// draw children whose z order is larger than zero
		for(int i = 0; i < m_children->num; i++) {
			wyNode* n = (wyNode*)wyArrayGet(m_children, i);
			if(n->getZOrder() >= 0) {
				// get child bound relative to scrollable layer
				float w = n->getWidth();
				float h = n->getHeight();
				float x = n->isRelativeAnchorPoint() ? (n->getPositionX() - w * n->getAnchorX()) : n->getPositionX();
				float y = n->isRelativeAnchorPoint() ? (n->getPositionY() - h * n->getAnchorY()) : n->getPositionY();
				x += m_positionX;
				y += m_positionY;

				// check bound, if intersected, visit this child
				if(x + w > 0 && pW > x && y + h > 0 && pH > y) {
					// set flag so it will be notified when it is invisible
					wyUserData& ud = n->getUserData();
					ud.b = false;

					// visit it
					n->visit();
				} else {
					wyUserData& ud = n->getUserData();
					if(!ud.b) {
						sl->invokeOnScrollableChildNotVisible(n);
						ud.b = true;
					}
				}
			}
		}

		// restore
		if(m_hasClip)
			glDisable(GL_SCISSOR_TEST);

		// if grid is set, end grid
		if(m_grid != NULL && m_grid->isActive()) {
			m_grid->afterDraw(this);
		}

		// pop matrix
		glPopMatrix();
	}