Skip to content

Commit

Permalink
Antialiasing Option!
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed Jul 6, 2024
1 parent bc132f5 commit 150a9f9
Show file tree
Hide file tree
Showing 31 changed files with 142 additions and 132 deletions.
2 changes: 1 addition & 1 deletion source/Alphabet.hx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class AlphaCharacter extends FlxSprite
var tex = Paths.getSparrowAtlas('ui/alphabet');
frames = tex;

antialiasing = true;
antialiasing = FlxG.save.data.antialiasing;
}
public function createBoldLetter(letter:String)
{
Expand Down
3 changes: 2 additions & 1 deletion source/BGSprite.hx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package;
import flixel.FlxG;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.FlxSprite;
import sys.io.File;
Expand Down Expand Up @@ -60,7 +61,7 @@ class BGSprite extends FlxSprite
}
}
}
this.antialiasing = antialiasing;
this.antialiasing = this.antialiasing ? FlxG.save.data.antialiasing : antialiasing;
scrollFactor.set(scrollX, scrollY);
this.active = active;
}
Expand Down
14 changes: 7 additions & 7 deletions source/ChangeKeybinds.hx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ChangeKeybinds extends MusicBeatState
tutorial.screenCenter(X);
tutorial.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
tutorial.borderSize = 2;
tutorial.antialiasing = true;
tutorial.antialiasing = FlxG.save.data.antialiasing;
add(tutorial);

createPresetUI();
Expand Down Expand Up @@ -285,7 +285,7 @@ class ChangeKeybinds extends MusicBeatState
var control:FlxText = new FlxText((FlxG.width / 2) - textx, (preset.y + 125) + (order * 100), 0, uiControl.uiName + ":", 32);
control.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER);
control.borderSize = 2;
control.antialiasing = true;
control.antialiasing = FlxG.save.data.antialiasing;
add(control);

controlTexts.push(control);
Expand All @@ -305,7 +305,7 @@ class ChangeKeybinds extends MusicBeatState
keybind.y = control.y;
keybind.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER);
keybind.borderSize = 2;
keybind.antialiasing = true;
keybind.antialiasing = FlxG.save.data.antialiasing;
add(keybind);

keybindTexts.add(keybind);
Expand All @@ -323,30 +323,30 @@ class ChangeKeybinds extends MusicBeatState
choosePreset.screenCenter(X);
choosePreset.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
choosePreset.borderSize = 2;
choosePreset.antialiasing = true;
choosePreset.antialiasing = FlxG.save.data.antialiasing;
keybindPresetGroup.add(choosePreset);
add(choosePreset);

preset = new FlxText(0, choosePreset.y + 75, FlxG.width / 2, keybindPresets[curSelectedPreset], 32);
preset.screenCenter(X);
preset.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
preset.borderSize = 2;
preset.antialiasing = true;
preset.antialiasing = FlxG.save.data.antialiasing;
add(preset);
keybindPresetGroup.add(preset);
selectableItems.push(preset);

presetLeft = new FlxText(preset.x - arrowOffset, preset.y - preset.textField.height - 2, FlxG.width / 2, "<", 32);
presetLeft.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER);
presetLeft.borderSize = 1;
presetLeft.antialiasing = true;
presetLeft.antialiasing = FlxG.save.data.antialiasing;
keybindPresetGroup.add(presetLeft);
add(presetLeft);

presetRight = new FlxText(preset.x + arrowOffset, preset.y - preset.textField.height - 2, FlxG.width / 2, ">", 32);
presetRight.setFormat("Comic Sans MS Bold", 32, FlxColor.WHITE, CENTER);
presetRight.borderSize = 1;
presetRight.antialiasing = true;
presetRight.antialiasing = FlxG.save.data.antialiasing;
keybindPresetGroup.add(presetRight);
add(presetRight);

Expand Down
6 changes: 3 additions & 3 deletions source/ChangeLanguageState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class ChangeLanguageState extends MusicBeatState
menuBG.color = 0xFFea71fd;
menuBG.setGraphicSize(Std.int(menuBG.width * 1.1));
menuBG.updateHitbox();
menuBG.antialiasing = true;
menuBG.antialiasing = FlxG.save.data.antialiasing;
menuBG.loadGraphic(MainMenuState.randomizeBG());
add(menuBG);

var helper:FlxText = new FlxText(0, 150, FlxG.width, "Select a language", 40);
helper.setFormat("Comic Sans MS Bold", 60, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
helper.antialiasing = true;
helper.antialiasing = FlxG.save.data.antialiasing;
helper.borderSize = 3;
helper.screenCenter(X);
add(helper);
Expand All @@ -53,7 +53,7 @@ class ChangeLanguageState extends MusicBeatState

var text:FlxText = new FlxText(0, 350 + (i * 75), FlxG.width, curLanguage.langaugeName, 40);
text.setFormat("Comic Sans MS Bold", 30, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE);
text.antialiasing = true;
text.antialiasing = FlxG.save.data.antialiasing;
text.screenCenter(X);
add(text);
languageTextGroup.add(text);
Expand Down
4 changes: 2 additions & 2 deletions source/Character.hx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Character extends FlxSprite
skins.set('recursed', 'bf-recursed');
skins.set('gfSkin', 'gf-none');

antialiasing = true;
antialiasing = FlxG.save.data.antialiasing;

switch (curCharacter)
{
Expand Down Expand Up @@ -1292,7 +1292,7 @@ class Character extends FlxSprite

nativelyPlayable = jsonCustom.nativelyPlayable;

antialiasing = jsonCustom.antialiasing;
antialiasing = jsonCustom.antialiasing ? FlxG.save.data.antialiasing : jsonCustom.antialiasing;

if (!jsonCustom.iconAntialiasing) {
HealthIcon.noAaChars.push(curCharacter);
Expand Down
18 changes: 9 additions & 9 deletions source/CharacterSelectState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class CharacterSelectState extends MusicBeatState
//create BG

var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('backgrounds/shared/sky_night'));
bg.antialiasing = true;
bg.antialiasing = FlxG.save.data.antialiasing;
bg.scrollFactor.set(0.75, 0.75);
bg.active = false;

Expand Down Expand Up @@ -317,7 +317,7 @@ class CharacterSelectState extends MusicBeatState
legs.frames = Paths.getSparrowAtlas('characters/shaggy_god', 'shared');
legs.animation.addByPrefix('legs', "solo_legs", 30);
legs.animation.play('legs');
legs.antialiasing = true;
legs.antialiasing = FlxG.save.data.antialiasing;
legs.flipX = true;
legs.updateHitbox();
legs.offset.set(legs.frameWidth / 2, 10);
Expand Down Expand Up @@ -351,7 +351,7 @@ class CharacterSelectState extends MusicBeatState
characterText.borderSize = 5;
characterText.screenCenter(X);
characterText.cameras = [camHUD];
characterText.antialiasing = true;
characterText.antialiasing = FlxG.save.data.antialiasing;
characterText.y = FlxG.height - 180;
add(characterText);

Expand All @@ -363,34 +363,34 @@ class CharacterSelectState extends MusicBeatState
resetText.y -= resetText.textField.textHeight - 100;
resetText.borderSize = 3;
resetText.cameras = [camHUD];
resetText.antialiasing = true;
resetText.antialiasing = FlxG.save.data.antialiasing;
resetText.visible = false;
add(resetText);

funnyIconMan = new HealthIcon('bf', true);
funnyIconMan.cameras = [camHUD];
funnyIconMan.visible = false;
funnyIconMan.antialiasing = true;
funnyIconMan.antialiasing = FlxG.save.data.antialiasing;
updateIconPosition();
add(funnyIconMan);

var tutorialThing:FlxSprite = new FlxSprite(-110, -30).loadGraphic(Paths.image('ui/charSelectGuide'));
tutorialThing.setGraphicSize(Std.int(tutorialThing.width * 1.5));
tutorialThing.antialiasing = true;
tutorialThing.antialiasing = FlxG.save.data.antialiasing;
tutorialThing.cameras = [camHUD];
add(tutorialThing);

var arrowLeft:FlxSprite = new FlxSprite(10,0).loadGraphic(Paths.image("ui/ArrowLeft_Idle", "preload"));
arrowLeft.screenCenter(Y);
arrowLeft.antialiasing = true;
arrowLeft.antialiasing = FlxG.save.data.antialiasing;
arrowLeft.scrollFactor.set();
arrowLeft.cameras = [camHUD];
arrows[0] = arrowLeft;
add(arrowLeft);

var arrowRight:FlxSprite = new FlxSprite(-5,0).loadGraphic(Paths.image("ui/ArrowRight_Idle", "preload"));
arrowRight.screenCenter(Y);
arrowRight.antialiasing = true;
arrowRight.antialiasing = FlxG.save.data.antialiasing;
arrowRight.x = 1280 - arrowRight.width - 5;
arrowRight.scrollFactor.set();
arrowRight.cameras = [camHUD];
Expand Down Expand Up @@ -433,7 +433,7 @@ class CharacterSelectState extends MusicBeatState
babyArrow.animation.addByPrefix('purple', 'arrowLEFT0');
babyArrow.animation.addByPrefix('red', 'arrowRIGHT0');

babyArrow.antialiasing = true;
babyArrow.antialiasing = FlxG.save.data.antialiasing;
babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7));

babyArrow.x += 160 * 0.7 * i;
Expand Down
2 changes: 1 addition & 1 deletion source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ChartingState extends MusicBeatState
bg.setGraphicSize(Std.int(bg.width * 1.1));
bg.updateHitbox();
bg.screenCenter();
bg.antialiasing = true;
bg.antialiasing = FlxG.save.data.antialiasing;
bg.color = FlxColor.GRAY;
add(bg);

Expand Down
14 changes: 7 additions & 7 deletions source/CreditsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
titleText.borderSize = 3;
titleText.borderQuality = 3;
titleText.screenCenter(X);
titleText.antialiasing = true;
titleText.antialiasing = FlxG.save.data.antialiasing;
titleText.scrollFactor.set(0, 1);
if (DoFunnyScroll)
{
Expand All @@ -563,7 +563,7 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
var textItem:FlxText = new FlxText(0, i * 50, 0, currentPerson.name, 32);
textItem.setFormat(defaultFormat.font, defaultFormat.size, defaultFormat.color, defaultFormat.alignment, defaultFormat.borderStyle, defaultFormat.borderColor);
textItem.screenCenter(X);
textItem.antialiasing = true;
textItem.antialiasing = FlxG.save.data.antialiasing;
textItem.scrollFactor.set(0, 1);

var iconImage:Dynamic = FileSystem.exists(TitleState.modFolder + '/images/credits/icons/Mod Devs/' + currentPerson.name + '.png') ? Paths.customImage(TitleState.modFolder + '/images/credits/icons/Mod Devs/' + currentPerson.name) : Paths.image('credits/icons/' + creditsTypeString + '/' + currentPerson.name);
Expand All @@ -573,7 +573,7 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
add(personIcon);

personIcon.visible = !DoFunnyScroll;
personIcon.antialiasing = currentPerson.antialiasing;
personIcon.antialiasing = currentPerson.antialiasing ? FlxG.save.data.antialiasing : currentPerson.antialiasing;

var creditsTextItem:CreditsText = new CreditsText(textItem, true, personIcon);

Expand Down Expand Up @@ -606,7 +606,7 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
{
var logoBl:FlxSprite = new FlxSprite(StupidCameraFollow.x, StupidCameraFollow.y);
logoBl.frames = Paths.getSparrowAtlas('ui/logoBumpin');
logoBl.antialiasing = true;
logoBl.antialiasing = FlxG.save.data.antialiasing;
logoBl.alpha = 0;
logoBl.x -= logoBl.width / 2;
logoBl.y -= logoBl.height / 2;
Expand Down Expand Up @@ -860,15 +860,15 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
personName.setFormat(selectedFormat.font, selectedFormat.size, selectedFormat.color, selectedFormat.alignment, selectedFormat.borderStyle, selectedFormat.borderColor);
personName.screenCenter(X);
personName.updateHitbox();
personName.antialiasing = true;
personName.antialiasing = FlxG.save.data.antialiasing;
personName.scrollFactor.set();
personName.active = false;

var credits:FlxText = new FlxText(0, personName.y + 50, FlxG.width / 1.25, theCreditsText, 25);
credits.setFormat(selectedFormat.font, selectedFormat.size, selectedFormat.color, selectedFormat.alignment, selectedFormat.borderStyle, selectedFormat.borderColor);
credits.screenCenter(X);
credits.updateHitbox();
credits.antialiasing = true;
credits.antialiasing = FlxG.save.data.antialiasing;
credits.scrollFactor.set();
credits.active = false;

Expand Down Expand Up @@ -916,7 +916,7 @@ if (FileSystem.exists(TitleState.modFolder + '/data/credits.json')) {
discordText.alpha = 0;
discordText.updateHitbox();
discordText.scrollFactor.set();
discordText.antialiasing = true;
discordText.antialiasing = FlxG.save.data.antialiasing;
discordText.active = false;
add(discordText);
FlxTween.tween(discordText, { alpha: 1 }, fadeTime);
Expand Down
27 changes: 14 additions & 13 deletions source/CreditsPopUp.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package;

import flixel.FlxG;
import haxe.Json;
import sys.io.File;
import sys.FileSystem;
Expand Down Expand Up @@ -84,39 +85,39 @@ class CreditsPopUp extends FlxSpriteGroup
case 0 | 1:
headingPath = {path: 'songHeadings/daveHeading', antiAliasing: false, iconOffset: 0};
case 2:
headingPath = {path: 'songHeadings/bambiHeading', antiAliasing: true, iconOffset: 0};
headingPath = {path: 'songHeadings/bambiHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 0};
case 3:
headingPath = {path: 'songHeadings/splitathonHeading', antiAliasing: false, iconOffset: 0};
case 4:
headingPath = {path: 'songHeadings/festivalHeading', antiAliasing: true, iconOffset: 0};
headingPath = {path: 'songHeadings/festivalHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 0};
case 5:
headingPath = {path: 'songHeadings/bevelHeading', antiAliasing: false, iconOffset: 0};
case 6:
headingPath = {path: 'songHeadings/kabungaHeading', antiAliasing: true, iconOffset: 0};
headingPath = {path: 'songHeadings/kabungaHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 0};
case 7:
headingPath = {path: 'songHeadings/secretLeakHeading', antiAliasing: true, iconOffset: 3};
headingPath = {path: 'songHeadings/secretLeakHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 3};
case 8:
headingPath = {path: 'songHeadings/tristanHeading', antiAliasing: true, iconOffset: 0};
headingPath = {path: 'songHeadings/tristanHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 0};
case 9:
headingPath = {path: 'songHeadings/botHeading', antiAliasing: true,
headingPath = {path: 'songHeadings/botHeading', antiAliasing: FlxG.save.data.antialiasing,
animation: new Animation('botTrot', 'Bot trot', 24, true, [false, false]), iconOffset: 0};
case 10:
headingPath = {path: 'songHeadings/recursedHeading', antiAliasing: true, iconOffset: 5};
headingPath = {path: 'songHeadings/recursedHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 5};
case 11:
headingPath = {path: 'songHeadings/californiaHeading', antiAliasing: true,
headingPath = {path: 'songHeadings/californiaHeading', antiAliasing: FlxG.save.data.antialiasing,
animation: new Animation('california', 'California', 24, true, [false, false]), iconOffset: 0};
case 12:
headingPath = {path: 'songHeadings/fnafHeading', antiAliasing: true, iconOffset: 0};
headingPath = {path: 'songHeadings/fnafHeading', antiAliasing: FlxG.save.data.antialiasing, iconOffset: 0};
case 13:
headingPath = {path: 'songHeadings/fnfengeading', antiAliasing: false, iconOffset: 0};
case 14:
headingPath = {path: 'songHeadings/cheatingHeading', antiAliasing: true,
headingPath = {path: 'songHeadings/cheatingHeading', antiAliasing: FlxG.save.data.antialiasing,
animation: new Animation('cheating', 'Cheating', 24, true, [false, false]), iconOffset: 0};
case 15:
headingPath = {path: 'songHeadings/unfairHeading', antiAliasing: true,
headingPath = {path: 'songHeadings/unfairHeading', antiAliasing: FlxG.save.data.antialiasing,
animation: new Animation('unfair', 'Unfairness', 24, true, [false, false]), iconOffset: 0};
case 16:
headingPath = {path: 'songHeadings/expungedHeading', antiAliasing: true,
headingPath = {path: 'songHeadings/expungedHeading', antiAliasing: FlxG.save.data.antialiasing,
animation: new Animation('expunged', 'Expunged', 24, true, [false, false]), iconOffset: 0};
default:
if (FreeplayState.isaCustomSong) {
Expand Down Expand Up @@ -259,7 +260,7 @@ class CreditsPopUp extends FlxSpriteGroup
funnyText = new FlxText(1, 0, 650, text, 16);
funnyText.setFormat('Comic Sans MS Bold', 30, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
funnyText.borderSize = 2;
funnyText.antialiasing = true;
funnyText.antialiasing = FlxG.save.data.antialiasing;
add(funnyText);
}
public function rescaleIcon()
Expand Down
10 changes: 5 additions & 5 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class DialogueBox extends FlxSpriteGroup
box.updateHitbox();
box.animation.addByPrefix('normalOpen', 'Speech Bubble Normal Open', 24, false);
box.animation.addByPrefix('normal', 'speech bubble normal', 24, true);
box.antialiasing = true;
box.antialiasing = FlxG.save.data.antialiasing;

if (!PlayState.instance.hasDialogue)
return;
Expand Down Expand Up @@ -241,25 +241,25 @@ class DialogueBox extends FlxSpriteGroup
dropText = new FlxText(242, 502, Std.int(FlxG.width * 0.6), "", 32);
dropText.font = 'Comic Sans MS Bold';
dropText.color = PlayState.instance.localFunny != PlayState.CharacterFunnyEffect.Recurser ? 0xFFFFFFFF : 0xFF00137F;
dropText.antialiasing = true;
dropText.antialiasing = FlxG.save.data.antialiasing;
add(dropText);

swagDialogue = new FlxTypeText(240, 500, Std.int(FlxG.width * 0.6), "", 32);
swagDialogue.font = 'Comic Sans MS Bold';
swagDialogue.color = 0xFF000000;
swagDialogue.antialiasing = true;
swagDialogue.antialiasing = FlxG.save.data.antialiasing;
add(swagDialogue);
default:
dropText = new FlxText(242, 502, Std.int(FlxG.width * 0.6), "", 32);
dropText.font = 'Comic Sans MS Bold';
dropText.color = 0xFF00137F;
dropText.antialiasing = true;
dropText.antialiasing = FlxG.save.data.antialiasing;
add(dropText);

swagDialogue = new FlxTypeText(240, 500, Std.int(FlxG.width * 0.6), "", 32);
swagDialogue.font = 'Comic Sans MS Bold';
swagDialogue.color = 0xFF000000;
swagDialogue.antialiasing = true;
swagDialogue.antialiasing = FlxG.save.data.antialiasing;
add(swagDialogue);
}
dialogue = new Alphabet(0, 80, "", false, true);
Expand Down
Loading

0 comments on commit 150a9f9

Please sign in to comment.