Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 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
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
898 changes: 262 additions & 636 deletions flixel/FlxCamera.hx

Large diffs are not rendered by default.

65 changes: 31 additions & 34 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package flixel;

import flixel.system.render.FlxRenderer;
import flixel.math.FlxMath;
import flixel.math.FlxRandom;
import flixel.math.FlxRect;
Expand Down Expand Up @@ -143,10 +144,33 @@ class FlxG
*/
public static var onMobile(get, never):Bool;

public static var renderMethod(default, null):FlxRenderMethod;
@:deprecated("renderMethod is deprecated, use FlxG.render.method, instead.")
public static var renderMethod(get, null):flixel.system.render.FlxRenderer.FlxRenderMethod;
@:noCompletion static inline function get_renderMethod():flixel.system.render.FlxRenderer.FlxRenderMethod
{
return FlxG.renderer.method;
}

@:deprecated("renderBlit is deprecated, compare against FlxG.render.method, instead.")
public static var renderBlit(get, never):Bool;
@:noCompletion static inline function get_renderBlit():Bool
{
return FlxG.renderer.method == BLITTING;
}

@:deprecated("renderTile is deprecated, compare against FlxG.render.method, instead.")
public static var renderTile(get, never):Bool;
@:noCompletion static inline function get_renderTile():Bool
{
return FlxG.renderer.method != BLITTING;
}

public static var renderBlit(default, null):Bool;
public static var renderTile(default, null):Bool;
/**
* The global renderer instance.
*
* @see `FlxRenderer`
*/
public static var renderer(default, null):FlxRenderer;

/**
* Represents the amount of time in seconds that passed since last frame.
Expand Down Expand Up @@ -541,10 +565,6 @@ class FlxG
FlxG.height = height;

initRenderMethod();
#if FLX_OPENGL_AVAILABLE
// Query once when window is created and cache for later
bitmap.get_maxTextureSize();
#end

FlxG.initialWidth = width;
FlxG.initialHeight = height;
Expand Down Expand Up @@ -590,28 +610,8 @@ class FlxG

static function initRenderMethod():Void
{
#if !flash
renderMethod = switch (stage.window.context.type)
{
case OPENGL, OPENGLES, WEBGL: DRAW_TILES;
default: BLITTING;
}
#else
#if web
renderMethod = BLITTING;
#else
renderMethod = DRAW_TILES;
#end
#end

#if air
renderMethod = BLITTING;
#end

renderBlit = renderMethod == BLITTING;
renderTile = renderMethod == DRAW_TILES;

FlxObject.defaultPixelPerfectPosition = renderBlit;
renderer = FlxRenderer.create();
FlxObject.defaultPixelPerfectPosition = FlxG.renderer.method == BLITTING;
}

#if FLX_SAVE
Expand Down Expand Up @@ -750,8 +750,5 @@ class FlxG
}
}

enum FlxRenderMethod
{
DRAW_TILES;
BLITTING;
}
@:deprecated("FlxG.FlxRenderMethod is deprecated, use FlxRenderer.FlxRenderMethod instead")
typedef FlxRenderMethod = flixel.system.render.FlxRenderer.FlxRenderMethod;
17 changes: 7 additions & 10 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.FlxRenderer;
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;
FlxRenderer.totalDrawCalls = 0;

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

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

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

if (FlxG.renderer.method != BLITTING)
{
#if FLX_DEBUG
debugger.stats.drawCalls(FlxDrawBaseItem.drawCalls);
debugger.stats.drawCalls(FlxRenderer.totalDrawCalls);
#end
}

FlxG.cameras.unlock();

FlxG.signals.postDraw.dispatch();

#if FLX_DEBUG
Expand Down
39 changes: 28 additions & 11 deletions flixel/FlxObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ class FlxObject extends FlxBasic
return;

final rect = getBoundingBox(camera);
if (FlxG.renderTile)
if (FlxG.renderer.method != BLITTING)
{
final view = camera.getViewMarginRect();
view.pad(2);
Expand All @@ -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);
FlxG.renderer.beginDrawDebug(camera);
drawDebugBoundingBox(rect, allowCollisions);
FlxG.renderer.endDrawDebug();
}
}

function drawDebugBoundingBox(gfx:Graphics, rect:FlxRect, allowCollisions:FlxDirectionFlags, partial:Bool)
@:deprecated("drawDebugBoundingBox(gfx, rect, allowCollisions, partial) is deprecated. Use drawDebugBoundingBox(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(rect:FlxRect, allowCollisions:FlxDirectionFlags)
{
// Find the color to use
var color = getDebugBoundingBoxColor(allowCollisions);
color.alphaFloat = 0.75;
drawDebugBoundingBoxColor(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(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(rect:FlxRect, color:FlxColor)
{
FlxG.renderer.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, FlxG.renderer.beginDrawDebug(camera) instead")
inline function beginDrawDebug(camera:FlxCamera):Graphics
{
if (FlxG.renderBlit)
FlxG.renderer.beginDrawDebug(camera);

if (FlxG.renderer.method == BLITTING)
{
FlxSpriteUtil.flashGfx.clear();
return FlxSpriteUtil.flashGfx;
}
else
{
return camera.debugLayer.graphics;
return camera.viewQuad.debugLayer.graphics;
}
}

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

Expand Down
Loading