buffer_poke

Add data to a buffer at a specific position.

Syntax:

buffer_poke(buffer, offset, type, value);


Argument Description
buffer The index of the buffer to use.
offset The offset position (in bytes) within the buffer to write the given data to.
type The type of data that is to be written to the buffer (see the list of constants here).
value The data to add to the buffer, in accordance with the type specified.


Returns: N/A


Description

With the buffer_write function, you can write data to the given buffer at the current "seek" position, with each piece of data advancing this position by the bytes being written or read. However, it may be necessary for you to change a given piece of data without wanting to change the current seek position, and that's when you would use this function. You simply supply the function with a buffer index, and then the offset position from the buffer start (in bytes) within that buffer to write to, as well as the data type and the value to be written.


Example:

buffer_poke(buff, 3, buffer_u8, colour_get_blue(image_blend));

The above code will add the blue component value of the colour used for the image blend into the buffer indexed in the variable "buff", at the third position in the buffer and as an unsigned 8bit value.


Back: Buffers
Next: buffer_save
© Copyright YoYo Games Ltd. 2018 All Rights Reserved