buffer_fill

Writes data to a buffer.

Syntax:

GML Code Example

buffer_fill(buffer, offset, type, value, size);


Argument Description
buffer The index of the buffer to fill.
offset The data offset value (in bytes).
type The type of data that is to be written to the buffer (see the list of constants here).
value The data to write.
size The size of the buffer (in bytes) that you wish to fill.


Returns: N/A


Description

This function can be used to fill a previously created buffer with a given data type and value. The data you fill the buffer with must be in agreement with the "type" argument of this function, meaning that you can't try to fill with a string and use the unsigned 16bit integer type, for example. The type constants are the same as those used by the buffer_read and buffer_write functions. The "size" is the size of the buffer (in bytes) that you wish to fill, while the offset is the offset value (also in bytes) from the start of the buffer to start the fill from.


Example:

GML Code Example

map_buffer = buffer_create(16384, buffer_fixed, 0);
 buffer_fill(map_buffer, 0, buffer_u16, 0, 16384);

The above code finds the start of the buffer with the id stored in the variable "buff" them writes a series of signed 16bit integer values to it.


Back: Buffers



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here