SFML community forums

Help => Window => Topic started by: Cerus on December 13, 2011, 12:33:53 am

Title: Odd trouble drawing text
Post by: Cerus on December 13, 2011, 12:33:53 am
Alrighty, so I can get my "tart new journey" and "[C]ontinue your journey" messages to appear in the first function of my source just fine:
This works perfectly...
Code: [Select]
int main(/*commandline arguments go here*/){
  Game.Display();
  Game.Clear();
  Game.EnableKeyRepeat(false);
  if(!Image[0].LoadFromFile("gfx/frame.png")){
    std::cout<<"Failed to load image!"<<std::endl;
  }
  //Set the image as a sprite...
  Sprite[0].SetImage(Image[0]);
  mtFont.LoadFromFile("gfx/FreeMono.ttf",12);
  menu_text1.SetText("[S]tart new journey");
  menu_text2.SetText("[C]ontinue your journey");
  menu_text1.SetFont(mtFont);
  menu_text2.SetFont(mtFont);
  menu_text1.SetSize(16);
  menu_text2.SetSize(16);
  menu_text1.Move(412,280);
  menu_text2.Move(412,294);
  Game.Clear();
  Game.Draw(Sprite[0]);
  Game.Draw(menu_text1);
  Game.Draw(menu_text2);
  Game.Display();

...yet when my second function (character naming and general 'newgame' stuff) begins, it fails to print the name-request, even though it still responds to events with...:
Code: [Select]
int game_start(){
  Game.Display();
  if(!Image[0].LoadFromFile("gfx/frame.png")){
    std::cout<<"Failed to load image!"<<std::endl;
  }
  //Set the image as a sprite...
  Sprite[0].SetImage(Image[0]);
  mtFont.LoadFromFile("gfx/FreeMono.ttf",12);
  menu_text1.SetText("By what name shalt");
  menu_text2.SetText("thee be known?");
  menu_text1.SetFont(mtFont);
  menu_text2.SetFont(mtFont);
  menu_text1.SetSize(16);
  menu_text2.SetSize(16);
  menu_text1.Move(412,280);
  menu_text2.Move(412,294);
  Game.Clear();
  Game.Draw(Sprite[0]);
  Game.Draw(menu_text1);
  Game.Draw(menu_text2);
  Game.Display();

...and yes, the second function is called.  All I get in return is the blank 'frame' image also used in the first function.  What am I doing wrong?  I feel like a complete fool.  @_@;

EDIT:  Alrighty, so...  I changed MenuText1 and MenuText2 into a single array known as menu_text.  Setting the code to display this array has kept what already worked working, but curiously, the second function was only willing to display