Demo of low res colour vga video for stm32f3 discovery board

Dependencies:   STM32F3-Discovery-minimal

Fork of Space_Invaders_Demo by Martin Johnson

Revision:
5:594c9712697c
Parent:
3:93e488fbb8a2
Child:
8:34fb94209517
Child:
14:3035b3271395
--- a/gdi.c	Wed May 16 02:48:27 2018 +0000
+++ b/gdi.c	Thu May 17 00:59:01 2018 +0000
@@ -286,7 +286,7 @@
 	if (x >= VID_PIXELS_X || y >= VID_PIXELS_Y) return;
 
 	w = x;// >> 3;
-	r = x - (w << 3);
+	//r = x - (w << 3);
 
 //	Prepare mask
 
@@ -439,6 +439,19 @@
 	}
 }
 
+void gdiHLine(u16 x, u16 y, u16 x1, u16 rop) {
+	if(x>x1) {
+		int t=x1;
+		x1=x;
+		x=t;
+	}
+	char *start=fb[y]+x;
+	int n=x1-x+1;
+	while(n--) {
+		*start++|=(colour<<4);
+	}
+}
+
 void	gdiFilledCircle(u16 x, u16 y, u16 r, u16 rop) {
 
 i32		x1, y1;
@@ -450,8 +463,9 @@
 	for (a = 0; a < 100; a+=div) {		
 		x1 = r * mthCos(a);
 		y1 = r * mthSin(a);
-		gdiLine(NULL, (x1 / 10000) + x,(y1 / 10000) + y,-(x1 / 10000) + x,(y1 / 10000) + y,rop);
-		gdiLine(NULL, (x1 / 10000) + x,-(y1 / 10000) + y,-(x1 / 10000) + x,-(y1 / 10000) + y,rop);
+		gdiHLine( (x1 / 10000) + x,(y1 / 10000) + y,-(x1 / 10000) + x,rop);
+		gdiHLine( (x1 / 10000) + x,-(y1 / 10000) + y,-(x1 / 10000) + x,rop);
+//		gdiPoint(NULL, (x1 / 10000) + x,(y1 / 10000) + y,rop);
 	}
 }
 //*****************************************************************************