This asset is composed by a BufferViewer structure (new in GMS2.3) that allow for visualising/selecting/copying buffer contents. The viewer GUI is fully customisable, implements rows/columns names, scrollbar and autoscroll on selection drag.
In the examples - bViewer - represents an instance of the BufferViewer structure.
This function opens and loads a binary file asynchronously into a default buffer to be rendered in the bufferViewer. The created buffer will be using a default type of "buffer_fast".
This function returns a copy of the current selection as a byte array.
This function will force a refresh of the display. This is an important function as it will refresh the surface used by the viewer.
NOTE: As it is the code doesn't require you to call it at all. But if you want to change the underlying code and increase functionality take into consideration that you might need to force the redraw by calling this function.
bViewer.drawColumnName(x, y, columnIndex); bViewer.drawCharValue(x, y, byte, rawIndex); bViewer.drawHexValue(x, y, byte, rawIndex); bViewer.drawRowName(x, y, lineStartIndex); bViewer.drawScrollbar(x1, y1, x2, y2, scrollAmount);
This set of functions is responsible for the drawing of each one of the components of the BufferViewer. These determine the GUI style used and are "virtual" methods which means they can be override to accommodate for your likings.
bViewer.scrollUp(); bViewer.scrollDown(); bViewer.mouseClick(); bViewer.mouseHold(); bViewer.asyncSaveLoad(); bViewer.draw();
These functions are called "event" methods. They bind the GMS2 event system to the BufferViewer GUI structure. They should be called in the respective object event of the using instance.
NOTE: The sample code includes a fully documented object with all the setup done for you so you can read the code and understand where everything should go.
This function will set the viewer target buffer to an already existing buffer (this function can be used instead of openFile if you want to load the buffer manually).
This is the function used to set the font that BufferViewer will use to render the data to the screen.
bViewer.setSize(width, height); bViewer.setWidth(width) bViewer.setHeight(height);
These functions are used to set the BufferViewer dimensions.
NOTE: The code automatically manages the number of columns and rows, taking into account the font, width and height.
This is the function used to set the position of the BufferViewer GUI on screen. It can use both screen/room coordinates depending on where you call the draw function (see below).
This is the function sets the width of the column containing the row names.
This is the function used to set the auto scroll (selection drag) sensitivity [0-1].
This is the function used to set the scroll (mouse wheel) step.
This is the function allows for manually setting the selection of the BufferViewer where "start" and "end" are buffer byte indexes.
bViewer.getDeactivatedColor(); // can override bViewer.getActivatedColor(); // can override bViewer.getTellColor(); // can override bViewer.getTopRow(); bViewer.getColumns(); bViewer.getRows(); bViewer.getMaxRows();
This last set of functions are almost always used internally but can be useful while overriding existing methods. The "get*Color" functions only return a fixed value and can be override to your liking .
Included is a sample project that consists of a code example completely documented where some functionality is being used.
Included with the project is a font created by JetBrains. JetBrains Mono typeface is available under the SIL Open Font License 1.1 license and can be used free of charge, for both commercial and non-commercial purposes.
The asset is fully compatible with 2.3+ and is purely written in GML making it compatible with all exports available.
[TERMS OF PURCHASE]
Minor bug fixes