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 unused legacy code & defines #3059

Open
wants to merge 6 commits into
base: release6
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion checkstyle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"FLX_NATIVE_CURSOR",
"FLX_SOUND_TRAY",
"FLX_POINTER_INPUT",
"FLX_POST_PROCESS",
"FLX_RECORD"
],
"defineCombinations": [
Expand Down
93 changes: 6 additions & 87 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package flixel;

import openfl.Lib;
import openfl.display.DisplayObject;
import openfl.display.Stage;
import openfl.display.StageDisplayState;
import openfl.net.URLRequest;
import flixel.effects.postprocess.PostProcess;
import flixel.math.FlxMath;
import flixel.math.FlxRandom;
import flixel.math.FlxRect;
Expand All @@ -28,6 +22,11 @@ import flixel.system.scaleModes.RatioScaleMode;
import flixel.util.FlxCollision;
import flixel.util.FlxSave;
import flixel.util.typeLimit.NextState;
import openfl.Lib;
import openfl.display.DisplayObject;
import openfl.display.Stage;
import openfl.display.StageDisplayState;
import openfl.net.URLRequest;
#if FLX_TOUCH
import flixel.input.touch.FlxTouchManager;
#end
Expand All @@ -49,12 +48,6 @@ import flixel.input.FlxAccelerometer;
#if FLX_POINTER_INPUT
import flixel.input.FlxSwipe;
#end
#if FLX_POST_PROCESS
import flixel.util.FlxDestroyUtil;
import openfl.display.OpenGLView;

using flixel.util.FlxArrayUtil;
#end

#if html5
import flixel.system.frontEnds.HTML5FrontEnd;
Expand Down Expand Up @@ -508,62 +501,6 @@ class FlxG
return child;
}

public static function addPostProcess(postProcess:PostProcess):PostProcess
{
#if FLX_POST_PROCESS
if (OpenGLView.isSupported)
{
var postProcesses = game.postProcesses;

// chaining
var length = postProcesses.length;
if (length > 0)
{
postProcesses[length - 1].to = postProcess;
}

game.postProcessLayer.addChild(postProcess);
postProcesses.push(postProcess);
}
else
{
FlxG.log.error("Shaders are not supported on this platform.");
}
#end

return postProcess;
}

public static function removePostProcess(postProcess:PostProcess):Void
{
#if FLX_POST_PROCESS
var postProcesses = game.postProcesses;
if (postProcesses.remove(postProcess))
{
chainPostProcesses();
postProcess.to = null;

FlxDestroyUtil.removeChild(game.postProcessLayer, postProcess);
}
#end
}

#if FLX_POST_PROCESS
static function chainPostProcesses():Void
{
var postProcesses = game.postProcesses;

if (postProcesses.length > 0)
{
for (i in 0...postProcesses.length - 1)
{
postProcesses[i].to = postProcesses[i + 1];
}
postProcesses.last().to = null;
}
}
#end

/**
* Opens a web page, by default a new tab or window. If the URL does not
* already start with `"http://"` or `"https://"`, it gets added automatically.
Expand Down Expand Up @@ -640,31 +577,13 @@ class FlxG

static function initRenderMethod():Void
{
renderMethod = BLITTING;

#if (!lime_legacy && !flash)
#if (lime >= "7.0.0")
#if !flash
renderMethod = switch (stage.window.context.type)
{
case OPENGL, OPENGLES, WEBGL: DRAW_TILES;
default: BLITTING;
}
#else
if (!Lib.application.config.windows[0].hardware)
{
renderMethod = BLITTING;
}
else
{
renderMethod = switch (stage.window.renderer.type)
{
case OPENGL, CONSOLE: DRAW_TILES;
case CANVAS, FLASH, CAIRO: BLITTING;
default: BLITTING;
}
}
#end
#else
#if web
renderMethod = BLITTING;
#else
Expand Down
68 changes: 0 additions & 68 deletions flixel/FlxGame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import openfl.filters.BitmapFilter;
#if desktop
import openfl.events.FocusEvent;
#end
#if FLX_POST_PROCESS
import flixel.effects.postprocess.PostProcess;
import openfl.display.OpenGLView;
#end
#if FLX_DEBUG
import flixel.system.debug.FlxDebugger;
#end
Expand Down Expand Up @@ -148,14 +144,6 @@ class FlxGame extends Sprite
*/
var _filters:Array<BitmapFilter>;

#if (desktop && lime_legacy)
/**
* Ugly workaround to ensure consistent behaviour between flash and cpp
* (the focus event should not fire when the game starts up!)
*/
var _onFocusFiredOnce:Bool = false;
#end

#if FLX_FOCUS_LOST_SCREEN
/**
* The "focus lost" screen.
Expand Down Expand Up @@ -229,18 +217,6 @@ class FlxGame extends Sprite
var _recordingRequested:Bool = false;
#end

#if FLX_POST_PROCESS
/**
* `Sprite` for postprocessing effects
*/
var postProcessLayer:Sprite = new Sprite();

/**
* Post process effects active on the `postProcessLayer`.
*/
var postProcesses:Array<PostProcess> = [];
#end

/**
* Instantiate a new game object.
*
Expand Down Expand Up @@ -329,11 +305,6 @@ class FlxGame extends Sprite

addChild(_inputContainer);

#if FLX_POST_PROCESS
if (OpenGLView.isSupported)
addChild(postProcessLayer);
#end

// Creating the debugger overlay
#if FLX_DEBUG
debugger = new FlxDebugger(FlxG.stage.stageWidth, FlxG.stage.stageHeight);
Expand All @@ -355,13 +326,8 @@ class FlxGame extends Sprite
#end

// Focus gained/lost monitoring
#if (desktop && openfl <= "4.0.0")
stage.addEventListener(FocusEvent.FOCUS_OUT, onFocusLost);
stage.addEventListener(FocusEvent.FOCUS_IN, onFocus);
#else
stage.addEventListener(Event.DEACTIVATE, onFocusLost);
stage.addEventListener(Event.ACTIVATE, onFocus);
#end

// Instantiate the initial state
resetGame();
Expand Down Expand Up @@ -390,15 +356,6 @@ class FlxGame extends Sprite
return; // Don't run this function twice (bug in standalone flash player)
#end

#if (desktop && lime_legacy)
// make sure the on focus event doesn't fire on startup
if (!_onFocusFiredOnce)
{
_onFocusFiredOnce = true;
return;
}
#end

#if mobile
// just check if device orientation has been changed
onResize(_);
Expand Down Expand Up @@ -429,11 +386,6 @@ class FlxGame extends Sprite

function onFocusLost(event:Event):Void
{
#if next
if (event != null && event.target != FlxG.stage)
return;
#end

#if flash
if (_lostFocus)
return; // Don't run this function twice (bug in standalone flash player)
Expand Down Expand Up @@ -468,11 +420,6 @@ class FlxGame extends Sprite
var width:Int = FlxG.stage.stageWidth;
var height:Int = FlxG.stage.stageHeight;

#if !flash
if (FlxG.renderTile)
FlxG.bitmap.onContext();
#end

resizeGame(width, height);
}

Expand All @@ -498,11 +445,6 @@ class FlxGame extends Sprite
if (soundTray != null)
soundTray.screenCenter();
#end

#if FLX_POST_PROCESS
for (postProcess in postProcesses)
postProcess.rebuild();
#end
}

/**
Expand Down Expand Up @@ -737,11 +679,6 @@ class FlxGame extends Sprite

updateInput();

#if FLX_POST_PROCESS
if (postProcesses[0] != null)
postProcesses[0].update(FlxG.elapsed);
#end

#if FLX_SOUND_SYSTEM
FlxG.sound.update(FlxG.elapsed);
#end
Expand Down Expand Up @@ -857,11 +794,6 @@ class FlxGame extends Sprite
if (FlxG.renderTile)
FlxDrawBaseItem.drawCalls = 0;

#if FLX_POST_PROCESS
if (postProcesses[0] != null)
postProcesses[0].capture();
#end

FlxG.cameras.lock();

if (FlxG.plugins.drawOnTop)
Expand Down
Loading
Loading