Blank screen when I'm trying to test text

Hi, so I’m extremely new to Haxe + HaxeFlixel.

I’m messing around with FlxText, and I’ve just been inputting whatever code with the help of a friend… I have to build the project in Visual Studio Code with CTRL+SHIFT+B otherwise it doesn’t work (which sucks because that means it always will build in html5, I wish I could change it to build for Windows). When I build the game, it’s just a blank screen, though it’s supposed to say “deez nuts” in a custom font (I know, very unfunny haha. it’s just a test anyway). Here’s the code, it may be a bit messy:

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.text.FlxText;
import flixel.util.FlxColor;

class Main extends FlxState
{
	var testtext:FlxText;

	override public function create()
	{
		testtext = new FlxText(0, 0, 0, 'deez nuts', 16);
		testtext.text = "deez nuts\n";
		testtext.setFormat("assets/font/squareglyphscustom.ttf", 20, FlxColor.MAGENTA, CENTER);
		testtext.setBorderStyle(OUTLINE, FlxColor.PINK, 1);
		testtext.screenCenter();
		add(testtext);
		super.create();
	}

	override public function update(elapsed:Float)
	{
		testtext.angle += 0.1;
		super.update(elapsed);
	}
}

I’m not sure what to do. The \n is there because my friend suggested I put it there, to quote him: “The custom fonts are a bit special”. As for why I have to build the game in VSC specifically, every time I try to build it outside of there, I get something like “could not find Visual Studio 2017 vsdevcmd, could not automatically setup MSVC”. Pretty sure I can just get VS 2017 and that’ll fix that, but what the heck is failing that the screen is still blank?

I just tried out your code with a different font and it’s working for me on HTML5 and cpp.
Setting the font path incorrectly will also properly fallback to a different font, so you shouldn’t be seeing a blank screen. :thinking:

I’ve got a couple questions/suggestions for ya:

  1. I just want to double check, did you follow this guide completely? Install HaxeFlixel | HaxeFlixel 2D Game Engine
  2. I assume you then generated your project following this guide? Hello World | HaxeFlixel 2D Game Engine
  3. Also what shell environment are you using?
  4. Did you follow the VSCode C++ setup guide? The “Windows” target is actually compiling with the Haxe C++ target, so that guide should fix that error you’re having. Configure Visual Studio Code for Microsoft C++
  5. What Haxe version are you using?

Screenshot of your code running:

Yes, I followed the setup guides fully. I am using the latest version of Haxe and all the components. I’m also using Visual Studio Code to input and build the program, I don’t remember a C++ setup guide but I should be able to compile C++ as well (not that I’ll be using that for a long time though). I actually slightly changed up the code and it now works, here’s what I’ve got now:

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;

class PlayState extends FlxState
{
	var deez:FlxText;

	override public function create()
	{
		deez = new FlxText(0, 0, 0, 'deez nuts\nYOOOO THE CUSTOM FONT WORKS', 32);
		deez.setFormat("assets/squareglyphscustom.ttf", 20, FlxColor.MAGENTA);
		deez.alignment = "center";
		deez.screenCenter();
		deez.x -= 20;
		deez.y += 4;
		deez.angle -= 3;
		add(deez);
		FlxTween.tween(deez, {angle: deez.angle + 6, x: deez.x + 40, y: deez.y -= 8}, 0.8, {ease: FlxEase.circInOut, type: PINGPONG});
		super.create();
	}

	override public function update(elapsed:Float)
	{
		//        deez.angle += 2; we don't need this anymore for what we're about to do
		super.update(elapsed);
	}
}

Pretty sure the tweaks are suggestions from the friend I mentioned in my initial post, but as I said the text now shows for me. Sorry if this creates any confusion. + Sorry for the really late reply.

No need to apologize, I’m glad you were able to figure out your issue!