Good Grid

Alphalaneous

Good Grid

The ultimate DrawGridLayer rewrite and API!

  • Better Performance!
  • Rotation Support!
  • Extensive API
  • Bug Fixes
  • Exactly Like Vanilla (by default)

Editor Extension in MegaHack cannot be detected, thus the grid size will too small unless you enable extension override in this mod's settings.

Here's what you can do with the API as a Developer:

LineColor

This is a class that contains up to 2 colors for solid or gradient lines. When passing one into the constructor, both color A and B equal the same value. If you pass two colors, the line will be a gradient between the two.

LineColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a);

Constructor with rgba bytes.

LineColor(const cocos2d::ccColor4B& colorA);

Constructor with one color, will make the line solid.

LineColor(const cocos2d::ccColor4B& colorA, const cocos2d::ccColor4B& colorB);

Constructor with two colors, will make the line a gradient between the two colors.

cocos2d::ccColor4B getColorA() const

Returns the first color.

cocos2d::ccColor4B getColorB() const

Returns the second color if it is set, else returns the first color.

DrawGridAPI.hpp

void markDirty()

Marks the grid as dirty, forcing it to update it's culling bounds.

bool isDirty()

Returns true if the grid is marked as dirty.

void setVanillaDraw(bool enabled)

Sets the grid rendering to Vanilla's implementation (used mostly for debugging, should not be used in a mod).

bool isVanillaDraw()

Returns true if vanilla draw is enabled.

void setLineSmoothing(bool enabled)

Line smoothing is only supported on Windows and MacOS! Sets all lines to smooth (useful for editor camera rotation)

bool hasLineSmoothing()

Line smoothing is only supported on Windows and MacOS! Returns true of line smoothing is enabled

void setLineSmoothingLimit(float limit)

Line smoothing is only supported on Windows and MacOS! Sets the editor zoom limit (if >= than this limit, the lines will not be made smooth) for line smoothing as having too many smoothed lines on screen at once is laggy. I recommend keeping it at default.

float getLineSmoothingLimit()

Returns the line smoothing limit

void overrideGridBoundsSize(cocos2d::CCSize size)

Sets the grid's max width and height bounds (useful for editor extenders and limiters).

cocos2d::CCSize getGridBoundsSize()

Returns the max width and height bounds of the grid.

void overrideGridBoundsOrigin(cocos2d::CCPoint origin)

Sets the grid's origin (bottom left) coordinates.

cocos2d::CCPoint getGridBoundsOrigin()

Returns the coordinates of the grid's origin.

cocos2d::CCSize getWorldViewSize()

Returns the World View size. This size is the window size scaled by the editor zoom multiplied by the overdraw factor to account for rotation.

float getOverdrawFactor()

Returns the overdraw factor for the rotated editor view.

void drawLine(const cocos2d::ccVertex2F& start, const cocos2d::ccVertex2F& end, const LineColor& color, float width, bool blend = false)

Draws a line to the screen with two coordinates where it starts and ends. Takes in a LineColor param which allows for a solid or gradient color. The width is the line width, for the purpose of optimization, this also determines Z ordering for that specific width. Blending is an optional param that will make the line blend with additive blending.

void drawRect(const cocos2d::CCRect& rect, const cocos2d::ccColor4B& color, bool blend = false)

Draws a rectangle to the screen with a CCRect param dictating the bounds and a color param to set its color. Blending is an optional param that will make the rectangle blend with additive blending.

void drawRectOutline(const cocos2d::CCRect& rect, const cocos2d::ccColor4B& color, float width, bool blend = false)

Draws a rectangle outline to the screen with a CCRect param dictating the bounds, a color param to set its color, and the width of the outline. Blending is an optional param that will make the rectangle outline blend with additive blending.

bool isObjectVisible(GameObject* object)

Util to check if an object is visible (accounting for selecting, group and hide options).

geode::Result<DrawNode&> getNodeByID(const std::string& id)

Returns a result of a DrawNode if one by the passed in ID exists.

template <typename T>
requires std::is_base_of_v<DrawNode, T>
geode::Result<T&> getNode(const std::string& id)

Returns a result of a DrawNode if one passed by the type and ID exists.

template <typename T>
requires std::is_base_of_v<DrawNode, T>
geode::Result<T&> getNode()

Returns a result of a DrawNode if one passed by the type. Will always be first of a type if multiple exist.

template <typename T, typename... Args>
requires std::is_base_of_v<DrawNode, T>
T& addDraw(const std::string& id, Args&&... args)

Returns a reference of and adds a custom DrawNode to the DrawGridLayer with an ID.

DrawNode.hpp

This class is what makes up every part of the new DrawGridLayer. Every layer on it inherits this class. It provides a few methods as well as some virtuals you can override that will be called when added via the DrawGridAPI. You usually do not need to manually construct this yourself, as DrawGridAPI::addDraw will construct one for you and return it.

void setID(const std::string& id)

Sets the ID of the DrawNode.

std::string getID() const

Returns the ID of the DrawNode.

void setEnabled(bool enabled)

Sets if the DrawNode is enabled (should draw to the DrawGridLayer).

bool isEnabled() const

Returns true if the DrawNode is enabled (will draw to the DrawGridLayer).

void setZOrder(int order)

Sets the Z order of the DrawNode, note that this is width exclusive, it will draw in this order per line width, then rectangles, then rectangle outlines.

int getZOrder() const

Returns the Z order of the DrawNode.

virtual void init(DrawGridLayer* drawGridLayer)

A virtual you can override that will be called whenever the DrawGridLayer is created.

virtual void draw(DrawGridLayer* drawGridLayer, float minX, float maxX, float minY, float maxY);

A virtual you can override that will draw what is within it to the DrawGridLayer, The minX, maxX, minY, and maxY params are the culling bounds, these respect scale and rotation, please use these for the best performance.

DrawLayers.hpp

Every method here has an optional priority param, it is used if you need to run your code after or before something else. (For static changes such setColor methods, the highest number is the only one that ends up getting set. setPropertiesFor methods will be in order of prio and all will run).

class Grid : public DrawNode

The editor grid.

void setGridColor(const LineColor& color, int priority = 0)

Sets the grid color.

const LineColor& getGridColor() const

Returns the grid color.

int getGridColorPriority() const

Returns the grid color priority.

void setLineWidth(float width, int priority = 0)

Sets the line width.

float getLineWidth() const

Returns the line width.

int getLineWidthPriority() const

Returns the line width priority.

class Bounds : public DrawNode

The bounds of the editor (white vertical line at X: 0 and the max and minimum height).

void setTopBoundColor(const LineColor& color, int priority = 0)

Sets the top bound color.

const LineColor& getTopBoundColor() const

Returns the top bound color.

int getTopBoundColorPriority() const

Returns the top bound priority.

void setBottomBoundColor(const LineColor& color, int priority = 0)

Sets the bottom bound color.

const LineColor& getBottomBoundColor() const

Returns the bottom bound color.

int getBottomBoundColorPriority() const

Returns the bottom bound priority.

void setVerticalBoundColor(const LineColor& color, int priority = 0)

Sets the vertical bound color.

const LineColor& getVerticalBoundColor() const

Returns the vertical bound color.

int getVerticalBoundColorPriority() const

Returns the vertical bound priority.

void seTopBoundtLineWidth(float width, int priority = 0)

Sets the top bound line width.

float getTopBoundLineWidth() const

Returns the top bounc line width.

int getTopBoundLineWidthPriority() const

Returns the top bound line width priority.

void setBottomBoundLineWidth(float width, int priority = 0)

Sets the bottom bound line width.

float getBottomBoundLineWidth() const

Returns the bottom bound line width.

int getBottomBoundLineWidthPriority() const

Returns the bottom bound line width priority.

void setVerticalBoundLineWidth(float width, int priority = 0)

Sets the vertical bound line width.

float getVerticalBoundLineWidth() const

Returns the vertical bound line width.

int getVerticalBoundLineWidthPriority() const

Returns the vertical bound line width priority.

class Ground : public DrawNode

The ground lines (when in a non cube/robot gamemode).

void setTopGroundColor(const LineColor& color, int priority = 0)

Sets the top ground color.

const LineColor& getTopGroundColor() const

Returns the top ground color.

int getTopGroundColorPriority() const

Returns the top ground priority.

void setBottomGroundColor(const LineColor& color, int priority = 0)

Sets the bottom ground color.

const LineColor& getBottomGroundColor() const

Returns the bottom ground color.

int getBottomGroundColorPriority() const

Returns the bottom ground priority.

void setTopGroundLineWidth(float width, int priority = 0)

Sets the top ground line width.

float getTopGroundLineWidth() const

Returns the top ground line width.

int getTopGroundLineWidthPriority() const

Returns the top ground line width priority.

void setBottomGroundLineWidth(float width, int priority = 0)

Sets the bottom ground line width.

float getBottomGroundLineWidth() const

Returns the bottom ground line width.

int getBottomGroundLineWidthPriority() const

Returns the bottom ground line width priority.

class GuideObjects : public DrawNode

These are the objects that show portal bounds when preview is enabled.

void setPropertiesForObject(std::function<void(LineColor& bottomColor, LineColor& topColor, EffectGameObject* object, float& lineWidthBottom, float& lineWidthTop)> colorForObject, int priority = 0)

Lets you pass in a method that allows for modifying the colors, as well as passing in the object. An example would be setting colors depending on an object.

class EffectLines : public DrawNode

These are the lines triggers show when not spawn or touch triggered.

void setPropertiesForObject(std::function<void(LineColor& color, EffectGameObject* object, float& lineWidth)> colorForObject, int priority = 0)

Lets you pass in a method that allows for modifying the color, as well as passing in the object. An example would be setting colors depending on an object.

class DurationLines : public DrawNode

These are the duration lines triggers show.

void setPropertiesForObject(std::function<void(LineColor& color, EffectGameObject* object, float& lineWidth)> colorForObject, int priority = 0)

Lets you pass in a method that allows for modifying the color, as well as passing in the object. An example would be setting colors depending on an object.

class Guidelines : public DrawNode

These are the music guidelines you can set when choosing a song.

void setPropertiesForValue(std::function<void(LineColor& color, float value, float& lineWidth)> colorForValue, int priority = 0)

Lets you pass in a method that allows for modifying the color, as well as passing in the numeric color value the guideline is set to (view https://wyliemaster.github.io/gddocs/#/resources/client/level-components/guideline-string for more info). An example would be setting colors depending on the value, expanding what color values already exist.

class BPMTriggers : public DrawNode

These are the bpm guidelines you can set with a BPM Trigger.

void setPropertiesForBeats(std::function<void(LineColor& color, AudioLineGuideGameObject* object, int beat, int beatsPerBar, float& lineWidth)> colorForBeats, int priority = 0)

Lets you pass in a method that allows for modifying the color, as well as passing in the object, what beat the line being modified is on, and how many beats per bar there are. An example would be changing the beat color depending on what beat it is in a bar.

class AudioLine : public DrawNode

This is the line that shows when you play music in the editor.

void setPropertiesForTime(std::function<void(LineColor& color, bool playback, float time, const cocos2d::CCPoint& position, float& lineWidth)> colorForTime, int priority = 0);

Lets you pass in a method that allows for modifying the color, as well as passing in if playback is live, the song's time, and the position of the line. An example would be setting the line color hue based on the time.

class PositionLines : public DrawNode

The center vertical and horizontal lines that mark before and after a trigger activates.

void setVerticalLineColor(const LineColor& color, int priority = 0)

Sets the vertical line color.

const LineColor& getVerticalLineColor() const

Returns the vertical line color.

int getVerticalLineColorPriority() const

Returns the vertical line priority.

void setHorizontalLineColor(const LineColor& color, int priority = 0)

Sets the horizontal line color.

const LineColor& getVerticalLineColor() const

Returns the horizontal line color.

int getHorizontalLineColorPriority() const

Returns the horizontal line priority.

void setVerticalLineWidth(float width, int priority = 0)

Sets the vertical line width.

float getVerticalLineWidth() const

Returns the vertical line width.

int getVerticalLineWidthPriority() const

Returns the vertical line width priority.

void setHorizontalLineWidth(float width, int priority = 0)

Sets the horizontal line width.

float getHoritzontalLineWidth() const

Returns the horizontal line width.

int getHorizontalLineWidthPriority() const

Returns the horizontal line width priority.

class PreviewLockLine : public DrawNode

The line that shows the position where preview is locked.

void setLineColor(const LineColor& color, int priority = 0)

Sets the line color.

const LineColor& getLineColor() const

Returns the line color.

int getLineColorPriority() const

Returns the line color priority.

void setLineWidth(float width, int priority = 0)

Sets the line width.

float getLineWidth() const

Returns the line width.

int getLineWidthPriority() const

Returns the line width priority.

1.1.2

  • Minor fixes from hiimjasmine00

1.1.1

  • Fixed a culling bug
  • Fixed a bug where the audio line did not respect timewarp preview

1.1.0

  • Add line widths to the API
  • Add x position reference for BPM Triggers
  • Don't automatically add the ground offset in Grid::draw
    • Makes more sense when setting bounds now

1.0.1

  • Fixed a bug with duration line updating

1.0.0

  • Initial Release.
The recommended way to install mods is through the in-game mod loader . You will have to manually install the .geode files you get from this page.

Some mods also require other mods as dependencies ; you will need to find and install them yourself.

Site made by HJfod . Thank you to nekit for the domain!

Geode Team 2025