Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
d390790
Implement FlxCameraView & port blit/quad renderer
ACrazyTown Dec 23, 2025
1acebed
Merge remote-tracking branch 'upstream/dev' into seperate-renderer
ACrazyTown Dec 23, 2025
1b1a5a0
merge some fixes from upstream cus im dumb and on an old branch!!
ACrazyTown Dec 23, 2025
66c64bd
formatting
ACrazyTown Dec 23, 2025
a0861e9
Add debug drawing methods to `FlxCamera` and `FlxCameraView`
ACrazyTown Dec 23, 2025
2d4eacb
FlxQuadView: wrap debug draw methods in FLX_DEBUG
ACrazyTown Dec 23, 2025
0721511
use FlxCameraView to count draw calls
ACrazyTown Dec 24, 2025
f45d5a1
Fix filters
ACrazyTown Dec 24, 2025
5a81eaf
drawDebugCircle -> drawDebugFilledCircle
ACrazyTown Dec 24, 2025
dfd4604
move view margins back to FlxCamera
ACrazyTown Dec 24, 2025
3cd97d9
redo unlock/lock
ACrazyTown Dec 24, 2025
1998f39
A bunch of deprecations
ACrazyTown Dec 24, 2025
d7c4f9e
missed this deprecation
ACrazyTown Dec 24, 2025
50357c7
checkResize() shouldn't be a global thing
ACrazyTown Dec 24, 2025
ac364da
FlxRenderer draft
ACrazyTown Jan 22, 2026
08b0993
some polishing in progress
ACrazyTown Jan 23, 2026
af8a67a
oops
ACrazyTown Jan 23, 2026
5cf309c
fixes and a whole lot of docs
ACrazyTown Jan 24, 2026
552bdb7
fix debug drawing
ACrazyTown Jan 24, 2026
f4775d5
fix flash
ACrazyTown Jan 24, 2026
79fd40f
fix deprecation warnings
ACrazyTown Jan 24, 2026
468f65e
update some more docs
ACrazyTown Jan 24, 2026
726c0be
change `method == DRAW_TILES` checks into `method != BLITTING`
ACrazyTown Jan 25, 2026
9441d8c
Make `FlxCameraView.create()` dynamic
ACrazyTown Jan 25, 2026
181cec8
change import
Geokureli Jan 26, 2026
fb9d27c
Bring back accidentally removed method
ACrazyTown Jan 26, 2026
52342c8
Merge branch 'seperate-renderer' of https://github.com/ACrazyTown/fli…
ACrazyTown Jan 26, 2026
f45c61e
fix line debug draw
ACrazyTown Jan 26, 2026
b4c0c8a
Fix C++ CI
ACrazyTown Jan 27, 2026
39b08ce
no longer need to recreate MatrixVector in ReusableFrame
ACrazyTown Jan 27, 2026
51ffbed
some hail mary stuff
Geokureli Feb 24, 2026
1043633
fix debug draw
Geokureli Feb 25, 2026
b6fc6bb
move some rendereer methods to view
Geokureli Feb 26, 2026
bb17eb1
whitespace
Geokureli Feb 26, 2026
9bfbcee
organize methods
Geokureli Feb 26, 2026
dc6102d
use existing drawDebug methods
Geokureli Feb 26, 2026
8362c91
use existing debug draw methods to prevent breaking changes in overrides
Geokureli Feb 26, 2026
29d23c8
make FlxRenderer an abstract class
Geokureli Feb 26, 2026
bf58333
remove targetGraphics from quad view
Geokureli Feb 26, 2026
29684d7
add createView for custom views
Geokureli Feb 26, 2026
e5267a4
revert offset in drawDebugLine
Geokureli Feb 27, 2026
0ad6a68
doc
Geokureli Feb 27, 2026
1c9c167
make viewQuad and viewBlit private
Geokureli Feb 27, 2026
1d4937c
deprecate transformObject
Geokureli Feb 27, 2026
e43175f
call calc in camera, not view
Geokureli Feb 27, 2026
840ff6d
rework and group deprecated getters
Geokureli Feb 27, 2026
5f8516b
fix bitmap text
Geokureli Feb 27, 2026
23af18d
remove display
Geokureli Feb 27, 2026
0a0b357
Merge branch 'dev' into seperate-renderer
Geokureli Feb 27, 2026
4c7cd52
Merge branch 'seperate-renderer' into geo-separate-renderer
Geokureli Feb 27, 2026
d2c7dd1
more bitmap text fixes
Geokureli Feb 27, 2026
caca90a
whitespace + view creation
Geokureli Feb 27, 2026
8b34e47
and FlxG.renderer.blit and tile
Geokureli Feb 27, 2026
d3def2f
add initGlobals
Geokureli Feb 28, 2026
74a38f4
view/cam setters/getters
Geokureli Mar 3, 2026
3a404ce
add FlxVertexBuffer to wrap Graphics calls
Geokureli Mar 8, 2026
b2d0777
tiny fixes
Geokureli Mar 8, 2026
7b0e049
add accidentally removed method
Geokureli Mar 8, 2026
8f7cc5e
remove missed ref to view.display
Geokureli Mar 12, 2026
6fc5b80
Use abstracts unless there are default values
Geokureli Mar 12, 2026
2e8dbbb
move rendering methods to view
Geokureli Mar 12, 2026
59b4346
split TrackerProfile from Tracker
Geokureli Mar 13, 2026
b19f593
split copyPixels/drawPixels into copyFrame/drawFrame
Geokureli Mar 13, 2026
e78983a
change statics to instance vars
Geokureli Mar 13, 2026
5af0840
add FlxVector2d wrapper for openfl.Vector
Geokureli Mar 13, 2026
a4ab01f
fix warning
Geokureli Mar 14, 2026
4fd4035
Update flixel/system/debug/stats/Stats.hx
Geokureli Mar 17, 2026
15c7a00
fix typo
Geokureli Mar 17, 2026
598ef55
Merge branch 'geo-separate-renderer' into geo-render-FlxVector2d
Geokureli Mar 17, 2026
d3b59a6
Merge pull request #1 from Geokureli/geo-separate-renderer
ACrazyTown Mar 17, 2026
243ac94
some docs
ACrazyTown Mar 17, 2026
b6748d8
Rename `FlxVertexBuffer` to `FlxCanvas` + add docs
ACrazyTown Mar 17, 2026
a261bfd
remove accidental include
ACrazyTown Mar 17, 2026
087e710
ooops
ACrazyTown Mar 17, 2026
74354a0
Deprecate and avoid using batching related functions
ACrazyTown Mar 18, 2026
f160941
Add `FLX_RENDER_DRAWQUADS` flag
ACrazyTown Mar 26, 2026
e4c7928
Move some DRAW_QUADS specific things around
ACrazyTown Mar 13, 2026
bceadb9
typo
ACrazyTown Mar 26, 2026
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
912 changes: 284 additions & 628 deletions flixel/FlxCamera.hx

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions flixel/FlxGame.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flixel;

import flixel.graphics.tile.FlxDrawBaseItem;
import flixel.system.render.FlxCameraView;
import flixel.system.FlxSplash;
import flixel.util.FlxArrayUtil;
import flixel.util.FlxDestroyUtil;
Expand Down Expand Up @@ -803,10 +803,9 @@ class FlxGame extends Sprite

FlxG.signals.preDraw.dispatch();

if (FlxG.renderTile)
FlxDrawBaseItem.drawCalls = 0;
FlxCameraView.totalDrawCalls = 0;

FlxG.cameras.lock();
FlxG.cameras.clear();

if (FlxG.plugins.drawOnTop)
{
Expand All @@ -819,17 +818,15 @@ class FlxGame extends Sprite
_state.draw();
}

FlxG.cameras.render();

if (FlxG.renderTile)
{
FlxG.cameras.render();

#if FLX_DEBUG
debugger.stats.drawCalls(FlxDrawBaseItem.drawCalls);
debugger.stats.drawCalls(FlxCameraView.totalDrawCalls);
#end
}

FlxG.cameras.unlock();

FlxG.signals.postDraw.dispatch();

#if FLX_DEBUG
Expand Down
35 changes: 26 additions & 9 deletions flixel/FlxObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1318,18 +1318,27 @@ class FlxObject extends FlxBasic

if (rect.width > 0 && rect.height > 0)
{
final gfx = beginDrawDebug(camera);
drawDebugBoundingBox(gfx, rect, allowCollisions, immovable);
endDrawDebug(camera);
camera.beginDrawDebug();
drawDebugBoundingBox(camera, rect, allowCollisions);
camera.endDrawDebug();
}
}

function drawDebugBoundingBox(gfx:Graphics, rect:FlxRect, allowCollisions:FlxDirectionFlags, partial:Bool)
@:deprecated("drawDebugBoundingBox(gfx, rect, allowCollisions, partial) is deprecated. Use drawDebugBoundingBox(camera, rect, allowCollisions) instead.")
overload extern inline function drawDebugBoundingBox(gfx:Graphics, rect:FlxRect, allowCollisions:FlxDirectionFlags, partial:Bool)
{
// Find the color to use
final color = getDebugBoundingBoxColor(allowCollisions);
drawDebugBoundingBoxColor(gfx, rect, color);
}

overload extern inline function drawDebugBoundingBox(camera:FlxCamera, rect:FlxRect, allowCollisions:FlxDirectionFlags)
{
// Find the color to use
var color = getDebugBoundingBoxColor(allowCollisions);
color.alphaFloat = 0.75;
drawDebugBoundingBoxColor(camera, rect, color);
}

function getDebugBoundingBoxColor(allowCollisions:FlxDirectionFlags)
{
Expand All @@ -1346,30 +1355,38 @@ class FlxObject extends FlxBasic

}

function drawDebugBoundingBoxColor(gfx:Graphics, rect:FlxRect, color:FlxColor)
@:deprecated("drawDebugBoundingBoxColor(gfx, rect, color) is deprecated, use drawDebugBoundingBoxColor(camera, rect, color) instead")
overload extern inline function drawDebugBoundingBoxColor(gfx:Graphics, rect:FlxRect, color:FlxColor)
{
// fill static graphics object with square shape
gfx.lineStyle(1, color, 0.75, false, null, null, MITER, 255);
gfx.drawRect(rect.x + 0.5, rect.y + 0.5, rect.width - 1.0, rect.height - 1.0);
}

overload extern inline function drawDebugBoundingBoxColor(camera:FlxCamera, rect:FlxRect, color:FlxColor)
{
camera.drawDebugRect(rect.x + 0.5, rect.y + 0.5, rect.width - 1.0, rect.height - 1.0, color);
}

@:deprecated("use object.beginDrawDebug(camera) is deprecated, camera.beginDrawDebug() instead")
inline function beginDrawDebug(camera:FlxCamera):Graphics
{
camera.beginDrawDebug();

if (FlxG.renderBlit)
{
FlxSpriteUtil.flashGfx.clear();
return FlxSpriteUtil.flashGfx;
}
else
{
return camera.debugLayer.graphics;
return camera.viewQuad.debugLayer.graphics;
}
}

@:deprecated("use object.endDrawDebug(camera) is deprecated, camera.endDrawDebug() instead")
inline function endDrawDebug(camera:FlxCamera)
{
if (FlxG.renderBlit)
camera.buffer.draw(FlxSpriteUtil.flashGfxSprite);
camera.endDrawDebug();
}
#end

Expand Down
16 changes: 14 additions & 2 deletions flixel/graphics/tile/FlxDrawBaseItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package flixel.graphics.tile;

import flixel.FlxCamera;
import flixel.graphics.frames.FlxFrame;
import flixel.system.render.FlxCameraView;
import flixel.math.FlxMatrix;
import openfl.display.BlendMode;
import openfl.geom.ColorTransform;
Expand All @@ -14,7 +15,18 @@ class FlxDrawBaseItem<T>
/**
* Tracks the total number of draw calls made each frame.
*/
public static var drawCalls:Int = 0;
@:deprecated("drawCalls is deprecated, use FlxCameraView.totalDrawCalls instead")
public static var drawCalls(get, set):Int;

static function set_drawCalls(value:Int):Int
{
return FlxCameraView.totalDrawCalls = value;
}

static function get_drawCalls():Int
{
return FlxCameraView.totalDrawCalls;
}

@:noCompletion
@:deprecated("blendToInt() is deprecated, remove all references to it")
Expand Down Expand Up @@ -63,7 +75,7 @@ class FlxDrawBaseItem<T>

public function render(camera:FlxCamera):Void
{
drawCalls++;
FlxCameraView.totalDrawCalls++;
}

public function addQuad(frame:FlxFrame, matrix:FlxMatrix, ?transform:ColorTransform):Void {}
Expand Down
8 changes: 4 additions & 4 deletions flixel/graphics/tile/FlxDrawQuadsItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>
setParameterValue(shader.hasTransform, true);
setParameterValue(shader.hasColorTransform, colored || hasColorOffsets);

camera.canvas.graphics.overrideBlendMode(blend);
camera.canvas.graphics.beginShaderFill(shader);
camera.canvas.graphics.drawQuads(rects, null, transforms);
camera.canvas.graphics.endFill();
camera.viewQuad.canvas.graphics.overrideBlendMode(blend);
camera.viewQuad.canvas.graphics.beginShaderFill(shader);
camera.viewQuad.canvas.graphics.drawQuads(rects, null, transforms);
camera.viewQuad.canvas.graphics.endFill();
super.render(camera);
}

Expand Down
12 changes: 6 additions & 6 deletions flixel/graphics/tile/FlxDrawTrianglesItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
setParameterValue(shader.hasTransform, true);
setParameterValue(shader.hasColorTransform, colored || hasColorOffsets);

camera.canvas.graphics.overrideBlendMode(blend);
camera.viewQuad.canvas.graphics.overrideBlendMode(blend);

camera.canvas.graphics.beginShaderFill(shader);
camera.viewQuad.canvas.graphics.beginShaderFill(shader);
#else
camera.canvas.graphics.beginBitmapFill(graphics.bitmap, null, true, (camera.antialiasing || antialiasing));
camera.viewQuad.canvas.graphics.beginBitmapFill(graphics.bitmap, null, true, (camera.antialiasing || antialiasing));
#end

camera.canvas.graphics.drawTriangles(vertices, indices, uvtData, TriangleCulling.NONE);
camera.canvas.graphics.endFill();
camera.viewQuad.canvas.graphics.drawTriangles(vertices, indices, uvtData, TriangleCulling.NONE);
camera.viewQuad.canvas.graphics.endFill();

#if FLX_DEBUG
if (FlxG.debugger.drawDebug)
{
var gfx:Graphics = camera.debugLayer.graphics;
var gfx:Graphics = camera.viewQuad.debugLayer.graphics;
gfx.lineStyle(1, FlxColor.BLUE, 0.5);
gfx.drawTriangles(vertices, indices, uvtData);
}
Expand Down
44 changes: 19 additions & 25 deletions flixel/path/FlxBasePath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,8 @@ class FlxTypedBasePath<TTarget:FlxBasic> extends FlxBasic implements IFlxDestroy
*/
public function drawDebugOnCamera(camera:FlxCamera):Void
{
// Set up our global flash graphics object to draw out the path
var gfx:Graphics = null;
if (FlxG.renderBlit)
{
gfx = FlxSpriteUtil.flashGfx;
gfx.clear();
}
else
{
gfx = camera.debugLayer.graphics;
}

camera.beginDrawDebug();

final length = nodes.length;
// Then fill up the object with node and path graphics
for (i=>node in nodes)
Expand All @@ -355,24 +345,20 @@ class FlxTypedBasePath<TTarget:FlxBasic> extends FlxBasic implements IFlxDestroy
}

// draw a box for the node
drawNode(gfx, prevNodeScreen, nodeSize, nodeColor);
drawNode(camera, prevNodeScreen, nodeSize, nodeColor);

if (i + 1 < length || loopType == LOOP)
{
// draw a line to the next node, if LOOP, get connect the tail and head
final nextNode = nodes[(i + 1) % length];
final nextNodeScreen = copyWorldToScreenPos(nextNode, camera);
drawLine(gfx, prevNodeScreen, nextNodeScreen);
drawLine(camera, prevNodeScreen, nextNodeScreen);
nextNodeScreen.put();
}
prevNodeScreen.put();
}

if (FlxG.renderBlit)
{
// then stamp the path down onto the game buffer
camera.buffer.draw(FlxSpriteUtil.flashGfxSprite);
}
camera.endDrawDebug();
}

@:access(flixel.FlxCamera)
Expand All @@ -396,16 +382,14 @@ class FlxTypedBasePath<TTarget:FlxBasic> extends FlxBasic implements IFlxDestroy
return result;
}

inline function drawNode(gfx:Graphics, node:FlxPoint, size:Int, color:FlxColor)
inline function drawNode(camera:FlxCamera, node:FlxPoint, size:Int, color:FlxColor)
{
gfx.beginFill(color.rgb, color.alphaFloat);
gfx.lineStyle();
final offset = Math.floor(size * 0.5);
gfx.drawRect(node.x - offset, node.y - offset, size, size);
gfx.endFill();
camera.drawDebugFilledRect(node.x - offset, node.y - offset, size, size, color);
}

function drawLine(gfx:Graphics, node1:FlxPoint, node2:FlxPoint)
@:deprecated("drawLine(gfx, node1, node2) is deprecated. Use drawLine(camera, node1, node2) instead.")
overload extern inline function drawLine(gfx:Graphics, node1:FlxPoint, node2:FlxPoint)
{
// then draw a line to the next node
final color = debugDrawData.lineColor;
Expand All @@ -416,6 +400,16 @@ class FlxTypedBasePath<TTarget:FlxBasic> extends FlxBasic implements IFlxDestroy
gfx.moveTo(node1.x + lineOffset, node1.y + lineOffset);
gfx.lineTo(node2.x + lineOffset, node2.y + lineOffset);
}

overload extern inline function drawLine(camera:FlxCamera, node1:FlxPoint, node2:FlxPoint)
{
// then draw a line to the next node
final color = debugDrawData.lineColor;
final size = debugDrawData.lineSize;
final lineOffset = debugDrawData.lineSize / 2;

camera.drawDebugLine(node1.x + lineOffset, node1.y + lineOffset, node2.x + lineOffset, node2.y + lineOffset, color, size);
}
#end
}

Expand Down
26 changes: 13 additions & 13 deletions flixel/system/debug/interaction/Interaction.hx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import flixel.system.debug.interaction.tools.TrackObject;
import flixel.system.debug.interaction.tools.Transform;
import flixel.util.FlxDestroyUtil;
import flixel.util.FlxSpriteUtil;
import flixel.util.FlxColor;
import openfl.display.BitmapData;
import openfl.display.DisplayObject;
import openfl.display.Graphics;
Expand Down Expand Up @@ -377,6 +378,7 @@ class Interaction extends Window
drawItemsSelection();
}

@:deprecated("getDebugGraphics() is deprecated. Use the debug draw functions from FlxCamera instead.")
public function getDebugGraphics():Graphics
{
if (FlxG.renderBlit)
Expand All @@ -394,25 +396,23 @@ class Interaction extends Window

function drawItemsSelection():Void
{
var gfx:Graphics = getDebugGraphics();
if (gfx == null)
return;
final camera = FlxG.camera;
camera.beginDrawDebug();

for (member in selectedItems)
{
if (member != null && member.scrollFactor != null && member.isOnScreen())
{
final margin = 0.5;
final scroll = FlxG.camera.scroll;
final scroll = camera.scroll;
// Render a white rectangle centered at the selected item
gfx.lineStyle(1.0, 0xFFFFFF, 0.75);
gfx.drawRect(member.x - scroll.x - margin, member.y - scroll.y - margin, member.width + margin*2, member.height + margin*2);

final color:FlxColor = FlxColor.fromRGBFloat(1, 1, 1, 0.75);
camera.drawDebugRect(member.x - scroll.x - margin, member.y - scroll.y - margin, member.width + margin*2, member.height + margin*2, color);
}
}

// Draw the debug info to the main camera buffer.
if (FlxG.renderBlit)
FlxG.camera.buffer.draw(FlxSpriteUtil.flashGfxSprite);
camera.endDrawDebug();
}

/**
Expand Down Expand Up @@ -791,18 +791,18 @@ class Interaction extends Window
public function toDebugX(worldX:Float, camera:FlxCamera)
{
if (FlxG.renderTile)
return camera.canvas.localToGlobal(new Point(worldX, 0)).x;
return camera.viewQuad.canvas.localToGlobal(new Point(worldX, 0)).x;
else
@:privateAccess
return camera._flashBitmap.localToGlobal(new Point(worldX, 0)).x;
return camera.viewBlit._flashBitmap.localToGlobal(new Point(worldX, 0)).x;
}

public function toDebugY(worldY:Float, camera:FlxCamera)
{
if (FlxG.renderTile)
return camera.canvas.localToGlobal(new Point(0, worldY)).y;
return camera.viewQuad.canvas.localToGlobal(new Point(0, worldY)).y;
else
@:privateAccess
return camera._flashBitmap.localToGlobal(new Point(0, worldY)).y;
return camera.viewBlit._flashBitmap.localToGlobal(new Point(0, worldY)).y;
}
}
Loading