Slick Forums

Discuss the Slick 2D Library
It is currently Tue May 21, 2013 10:58 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: ResizableFrame questions
PostPosted: Fri Jul 06, 2012 10:14 pm 
Offline

Joined: Fri Jul 06, 2012 10:02 pm
Posts: 4
I'm new to TWL, and i cant find information about what i need... I want to create a resizable frame (user could resize it by draging its edge) in the lwjgl window, and i want to display the openGL viewport in that frame. How can i actualy do that?

This one is not relative to the topic, but: How can i check if mouse is over the twls Button?


Top
 Profile  
 
PostPosted: Fri Jul 06, 2012 10:37 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
a) override paintWidget() and carefully put your rendering code in there - best to use LWJGLRenderer.pauseRendering() and resumeRendering(). You will need to setup the view port based on the position & size of the widget. You can take a look at the TWL Theme Editor - it does this to render the preview in the bottom center.

b) a button will set the "hover" animation state while the mouse is over it

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sat Jul 07, 2012 10:13 pm 
Offline

Joined: Fri Jul 06, 2012 10:02 pm
Posts: 4
MatthiasM wrote:
a) override paintWidget() and carefully put your rendering code in there - best to use LWJGLRenderer.pauseRendering() and resumeRendering(). You will need to setup the view port based on the position & size of the widget. You can take a look at the TWL Theme Editor - it does this to render the preview in the bottom center.

b) a button will set the "hover" animation state while the mouse is over it

a) Could you plese clarify the anwser? How can overriding a paintWidget method with the rendering code put the view port into the resizable frame? I dont even think that method is somehow related to the ResizableFrame class.

b) I wanted to ask how can i check if the mouse is over the button!

P.S
Please write no more anwsers like "bananas are yellow" when i ask you "how can i change the color of bannanas"... I'm not trying to make you feel bad, i'm just really pissed, because the documentation of TWL is awful, just like your anwser.


Top
 Profile  
 
PostPosted: Sat Jul 07, 2012 10:38 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Well - if you don't like my answers then you are out of luck. If you want more precise answers you should ask precise questions and not vague ones like "i want to display the openGL viewport in that frame".

a) every widget has a paintWidget() method. LWJGLRenderer always keeps the same OpenGL state (which you can see in it's code) - so based on that knowledge you can do your own OpenGL drawing inside that method as long as you reset the GL state - which is mostly what pause/resumeRendering is designed for - it reverts the GL state to that which was active before TWL started rendering.

b) look in the code how the animation state "hover" (or STATE_HOVER in code) is set. Basically every mouse interaction happens in handleEvent(), but this requires that you subclass the Button. The theme will use the "hover" to decide how to render the button while the mouse is over it. And tool tips are displayed by the GUI automatically when a widget has a tool tip.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group