Telesketch para NDS
- Samir Ramirez
- 17 jun 2009
- 1 Min. de lectura
He implementado usando Palib un sencillo telesketch para la NDS. El telesketch se puede descargar desde aquí. También puedes descargarte el código fuente (aquí) por si te interesa. Este código (el correspondiente al archivo main.c) es el siguiente:
// Includes #include // Include for PA_Lib
s32 xcor = 8; //x0, y0 punto inicial y x1, y1 punto final s32 ycor = 6;
s32 linea = 0; //no esta dibujando linea
void pintapuntos() { s16 i, j; for (i=0;i<25;i++) { for (j=0;j 17) { if (linea == 0) { PA_SetSpriteXY(0, 1, xcor-10-8, ycor-8); }
if (linea == 1) //hay que dibujar linea { PA_SetSpriteXY(0, 0, xcor-10-8, ycor-8); PA_Draw16bitLineEx (0, xcor, ycor, xcor-10, ycor, PA_RGB(1, 1, 1),3);
} xcor = xcor-10; }
}
if (Pad.Newpress.Right) { if (xcor 15) { if (linea == 0) { PA_SetSpriteXY(0, 1, xcor-8, ycor-8-10); } else if (linea == 1) //hay que dibujar linea { PA_SetSpriteXY(0, 0, xcor-8, ycor-8-10); PA_Draw16bitLineEx (0, xcor, ycor, xcor, ycor-10, PA_RGB(1, 1, 1),3);
} ycor = ycor-10; }
}
if (Pad.Newpress.Down) { if (ycor < 184) { if (linea == 0) { PA_SetSpriteXY(0, 1, xcor-8, ycor-8+10); }
if (linea == 1) //hay que dibujar linea { PA_SetSpriteXY(0, 0, xcor-8, ycor-8+10); PA_Draw16bitLineEx (0, xcor, ycor, xcor, ycor+10, PA_RGB(1, 1, 1),3);
} ycor = ycor+10; }
}
// si pulsamos “B” borramos la pantalla if (Pad.Newpress.B){ PA_Clear16bitBg(0); pintapuntos(); }
PA_WaitForVBL(); }
return 0; } // Fin de main
Kommentare