RLGL Hello triangle example.

This commit is contained in:
jussi
2023-12-14 23:08:19 +02:00
parent 5ebdba6af0
commit ba4595305f
11 changed files with 254 additions and 87 deletions

View File

@@ -839,6 +839,28 @@ int ltexturesGetImageColor( lua_State *L ) {
## Textures - Image configuration functions
*/
/*
> imageData = RL.GetImageData( Image image )
Get image data as Buffer
- Success return Buffer
*/
int ltexturesGetImageData( lua_State *L ) {
Image *image = uluaGetImage( L, 1 );
Buffer buffer = (Buffer){
.type = BUFFER_UNSIGNED_CHAR,
.size = GetPixelDataSize( image->width, image->height, image->format ),
};
buffer.data = malloc( buffer.size * sizeof( unsigned char ) );
memcpy( buffer.data, image->data, buffer.size );
uluaPushBuffer( L, buffer );
return 1;
}
/*
> size = RL.GetImageSize( Image image )