Results 1 to 3 of 3

Thread: How to Clip Scrolling Text

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default How to Clip Scrolling Text

    You say that clipping a scroll text area is slow on Android. Any chance you could share the implementation with us so we can try it out (I obviously don't care about Android right now)? Trying to clip the bottom and top of a scroll area.

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,376

    Default

    Sure - there is a commented out example in RTSimpleApp/source/GUI/AboutMenu.cpp

    Find this part:

    Code:
    	/*
    	//this is one way to clip the image on the bottom - glClipPlane is too slow/broken on Android so we actually won't use it
    	EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
    	pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
    	*/
    
    	//another way would be to just blit a colored bar over the bottom:
    	//pEnt = CreateOverlayRectEntity(pBG, CL_Rectf(0, GetScreenSizeYf()-offsetFromBottom, GetScreenSizeXf(), 320), 
    
    MAKE_RGBA(0,0,0,100));
    
    	//but the nicest way is to blit a matching bar at the bottom with transparency:
    	Entity *pOverlay = CreateOverlayEntity(pBG, "", "interface/bg_stone_overlay.rttex", 0, GetScreenSizeYf()+1); 
    	SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
    And change to:

    Code:
    	//this is one way to clip the image on the bottom - glClipPlane is too slow/broken on Android so we actually won't use it
    	EntityComponent *pClip = pScroll->AddComponent(new RenderClipComponent);
    	pClip->GetVar("clipMode")->Set(uint32(RenderClipComponent::CLIP_MODE_BOTTOM));
    	
    
    	//another way would be to just blit a colored bar over the bottom:
    	//pEnt = CreateOverlayRectEntity(pBG, CL_Rectf(0, GetScreenSizeYf()-offsetFromBottom, GetScreenSizeXf(), 320), MAKE_RGBA(0,0,0,100));
    /*
    	//but the nicest way is to blit a matching bar at the bottom with transparency:
    	Entity *pOverlay = CreateOverlayEntity(pBG, "", "interface/bg_stone_overlay.rttex", 0, GetScreenSizeYf()+1); 
    	SetAlignmentEntity(pOverlay, ALIGNMENT_DOWN_LEFT);
    */
    Also, you'll have to add shared/entity/RenderClipComponent.cpp to your project.

    You should be able to run RTSimpleApp, click on About, and see the scroller cut off at the bottom.

    On Windows, you can add more RenderClipComponents and say, cut off the top or sides too, but on iOS I think the GLES driver limits you to just one (glClipPlane) at a time.
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    ah, but I won't be able to clip the top and bottom without overlaying an image (a GLES constraint)... bummer. Oh well, thanks for your help though!

Similar Threads

  1. Scrolling in RTSimpleApp
    By BigBMan in forum Proton SDK
    Replies: 4
    Last Post: 12-10-2010, 04:40 AM
  2. Edge scrolling in editor.
    By NovaLaw in forum Novashell Game Creation System
    Replies: 2
    Last Post: 11-20-2008, 02:25 AM
  3. Screen scrolling
    By Blint in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 08-21-2008, 08:40 PM
  4. scrolling shooter...
    By harrio in forum Novashell Game Creation System
    Replies: 2
    Last Post: 02-19-2008, 02:17 AM
  5. Scrolling to optimize?
    By Snakesoft in forum Novashell Game Creation System
    Replies: 6
    Last Post: 03-28-2007, 11:57 AM

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
  •