Skip to content

Commit

Permalink
lowercase args
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Aug 10, 2023
1 parent 9b976cc commit 34a0e6f
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 179 deletions.
156 changes: 78 additions & 78 deletions flixel/FlxG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -331,26 +331,26 @@ class FlxG
/**
* Resizes the game within the window by reapplying the current scale mode.
*/
public static inline function resizeGame(Width:Int, Height:Int):Void
public static inline function resizeGame(width:Int, height:Int):Void
{
scaleMode.onMeasure(Width, Height);
scaleMode.onMeasure(width, height);
}

/**
* Resizes the window. Only works on desktop targets (Neko, Windows, Linux, Mac).
*/
public static function resizeWindow(Width:Int, Height:Int):Void
public static function resizeWindow(width:Int, height:Int):Void
{
#if desktop
#if openfl_legacy
stage.resize(Width, Height);
stage.resize(width, height);
#else
#if air
var window = flash.desktop.NativeApplication.nativeApplication.activeWindow;
window.width = Width;
window.height = Height;
window.width = width;
window.height = height;
#else
Lib.application.window.resize(Width, Height);
Lib.application.window.resize(width, height);
#end
#end
#end
Expand Down Expand Up @@ -404,31 +404,31 @@ class FlxG
* NOTE: this takes the entire area of `FlxTilemap`s into account (including "empty" tiles).
* Use `FlxTilemap#overlaps()` if you don't want that.
*
* @param ObjectOrGroup1 The first object or group you want to check.
* @param ObjectOrGroup2 The second object or group you want to check. If it is the same as the first,
* Flixel knows to just do a comparison within that group.
* @param NotifyCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* @param ProcessCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* If a `ProcessCallback` is provided, then `NotifyCallback`
* will only be called if `ProcessCallback` returns true for those objects!
* @param objectOrGroup1 The first object or group you want to check.
* @param objectOrGroup2 The second object or group you want to check. If it is the same as the first,
* Flixel knows to just do a comparison within that group.
* @param notifyCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* @param processCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* If a `ProcessCallback` is provided, then `NotifyCallback`
* will only be called if `ProcessCallback` returns true for those objects!
* @return Whether any overlaps were detected.
*/
public static function overlap(?ObjectOrGroup1:FlxBasic, ?ObjectOrGroup2:FlxBasic, ?NotifyCallback:Dynamic->Dynamic->Void,
?ProcessCallback:Dynamic->Dynamic->Bool):Bool
public static function overlap(?objectOrGroup1:FlxBasic, ?objectOrGroup2:FlxBasic, ?notifyCallback:Dynamic->Dynamic->Void,
?processCallback:Dynamic->Dynamic->Bool):Bool
{
if (ObjectOrGroup1 == null)
ObjectOrGroup1 = state;
if (ObjectOrGroup2 == ObjectOrGroup1)
ObjectOrGroup2 = null;
if (objectOrGroup1 == null)
objectOrGroup1 = state;
if (objectOrGroup2 == objectOrGroup1)
objectOrGroup2 = null;

FlxQuadTree.divisions = worldDivisions;
var quadTree = FlxQuadTree.recycle(worldBounds.x, worldBounds.y, worldBounds.width, worldBounds.height);
quadTree.load(ObjectOrGroup1, ObjectOrGroup2, NotifyCallback, ProcessCallback);
var result:Bool = quadTree.execute();
final quadTree = FlxQuadTree.recycle(worldBounds.x, worldBounds.y, worldBounds.width, worldBounds.height);
quadTree.load(objectOrGroup1, objectOrGroup2, notifyCallback, processCallback);
final result:Bool = quadTree.execute();
quadTree.destroy();
return result;
}
Expand All @@ -439,17 +439,17 @@ class FlxG
* pixel perfect match on the intersecting area. Works with rotated and animated sprites.
* May be slow, so use it sparingly.
*
* @param Sprite1 The first `FlxSprite` to test against.
* @param Sprite2 The second `FlxSprite` to test again, sprite order is irrelevant.
* @param AlphaTolerance The tolerance value above which alpha pixels are included.
* Default to `255` (must be fully opaque for collision).
* @param Camera If the collision is taking place in a camera other than
* @param sprite1 The first `FlxSprite` to test against.
* @param sprite2 The second `FlxSprite` to test again, sprite order is irrelevant.
* @param alphaTolerance The tolerance value above which alpha pixels are included.
* Default to `255` (must be fully opaque for collision).
* @param camera If the collision is taking place in a camera other than
* `FlxG.camera` (the default/current) then pass it here.
* @return Whether the sprites collide
*/
public static inline function pixelPerfectOverlap(Sprite1:FlxSprite, Sprite2:FlxSprite, AlphaTolerance:Int = 255, ?Camera:FlxCamera):Bool
public static inline function pixelPerfectOverlap(sprite1:FlxSprite, sprite2:FlxSprite, alphaTolerance = 255, ?camera:FlxCamera):Bool
{
return FlxCollision.pixelPerfectCheck(Sprite1, Sprite2, AlphaTolerance, Camera);
return FlxCollision.pixelPerfectCheck(sprite1, sprite2, alphaTolerance, camera);
}

/**
Expand All @@ -462,48 +462,48 @@ class FlxG
* To create your own collision logic, write your own `ProcessCallback` and use `FlxG.overlap` to set it up.
* NOTE: does NOT take objects' `scrollFactor` into account, all overlaps are checked in world space.
*
* @param ObjectOrGroup1 The first object or group you want to check.
* @param ObjectOrGroup2 The second object or group you want to check. If it is the same as the first,
* Flixel knows to just do a comparison within that group.
* @param NotifyCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* @param objectOrGroup1 The first object or group you want to check.
* @param objectOrGroup2 The second object or group you want to check. If it is the same as the first,
* Flixel knows to just do a comparison within that group.
* @param notifyCallback A function with two `FlxObject` parameters -
* e.g. `onOverlap(object1:FlxObject, object2:FlxObject)` -
* that is called if those two objects overlap.
* @return Whether any objects were successfully collided/separated.
*/
public static inline function collide(?ObjectOrGroup1:FlxBasic, ?ObjectOrGroup2:FlxBasic, ?NotifyCallback:Dynamic->Dynamic->Void):Bool
public static inline function collide(?objectOrGroup1:FlxBasic, ?objectOrGroup2:FlxBasic, ?notifyCallback:Dynamic->Dynamic->Void):Bool
{
return overlap(ObjectOrGroup1, ObjectOrGroup2, NotifyCallback, FlxObject.separate);
return overlap(objectOrGroup1, objectOrGroup2, notifyCallback, FlxObject.separate);
}

/**
* Regular `DisplayObject`s are normally displayed over the Flixel cursor and the Flixel debugger if simply
* added to `stage`. This function simplifies things by adding a `DisplayObject` directly below mouse level.
*
* @param Child The `DisplayObject` to add
* @param IndexModifier Amount to add to the index - makes sure the index stays within bounds.
* @param child The `DisplayObject` to add
* @param indexModifier Amount to add to the index - makes sure the index stays within bounds.
* @return The added `DisplayObject`
*/
public static function addChildBelowMouse<T:DisplayObject>(Child:T, IndexModifier:Int = 0):T
public static function addChildBelowMouse<T:DisplayObject>(child:T, indexModifier = 0):T
{
var index = game.getChildIndex(game._inputContainer);
var max = game.numChildren;

index = FlxMath.maxAdd(index, IndexModifier, max);
game.addChildAt(Child, index);
return Child;
index = FlxMath.maxAdd(index, indexModifier, max);
game.addChildAt(child, index);
return child;
}

/**
* Removes a child from the Flixel display list, if it is part of it.
*
* @param Child The `DisplayObject` to add
* @param child The `DisplayObject` to add
* @return The removed `DisplayObject`
*/
public static inline function removeChild<T:DisplayObject>(Child:T):T
public static inline function removeChild<T:DisplayObject>(child:T):T
{
if (game.contains(Child))
game.removeChild(Child);
return Child;
if (game.contains(child))
game.removeChild(child);
return child;
}

public static function addPostProcess(postProcess:PostProcess):PostProcess
Expand Down Expand Up @@ -566,27 +566,27 @@ class FlxG
* 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.
*
* @param URL The address of the web page.
* @param Target `"_blank"`, `"_self"`, `"_parent"` or `"_top"`
* @param url The address of the web page.
* @param target `"_blank"`, `"_self"`, `"_parent"` or `"_top"`
*/
public static inline function openURL(URL:String, Target:String = "_blank"):Void
public static inline function openURL(url:String, target = "_blank"):Void
{
var prefix:String = "";
var prefix = "";
// if the URL does not already start with "http://" or "https://", add it.
if (!~/^https?:\/\//.match(URL))
if (!~/^https?:\/\//.match(url))
prefix = "http://";
Lib.getURL(new URLRequest(prefix + URL), Target);
Lib.getURL(new URLRequest(prefix + url), target);
}

/**
* Called by `FlxGame` to set up `FlxG` during `FlxGame`'s constructor.
*/
@:allow(flixel.FlxGame.new)
static function init(Game:FlxGame, Width:Int, Height:Int):Void
static function init(game:FlxGame, width:Int, height:Int):Void
{
game = Game;
width = Std.int(Math.abs(Width));
height = Std.int(Math.abs(Height));
FlxG.game = game;
FlxG.width = width = Std.int(Math.abs(width));
FlxG.height = height = Std.int(Math.abs(height));

initRenderMethod();

Expand Down Expand Up @@ -714,11 +714,11 @@ class FlxG
worldDivisions = 6;
}

static function set_scaleMode(ScaleMode:BaseScaleMode):BaseScaleMode
static function set_scaleMode(value:BaseScaleMode):BaseScaleMode
{
scaleMode = ScaleMode;
scaleMode = value;
game.onResize(null);
return ScaleMode;
return value;
}

#if FLX_MOUSE
Expand All @@ -741,28 +741,28 @@ class FlxG
}
#end

static function set_updateFramerate(Framerate:Int):Int
static function set_updateFramerate(value:Int):Int
{
if (Framerate < drawFramerate)
if (value < drawFramerate)
log.warn("FlxG.framerate: the game's framerate shouldn't be smaller than the flash framerate," + " since it can stop your game from updating.");

updateFramerate = Framerate;
updateFramerate = value;

game._stepMS = Math.abs(1000 / Framerate);
game._stepMS = Math.abs(1000 / value);
game._stepSeconds = game._stepMS / 1000;

if (game._maxAccumulation < game._stepMS)
game._maxAccumulation = game._stepMS;

return Framerate;
return value;
}

static function set_drawFramerate(Framerate:Int):Int
static function set_drawFramerate(value:Int):Int
{
if (Framerate > updateFramerate)
if (value > updateFramerate)
log.warn("FlxG.drawFramerate: the update framerate shouldn't be smaller than the draw framerate," + " since it can stop your game from updating.");

drawFramerate = Std.int(Math.abs(Framerate));
drawFramerate = Std.int(Math.abs(value));

if (game.stage != null)
game.stage.frameRate = drawFramerate;
Expand All @@ -772,18 +772,18 @@ class FlxG
if (game._maxAccumulation < game._stepMS)
game._maxAccumulation = game._stepMS;

return Framerate;
return value;
}

static function get_fullscreen():Bool
{
return stage.displayState == StageDisplayState.FULL_SCREEN || stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

static function set_fullscreen(Value:Bool):Bool
static function set_fullscreen(value:Bool):Bool
{
stage.displayState = Value ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
return Value;
stage.displayState = value ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
return value;
}

static inline function get_stage():Stage
Expand Down
24 changes: 12 additions & 12 deletions flixel/tile/FlxTile.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,24 @@ class FlxTile extends FlxObject
/**
* Instantiate this new tile object. This is usually called from FlxTilemap.loadMap().
*
* @param Tilemap A reference to the tilemap object creating the tile.
* @param Index The actual core map data index for this tile type.
* @param Width The width of the tile.
* @param Height The height of the tile.
* @param Visible Whether the tile is visible or not.
* @param AllowCollisions The collision flags for the object. By default this value is ANY or NONE depending on the parameters sent to loadMap().
* @param tilemap A reference to the tilemap object creating the tile.
* @param index The actual core map data index for this tile type.
* @param width The width of the tile.
* @param height The height of the tile.
* @param visible Whether the tile is visible or not.
* @param allowCollisions The collision flags for the object. By default this value is ANY or NONE depending on the parameters sent to loadMap().
*/
public function new(Tilemap:FlxTilemap, Index:Int, Width:Float, Height:Float, Visible:Bool, AllowCollisions:FlxDirectionFlags)
public function new(tilemap:FlxTilemap, index:Int, width:Float, height:Float, visible:Bool, allowCollisions:FlxDirectionFlags)
{
super(0, 0, Width, Height);
super(0, 0, width, height);

immovable = true;
moves = false;

tilemap = Tilemap;
index = Index;
visible = Visible;
allowCollisions = AllowCollisions;
this.tilemap = tilemap;
this.index = index;
this.visible = visible;
this.allowCollisions = allowCollisions;
}

/**
Expand Down
Loading

0 comments on commit 34a0e6f

Please sign in to comment.