Exemple #1
0
void Button::draw(void)
{
	if(getVisible())
	{
		// draw the bkgd of button
		if(mMouseOver)	{
			if(mNormalTexture == NULL)
				gGraphics->BlitRect(mX, mY, mWidth, mHeight, D3DCOLOR_ARGB(255, 255, 166, 0));
			else	{
				gGraphics->BlitTexture(mHooverTexture, getRect());

			}

			// so it wont be true forever
			mMouseOver = false;
		}
		else	{
			if(mNormalTexture == NULL)
				gGraphics->BlitRect(mX, mY, mWidth, mHeight, mColor);
			else
				gGraphics->BlitTexture(mNormalTexture, getRect());
		}

		// draw the font 
		if(mFont && !getOverlap())	{
			strcpy(buffer, mDisplayText.c_str());
			gGraphics->drawText(buffer, mX-mWidth/2+5, mY-mHeight/2, D3DCOLOR_ARGB(255,0,0,0));
		}
		
		overlaped(false);
	}
}
Exemple #2
0
void WordsGraph::print() {
	for (Word word : words)
		cout<<"\t"<<word.getText();
	cout<<endl;
	for (int i=0; i<words.size(); i++) {
		cout<<words.at(i).getText();
		for (int j=0; j<words.size(); j++)
			cout<<"\t"<<getOverlap(i,j);
		cout<<endl;
	}
}
void ccdfs(vector<int> &a, int i, vector<Vec4f> &obj)
{
	for (size_t j=0; j<obj.size(); ++j)
    {
        if (a[j]!=0)
            continue;
        if (getOverlap(obj[i][1],obj[i][2],obj[i][3], obj[j][1],obj[j][2],obj[j][3])<=0.3f)
            continue;

		a[j] = a[i];
		ccdfs(a, j, obj);
    }
}
Exemple #4
0
CollisionReport aabb2aabb (Shape* A, Shape* B, glm::mat4& tA, glm::mat4& tB) {
	// get bbox
	aabb a = A->getBounds(tA);
	aabb b = B->getBounds(tB);
	CollisionReport report;
	report.collide = !(a.xMin >= b.xMax || b.xMin >= a.xMax || a.yMin >= b.yMax || b.yMin >= a.yMax);
	if (report.collide) {
		glm::vec2 axes[2];
		axes[0] = glm::vec2 (1.0f, 0.0f);
		axes[1] = glm::vec2 (0.0f, 1.0f);
		for (int i = 0; i < 2; i++) {
			glm::vec2 pA = A->Project (axes[i], tA);
			glm::vec2 pB = B->Project (axes[i], tB);
			float overlap = getOverlap (pA, pB);
			if (fabs(overlap) < fabs(report.distance)) {
				report.axis = axes[i];
				report.distance = overlap;
			}
		}
	}
	return report;


}
Exemple #5
0
void printBlocks (struct psl *psl, int maxBlockGap, struct psl *nestedPsl)
{
int i, qsStart = 0;
int exonsCovered = 0;
int totalBases = 0;
int totalExons = 0;
int intronsPresent = 0;
int intronsPresentBases = 0;
int intronsSpliced = 0;
for (i = 0 ; i < psl->blockCount ; i++)
    {
    int qs = psl->qStarts[i];
    int qe = psl->qStarts[i] + psl->blockSizes[i];
    int te = psl->tStarts[i] + psl->blockSizes[i];
    int tdiff = 0;
    int qdiff = 0;
    int cumTdiff = 0;
    int oqs, oqe;
    int tsNext = 999999;
    int qsNext = 0;
    float coverage = 0;
    int bases = 0;
    int oldte = te;
    int gapRatio = 0;
    if (i < psl->blockCount -1)
        {
        tsNext = psl->tStarts[i+1];
        qsNext = psl->qStarts[i+1];
        tdiff = tsNext - te;
        qdiff = qsNext - qe;
        }
    else
        tdiff = 9999999;
    cumTdiff = tdiff;
    qsStart = qs;
/* combine blocks that are close together */
    while (tdiff < maxBlockGap && i< (psl->blockCount)-1)
        {
        i++;
        te = psl->tStarts[i] + psl->blockSizes[i];
        qe = psl->qStarts[i] + psl->blockSizes[i];
        if (i < psl->blockCount -1)
            {
            tsNext = psl->tStarts[i+1];
            qsNext = psl->qStarts[i+1];
            tdiff = tsNext - te;
            qdiff = qsNext - qe;
            }
        else
            tdiff = 9999999;
        cumTdiff += tdiff;
        oldte = te;
        }
    oqs = qs; oqe = qe;
    if (psl->strand[0] == '-')
        reverseIntRange(&oqs, &oqe, psl->qSize);
    gapRatio = qdiff*100/tdiff;
    printf("%d-%d:%d",oqs,oqe,gapRatio); 
    if (gapRatio < 30 && tdiff > 30 && 
            i < (psl->blockCount)-1)
        {
        int bases = (tdiff-qdiff > 0) ? tdiff - qdiff : 0;
        intronsPresent++;
        intronsPresentBases += bases;
        }
    if (nestedPsl != NULL)
        {
        int numBlocks = 0;
        bases = getOverlap(nestedPsl, oqs, oqe, &numBlocks); 
        coverage = (float)bases/(float)(oqe-oqs);
        totalBases += bases;
        totalExons++;
        if (coverage > 0.20)
            exonsCovered++;
        printf("/%d", numBlocks-1);
        intronsSpliced += numBlocks-1;
        }
    printf(", ");
    }
}