Exemple #1
0
void COrbEffectPainter::Paint (CG16bitImage &Dest, int x, int y, SViewportPaintCtx &Ctx)

//	Paint
//
//	Paint the effect

	{
	CalcSphericalTables();
	DrawFilledCircle(Dest, x, y, m_iRadius, m_pColorTable, m_pOpacityTable);
	}
Exemple #2
0
void DrawNode (STopologyMapCtx &Ctx, COutputChart &Output, CTopologyNode *pNode, int x, int y)

//	DrawNode
//
//	Draws a topology node

	{
	CG16bitImage &Dest = Output.GetOutputImage();
	const CG16bitFont &NameFont = Output.GetStyleFont(STYLE_NAME);
	WORD wNameColor = Output.GetStyleColor(STYLE_NAME);

	DrawAlphaGradientCircle(Dest, x + 2, y + 2, NODE_RADIUS + 1, 0);
	DrawFilledCircle(Dest, x, y, NODE_RADIUS, NODE_COLOR);
	DrawAlphaGradientCircle(Dest, x - 2, y - 2, NODE_RADIUS - 3, CG16bitImage::RGBValue(255, 255, 255));

	NameFont.DrawText(Dest,
			x, y + NODE_RADIUS + 2,
			wNameColor,
			255,
			pNode->GetSystemName(),
			CG16bitFont::AlignCenter);
	}
Exemple #3
0
void Menu_Draw(Bitmap* b){

	//Create Background
	DrawFilledRectangle(b, borderX, borderY, SCREEN_X - 2 * borderX, SCREEN_Y - 2 * borderY, RGB(0,0,0));
	//Inner red Border
	DrawRectangle(b, borderX + rectBorder, borderY + rectBorder ,
	 (SCREEN_X - 2 * borderX) - 2 * rectBorder , (SCREEN_Y - 2 * borderY ) - 2 * rectBorder, RGB(193,0,0));

	//Column Header
	char *itemHeader;
	asprintf(&itemHeader, "Itemname    SPD  SPW   INV    PRZ");
	DrawText(b, itemHeader, listEdgeX + 0 * colWidth, listEdgeY - rowHeight -2);
	free(itemHeader);

	//Items
	for(int i = 0 ; i < maxListRows ; i++){
		itemIndex = i + menuSelectedItem - 4;
		if (itemIndex >= 0 && itemIndex <= itemCount){
			//Mark Items you can't afford
			if(itemList[itemIndex]->prize > p1.money){
				DrawFilledCircle(b, listEdgeX +circleRadius , listEdgeY + rowHeight * i + circleRadius + 1, circleRadius ,RGB(255,0,0));
			}	
			//Item Owned
			if(listCount(&p1.inventory, (Item*)itemList[itemIndex]) >= 1){
				DrawFilledCircle(b, listEdgeX +circleRadius , listEdgeY + rowHeight * i + circleRadius + 1, circleRadius ,RGB(0,255,0));
			}
			//Item name
			char *itemName;
			asprintf(&itemName, itemList[itemIndex]->name);
			DrawText(b, itemName, listEdgeX + 0 * colWidth, listEdgeY + rowHeight * i);
			free(itemName);

			//Item Dig-Speed
			char *itemSPD;
			asprintf(&itemSPD, "% 3d", itemList[itemIndex]->speedDigMod);
			DrawText(b, itemSPD, listEdgeX + 6 * colWidth, listEdgeY + rowHeight * i);
			free(itemSPD);

			//Item Walk-Speed
			char *itemSPW;
			asprintf(&itemSPW, "% 2d", itemList[itemIndex]->speedWalkMod);
			DrawText(b, itemSPW, listEdgeX + 9 * colWidth, listEdgeY + rowHeight * i);
			free(itemSPW);	

			//Item Inventory size
			char *itemINV;
			asprintf(&itemINV, "% 4d", itemList[itemIndex]->inventorySizeTaken);
			DrawText(b, itemINV, listEdgeX + 11 * colWidth, listEdgeY + rowHeight * i);
			free(itemINV);		

			//Item Prize
			char *itemPRZ;
			asprintf(&itemPRZ, "% 5d", itemList[itemIndex]->prize);
			DrawText(b, itemPRZ, listEdgeX + 14 * colWidth, listEdgeY + rowHeight * i);
			free(itemPRZ);
			setFont(fontwhite8);
		}else{
			// dunno
		}
	}
	//Draw Border around current selection
	DrawRectangle(b, listEdgeX , listEdgeY + 4 * rowHeight -2, SCREEN_X - (2 * borderX + 2 * 2 * rectBorder + 2), rowHeight + 2 * 1, RGB(128, 0, 0));

	//Separate ItemList from Character Infos
	DrawHorizontalLine(b, listEdgeX , listEdgeY + 10 * rowHeight + 2 , SCREEN_X - (2 * 2 * rectBorder + 2 * borderX + 2), RGB(255,255,255));

	//Draw Player Info (Cash / Free Space)
	setFont(fontwhite16);
	char *playerCash;
	asprintf(&playerCash, "$:%3d Inv:%3d", p1.money, getFreeInvSpace(&p1));
	DrawText(b, playerCash, listEdgeX , listEdgeY + rowHeight * 11);
	free(playerCash);
	setFont(fontwhite8);	


	//Draw Players Minerals
	//Coal
	DrawRLEBitmap(b,sprt_coal,listEdgeX + 1 * colWidth,listEdgeY + rowHeight * 13);
	//Iron
	DrawRLEBitmap(b,sprt_treasure1,listEdgeX + 5 * colWidth,listEdgeY + rowHeight * 13);
	//Gold
	DrawRLEBitmap(b,sprt_gold,listEdgeX + 9 * colWidth,listEdgeY + rowHeight * 13);
	//Diamonds
	DrawRLEBitmap(b,sprt_diam_red,listEdgeX + 13 * colWidth,listEdgeY + rowHeight * 13);

	char *playerMinerals;
	asprintf(&playerMinerals, "     % 3d     % 3d     % 3d     % 3d",
		getMineralAmount(&p1, MIN_COAL),
		getMineralAmount(&p1, MIN_IRON),
		getMineralAmount(&p1, MIN_GOLD),
		getMineralAmount(&p1, MIN_DIAMOND));
	DrawText(b, playerMinerals, listEdgeX - colWidth / 2, listEdgeY + rowHeight * 13.5);
	free(playerMinerals);	


}
Exemple #4
0
static void
ParseDrawFunction(DviWidget dw, char *buf)
{
	int v[DRAW_ARGS_MAX];
	int i, no_move = 0;
	char *ptr;
	
	v[0] = v[1] = v[2] = v[3] = 0;
	
	if (buf[0] == '\0')
		return;
	ptr = buf+1;
	
	for (i = 0; i < DRAW_ARGS_MAX; i++) {
		if (sscanf(ptr, "%d", v + i) != 1)
			break;
		while (*ptr == ' ')
			ptr++;
		while (*ptr != '\0' && *ptr != ' ')
			ptr++;
	}
	
	switch (buf[0]) {
	case 'l':				/* draw a line */
		DrawLine(dw, v[0], v[1]);
		break;
	case 'c':				/* circle */
		DrawCircle(dw, v[0]);
		break;
	case 'C':
		DrawFilledCircle(dw, v[0]);
		break;
	case 'e':				/* ellipse */
		DrawEllipse(dw, v[0], v[1]);
		break;
	case 'E':
		DrawFilledEllipse(dw, v[0], v[1]);
		break;
	case 'a':				/* arc */
		DrawArc(dw, v[0], v[1], v[2], v[3]);
		break;
	case 'p':
		DrawPolygon(dw, v, i);
		break;
	case 'P':
		DrawFilledPolygon(dw, v, i);
		break;
	case '~':				/* wiggly line */
		DrawSpline(dw, v, i);
		break;
	case 't':
		dw->dvi.line_thickness = v[0];
		break;
	case 'f':
		if (i > 0 && v[0] >= 0 && v[0] <= DVI_FILL_MAX)
			dw->dvi.fill = v[0];
		no_move = 1;
		break;
	default:
#if 0
		warning("unknown drawing function %s", buf);
#endif
		no_move = 1;
		break;
	}
	
	if (!no_move) {
		if (buf[0] == 'e') {
			if (i > 0)
				dw->dvi.state->x += v[0];
		}
		else {
			while (--i >= 0) {
				if (i & 1)
					dw->dvi.state->y += v[i];
				else
					dw->dvi.state->x += v[i];
			}
		}
	}
} 
Exemple #5
0
void DrawFilledCircleTrans (CG16bitImage &Dest, int xDest, int yDest, int iRadius, WORD wColor, DWORD byOpacity)

//	DrawFilledCircleTrans
//
//	Draws an transparent filled circle

{
    //	Deal with edge-conditions

    if (iRadius <= 0)
    {
        Dest.DrawPixelTrans(xDest, yDest, wColor, (BYTE)byOpacity);
        return;
    }
    else if (byOpacity == 255)
    {
        DrawFilledCircle(Dest, xDest, yDest, iRadius, wColor);
        return;
    }

    //	Initialize some stuff

    int x = 0;
    int y = iRadius;
    int d = 1 - iRadius;
    int deltaE = 3;
    int deltaSE = -2 * iRadius + 5;

    Dest.FillLineTrans(xDest - iRadius, yDest, 1 + 2 * iRadius, wColor, byOpacity);

    //	Loop

    while (y > x)
    {
        if (d < 0)
        {
            d += deltaE;
            deltaE += 2;
            deltaSE += 2;
        }
        else
        {
            d += deltaSE;
            deltaE += 2;
            deltaSE += 4;

            Dest.FillLineTrans(xDest - x, yDest - y, 1 + 2 * x, wColor, byOpacity);
            Dest.FillLineTrans(xDest - x, yDest + y, 1 + 2 * x, wColor, byOpacity);

            y--;
        }

        x++;

        if (y >= x)
        {
            Dest.FillLineTrans(xDest - y, yDest - x, 1 + 2 * y, wColor, byOpacity);
            Dest.FillLineTrans(xDest - y, yDest + x, 1 + 2 * y, wColor, byOpacity);
        }
    }
}
//-----------------------------------------------------------------------------------------------
void DrawFilledOutlinedCircle( const Vector2& center, float radius, const Rgba& fillColor, const Rgba& edgeColor, float alpha )
{
    DrawFilledCircle( center, radius, fillColor, alpha );
    DrawOutlinedCircle( center, radius, edgeColor, alpha );
}