コード例 #1
0
ファイル: Paint2.cpp プロジェクト: kyushu-pc/kpc
void p9(void) {
	SetDrawScreen(DX_SCREEN_BACK);

	char keybuf[256];

	while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) {
		ClearDrawScreen();
		DrawLine(10, 10, 200, 10, GetColor(255, 0, 0));
		DrawLine(10, 20, 200, 20, GetColor(0, 255, 0));
		DrawLine(10, 30, 200, 30, GetColor(0, 0, 255));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100);	//	αブレンド
		DrawBox(5, 5, 205, 35, GetColor(255, 255, 255), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, TRUE);	//	ブレンドなし
		DrawBox(100, 100, 201, 201, GetColor(255, 0, 0), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_ADD, 255);	//	加算ブレンド
		DrawCircle(150, 150, 50, GetColor(0, 255, 255), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_SUB, 255);	//	減算ブレンド
		DrawCircle(150, 150, 30, GetColor(0, 100, 100), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_INVSRC, 255);	//	反転ブレンド
		DrawOval(300, 200, 30, 25, GetColor(0, 0, 0), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_MULA, 255);	//	乗算ブレンド
		DrawOval(300, 200, 25, 30, GetColor(0, 100, 100), TRUE);
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
		DrawPixel(320, 240, GetColor(255, 255, 255));
		DrawTriangle(5, 5, 205, 5, 5, 35, GetColor(0, 0, 0), TRUE);
		DrawTriangle(5, 5, 205, 5, 5, 35, GetColor(255, 255, 255), FALSE);

		ScreenFlip();
	}
}
コード例 #2
0
ファイル: objects.cpp プロジェクト: kypp/running-game
void Stadium::draw()
{
	float rout = rin+lanes*lanesize;
	float mv = length/8;
	glColor3f(1,0,0);
	DrawOval(mv, rout, true);	
	glTranslatef(0,0,-0.01);
	glColor3f(0.3,.8,0.2);
	DrawOval(mv, rin, true);
	glColor3f(0,0,0);	
	glTranslatef(0,0,-0.01);
	for (int i = 0; i <= lanes; i++)
	{
		DrawOval(mv, rin+i*lanesize, false);
	}
}
コード例 #3
0
ファイル: chap3.c プロジェクト: WongTai/snippets
Redraw(Display * display, Window window, GC gc)
{
  XDrawLine(display, window, gc, 1, 1, 100, 100);

  XDrawRectangle(display, window, gc, 100, 100, 100, 100);
  XFillRectangle(display, window, gc, 200, 200, 100, 100);

  DrawOval(display, window, gc, 100, 100, 100, 100);
  FillOval(display, window, gc, 110, 110, 64, 64);

  XFlush(display);
}
コード例 #4
0
ファイル: test_draw.cpp プロジェクト: mauvecow/DxPortLib
static void DrawBounceThings() {
    SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
    
    for (int i = 0; i < BOUNCETHINGCOUNT; ++i) {
        const BounceThing *thing = &things[i];
        
        if (thing->isCircle) {
            float halfW = (float)thing->w * 0.5f;
            float halfH = (float)thing->h * 0.5f;
            DrawOval(
                (int)(thing->x + halfW), (int)(thing->y + halfH),
                (int)halfW, (int)halfH,
                thing->color, thing->isFilled
            );
        } else {
            DrawBox(
                thing->x, thing->y,
                thing->x + thing->w, thing->y + thing->h,
                thing->color, thing->isFilled
            );
        }
    }
}