problem with displaying text

Black'Tea

16-12-2007 18:22:31

I want to display text on my screen. The window is there, but the text isn´t displayed. Moreover I want only the text, not the window... please help :)


QuickGUI::GUIManager* mGUI;
QuickGUI::Sheet* mGameSheet;
QuickGUI::Window* mGameWindow;
QuickGUI::Label* mGamePoints;


mGameSheet = new Sheet("GameSheet","",mGUI);
mGameWindow = mGameSheet->createWindow();
mGameWindow->setPosition(mRoot->mCamera->getViewport()->getActualWidth() * 0.8,
mRoot->mCamera->getViewport()->getActualHeight() * 0.1);
mGameWindow->show();

mGamePoints = mGameWindow->createLabel();
mGameWindow->addChild(mGamePoints);

mGamePoints->setPosition(0,0);
mGamePoints->setWidth(20);
mGamePoints->setHeight(20);
mGamePoints->setFont("StarWars");
mGamePoints->setText("d1ds00");
mGamePoints->show();

mGUI->setActiveSheet(mGameSheet);

kungfoomasta

16-12-2007 20:06:16

Few things:

- You shouldn't create Sheets on your own, use the GUIManager to create/destroy sheets. I forgot to make the Sheet constructor/destructor protected.. I will commit this to SVN.
- You don't need to add as a child, it is already done for you on creation. If you wanted to move a widget from one parent to another, then using remove/addChild would be a good idea.
- If the text does not fit the text dimensions, it will not be rendered. Try using a smaller font size, or larger label dimensions.

Black'Tea

22-12-2007 10:46:13

mGameSheet = mGUI->createSheet();
mGameSheet->setName("GameSheet");
mGameSheet->setTexture("");
mGameWindow = mGameSheet->createWindow();
mGameWindow->setPosition(mRoot->mCamera->getViewport()->getActualWidth() * 0.8,
mRoot->mCamera->getViewport()->getActualHeight() * 0.1);
mGameWindow->setWidth(200);
mGameWindow->setHeight(200);
mGameWindow->show();

mGamePoints = mGameWindow->createLabel();

mGamePoints->setPosition(10,40);
mGamePoints->setWidth(100);
mGamePoints->setHeight(100);
mGamePoints->setFont("nxogrefont");
mGamePoints->setText("eo");
mGamePoints->show();

mGUI->setActiveSheet(mGameSheet);


I followed your corrections, but the text isn´t displayed. There is only a gray bar in stead of text.

kungfoomasta

22-12-2007 11:36:52

The function "setName" doesn't exist anymore, try updating to the latest release, or SVN. Also, can you post the definition of "nxogrefont"? If you make the label size a really large amount, like 600/600, does any of the characters appear?

Black'Tea

22-12-2007 12:46:17

I updated to the latest version, but I´m now too stupid to create the GUIManager.
How can I create one?

QuickGUI::GUIManager* mGUI;

mGUI = new QuickGUI::GUIManager(); // doesn´t work
mGUI->setViewport(mRoot->mCamera->getViewport());
mGUI->setSceneManager(mRoot->mSceneMgr);


edit:

mGUI = new QuickGUI::GUIManager("guimain",mRoot->mCamera->getViewport());

this makes an error. I have "no access to protected member, which declaration was in QuickGUI::GUIManager-class" (free translation^^)

kungfoomasta

22-12-2007 21:46:10

There is a class called "Root", which manages creation/deletion/access to GUIManagers. It is also responsible for the creation of the SkinSetManager, and may have more responsibilities in the future.

Order of operations:
1. Register qgui config parser
<finish ogre init>
2. Create qgui Root
3. Add skinsets via SkinSetManager
4. Create/Use GUIManagers.

Black'Tea

23-12-2007 10:58:37

worked fine, thanks :)

now, the current problem...

NOgre.fontdef (found the entry about fonts in wiki...)
nxogrefontr.12
{
type truetype
source eurostile.ttf
size 12
resolution 55
}


mGameSheet = mGUI->createSheet();

mGameWindow = mGameSheet->createWindow();
mGameWindow->setPosition(mRoot->mCamera->getViewport()->getActualWidth() * 0.1,
mRoot->mCamera->getViewport()->getActualHeight() * 0.1);
mGameWindow->setWidth(650);
mGameWindow->setHeight(650);
mGameWindow->show();

mGamePoints = mGameWindow->createLabel();

mGamePoints->setPosition(10,40);
mGamePoints->setWidth(600);
mGamePoints->setHeight(600);
mGamePoints->setFont("nxogrefontr.12");
mGamePoints->setText("d");
mGamePoints->show();

mGUI->setActiveSheet(mGameSheet);




Edit
some more trouble... I created 4 Buttons and gave them texts.
The first and second button are textless, but the third and the fourth have texts :)
Don´t know why...

m_Bstart = mMenuWindow->createButton("Start");
m_Bstart->setXPosition( mMenuWindow->getWidth() * 0.1 );
m_Bstart->setYPosition( mMenuWindow->getHeight() * 0.3 );
m_Bstart->setWidth( mMenuWindow->getWidth() * 0.8);
m_Bstart->setHeight( mMenuWindow->getHeight() * 0.1);
m_Bstart->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_CLICK,&QuickGuiManager::SetupGame_GO,this);
m_Bstart->setText("Start");
m_Bstart->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(m_Bstart->getWidth(),m_Bstart->getHeight()));
m_Bstart->setFont("nxogrefontr.36");

m_Boptions = mMenuWindow->createButton("options");
m_Boptions->setXPosition( mMenuWindow->getWidth() * 0.1 );
m_Boptions->setYPosition( mMenuWindow->getHeight() * 0.45 );
m_Boptions->setWidth( mMenuWindow->getWidth() * 0.8);
m_Boptions->setHeight( mMenuWindow->getHeight() * 0.1);
m_Boptions->setText("Options");
m_Boptions->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(m_Bstart->getWidth(),m_Bstart->getHeight()));
m_Boptions->setFont("nxogrefontr.36");

m_Bhighscore = mMenuWindow->createButton("highscore");
m_Bhighscore->setXPosition( mMenuWindow->getWidth() * 0.1 );
m_Bhighscore->setYPosition( mMenuWindow->getHeight() * 0.6 );
m_Bhighscore->setWidth( mMenuWindow->getWidth() * 0.8);
m_Bhighscore->setHeight( mMenuWindow->getHeight() * 0.1);
m_Bhighscore->setText("Highscore");
m_Bhighscore->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(m_Bstart->getWidth(),m_Bstart->getHeight()));
m_Bhighscore->setFont("nxogrefontr.36");

m_Bclose = mMenuWindow->createButton("close");
m_Bclose->setXPosition( mMenuWindow->getWidth() * 0.1 );
m_Bclose->setYPosition( mMenuWindow->getHeight() * 0.75 );
m_Bclose->setWidth( mMenuWindow->getWidth() * 0.8);
m_Bclose->setHeight( mMenuWindow->getHeight() * 0.1);
m_Bclose->setText("Close");
m_Bclose->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(m_Bstart->getWidth(),m_Bstart->getHeight()));
m_Bclose->setFont("nxogrefontr.36");


Edit2: AArgh?
When I put the m_Bclose-part into the space between the start-part and options-part (in code), then "Options" is displayed, but "Close" isn´t.

It´s strange. Whatever I do... there is everytime a problem with displaying the hole text. Often I get only a part of the text.

kungfoomasta

23-12-2007 22:08:09

What video card do you have? There have been a lot of reported render problems with ati cards and older integrated cards. I don't know the source of this problem.. I will probably ask for some help in the ogre dev forums soon. If you have another machine you can test this on, does it still have the same rendering problems?

Black'Tea

03-01-2008 13:55:17

I tested it on another machine (Geforce videocard) and it works...
But some more trouble...I´ve created a button, which I have to click very often to make it work.

kungfoomasta

03-01-2008 17:50:52

Are you saying the button doesn't register as being clicked, with every injection? Can you debug and see if its being entered every time? One way would be to output a message to the ogre log for every click, so you can compare clicks vs messages.

Black'Tea

11-02-2008 16:44:52

don´t checked it yet (yeah, I´m lazy), but what about displaying text with ATI-cards? Did sth. change?

oh - I looked in the ToDo-thread...
If I understand it right, it seems that the problems I had are already solved

great work :)

When do you release version 0.9.7?

kungfoomasta

11-02-2008 17:52:23

I was going to release last weekend, but it was brought to my attention Clipping doesn't work as expected. Aside from documentation, that's the only item on the list..

Black'Tea

11-02-2008 18:17:34

ok,
I already updated via SVN (don´t know if the double-klick-bug is already changed, but...) and I tried to compile my application, but it crashed.
The funktion createGUIManager has a new parameter (const std::string &defaultSkin) and I don´t know how I have to use this parameter.
When I write ,"") it crashes ingame with a message like " "" is not found in MouseCursor::SetSkin "

kungfoomasta

11-02-2008 18:20:33

If you're using the default "qgui" skin, pass "qgui" as the arguement. I'm not familiar with the Double Click Bug, you'll have to fill me in if there is one. Also for clarification, the ATI rendering issue has been resolved a while back. :)

Black'Tea

11-02-2008 18:31:43

I'm not familiar with the Double Click Bug, you'll have to fill me in if there is one.

oh, my fault.

- Double and Triple Click Events [done]

I missunderstood this... I thought it was the bug, which I have discribed in this thread... that I have to click more than one times to make the button work ;)

damn, that´s nice!
I updated, used "qgui" as my parameter and now it´s nearly is bugfree. All text is displayed fine and my "click-bug" is nearly away.
Now, when I´m clicking fast (fast click, not waiting with the mousebutton pressed), it works perfectly, but when I´m waiting a short while with the mousebutton pressed, nothing happens.
but although... realy nice, thanks :)

kungfoomasta

11-02-2008 19:07:02

I don't remember if I added functions to affect the single/double/triple click times, I'll have to check on them and add them if they're missing. If there are more ideal times to use as default we should update it, I just took a stab in the dark at setting click times.

Black'Tea

18-02-2008 17:49:49

Hm, I think you didn´t understand what I mean. When I´m clicking very fast (short duration where the mousebutton is pressed), it all works. But when I´m clicking slow, then nothing happend. The button on the screen shows to be pressed, but the funktion isn´t triggert.
I hope you understand me this time, sorry for my bad english ;)

I have another problem... with textboxes... I´d liked to get some input (for requesting the player´s name), but the input doesn´t work. Don´t know why.
In addition to that, there is another problem. When I´m scrolling over the textbox, something strange appears.

ok, the code:
mPlayerNameLabel = mPlayerWindow->createTextBox("playername");
mPlayerNameLabel->setXPosition( mPlayerWindow->getWidth() * 0.05 );
mPlayerNameLabel->setYPosition( mPlayerWindow->getHeight() * 0.4 );
mPlayerNameLabel->setWidth( mPlayerWindow->getWidth() * 0.9);
mPlayerNameLabel->setHeight( mPlayerWindow->getHeight() * 0.3);
mPlayerNameLabel->setText("Player");
mPlayerNameLabel->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(mPlayerNameLabel->getWidth(),mPlayerNameLabel->getHeight()));
mPlayerNameLabel->setFont("StarWars.24");
mPlayerNameLabel->allowResizing(true);
mPlayerNameLabel->setReadOnly(false);
mPlayerNameLabel->setTextColor(Ogre::ColourValue(1.0,0.0,0.0));
mPlayerNameLabel->show();


and now the strange thing, which appears:

without the mouse on the textbox



with the mouse on the textbox

kungfoomasta

18-02-2008 18:36:26

When the mouse cursor moves over the text box, its image tries to change to a text cursor. My guess is that you have outdated SkinSet files, and instead of displaying the text cursor, the entire skinset is displayed.

1. Make sure you have the latest from SVN.
2. Delete the .skinset file and the Skinset*.png file, so they are rebuilt.

I can't reproduce the slow clicking vs the fast clicking, I don't know whats happeneing there.

Black'Tea

19-02-2008 20:54:03

I can't reproduce the slow clicking vs the fast clicking, I don't know whats happeneing there.

Then the players in my game have to click fast ;) no bigger problem

But what´s about the input-textbox which doesn´t work allright (I didn´t replaced the old skinset file yet, but this wouldn´t solve this error, would it?)

kungfoomasta

19-02-2008 21:12:33

Only one way to find out.. :wink:

Black'Tea

20-02-2008 16:17:39

worked :)
thanks