Text is blurry (with screen scaling)


(John Andersson) #1

If I scale the screen, the text becomes blurry, no matter the smooth setting. If I don’t scale the screen, the text is just fine. How should I remedy this?


(Zachary Lewis) #2

Make sure:

  • smoothing is off (both the text and the screen)
  • FP.screen.scale is a whole number
  • your text is pixel perfect

(John Andersson) #3

pixel perfect? wut? how do I make it pixel perfect? the other criteria is met


(Zachary Lewis) #4

Are you using a pixel font?


(John Andersson) #5

I’m using standard text


(Zachary Lewis) #6

Share a screenshot. :saxophone:


(John Andersson) #7


(Mike Evmm) #8

Are you editing the text’s scale property, instead of size?


(John Andersson) #9

I’m not editing it at all


(Mike Evmm) #10

Well, that’s weird; it doesn’t happen with me at all. Could you post the code for adding the text, please?

(This is the code I used, by the way: @Main.as

super(800, 640);
FP.screen.scale = 3;
FP.world = new Test();

@Test.as

var text:Text = new Text("TEST");
addGraphic(text);

(John Andersson) #11

Gameworld:

add(hud);

Hud: public class HUD extends Entity { //Text private var hptext:HpText = new HpText(10, 8); private var heart:Heart = new Heart(5, 5);

	public function HUD() 
	{
	}
	
	override public function added():void
	{
		FP.world.add(hptext);
		FP.world.add(heart);
	}

HpText:

public class HpText extends Textfield
{
	private var textField:Text = new Text(String(HeroStats.hp), 0, 0, { color: 0xFFFFFF, size: 10 } );
	
	public function HpText(x:int, y:int)
	{
		super(x, y);
		graphic = textField
		graphic.scrollX = graphic.scrollY = 0;
	}
	
	public override function update():void
	{
		textField.text = "  : " + String(HeroStats.hp);
	}

Textfield:

public class Textfield extends Entity 
{
	public function Textfield(x:Number=0, y:Number=0, graphic:Graphic=null, mask:Mask=null) 
	{
		super(x, y, graphic, mask);	
		
		type = "textfield"
		layer = -5
	}
}

(Ultima2876) #12

What version of FlashPunk are you using?


(Justin Wolf) #13

It’s because of the size: 10 in your Text's parameters. Remove it, and it will scale appropriately. The native size of the default pixel text in FlashPunk is 8 pt. So, in order to keep it sharp, you need to have your Text size in divisibles of 8 (8, 16, 24, 32, etc.) when scaling the screen.


(Zachary Lewis) #14

This is important! If you are using a pixel font that is natively designed for 10px, you’d need to make sure your size is divisible by 10.