Skip to content

Commit

Permalink
Reworked anti-aliasing code (sprites now default to true)
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Jun 25, 2023
1 parent 2cae781 commit 0fac918
Show file tree
Hide file tree
Showing 25 changed files with 13 additions and 48 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,6 @@
"target": "html5",
"args": ["-debug", "-watch"]
}
]
],
"cmake.configureOnOpen": false
}
2 changes: 0 additions & 2 deletions source/funkin/Alphabet.hx
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ class AlphaCharacter extends FlxSprite
super(x, y);
var tex = Paths.getSparrowAtlas('alphabet');
frames = tex;

antialiasing = true;
}

public function createBold(letter:String)
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/ComboMilestone.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ComboMilestone extends FlxTypedSpriteGroup<FlxSprite>
effectStuff.frames = Paths.getSparrowAtlas('comboMilestone');
effectStuff.animation.addByPrefix('funny', 'NOTE COMBO animation', 24, false);
effectStuff.animation.play('funny');
effectStuff.antialiasing = true;
effectStuff.animation.finishCallback = function(nameThing) {
kill();
};
Expand Down Expand Up @@ -108,7 +107,6 @@ class ComboMilestoneNumber extends FlxSprite
frames = Paths.getSparrowAtlas('comboMilestoneNumbers');
animation.addByPrefix(stringNum, stringNum, 24, false);
animation.play(stringNum);
antialiasing = true;
updateHitbox();
}

Expand Down
1 change: 0 additions & 1 deletion source/funkin/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ class FreeplayState extends MusicBeatSubState
fnfHighscoreSpr.animation.addByPrefix("highscore", "highscore", 24, false);
fnfHighscoreSpr.visible = false;
fnfHighscoreSpr.setGraphicSize(0, Std.int(fnfHighscoreSpr.height * 1));
fnfHighscoreSpr.antialiasing = true;
fnfHighscoreSpr.updateHitbox();
add(fnfHighscoreSpr);

Expand Down
14 changes: 5 additions & 9 deletions source/funkin/InitState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ class InitState extends FlxTransitionableState
{
override public function create():Void
{
trace('This is a debug build, loading InitState...');
#if android
FlxG.android.preventDefaultKeys = [flixel.input.android.FlxAndroidKey.BACK];
#end
#if newgrounds
NGio.init();
#end
#if discord_rpc
DiscordClient.initialize();
//
// FLIXEL SETUP
//
// This ain't a pixel art game! (most of the time)
FlxSprite.defaultAntialiasing = true;

Application.current.onExit.add(function(exitCode) {
DiscordClient.shutdown();
Expand Down
1 change: 0 additions & 1 deletion source/funkin/LoadingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class LoadingState extends MusicBeatState
funkay.loadGraphic(Paths.image('funkay'));
funkay.setGraphicSize(0, FlxG.height);
funkay.updateHitbox();
funkay.antialiasing = true;
add(funkay);
funkay.scrollFactor.set();
funkay.screenCenter();
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class MainMenuState extends MusicBeatState
bg.setGraphicSize(Std.int(bg.width * 1.2));
bg.updateHitbox();
bg.screenCenter();
bg.antialiasing = true;
add(bg);

camFollow = new FlxObject(0, 0, 1, 1);
Expand All @@ -82,7 +81,6 @@ class MainMenuState extends MusicBeatState
magenta.x = bg.x;
magenta.y = bg.y;
magenta.visible = false;
magenta.antialiasing = true;
magenta.color = 0xFFfd719b;
if (PreferencesMenu.preferences.get('flashing-menu')) add(magenta);
// magenta.scrollFactor.set();
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/NoteSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class NoteSplash extends FlxSprite

setupNoteSplash(x, y, noteData);

antialiasing = true;

// alpha = 0.75;
}

Expand Down
4 changes: 0 additions & 4 deletions source/funkin/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class TitleState extends MusicBeatState

logoBl = new FlxSprite(-150, -100);
logoBl.frames = Paths.getSparrowAtlas('logoBumpin');
logoBl.antialiasing = true;
logoBl.animation.addByPrefix('bump', 'logo bumpin', 24);
logoBl.animation.play('bump');

Expand All @@ -161,7 +160,6 @@ class TitleState extends MusicBeatState
gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle');
gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false);
gfDance.antialiasing = true;

add(gfDance);

Expand All @@ -180,7 +178,6 @@ class TitleState extends MusicBeatState
titleText.frames = Paths.getSparrowAtlas('titleEnter');
titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24);
titleText.animation.addByPrefix('press', "ENTER PRESSED", 24);
titleText.antialiasing = true;
titleText.animation.play('idle');
titleText.updateHitbox();
// titleText.screenCenter(X);
Expand Down Expand Up @@ -223,7 +220,6 @@ class TitleState extends MusicBeatState

ngSpr.updateHitbox();
ngSpr.screenCenter(X);
ngSpr.antialiasing = true;

FlxG.mouse.visible = false;

Expand Down
1 change: 0 additions & 1 deletion source/funkin/freeplayStuff/FreeplayScore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class ScoreNum extends FlxSprite
this.digit = initDigit;

animation.play(numToString[digit], true);
antialiasing = true;

setGraphicSize(Std.int(width * 0.4));
updateHitbox();
Expand Down
1 change: 0 additions & 1 deletion source/funkin/freeplayStuff/SongMenuItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class SongMenuItem extends FlxSpriteGroup
favIcon.frames = Paths.getSparrowAtlas('freeplay/favHeart');
favIcon.animation.addByPrefix('fav', "favorite heart", 24, false);
favIcon.animation.play('fav');
favIcon.antialiasing = true;
favIcon.setGraphicSize(60, 60);
add(favIcon);

Expand Down
2 changes: 0 additions & 2 deletions source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class FlxAtlasSprite extends FlxAnimate
throw 'FlxAtlasSprite not initialized properly. Are you sure the path (${path}) exists?';
}

this.antialiasing = true;

onAnimationFinish.add(cleanupAnimation);

// This defaults the sprite to play the first animation in the atlas,
Expand Down
7 changes: 0 additions & 7 deletions source/funkin/play/ResultState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class ResultState extends MusicBeatSubState
soundSystem.animation.play("idle");
soundSystem.visible = true;
});
soundSystem.antialiasing = true;
add(soundSystem);

difficulty = new FlxSprite(555);
Expand All @@ -132,7 +131,6 @@ class ResultState extends MusicBeatSubState
}

difficulty.loadGraphic(Paths.image("resultScreen/" + diffSpr));
difficulty.antialiasing = true;
add(difficulty);

var fontLetters:String = "AaBbCcDdEeFfGgHhiIJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz:1234567890";
Expand All @@ -148,7 +146,6 @@ class ResultState extends MusicBeatSubState
songName.text += PlayState.instance.currentSong.songId;
}

songName.antialiasing = true;
songName.letterSpacing = -15;
songName.angle = -4.1;
add(songName);
Expand All @@ -164,22 +161,18 @@ class ResultState extends MusicBeatSubState
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
blackTopBar.y = -blackTopBar.height;
FlxTween.tween(blackTopBar, {y: 0}, 0.4, {ease: FlxEase.quartOut, startDelay: 0.5});
blackTopBar.antialiasing = true;
add(blackTopBar);

var resultsAnim:FlxSprite = new FlxSprite(-200, -10);
resultsAnim.frames = Paths.getSparrowAtlas("resultScreen/results");
resultsAnim.animation.addByPrefix("result", "results", 24, false);
resultsAnim.animation.play("result");
resultsAnim.antialiasing = true;
add(resultsAnim);

var ratingsPopin:FlxSprite = new FlxSprite(-150, 120);
ratingsPopin.frames = Paths.getSparrowAtlas("resultScreen/ratingsPopin");
ratingsPopin.animation.addByPrefix("idle", "Categories", 24, false);
// ratingsPopin.animation.play("idle");
ratingsPopin.visible = false;
ratingsPopin.antialiasing = true;
add(ratingsPopin);

var scorePopin:FlxSprite = new FlxSprite(-180, 520);
Expand Down
1 change: 0 additions & 1 deletion source/funkin/play/notes/NoteSplash.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class NoteSplash extends FlxSprite
setup();

this.alpha = ALPHA;
this.antialiasing = true;
this.animation.finishCallback = this.onAnimationFinished;
}

Expand Down
1 change: 0 additions & 1 deletion source/funkin/play/notes/NoteSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class NoteSprite extends FlxSprite

setGraphicSize(Strumline.STRUMLINE_SIZE);
updateHitbox();
antialiasing = true;
}

public override function revive():Void
Expand Down
2 changes: 0 additions & 2 deletions source/funkin/play/notes/StrumlineNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ class StrumlineNote extends FlxSprite
this.animation.addByIndices('confirm-hold', 'right confirm', [2, 3, 4, 5], '', 24, true, false, false);
}

this.antialiasing = true;

this.setGraphicSize(Std.int(Strumline.STRUMLINE_SIZE * 1.55));
this.updateHitbox();
this.playStatic();
Expand Down
2 changes: 2 additions & 0 deletions source/funkin/play/notes/SustainTrail.hx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class SustainTrail extends FlxSprite
super(0, 0, fileName);

antialiasing = true;

// TODO: Why does this reference pixel stuff?
if (fileName == "arrowEnds")
{
endOffset = bottomClip = 1;
Expand Down
1 change: 0 additions & 1 deletion source/funkin/ui/AtlasText.hx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class AtlasChar extends FlxSprite
super(x, y);
frames = atlas;
this.char = char;
antialiasing = true;
}

function set_char(value:String)
Expand Down
1 change: 0 additions & 1 deletion source/funkin/ui/ColorsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class ColorsMenu extends Page
add(_effectSpr);
_effectSpr.y = 0;
_effectSpr.x = i * 130;
_effectSpr.antialiasing = true;
_effectSpr.scale.x = _effectSpr.scale.y = 0.7;
// _effectSpr.setGraphicSize();
_effectSpr.height = note.height;
Expand Down
1 change: 0 additions & 1 deletion source/funkin/ui/MenuList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ class MenuItem extends FlxSprite
{
super(x, y);

antialiasing = true;
setData(name, callback);
idle();
}
Expand Down
5 changes: 4 additions & 1 deletion source/funkin/ui/PopUpStuff.hx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
if (PlayState.instance.currentStageId.startsWith('school'))
{
rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7));
rating.antialiasing = false;
}
else
{
Expand Down Expand Up @@ -95,6 +96,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
if (PlayState.instance.currentStageId.startsWith('school'))
{
comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7));
comboSpr.antialiasing = false;
}
else
{
Expand Down Expand Up @@ -134,11 +136,12 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
if (PlayState.instance.currentStageId.startsWith('school'))
{
numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE));
numScore.antialiasing = false;
}
else
{
numScore.antialiasing = true;
numScore.setGraphicSize(Std.int(numScore.width * 0.5));
numScore.antialiasing = true;
}
numScore.updateHitbox();

Expand Down
2 changes: 0 additions & 2 deletions source/funkin/ui/PreferencesMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ class CheckboxThingie extends FlxSprite
animation.addByPrefix('static', 'Check Box unselected', 24, false);
animation.addByPrefix('checked', 'Check Box selecting animation', 24, false);

antialiasing = true;

setGraphicSize(Std.int(width * 0.7));
updateHitbox();

Expand Down
1 change: 0 additions & 1 deletion source/funkin/ui/StickerSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ class StickerSprite extends FlxSprite
super(x, y);
loadGraphic(Paths.image('transitionSwag/' + stickerSet + '/' + stickerName));
updateHitbox();
antialiasing = true;
scrollFactor.set();
}
}
Expand Down
1 change: 0 additions & 1 deletion source/funkin/ui/TallyCounter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class TallyNumber extends FlxSprite
animation.addByPrefix(Std.string(i), i + " small", 24, false);

animation.play(Std.string(digit));
antialiasing = true;
updateHitbox();
}
}
1 change: 0 additions & 1 deletion source/funkin/ui/animDebugShit/DebugBoundingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class DebugBoundingState extends FlxState
addInfo('Width', bf.width);
addInfo('Height', bf.height);

swagOutlines.antialiasing = true;
spriteSheetView.add(swagOutlines);

FlxG.stage.window.onDropFile.add(function(path:String) {
Expand Down

0 comments on commit 0fac918

Please sign in to comment.