X-Git-Url: https://harrygodden.com/git/?p=fishladder.git;a=blobdiff_plain;f=texsheet.c;fp=texsheet.c;h=367136bbc3e8d1d009cad32c479575e8725c5fc7;hp=f420866bd1a6dfc5ef6d9f5b033fb7e3f4bf0d97;hb=ec1dd5de4848534241c8bea3841ef36fe047915b;hpb=3cb144985169da3cea1c21a7b0bfba8d43c28fdb diff --git a/texsheet.c b/texsheet.c index f420866..367136b 100644 --- a/texsheet.c +++ b/texsheet.c @@ -47,7 +47,7 @@ int main( int argc, const char *argv[] ) return 0; } - fprintf( fp, "static enum %s_index\n{\n", argv[3] ); + fprintf( fp, "enum %s_index\n{\n", argv[3] ); // Load images // ----------- @@ -109,13 +109,12 @@ int main( int argc, const char *argv[] ) u8 *dest = (u8 *)malloc( 1024*1024*4 ); - // Clear (temp) for( int i = 0; i < 1024*1024; i ++ ) { dest[ i*4 + 0 ] = 0; dest[ i*4 + 1 ] = 0; - dest[ i*4 + 2 ] = 128; - dest[ i*4 + 3 ] = 255; + dest[ i*4 + 2 ] = 0; + dest[ i*4 + 3 ] = 0; } struct region @@ -132,8 +131,6 @@ int main( int argc, const char *argv[] ) }; int stack_h = 0; - int sf = 64; - for( int i = 0; i < num_images; i ++ ) { struct image_src *psrc = &source_images[ i ]; @@ -146,13 +143,18 @@ int main( int argc, const char *argv[] ) if( (pregion->p0[ 0 ] + psrc->x <= pregion->p1[0]) && (pregion->p0[ 1 ] + psrc->y <= pregion->p1[1]) ) { // Passed, add image and create subdivisions - fprintf( fp, "\t{ %hu, %hu, %hu, %hu },\n", - (u16)(sf * pregion->p0[0]), - (u16)(sf * pregion->p0[1]), - (u16)(sf * psrc->x), - (u16)(sf * psrc->y) + fprintf( fp, "\t{{ %f, %f, %f, %f }}", + (float)pregion->p0[0] / 1024.0f, + (float)pregion->p0[1] / 1024.0f, + (float)psrc->x / 1024.0f, + (float)psrc->y / 1024.0f ); + if( i != num_images-1 ) + fputs( ",\n", fp ); + else + fputc( '\n', fp ); + // Write image for( int y = 0; y < psrc->y; y ++ ) {