GameMaker Studio 2 (2.3)
Icon

xBufferViewer

xDGameStudios

You must be logged in to obtain assets

Description

[INFO]

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.

[FUNCTIONS]

In the examples - bViewer - represents an instance of the BufferViewer structure.

bViewer.openFile(filename);

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".

bViewer.copySelection();

This function returns a copy of the current selection as a byte array.

bViewer.refresh();

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.

bViewer.setBuffer(buffer);

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).

bViewer.setFont(font);

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.

bViewer.setPosition(x, y);

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).

bViewer.setRowNameWidth(width);

This is the function sets the width of the column containing the row names.

bViewer.setScrollSensitivity(value);

This is the function used to set the auto scroll (selection drag) sensitivity [0-1].

bViewer.setScrollStep(font);

This is the function used to set the scroll (mouse wheel) step.

bViewer.setSelection(start, end);

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 .

[SAMPLE PROJECT]

Included is a sample project that consists of a code example completely documented where some functionality is being used.

[BONUS]

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.

https://www.jetbrains.com/lp/mono/

[COMPATIBILITY]

The asset is fully compatible with 2.3+ and is purely written in GML making it compatible with all exports available.

[TERMS OF PURCHASE]

  • You will receive free updates as they release on this website.
  • The price may vary based on the marketplace.
  • Support, bug fix will be handled on a case-by-case basis at earliest possible.
  • No parts of your purchase may be re-distributed, re-sold, or bundled with existing assets.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.4. Published January 20, 2021

Minor bug fixes

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait

Back to Top