full screen sheets

ToeNails

29-07-2009 04:49:58

Sheeet! these sheets are driving me nuts :lol:

I was wondering is there any way to make the master sheet, using .sheet files, full screen without having to edit the size for every possible resolution? Say I make the sheet file at 1280x1024, yet the program launches at 1600x1280 due to the user's previous choice. Is there anyway to anchor the sheet full screen at initialization and still keep everything else in relative position?

Please note i'm not resizing the window.

(I've already thought of a work around by saving the gui sheet files when windowsize options are changed, but i wish it were a little less cluttered)

Also little off topic, but how do i get rid of OS mouse cursor?
(sorry if this has been answered somewhere else, couldn't find anything)
Edit: WindowsAPI ShowCursor(false);

Thanks for all your time KungFoo!

kungfoomasta

29-07-2009 18:29:18

If you want resolution perfect layouts you'd need to create a sheet for each resolution. However I think you can achieve good results simply by resizing the sheet and using the anchoring system for widget placement. In your application you should be able to get the size of the render window and set the size of the sheet you use. As far as I know there is no way for QuickGUI to determine when the render window has been resized, so its up to the application to handle any associated behavior you would want, ie Sheet matching window dimensions.

If you check out the anchoring tutorial it will probably help you understand how widgets are positioned, it can be found here.

Hiding the OS cursor is dependent on your OS, I forgot the Windows API for doing it. Sorry I can't be more helpful here.

Let me know if resizing your sheet doesn't put widgets where you want, if you have screenshots I could check them out and try to suggest ways to accomplish what you want. Or if its a bug, I can look into it when I get a chance.. :)

ToeNails

29-07-2009 22:39:02

First I'd like to thank you for replying kungfoo, your QuickSupport is one of the reasons why I picked quickgui for my project :)


This is what I mean by resizing at start.
QuickGUI::Sheet* gameSheet = QuickGUI::SheetManager::getSingleton().createSheet("media/GuiSheets/test.sheet",true);

GuiManager->setActiveSheet(gameSheet);

gameSheet->setDimensions(QuickGUI::Rect(0,0,vPort->getActualWidth(),vPort->getActualHeight()));



This is what it looks like at the size my sheet is supposed to be.



This is what it looks like when I launch ogre at higher resolution.


When I resize the sheet shouldn't everything else anchor with it? The size of the viewport hasn't changed since it is what it is at launch.



I found the answer to the mouse problem, edited my original post to reflect it

kungfoomasta

30-07-2009 01:08:01

Thanks for the kind words. :)

you need to set the anchoring of that widget, something like:

myWidget->setVerticalAnchor(ANCHOR_VERTICAL_BOTTOM);
myWIdget->setHorizontalAnchor(ANCHOR_HORIZONTAL_CENTER);


It's also important that you set the sheet's dimensions after creating everything on the sheet, as they will be repositioned/rescaled depending on its anchors.

ToeNails

30-07-2009 01:27:02

according to the .sheet file isn't my sheet already anchored?

Sheet Sheet
{
...

Dimensions 0 0 1280 1024

...

HorizontalAnchor ANCHOR_HORIZONTAL_LEFT

...

PositionRelativeToParentClientDimensions true

...

VerticalAnchor ANCHOR_VERTICAL_TOP

....

UserDefinedHandlers WidgetEvents
{
}

Child Widgets
{
Image Image
{
...
}
Panel Panel
{
HorizontalAnchor ANCHOR_HORIZONTAL_LEFT
....
PositionRelativeToParentClientDimensions true
.....
VerticalAnchor ANCHOR_VERTICAL_TOP
....
Child Widgets
{
Button Button
{
}
}
}
}
}



The top sheet it self is already made, i'm trying to resize it with code in the program. Which i can resize it using setSize and setDimensions, but nothing is adjusting to the size change.

kungfoomasta

30-07-2009 03:34:01

You need to go through the anchoring tutorial I posted. :P The anchors are set as you have found, but they aren't the same as the ones I suggested. With the setup you've shown the widgets are anchored according to the top and left of their parent. The Sheet widget has no parent, so anchoring of the Sheet does nothing.

ToeNails

30-07-2009 17:03:11

I feel so stupid. It's amazing how much good sleep can help...

I read that damn tutorial at least 15 times last night. I look at it this morning and I see my problem.

I needed to anchor the panel to the bottom, and to the left_right.

/me slaps him self on the head.

I"m really sorry, Thank you sooo much kungfoo!
---------------------------------------------------------------------------------------------------------------

One last question, then i'll stop. (fornow, i'll go work on sound until i get more questionpoints :lol: )

Since I made the buttons etc in the .sheet files, how do I use them in code? I don't see any getWidgitByName in the API. I could just be blind again :|

kungfoomasta

30-07-2009 18:19:48

I know how that goes, I've posted silly questions on Ogre forums by mistake due to lack of sleep. :lol:


/**
* Recursively searches through children and returns first widget found with widget_name given.
* NULL is returned if the widget is not found.
*/
virtual Widget* findWidget(const Ogre::String& widget_name);


All widgets have this API.