Results 1 to 5 of 5

Thread: Any examples for swipe controlled Entities?

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

    Default Any examples for swipe controlled Entities?

    Got any examples of how to do the following:

    1. scrollable text - with and without scrollbar?
    2. scrollable list - of entities, likely images representing the next screen. When tapped, loads the next screen.

    Thanks!

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

    Default

    Sure, I'll add a new sub-menu to the RTSimpleApp showing an example of making a screen scroll soon.
    Seth A. Robinson
    Robinson Technologies

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

    Default

    Ok, added another menu to the RTSimpleApp example to show how scroll bars work.

    Name:  simpleapp_scrollbar.jpg
Views: 6
Size:  99.0 KB

    Basically you can just add any entity/image like normal and it will scroll if needed. (It doesn't care if it is text or clickable images)

    If you want dragging to effect entities in some special way, you probably need to hook into the GetBaseApp()->m_sig_input signal and process the messages yourself, or, at a slightly high level, add a TouchHandlerComponent to an entity, and hook into the entities OnOverMove which will be called whenever the user drags over it. (This is what the ScrollComponent.cpp does.. other stuff like OnOverStart, OnOverEnd are also available)

    The nice thing about this is it will respect the size of your entity and only send the messages if it's actually over it.

    Also, keep in mind that you can hook into these functions/signals from anywhere, you don't have to make special components, you could just as easily wire OnOverMove on some entity image overlay to call a static function in your AboutMenu.cpp. Hmm, that all sounds so complicated, hope it makes sense.
    Seth A. Robinson
    Robinson Technologies

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

    Thumbs up

    I'm having trouble with horizontal scrolling with OverlayEntity objects:

    Code:
    	
    	float width = GetScreenSize().x;
    	float height = GetScreenSize().y;
    
            //setup the dimensions of where the scroll area will go
    	CL_Vec2f vTextAreaPos = CL_Vec2f(0, 100);
    	CL_Vec2f vTextAreaBounds = CL_Vec2f(width - 10, height - 300);
    
    	pScroll = pMain->AddEntity(new Entity("scroll"));
    	pScroll->GetVar("pos2d")->Set(vTextAreaPos);
    	pScroll->GetVar("size2d")->Set(vTextAreaBounds);
    	pScroll->AddComponent(new TouchHandlerComponent);
    
    	EntityComponent *pFilter = pScroll->AddComponent(new FilterInputComponent);
    	EntityComponent *pScrollComp = pScroll->AddComponent(new ScrollComponent);
    	EntityComponent *pScrollBarComp = pScroll->AddComponent(new ScrollBarRenderComponent); 	//also let's add a visual way to see the scroller position
    
    	Entity *pScrollChild = pScroll->AddEntity(new Entity("scroll_child"));
    
    	x = y = xSpace;
    	CreateOverlayEntity(pScrollChild, "Ent3", "interface/3_med.rttex", x,y);
    	x += 500; 
    	CreateOverlayEntity(pScrollChild, "Ent2", "interface/2_med.rttex", x,y);
    	x += 500;
    	CreateOverlayEntity(pScrollChild, "Ent1", "interface/1_med.rttex", x,y);
    
    	ResizeScrollBounds(&VariantList(pScroll));
    
    	SlideScreen(pMain, true);
    
    	return pMain;
    The same code works if I change the last few lines to


    Code:
    	CreateOverlayEntity(pScrollChild, "Ent3", "interface/3_med.rttex", x,y);
    	y += 500; 
    	CreateOverlayEntity(pScrollChild, "Ent2", "interface/2_med.rttex", x,y);
    	y += 500;
    	CreateOverlayEntity(pScrollChild, "Ent1", "interface/1_med.rttex", x,y);

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

    Default

    Code:
    I'm having trouble with horizontal scrolling with OverlayEntity objects:
    Ah, I've never actually tested horizontal before.. turns out there were some bugs. I fixed them (committed to svn), so it should now scroll horizontally properly.

    Warning I should have mentioned though: The ScrollBarRenderComponent.cpp currently only draws a vertical bar (if needed). I just haven't needed anything with a horizontal bar yet.
    Seth A. Robinson
    Robinson Technologies

Similar Threads

  1. Real bug to do with entities
    By Uhfgood in forum Novashell Game Creation System
    Replies: 9
    Last Post: 07-17-2008, 03:49 AM
  2. Help with attaching entities
    By Uhfgood in forum Novashell Game Creation System
    Replies: 1
    Last Post: 07-13-2008, 02:02 AM
  3. Getting Entities to discover the Brain State of other entities
    By stellarvector in forum Novashell Game Creation System
    Replies: 1
    Last Post: 06-28-2007, 11:11 PM
  4. Rotating tiles/entities
    By sphair in forum Novashell Game Creation System
    Replies: 0
    Last Post: 03-12-2007, 09:33 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
  •