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?
Text is blurry (with screen scaling)
Make sure:
- smoothing is off (both the text and the screen)
-
FP.screen.scale
is a whole number - your text is pixel perfect
pixel perfect? wut? how do I make it pixel perfect? the other criteria is met
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);
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
}
}
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.
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.