I made method,that draws text using Otter(2D Game Rendering Library using SFML.NET).But method not works correct,text not rendered. Code:
public static void DrawText(string Text,string Font,int Size,VXG_Color
clr)
{
Text t = new Text(Text,Font,Size);
t.Color = VXGColor(clr);
t.Render(0f,0f);
t.Visible = true;
}
Using method:
static void Main(string[] args)
{
DrawText("hello", @"C:\Users\serge\Downloads\DarkDemo\DarkDemo\bin\kongtext.ttf", 72, Rendering.VXG_Color.Orange);
}
Method is executed,exceptions not throwed,but its not renders,i dont see text.
I have a answer. Text class not rendering,because its not added to scene. To add it to scene,we need to create an entity,and add Text component to it.
Game g = new Game();
g.Color = Color.Black;
Scene scn = new Scene();
Text t = new Text("Text","Font",16);
Entity ent = new Entity();
ent.AddGraphics(t);
scn.Add(ent);
g.Start(scn);