OVR: Change the way to walk and rotate with the controller
[mercenary-reloaded.git] / src / libtext / text.c
index 6af9f21..0bb5b68 100644 (file)
@@ -122,3 +122,33 @@ void text_render(uint8_t *buffer, int image_width, int image_height, const char
        }
 }
 
+void text_insert_image(uint8_t *buffer, uint8_t palette[][3], const char *pixels, uint8_t alpha)
+{
+       int y, x;
+
+       for (y = 0; y < 200; y++) {
+               for (x = 0; x < 320; x++) {
+                       buffer[((2*y+0) * 2*320 + (2*x+0)) * 4 + 0] = palette[(int)(*pixels)][0];
+                       buffer[((2*y+0) * 2*320 + (2*x+0)) * 4 + 1] = palette[(int)(*pixels)][1];
+                       buffer[((2*y+0) * 2*320 + (2*x+0)) * 4 + 2] = palette[(int)(*pixels)][2];
+                       buffer[((2*y+0) * 2*320 + (2*x+0)) * 4 + 3] = alpha;
+
+                       buffer[((2*y+0) * 2*320 + (2*x+1)) * 4 + 0] = palette[(int)(*pixels)][0];
+                       buffer[((2*y+0) * 2*320 + (2*x+1)) * 4 + 1] = palette[(int)(*pixels)][1];
+                       buffer[((2*y+0) * 2*320 + (2*x+1)) * 4 + 2] = palette[(int)(*pixels)][2];
+                       buffer[((2*y+0) * 2*320 + (2*x+1)) * 4 + 3] = alpha;
+
+                       buffer[((2*y+1) * 2*320 + (2*x+0)) * 4 + 0] = palette[(int)(*pixels)][0];
+                       buffer[((2*y+1) * 2*320 + (2*x+0)) * 4 + 1] = palette[(int)(*pixels)][1];
+                       buffer[((2*y+1) * 2*320 + (2*x+0)) * 4 + 2] = palette[(int)(*pixels)][2];
+                       buffer[((2*y+1) * 2*320 + (2*x+0)) * 4 + 3] = alpha;
+
+                       buffer[((2*y+1) * 2*320 + (2*x+1)) * 4 + 0] = palette[(int)(*pixels)][0];
+                       buffer[((2*y+1) * 2*320 + (2*x+1)) * 4 + 1] = palette[(int)(*pixels)][1];
+                       buffer[((2*y+1) * 2*320 + (2*x+1)) * 4 + 2] = palette[(int)(*pixels)][2];
+                       buffer[((2*y+1) * 2*320 + (2*x+1)) * 4 + 3] = alpha;
+                       pixels++;
+               }
+       }
+}
+