guiFont is something that exists by default in SimpleApplication because (unfortunately) a long time ago the developers of SimpleApplication opted for convenience instead of clarity or correctness… so now new users end up being more confused instead of less confused because they wonder where these magic words came from and why they don’t work in some other class.
Suffice it to say, guiFont is just a class field like any other… but your class doesn’t have this field so you get an “Cannot find symbol” error because… well… the symbol hasn’t been defined.
Fear not, though, because the magic necessary to get this field turns out to be pretty simple:
Edit: just an addendum… I don’t mean to sound like I’m ragging on the original author(s) of SimpleApplication. It’s a product of its time and local momentum as much as anything else. I have the benefit of hindsight in my favor.
As a secondary option to @pspeed 's answer… you could always set up a get method and pass a reference to your main class so your not creating a new instance of BitmapFont when it already exists. It’s not a huge issue one way or the other, but it makes it easier to modify the font globally if you ever decide to change which font you are using.
@t0neg0d said:
As a secondary option to @pspeed 's answer... you could always set up a get method and pass a reference to your main class so your not creating a new instance of BitmapFont when it already exists. It's not a *huge* issue one way or the other, but it makes it easier to modify the font globally if you ever decide to change which font you are using.
Maybe the asset manager should cache these things so that we don’t create a new one every time. Oh, wait…
But yeah, if you decide you want a different font later than you have a search/replace to do. A getter is a fine solution for that.
Edit: or the font could be passed to the state if it is added in simpleInit() (versus app constructor)… then you could even have a different font for the menu than for everything else if you wanted.