Results 1 to 3 of 3

Thread: GUI Component Constant Repaint

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default GUI Component Constant Repaint

    I have a question regarding the gui component constant repaint.

    This is set using CL_GUIComponent::set_constant_repaint()

    When enabled the GUI will constantly repaint this component when there are no other messages to process.

    Internally, the GUI_Manager calls via the exec() calls: impl->invalidate_constant_repaint_components()

    That function iterates recursively all components checking for the "CL_GUIComponent::get_constant_repaint()" flag.

    If any child component contains the flag, the root component calls request_repaint()

    The recent addition the clanGUI API adds: CL_GUIWindowManagerTexture::process() that updates the GUI.

    But it does not check the constant_repaint flag of any components.

    This was intentional at the time, but I am not sure is that is correct.

    Some examples:
    If you create an animating component using the GUI texture window manager, these are the possible methods.

    Code:
    	...
    	CL_DisplayWindow window(desc);
    	...
    	CL_GUIWindowManagerTexture wm(window);
    	CL_GUIManager gui(wm, "../../../Resources/GUIThemeAero");
    
    	while (!quit)
    	{
    		Draw_The_Scene();
    		for each component
    		{
    			component->Animate();
    			if (component->FrameChanged())
    				component->request_repaint();
    		}
    
    		wm.process();
    		wm.draw_windows(gc);
    
    		window.flip(1);
    		CL_KeepAlive::process();
    	}
    OR

    Code:
    	...
    	CL_DisplayWindow window(desc);
    	...
    	CL_GUIWindowManagerTexture wm(window);
    	CL_GUIManager gui(wm, "../../../Resources/GUIThemeAero");
    
    	while (!quit)
    	{
    		Draw_The_Scene();
    		for each component
    		{
    			component->Animate();
    			component->set_constant_repaint(true);
    		}
    
    		wm.process(); // ** Will not work, because it does not look at the constant repaint flag
    		wm.draw_windows(gc);
    
    		window.flip(1);
    		CL_KeepAlive::process();
    	}
    Should wm.process() check for constant repaint components automatically?
    Or otherwise?

    I do not know

  2. #2
    Master Sorcerer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I would say yes. Your manual game loop should cause the same GUI to react the same way as if you called exec(), except for how it presents the textures.

    The constant repaint feature is meant for situations where something is constantly animating. The feature could probably use some improvements (such as specifying a desired/max fps), but no matter what its absolutely required for those situations where a game runs itself in a "GameView" component. In such situations its not unlikely that the game may eventually want to customize the presentation of the textures to apply post-processing effects or other effects related to window management.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Applied to ClanLib 2.2 and 2.3 SVN: "Check for constant repaint when using CL_GUIWindowManagerProvider_Texture::process()"

    The contant repaint issue will need looking at again in the future

    At the moment, it calls request_repaint() on the root component, if any child components contain a constant repaint request.

    I would have thought it would be preferable to ONLY call request_repaint() on the component that contain a constant repaint request.

    That way you will not be redrawing components that do not require it.

Similar Threads

  1. New example in ClanLib 2.0: Custom GUI Component
    By sphair in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-19-2009, 02:08 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •