mapcolor.c (826B)
1 // test mapcolor 2 3 #include "../lash_game_color.h" 4 #include "../lash_game_standard.h" 5 #include <stdio.h> 6 #include <stdlib.h> 7 8 int main(int argc, char *argv[]) { 9 if (argc < 5) { 10 printf("Usage: %s r g b a\n", argv[0]); 11 return 1; 12 } 13 unsigned char r = (char)atoi(argv[1]); 14 unsigned char g = (char)atoi(argv[2]); 15 unsigned char b = (char)atoi(argv[3]); 16 unsigned char a = (char)atoi(argv[4]); 17 18 union { 19 uint32_t color_int; 20 unsigned char color_bytes[4]; 21 } color; 22 23 unsigned int i = lash_mapColor(r, g, b, a); 24 color.color_int = i; 25 26 printf("Color given in RGBA: %03d %03d %03d %03d\n", r, g, b, a); 27 printf("Bytes stored in %p, order: %02X %03X %03X %03X\n", &color, color.color_bytes[0], color.color_bytes[1], color.color_bytes[2], color.color_bytes[3]); 28 printf("Int value is %d\n", color.color_int); 29 30 return 0; 31 }