Skip to content

Commit 27a756b

Browse files
StarmapoGeokureli
andauthored
Remove unused legacy code & defines (#3059)
* Remove legacy code & defines - Removed `FLX_POST_PROCESS` define & related code - Removed references to `openfl_next`, `lime_legacy` & `next` defines - Removed Lime & OpenFL version checks that are always true/false due to the current minimum versions * Removed `legacy` define being set in include.xml * Re-added `#if !flash` check in `initRenderMethod` I mistakenly removed the entire code due to it including `lime_legacy`. * Brought back `undump()` & `canBeDumped` as `refreshBitmap()` & `canBeRefreshed` respectively (old ones are now deprecated) - Also brought back `onAssetsReload()` & `getBitmapFromSystem()` * Added missing line breaks * remove old import * Remove another deprecated define * Restored mistakenly-removed define check * Rename `refreshBitmap()` to `refresh()` --------- Co-authored-by: George FunBook <[email protected]>
1 parent 39e1fcf commit 27a756b

File tree

18 files changed

+58
-671
lines changed

18 files changed

+58
-671
lines changed

checkstyle.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"FLX_NATIVE_CURSOR",
66
"FLX_SOUND_TRAY",
77
"FLX_POINTER_INPUT",
8-
"FLX_POST_PROCESS",
98
"FLX_RECORD"
109
],
1110
"defineCombinations": [

flixel/FlxCamera.hx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,9 +1676,7 @@ class FlxCamera extends FlxBasic
16761676

16771677
final targetGraphics = (graphics == null) ? canvas.graphics : graphics;
16781678

1679-
#if (openfl > "8.7.0")
16801679
targetGraphics.overrideBlendMode(null);
1681-
#end
16821680
targetGraphics.beginFill(Color, FxAlpha);
16831681
// i'm drawing rect with these parameters to avoid light lines at the top and left of the camera,
16841682
// which could appear while cameras fading

flixel/FlxG.hx

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package flixel;
22

3-
import flixel.effects.postprocess.PostProcess;
43
import flixel.math.FlxMath;
54
import flixel.math.FlxRandom;
65
import flixel.math.FlxRect;
@@ -50,12 +49,6 @@ import flixel.input.FlxAccelerometer;
5049
#if FLX_POINTER_INPUT
5150
import flixel.input.FlxSwipe;
5251
#end
53-
#if FLX_POST_PROCESS
54-
import flixel.util.FlxDestroyUtil;
55-
import openfl.display.OpenGLView;
56-
57-
using flixel.util.FlxArrayUtil;
58-
#end
5952

6053
#if html5
6154
import flixel.system.frontEnds.HTML5FrontEnd;
@@ -515,62 +508,6 @@ class FlxG
515508
return child;
516509
}
517510

518-
public static function addPostProcess(postProcess:PostProcess):PostProcess
519-
{
520-
#if FLX_POST_PROCESS
521-
if (OpenGLView.isSupported)
522-
{
523-
var postProcesses = game.postProcesses;
524-
525-
// chaining
526-
var length = postProcesses.length;
527-
if (length > 0)
528-
{
529-
postProcesses[length - 1].to = postProcess;
530-
}
531-
532-
game.postProcessLayer.addChild(postProcess);
533-
postProcesses.push(postProcess);
534-
}
535-
else
536-
{
537-
FlxG.log.error("Shaders are not supported on this platform.");
538-
}
539-
#end
540-
541-
return postProcess;
542-
}
543-
544-
public static function removePostProcess(postProcess:PostProcess):Void
545-
{
546-
#if FLX_POST_PROCESS
547-
var postProcesses = game.postProcesses;
548-
if (postProcesses.remove(postProcess))
549-
{
550-
chainPostProcesses();
551-
postProcess.to = null;
552-
553-
FlxDestroyUtil.removeChild(game.postProcessLayer, postProcess);
554-
}
555-
#end
556-
}
557-
558-
#if FLX_POST_PROCESS
559-
static function chainPostProcesses():Void
560-
{
561-
var postProcesses = game.postProcesses;
562-
563-
if (postProcesses.length > 0)
564-
{
565-
for (i in 0...postProcesses.length - 1)
566-
{
567-
postProcesses[i].to = postProcesses[i + 1];
568-
}
569-
postProcesses.last().to = null;
570-
}
571-
}
572-
#end
573-
574511
/**
575512
* Opens a web page, by default a new tab or window. If the URL does not
576513
* already start with `"http://"` or `"https://"`, it gets added automatically.
@@ -647,31 +584,13 @@ class FlxG
647584

648585
static function initRenderMethod():Void
649586
{
650-
renderMethod = BLITTING;
651-
652-
#if (!lime_legacy && !flash)
653-
#if (lime >= "7.0.0")
587+
#if !flash
654588
renderMethod = switch (stage.window.context.type)
655589
{
656590
case OPENGL, OPENGLES, WEBGL: DRAW_TILES;
657591
default: BLITTING;
658592
}
659593
#else
660-
if (!Lib.application.config.windows[0].hardware)
661-
{
662-
renderMethod = BLITTING;
663-
}
664-
else
665-
{
666-
renderMethod = switch (stage.window.renderer.type)
667-
{
668-
case OPENGL, CONSOLE: DRAW_TILES;
669-
case CANVAS, FLASH, CAIRO: BLITTING;
670-
default: BLITTING;
671-
}
672-
}
673-
#end
674-
#else
675594
#if web
676595
renderMethod = BLITTING;
677596
#else

flixel/FlxGame.hx

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import openfl.filters.BitmapFilter;
1515
#if desktop
1616
import openfl.events.FocusEvent;
1717
#end
18-
#if FLX_POST_PROCESS
19-
import flixel.effects.postprocess.PostProcess;
20-
import openfl.display.OpenGLView;
21-
#end
2218
#if FLX_DEBUG
2319
import flixel.system.debug.FlxDebugger;
2420
#end
@@ -149,14 +145,6 @@ class FlxGame extends Sprite
149145
*/
150146
var _filters:Array<BitmapFilter>;
151147

152-
#if (desktop && lime_legacy)
153-
/**
154-
* Ugly workaround to ensure consistent behaviour between flash and cpp
155-
* (the focus event should not fire when the game starts up!)
156-
*/
157-
var _onFocusFiredOnce:Bool = false;
158-
#end
159-
160148
#if FLX_FOCUS_LOST_SCREEN
161149
/**
162150
* The "focus lost" screen.
@@ -230,18 +218,6 @@ class FlxGame extends Sprite
230218
var _recordingRequested:Bool = false;
231219
#end
232220

233-
#if FLX_POST_PROCESS
234-
/**
235-
* `Sprite` for postprocessing effects
236-
*/
237-
var postProcessLayer:Sprite = new Sprite();
238-
239-
/**
240-
* Post process effects active on the `postProcessLayer`.
241-
*/
242-
var postProcesses:Array<PostProcess> = [];
243-
#end
244-
245221
/**
246222
* Instantiate a new game object.
247223
*
@@ -330,11 +306,6 @@ class FlxGame extends Sprite
330306

331307
addChild(_inputContainer);
332308

333-
#if FLX_POST_PROCESS
334-
if (OpenGLView.isSupported)
335-
addChild(postProcessLayer);
336-
#end
337-
338309
// Creating the debugger overlay
339310
#if FLX_DEBUG
340311
debugger = new FlxDebugger(FlxG.stage.stageWidth, FlxG.stage.stageHeight);
@@ -356,10 +327,7 @@ class FlxGame extends Sprite
356327
#end
357328

358329
// Focus gained/lost monitoring
359-
#if (desktop && openfl <= "4.0.0")
360-
stage.addEventListener(FocusEvent.FOCUS_OUT, onFocusLost);
361-
stage.addEventListener(FocusEvent.FOCUS_IN, onFocus);
362-
#elseif (sys && openfl >= "9.3.0")
330+
#if (sys && openfl >= "9.3.0")
363331
stage.nativeWindow.addEventListener(Event.DEACTIVATE, onFocusLost);
364332
stage.nativeWindow.addEventListener(Event.ACTIVATE, onFocus);
365333
#else
@@ -394,15 +362,6 @@ class FlxGame extends Sprite
394362
return; // Don't run this function twice (bug in standalone flash player)
395363
#end
396364

397-
#if (desktop && lime_legacy)
398-
// make sure the on focus event doesn't fire on startup
399-
if (!_onFocusFiredOnce)
400-
{
401-
_onFocusFiredOnce = true;
402-
return;
403-
}
404-
#end
405-
406365
#if mobile
407366
// just check if device orientation has been changed
408367
onResize(_);
@@ -433,11 +392,6 @@ class FlxGame extends Sprite
433392

434393
function onFocusLost(event:Event):Void
435394
{
436-
#if next
437-
if (event != null && event.target != FlxG.stage)
438-
return;
439-
#end
440-
441395
#if flash
442396
if (_lostFocus)
443397
return; // Don't run this function twice (bug in standalone flash player)
@@ -472,11 +426,6 @@ class FlxGame extends Sprite
472426
var width:Int = FlxG.stage.stageWidth;
473427
var height:Int = FlxG.stage.stageHeight;
474428

475-
#if !flash
476-
if (FlxG.renderTile)
477-
FlxG.bitmap.onContext();
478-
#end
479-
480429
resizeGame(width, height);
481430
}
482431

@@ -502,11 +451,6 @@ class FlxGame extends Sprite
502451
if (soundTray != null)
503452
soundTray.screenCenter();
504453
#end
505-
506-
#if FLX_POST_PROCESS
507-
for (postProcess in postProcesses)
508-
postProcess.rebuild();
509-
#end
510454
}
511455

512456
/**
@@ -741,11 +685,6 @@ class FlxGame extends Sprite
741685

742686
updateInput();
743687

744-
#if FLX_POST_PROCESS
745-
if (postProcesses[0] != null)
746-
postProcesses[0].update(FlxG.elapsed);
747-
#end
748-
749688
#if FLX_SOUND_SYSTEM
750689
FlxG.sound.update(FlxG.elapsed);
751690
#end
@@ -867,11 +806,6 @@ class FlxGame extends Sprite
867806
if (FlxG.renderTile)
868807
FlxDrawBaseItem.drawCalls = 0;
869808

870-
#if FLX_POST_PROCESS
871-
if (postProcesses[0] != null)
872-
postProcesses[0].capture();
873-
#end
874-
875809
FlxG.cameras.lock();
876810

877811
if (FlxG.plugins.drawOnTop)

0 commit comments

Comments
 (0)