So I'm trying to get a Text going in a class of mine, and in order to do that, I need a Font. However, when I try this, and use font.loadfromFile(), I get 6 errors related to it:
unexpected ( in declarator
basic type expected, not "fonts/OratorStd.ttf"
found '"fonts/OratorStd.ttf"' when expecting ')'
no identifier for declarator font.loadFromFile(int)
semicolon expected following function declaration
declaration expected, not ')'
And when I hover over the line, I see "Parser Error: <Identifier> expected, <Literal> found!". The issue I can see is that, for some reason, Font isn't showing as having any of the methods necessary to utilizing the class. Whenever I type a period after my font object, NOTHING shows up.
Here's my code:
module sound;
import dsfml.graphics;
import scene2d.actor;
class Sound: Actor
{
Sprite playSprite;
Sprite stopSprite;
Sprite folderSprite;
auto font = new Font();
font.loadFromFile("fonts/OratorStd.ttf");
Text label = new Text("Uninitialized", font);
this(Texture *play, Texture *stop, Texture *folder, int index)
{
int x, y;
x = (index % 10) * 96 + (index % 10) * 16;
y = (index % 9) * 16 + (index % 10) * 64;
playSprite = new Sprite(play);
playSprite.position(Vector2f(x, y + 32));
stopSprite = new Sprite(play);
stopSprite.position(Vector2f(x + 32, y + 32));
folderSprite = new Sprite(play);
folderSprite.position(Vector2f(x + 64, y + 32));
}
~this()
{
~playSprite();
~stopSprite();
~folderSprite();
}
override draw(Drawable surface)
{
surface.draw(label);
surface.draw(playSprite);
surface.draw(stopSprite);
surface.draw(folderSprite);
}
}
EDIT: Well, that was weird. I moved the font loading into my main class and passed it as a parameter to the SoundActor constructor (the new name for the class), and everything seems to be working fine, though I still don't get the lookup window when calling a member...