예제 #1
0
static void CALLING_C pset (int32_t x, int32_t y, GXSPRITE *sp)
{
	GXSPRITESW *p = (GXSPRITESW*)sp->handle;
    uint8_t *v;
    int32_t oy=0, ox=0, lx=sp->LX, ly=sp->LY;
	int d;
    /*=============================================================*/
    SPRITE_CLIPPING
    /*=============================================================*/
	d = g_pRLX->pGX->View.lPitch - lx*sizeof(Tsize);
    v = g_pRLX->pGX->View.lpBackBuffer + g_pRLX->pGX->View.lPitch * y + sizeof(Tsize) * x;
	if (p->bpp == sizeof(Tsize))
	{
		Tsize *u = (Tsize*)sp->data + oy * (int32_t)sp->LX + ox;
		int i;
		for (i=0;i<ly;i++,v+=d, u+=sp->LX)
		{
			int j;
			for (j=0;j<lx;j++,v+=sizeof(Tsize))
				PSET(v, u[j]);
		}
	}
	else
	if (p->bpp == 1)
	{
		uint8_t *u = (uint8_t*)sp->data + oy * (int32_t)sp->LX + ox;
		int i;
		for (i=0;i<ly;i++,v+=d, u+=sp->LX)
		{
			int j;
			for (j=0;j<lx;j++,v+=sizeof(Tsize))
				PSET(v, p->palette[u[j]]);
		}
	}
}
예제 #2
0
파일: main.c 프로젝트: taisukef/IchigoDot
// buf
void matrix_put(char* s, int dx, int dy, int dw, int dh) {
	unsigned char src[8];
	decode2(s, src);
	for (int i = 0; i < dw; i++) {
		for (int j = 0; j < dh; j++) {
			int x = dx + i;
			int y = dy + j;
			if (x < 0 || y < 0 || x > 7 || y > 7)
				continue;
			PRESET(x, y);
			int n = (src[i] >> j) & 1;
			if (n) {
				PSET(x, y);
			}
		}
	}
	/*
//	dx = dy = 0;
//	dw = dh = 8;
	int mask = ((1 << dh) - 1) >> (8 - dh + dy);
	for (int i = 0; i < dw; i++) {
		int y = dx + i;
		if (y < 0 || y > 7)
			continue;
		buf[y] &= ~mask;
		buf[y] |= (src[i] >> dy) & mask;
	}
	*/
}
예제 #3
0
/*------------------------------------------------------------------------
*
* PROTOTYPE  :
*
* DESCRIPTION :
*
*/
static void CALLING_C zoom_pset(GXSPRITE *sp, int32_t x, int32_t y, int32_t lx, int32_t ly)
{
    uint8_t *v = g_pRLX->pGX->View.lpBackBuffer + x * sizeof(Tsize) + g_pRLX->pGX->View.lPitch * y;
	int d = g_pRLX->pGX->View.lPitch - lx*sizeof(Tsize);

	GXSPRITESW *p = (GXSPRITESW*)sp->handle;
    int32_t dy = (sp->LY<<16) / ly;
    int32_t dx = (sp->LX<<16) / lx;

	{
		int ey = dy * ly;
		int ex = dx * lx;
		if (p->bpp == sizeof(Tsize))
		{
			int Y = 0;
			for (;Y<ey;Y+=dy, v+=d)
			{
				int X=0;
				const Tsize *w = (Tsize*)sp->data + (Y>>16) * sp->LX ;
				for (; X<ex ;X+=dx, v+=sizeof(Tsize))
				{
					const Tsize *t = w + (X>>16);
					PSET(v, *t);
				}
			}
		}
		else
		if (p->bpp == 1)
예제 #4
0
파일: main.c 프로젝트: cpavlina/afw
int main(void)
{
    afw_clock_rc();

    afw_pins_init();

    myUART.init(true, true, 8, 'N', 1);

    for (uint8_t i = 0; true; ++i) {
        PSET(P_TEST);
        while (!myUART.ready());
        myUART.send(i, false);
        while (!myUART.ready());
        PCLR(P_TEST);
        _delay_us(125);
    }
}
예제 #5
0
파일: main.c 프로젝트: taisukef/IchigoDot
void app_hit10() { // 10秒あてゲーム
	for (;;) {
		playMML("L8ER8EG16E16");
		ux_btn();
		for (;;) {
			FILL("afeaaa0067252577"); // title
			FLUSH();
			if (ux_btn())
				break;
		}
		playMML("C");
		FILL(PTN_3);
		FLUSH();
		WAIT(1000);
		playMML("C");
		FILL(PTN_2);
		FLUSH();
		WAIT(1000);
		playMML("C");
		FILL(PTN_1);
		FLUSH();
		WAIT(1000);
		playMML("G2");
		FILL(PTN_GO);
		FLUSH();
		WAIT(1000);
		
		CLS(1);
		systick = 0;
		int cnt = 0;
		int bkbtn = 0;
		for (;;) {
			int btn = ux_btn();
			if (btn && !bkbtn) {
				playMML("A4");
				CLS(0);
				break;
			}
			bkbtn = btn;
			setMatrix2(buf);
			wait(10);
		}
		unsigned int score = (10 * 100000 - systick) / 1000;
		if (score < 0)
			score = -score;
		playMML("L8CEG");
		FILL("00c9aaacacaaaa69"); // ok
		xprintf("%d\n", systick);
		xprintf("%d\n", score);
		/*
		for (int i = 0;; i++) {
			int n = time % 10;
			time /= 10;
			if (time == 0)
				break;
			FILL(PTN_NUM[n]);
			FLUSH();
			WAIT(500);
		}
		*/
		FILL(PTN_NUM[score / 10]);
		PSET(6, 6);
		FLUSH();
		WAIT(1000);
		FILL(PTN_NUM[score % 10]);
		FLUSH();
		WAIT(1000);
		FLUSH();
		WAIT(1000);
	}
}
예제 #6
0
파일: main.c 프로젝트: taisukef/IchigoDot
void app_renda() { // 連打ゲーム
	for (;;) {
		playMML("L8EGG");
		ux_btn();
		for (;;) {
			FILL("8aa2cc006595f010"); // title
//			FILL("8aa2cc006a953060"); // title
			FLUSH();
			if (ux_btn())
				break;
		}
		systick = 0;
		for (;;) {
			WAIT(10);
			if (!ux_state())
				break;
			if (systick > 10000) 
				return;
		}
		playMML("C");
		FILL(PTN_3);
		FLUSH();
		WAIT(1000);
		playMML("C");
		FILL(PTN_2);
		FLUSH();
		WAIT(1000);
		playMML("C");
		FILL(PTN_1);
		FLUSH();
		WAIT(1000);
		playMML("G2");
		FILL(PTN_GO);
		FLUSH();
		WAIT(1000);
		
		CLS(1);
		FLUSH();
		systick = 0;
		int cnt = 0;
		int bkbtn = 0;
		ux_btn();
		for (;;) {
			int btn = ux_btn();
			if (btn) {
				playMML("A16");
				PRESET(cnt % 8, cnt / 8);
				FLUSH();
				cnt++;
				if (cnt == 64)
					break;
			}
//			bkbtn = btn;
		}
		playMML("L8CEG");
		FILL("00c9aaacacaaaa69"); // ok
		xprintf("%d\n", systick);
		unsigned int score = 100000 / (systick / 64);
		xprintf("%d\n", score);
		/*
		for (int i = 0;; i++) {
			int n = time % 10;
			time /= 10;
			if (time == 0)
				break;
			FILL(PTN_NUM[n]);
			FLUSH();
			WAIT(500);
		}
		*/
		if (score > 250)
			score = 250;
		FILL(PTN_NUM[score / 10]);
		PSET(6, 6);
		FLUSH();
		WAIT(1000);
		FILL(PTN_NUM[score % 10]);
		FLUSH();
		WAIT(1000);
		FLUSH();
		WAIT(1000);
	}
}