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

remove refs to FLX_DRAW_QUADS #2962

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import openfl.filters.BitmapFilter;

using flixel.util.FlxColorTransformUtil;

private typedef FlxDrawItem = #if FLX_DRAW_QUADS flixel.graphics.tile.FlxDrawQuadsItem; #else flixel.graphics.tile.FlxDrawTilesItem; #end
private typedef FlxDrawItem = flixel.graphics.tile.FlxDrawQuadsItem;

/**
* The camera class is used to display the game's visuals.
Expand Down
3 changes: 1 addition & 2 deletions flixel/FlxSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ class FlxSprite extends FlxObject
public var clipRect(default, set):FlxRect;

/**
* GLSL shader for this sprite. Only works with OpenFL Next or WebGL.
* Avoid changing it frequently as this is a costly operation.
* GLSL shader for this sprite. Avoid changing it frequently as this is a costly operation.
* @since 4.1.0
*/
#if openfl_legacy
Expand Down
55 changes: 3 additions & 52 deletions flixel/graphics/FlxGraphic.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import flixel.system.FlxAssets;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
import openfl.display.BitmapData;
#if !FLX_DRAW_QUADS
import openfl.display.Tilesheet;
#end

/**
* `BitmapData` wrapper which is used for rendering.
Expand Down Expand Up @@ -323,15 +320,11 @@ class FlxGraphic implements IFlxDestroyable
*/
public var canBeDumped(get, never):Bool;

#if FLX_DRAW_QUADS
public var shader(default, null):FlxShader;
#else

/**
* Tilesheet for this graphic object. It is used only for `FlxG.renderTile` mode.
* GLSL shader for this graphic. Only used if utilizing sprites do not define a shader
* Avoid changing it frequently as this is a costly operation.
*/
public var tilesheet(get, never):Tilesheet;
#end
public var shader(default, null):FlxShader;

/**
* Usage counter for this `FlxGraphic` object.
Expand Down Expand Up @@ -378,14 +371,6 @@ class FlxGraphic implements IFlxDestroyable
inline function get__imageFrame() return imageFrame;
inline function set__imageFrame(value:FlxImageFrame) return imageFrame = value;

#if !FLX_DRAW_QUADS
/**
* Internal var holding Tilesheet for bitmap of this graphic.
* It is used only in `FlxG.renderTile` mode
*/
var _tilesheet:Tilesheet;
#end

@:deprecated('_useCount is deprecated, use incrementUseCount and decrementUseCount')
var _useCount(get, set):Int;
inline function get__useCount() return useCount;
Expand All @@ -412,9 +397,7 @@ class FlxGraphic implements IFlxDestroyable
frameCollectionTypes = new Array<FlxFrameCollectionType>();
bitmap = Bitmap;

#if FLX_DRAW_QUADS
shader = new FlxShader();
#end
}

/**
Expand Down Expand Up @@ -479,12 +462,7 @@ class FlxGraphic implements IFlxDestroyable
{
bitmap = FlxDestroyUtil.dispose(bitmap);

#if FLX_DRAW_QUADS
shader = null;
#else
if (FlxG.renderTile)
_tilesheet = null;
#end

key = null;
assetsKey = null;
Expand Down Expand Up @@ -552,29 +530,6 @@ class FlxGraphic implements IFlxDestroyable
return frame;
}

#if !FLX_DRAW_QUADS
/**
* Tilesheet getter. Generates new one (and regenerates) if there is no tilesheet for this graphic yet.
*/
function get_tilesheet():Tilesheet
{
if (_tilesheet == null)
{
var dumped:Bool = isDumped;

if (dumped)
undump();

_tilesheet = new Tilesheet(bitmap);

if (dumped)
dump();
}

return _tilesheet;
}
#end

/**
* Gets the `BitmapData` for this graphic object from OpenFL.
* This method is used for undumping graphic.
Expand Down Expand Up @@ -650,10 +605,6 @@ class FlxGraphic implements IFlxDestroyable
bitmap = value;
width = bitmap.width;
height = bitmap.height;
#if (!flash && !FLX_DRAW_QUADS)
if (FlxG.renderTile && _tilesheet != null)
_tilesheet = new Tilesheet(bitmap);
#end
}

return value;
Expand Down
38 changes: 0 additions & 38 deletions flixel/graphics/tile/FlxDrawBaseItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import flixel.graphics.frames.FlxFrame;
import flixel.math.FlxMatrix;
import openfl.display.BlendMode;
import openfl.geom.ColorTransform;
#if !FLX_DRAW_QUADS
import openfl.display.Tilesheet;
#end

/**
* @author Zaphod
Expand All @@ -21,42 +18,7 @@ class FlxDrawBaseItem<T>

public static function blendToInt(blend:BlendMode):Int
{
#if FLX_DRAW_QUADS
return 0; // no blend mode support in drawQuads()
#else
if (blend == null)
return Tilesheet.TILE_BLEND_NORMAL;

return switch (blend)
{
case BlendMode.ADD:
Tilesheet.TILE_BLEND_ADD;
#if !flash
case BlendMode.MULTIPLY:
Tilesheet.TILE_BLEND_MULTIPLY;
case BlendMode.SCREEN:
Tilesheet.TILE_BLEND_SCREEN;
case BlendMode.SUBTRACT:
Tilesheet.TILE_BLEND_SUBTRACT;
#if !lime_legacy
case BlendMode.DARKEN:
Tilesheet.TILE_BLEND_DARKEN;
case BlendMode.LIGHTEN:
Tilesheet.TILE_BLEND_LIGHTEN;
case BlendMode.OVERLAY:
Tilesheet.TILE_BLEND_OVERLAY;
case BlendMode.HARDLIGHT:
Tilesheet.TILE_BLEND_HARDLIGHT;
case BlendMode.DIFFERENCE:
Tilesheet.TILE_BLEND_DIFFERENCE;
case BlendMode.INVERT:
Tilesheet.TILE_BLEND_INVERT;
#end
#end
default:
Tilesheet.TILE_BLEND_NORMAL;
}
#end
}

public var nextTyped:T;
Expand Down
4 changes: 1 addition & 3 deletions flixel/graphics/tile/FlxDrawQuadsItem.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package flixel.graphics.tile;

#if FLX_DRAW_QUADS
import flixel.FlxCamera;
import flixel.graphics.frames.FlxFrame;
import flixel.graphics.tile.FlxDrawBaseItem.FlxDrawItemType;
Expand Down Expand Up @@ -144,5 +143,4 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>
parameter.value[0] = value;
}
#end
}
#end
}
129 changes: 0 additions & 129 deletions flixel/graphics/tile/FlxDrawTilesItem.hx

This file was deleted.

2 changes: 0 additions & 2 deletions flixel/graphics/tile/FlxGraphicsShader.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package flixel.graphics.tile;

#if FLX_DRAW_QUADS
import openfl.display.GraphicsShader;

class FlxGraphicsShader extends GraphicsShader
Expand Down Expand Up @@ -76,4 +75,3 @@ class FlxGraphicsShader extends GraphicsShader
super();
}
}
#end
4 changes: 1 addition & 3 deletions flixel/system/FlxAssets.hx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ abstract FlxJsonAsset<T>(OneOfTwo<T, String>) from T from String
typedef FlxShader =
#if (openfl_legacy || nme)
Dynamic;
#elseif FLX_DRAW_QUADS
flixel.graphics.tile.FlxGraphicsShader;
#else
openfl.display.Shader;
flixel.graphics.tile.FlxGraphicsShader;
#end
#end

Expand Down
4 changes: 1 addition & 3 deletions flixel/system/debug/stats/Stats.hx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ class Stats extends Window
drawMethod =
#if FLX_RENDER_TRIANGLE
"DrawTrian.";
#elseif FLX_DRAW_QUADS
"DrawQuads";
#else
"DrawTiles";
"DrawQuads";
#end
drawMethod = '\n$drawMethod:';
}
Expand Down
5 changes: 3 additions & 2 deletions flixel/system/macros/FlxDefines.hx
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ class FlxDefines
if (defined("mobile") || defined("js"))
define(FLX_ACCELEROMETER);

#if (openfl >= "8.0.0")
// #if (openfl >= "8.0.0")
// should always be defined as of 5.5.1 and, therefore, deprecated
define(FLX_DRAW_QUADS);
#end
// #end
}

static function defineInversion(userDefine:UserDefines, invertedDefine:HelperDefines)
Expand Down
Loading