Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix more pool leaks #345

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Other/FlxGameOfLife/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import flixel.tile.FlxTilemap;
import flixel.ui.FlxButton;
import flixel.util.FlxAxes;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
import openfl.display.BitmapData;
import openfl.geom.Rectangle;
import openfl.ui.Mouse;
Expand Down Expand Up @@ -419,7 +420,7 @@ class PlayState extends FlxState
if (mPos.x >= lifeMap.x && mPos.y >= lifeMap.y && mPos.x < lifeMap.x + lifeMap.width && mPos.y < lifeMap.y + lifeMap.height)
{
// if the mouse is over the lifeMap, get the tile it is over
var mPosOff:FlxPoint = new FlxPoint((mPos.x - lifeMap.x) / TILE_SIZE, (mPos.y - lifeMap.y) / TILE_SIZE);
final mPosOff = FlxPoint.get((mPos.x - lifeMap.x) / TILE_SIZE, (mPos.y - lifeMap.y) / TILE_SIZE);

// if the player just pressed the mouse, set the mouse mode to paint or erase mode, depending on the tile they clicked on
if (FlxG.mouse.justPressed)
Expand All @@ -436,19 +437,20 @@ class PlayState extends FlxState

for (points in getLine(Std.int(mPosOffPrev.x), Std.int(mPosOffPrev.y), Std.int(mPosOff.x), Std.int(mPosOff.y)))
lifeMap.setTile(points.x, points.y, mouseMode == PAINT ? 1 : 0);

}

mPosOffPrev = FlxPoint.get(mPosOff.x, mPosOff.y);
else
mPosOffPrev = FlxPoint.get();

mPosOffPrev.copyFrom(mPosOff);
}
else if (FlxG.mouse.released)
{
// if the player released the mouse, set the mode to none
mouseMode = NONE;
mPosOffPrev = null;

mPosOffPrev = FlxDestroyUtil.put(mPosOffPrev);
}
updateMouseCursor(true);
mPosOff.put();
}
else
{
Expand Down
Loading