Scrollable & Looping Menu

  ... the case you feel the need for a new feature or want to submit one.

Scrollable & Looping Menu

Postby Ungaze » Fri Jul 05, 2013 4:36 am

Hi. Just wanna share my Scrollable Looping Menu implementation. I have no experience making code for others, so I tried to make it readable as possible. Well here it is:

WHAT IS IT?
-Well basically, it's a menu list which you can swipe around, endlessly repeating/looping.

HOW TO USE IT?
- Aside from the LSM(LoopScrollMenu) object, all we need is a list of menu-items(can be a text, sprite or even rectangles. AKA IEntity) to pass as an argument, it's position and size. The list must contain at least 3 objects/items. It's basically a ClipEntity, so it needs the size parameters to define it's drawing bounds. The size also affects a lot of things like fling sensitivity and the menu item's size(most, if not all can be adjusted later on). Finally, position set's the position.

UPDATE:
- added a flick/fling detector to validate last few touch updates. Before, a long swipe would register a flick regardless how long it took to make the swipe(even a full stop at the end would register a flick). Now, if you end the swipe with a slow/stopping motion, flick would not register.
- fixed a minor bug when swiping to the left.

---- I'll add a video some time soon ----
---- I'll also try to add comments on the class itself ----
http://www.youtube.com/watch?v=haXfkZf-iNw&feature=youtu.be

The LoopScrollMenu class/object(updated 08/08/13)
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class LoopScrollMenu extends ClipEntity{
  2.        
  3.         private final ArrayList<IEntity> menuList, holderList;
  4.         private final MoveXModifier band;
  5.         private final float[] touchLog;
  6.         private final Entity binder, dummy, background;
  7.         private final float midX, midY;
  8.         private final int menuCount, focusIndex;
  9.         private final TimerHandler touchLogger;
  10.        
  11.         private ILoopScrollMenuListener listener;
  12.         private float onTouchDownX, margin, margin2, binderOffset, onDummyDownX, offsetter, touchSensitivity, flingStrength, maxJitter, menuScale, adjustment, flingSensitivity, flick;
  13.         private boolean isStatic = false;
  14.         private boolean registerDown = false;
  15.         private boolean self;
  16.         private boolean touchToFocus;
  17.         private int itemCount;
  18.        
  19.         public LoopScrollMenu(final ArrayList<IEntity> pMenuList, final float pX, final float pY, final float pWidth, final float pHeight){
  20.                 super(pX, pY, pWidth, pHeight);
  21.                 menuList = pMenuList;
  22.                 holderList = new ArrayList<IEntity>();
  23.                 menuCount = menuList.size();
  24.                 focusIndex = (menuCount - 1) / 2;
  25.                 midX = pWidth * 0.5f;
  26.                 midY = pHeight * 0.5f;
  27.                 background = new Entity();
  28.                 touchLog = new float[5];
  29.                
  30.                 binder = new Entity(midX, midY){
  31.                         @Override
  32.                         public void setX(float pX) {
  33.                                 focusOffset(pX);
  34.                                 super.setX(pX);
  35.                         }
  36.                 };
  37.                
  38.                 dummy = new Entity(0, 0){
  39.                         @Override
  40.                         public void setX(float pX) {
  41.                                 scroller(pX);
  42.                                 super.setX(pX);
  43.                         }
  44.                 };
  45.                
  46.                 band = new MoveXModifier(0.01f, 0, 0, EaseCubicOut.getInstance()){
  47.                         @Override
  48.                         protected void onModifierFinished(IEntity pItem) {
  49.                                 onSettle(menuList, focusIndex);
  50.                                 super.onModifierFinished(pItem);
  51.                         }
  52.                 };
  53.                
  54.                 final ITimerCallback touchLoggerCallback = new ITimerCallback() {
  55.                         @Override
  56.                         public void onTimePassed(TimerHandler pTimerHandler) {
  57.                                 for (int i = 0; i < 4; i++) {
  58.                                         touchLog[i] = touchLog[i + 1];
  59.                                 }
  60.                                 touchLog[4] = dummy.getX();
  61.                         }
  62.                 };
  63.                 touchLogger = new TimerHandler(0.02f, true, touchLoggerCallback);
  64.                
  65.                 if (menuCount > 2) {
  66.                         this.init();   
  67.                 }
  68.         }
  69.        
  70.         private void init(){
  71.                 self = true;
  72.                 for (int i = 0; i < menuCount; i++) {
  73.                         holderList.add(new Entity());
  74.                         holderList.get(i).attachChild(menuList.get(i));
  75.                         menuList.get(i).setTag(i);
  76.                         menuList.get(i).setCullingEnabled(true);
  77.                         binder.attachChild(holderList.get(i));
  78.                 }
  79.                 holderList.get(focusIndex).setZIndex(menuCount + 10);
  80.                 binder.sortChildren();
  81.                 this.attachChild(background);
  82.                 this.attachChild(binder);
  83.                 this.attachChild(dummy);
  84.                 this.setMenuScale(0.80f);
  85.                 this.setItemsShown(3);
  86.                 this.setSensitivity(1);
  87.                 this.setMaxJitter(1);
  88.                 this.setFlingSensitivty(midX * 0.3f);
  89.                 this.setTouchToFocus(true);
  90.                 self = false;
  91.                 this.reset();
  92.         }
  93.  
  94.         private void scroller(final float pX){
  95.                 if (offsetter + pX > margin) {
  96.                         offsetter -= margin2;
  97.                         this.rotate(1);
  98.                 }
  99.                 else if (offsetter + pX < -margin) {
  100.                         offsetter += margin2;
  101.                         this.rotate(-1);
  102.                 }
  103.                 binder.setX(offsetter + pX + midX);
  104.         }
  105.        
  106.         private void rotate(final int pStep){
  107.                 Collections.rotate(menuList, pStep);
  108.                 for (int i = 0; i < menuCount; i++) {
  109.                         menuList.get(i).detachSelf();
  110.                         holderList.get(i).attachChild(menuList.get(i));
  111.                 }
  112.         }
  113.        
  114.         private void flinger(final float pDistance, final float time){
  115.                 float finalDummyX = (Math.round((dummy.getX() + pDistance) / margin2)) * margin2;
  116.                 band.reset(time + 0.001f, dummy.getX(), finalDummyX);
  117.                 dummy.registerEntityModifier(band);
  118.         }
  119.        
  120.         private void focusOffset(final float pX){
  121.                 binderOffset = (pX - midX) / margin;
  122.                 this.onFocusOffset(holderList, binderOffset);
  123.         }
  124.        
  125.         private int getTouchedHolder(final float pX, final float pY){
  126.                 for (int i = 0; i < menuCount; i++) {
  127.                         if (menuList.get(i).contains(pX, pY)) {
  128.                                 return i;
  129.                         }
  130.                 }
  131.                 return menuCount;
  132.         }
  133.  
  134.         protected float abs(final float pFloat){
  135.                 return (pFloat < 0 ? -pFloat : pFloat);
  136.         }
  137.        
  138.         void debug(MainActivity main){
  139.                 binder.attachChild(new Rectangle(0, 0, 5, 300, main.getVertexBufferObjectManager()));
  140.                 dummy.attachChild(new Rectangle(0, 0, 5, 300, main.getVertexBufferObjectManager()));
  141.         }
  142.        
  143.         public void setFlingSensitivty(final float pSensitivity){
  144.                 flingSensitivity = pSensitivity;
  145.         }
  146.        
  147.         public float getFlingSensitivity(){
  148.                 return flingSensitivity;
  149.         }
  150.        
  151.         public void setFlingStrength(final float pStrength){
  152.                 flingStrength = pStrength;
  153.         }
  154.        
  155.         public float getFlingStrength(){
  156.                 return flingStrength;
  157.         }
  158.        
  159.         public void setSensitivity(final float pSensitivity){
  160.                 touchSensitivity = pSensitivity;
  161.         }
  162.        
  163.         public float getSensitivity(){
  164.                 return touchSensitivity;
  165.         }
  166.        
  167.         public void setMaxJitter(final float pAdjustment){
  168.                 adjustment = pAdjustment;
  169.                 maxJitter = (margin * 0.1f) * adjustment;
  170.         }
  171.        
  172.         public float getMaxJitter(){
  173.                 return adjustment;
  174.         }
  175.        
  176.         public void onFocusOffset(final ArrayList<IEntity> pMenuList, final float pOffset){
  177.                
  178.         }
  179.        
  180.         public void onSettle(final ArrayList<IEntity> pMenuList, final int pFocusItemIndex){
  181.                
  182.         }
  183.        
  184.         public IEntity getFocusedItem(){
  185.                 return menuList.get(focusIndex);
  186.         }
  187.        
  188.         public int getFocusIndex(){
  189.                 return focusIndex;
  190.         }
  191.        
  192.         public int getFocusedItemIndex(){
  193.                 return this.getFocusedItem().getTag();
  194.         }
  195.        
  196.         public void registerListener(final ILoopScrollMenuListener pListener){
  197.                 listener = pListener;
  198.         }
  199.        
  200.         public void setItemsShown(final int pItemCount){
  201.                 if (pItemCount <= menuCount) {
  202.                         itemCount = pItemCount;
  203.                         itemCount = (pItemCount%2 != 0 ? pItemCount : pItemCount - 1);
  204.                         this.setMargin(pItemCount);
  205.                         this.setFlingStrength((pItemCount - 1) * 0.5f);
  206.                 }
  207.         }
  208.        
  209.         public int getItemCount(){
  210.                 return itemCount;
  211.         }
  212.        
  213.         public void setMenuScale(final float pScale){
  214.                 menuScale = pScale;
  215.                 for (int i = 0; i < menuCount; i++) {
  216.                         this.setItemScale(i, menuScale);
  217.                 }
  218.         }
  219.        
  220.         public float getMenuScale(){
  221.                 return menuScale;
  222.         }
  223.        
  224.         public void setItemScale(final int index, final float pScale){
  225.                 menuList.get(index).setScale((margin2 * pScale) / menuList.get(0).getWidth());
  226.         }
  227.        
  228.         public void setMargin(final int pItemCount){
  229.                 margin = midX / (pItemCount - 1);
  230.                 margin2 = margin * 2;
  231.                 for (int i = 0; i < menuCount; i++) {
  232.                         holderList.get(i).setPosition((i * margin2) - (margin2 * focusIndex), 0);
  233.                         this.setItemScale(i, menuScale);
  234.                 }
  235.         }
  236.        
  237.         public float getMargin(){
  238.                 return margin;
  239.         }
  240.        
  241.         public void setTouchToFocus(final boolean pBoolean){
  242.                 touchToFocus = pBoolean;
  243.         }
  244.        
  245.         public boolean isTouchToFocus(){
  246.                 return touchToFocus;
  247.         }
  248.        
  249.         @Override
  250.         public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
  251.                 float x = pSceneTouchEvent.getX();
  252.                 float y = pSceneTouchEvent.getY();
  253.                 if (pSceneTouchEvent.isActionDown()) {
  254.                         registerDown = true;
  255.                         if (dummy.getEntityModifierCount() > 0) {
  256.                                 dummy.unregisterEntityModifier(band);
  257.                         } else if (this.getTouchedHolder(x, y) < menuCount) {
  258.                                 isStatic = true;
  259.                                 if (this.getTouchedHolder(x, y) == focusIndex) {
  260.                                         if (listener != null) {
  261.                                                 listener.onMenuItemPressed(this);
  262.                                         }
  263.                                 }
  264.                         }
  265.                         onTouchDownX = x;
  266.                         onDummyDownX = dummy.getX();
  267.                         for (int i = 0; i < 5; i++) {
  268.                                 touchLog[i] = onDummyDownX;
  269.                         }
  270.                         LoopScrollMenu.this.registerUpdateHandler(touchLogger);
  271.                 }
  272.                 if (pSceneTouchEvent.isActionMove()) {
  273.                         if (registerDown) {
  274.                                 dummy.setX(onDummyDownX + ((x - onTouchDownX) * touchSensitivity));
  275.                         }
  276.                 }
  277.                 if (pSceneTouchEvent.isActionUp()) {
  278.                         if (registerDown) {
  279.                                 registerDown = false;
  280.                                 LoopScrollMenu.this.unregisterUpdateHandler(touchLogger);
  281.                                 flick = touchLog[4] - touchLog[0];
  282.                                 float touchOffset = (x - onTouchDownX) * touchSensitivity;
  283.                                 if (flick > flingSensitivity || flick < -flingSensitivity) {
  284.                                         this.flinger(touchOffset * flingStrength, this.abs(touchOffset) / (margin * 2.5f));
  285.                                 } else if (isStatic) {
  286.                                         if (this.abs(touchOffset) <= maxJitter) {
  287.                                                 if (this.getTouchedHolder(x, y) == focusIndex) {
  288.                                                         if (listener != null) {
  289.                                                                 listener.onMenuItemReleased(this);
  290.                                                         }
  291.                                                 }
  292.                                                 if (touchToFocus && this.getTouchedHolder(x, y) != menuCount) {
  293.                                                         int distance =  focusIndex - this.getTouchedHolder(x, y);
  294.                                                         this.flinger(distance * margin2, (this.abs(distance) * 0.25f) + 0.25f);
  295.                                                 } else {
  296.                                                         this.flinger(0, this.abs(binderOffset));
  297.                                                 }
  298.                                         } else {
  299.                                                 this.flinger(0, this.abs(binderOffset));
  300.                                         }
  301.                                         isStatic = false;
  302.                                 } else {
  303.                                         this.flinger(0, this.abs(binderOffset));
  304.                                 }
  305.                         }
  306.                 }
  307.                 return true;
  308.         }
  309.        
  310.         @Override
  311.         public void reset() {
  312.                 dummy.unregisterEntityModifier(band);
  313.                 binder.setPosition(midX, midY);
  314.                 dummy.setPosition(0, 0);
  315.                 offsetter = 0;
  316.                 if (menuList.get(0).getTag() != 0) {
  317.                         this.rotate((menuList.get(0).getTag()));
  318.                 }
  319.                 this.onFocusOffset(holderList, 0);
  320.         }
  321.        
  322.         @Override
  323.         public void attachChild(IEntity pEntity) throws IllegalStateException {
  324.                 if (self) {
  325.                         super.attachChild(pEntity);
  326.                 } else {
  327.                         background.attachChild(pEntity);
  328.                 }
  329.         }
  330.  
  331. }
  332.  
Parsed in 0.027 seconds, using GeSHi 1.0.8.4


An interface for the listener:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public interface ILoopScrollMenuListener {
  2.        
  3.         void onMenuItemPressed(LoopScrollMenu pScrollMenu);
  4.         void onMenuItemReleased(LoopScrollMenu pScrollMenu);
  5.  
  6. }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


And an example of how it can be used:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class MainActivity extends BaseGameActivity implements ILoopScrollMenuListener{
  2.        
  3.         private static final int camW = 369;
  4.         private static final int camH = 480;
  5.         private static final String d = "DEBUG";
  6.        
  7.         private Scene scene;
  8.         private ArrayList<IEntity> buttons1, buttons2;
  9.         private LoopScrollMenu loopMenu1, loopMenu2;
  10.         private Font font;
  11.         private Rectangle background, b;
  12.         private Text title;
  13.  
  14.         @Override
  15.         public EngineOptions onCreateEngineOptions() {
  16.                 Log.d(d, "onCreateEngineOptions");
  17.                 final Camera camera = new Camera(0, 0, camW, camH);
  18.                 final EngineOptions options = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(camW, camH), camera);
  19.                 return options;
  20.         }
  21.  
  22.         @Override
  23.         public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws IOException {
  24.                 Log.d(d, "onCreateResources");
  25.                 // Create font object
  26.                 font = FontFactory.create(getFontManager(), getTextureManager(), 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32, Color.BLACK);
  27.                 font.load();
  28.                 pOnCreateResourcesCallback.onCreateResourcesFinished();
  29.         }
  30.  
  31.         @Override
  32.         public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws IOException {
  33.                 Log.d(d, "onCreateScene");
  34.                 // create scene and set touch bindings to true --- necessary for non whole screen LSMs
  35.                 scene = new Scene();
  36.                 scene.setTouchAreaBindingOnActionDownEnabled(true);
  37.                 scene.setTouchAreaBindingOnActionMoveEnabled(true);
  38.                 scene.setBackgroundEnabled(false);
  39.                 // create our background rectangle and attach it to scene
  40.                 background = new Rectangle(0, 0, camW, camH, getVertexBufferObjectManager());
  41.                 background.setAnchorCenter(0, 0);
  42.                 background.setColor(1, 1, 1);
  43.                 scene.attachChild(background);
  44.                 pOnCreateSceneCallback.onCreateSceneFinished(scene);
  45.         }
  46.  
  47.         @Override
  48.         public void onPopulateScene(Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws IOException {
  49.                 Log.d(d, "onPopulateScene");
  50.                 mEngine.registerUpdateHandler(new TimerHandler(0.01f, new ITimerCallback() {
  51.                         @Override
  52.                         public void onTimePassed(TimerHandler pTimerHandler) {
  53.                                 mEngine.unregisterUpdateHandler(pTimerHandler);
  54.                                 // create a title and a background box for it
  55.                                 title = new Text(camW * 0.5f, camH * 0.8f, font, "A SAMPLE OF A DEFAULT\nAND\nCUSTOM LOOP-SCROLL-MENU", new TextOptions(HorizontalAlign.CENTER), getVertexBufferObjectManager());
  56.                                 title.setScale(0.82f);
  57.                                 b = new Rectangle(camW * 0.5f, camH * 0.8f, title.getWidth(), title.getHeight(), getVertexBufferObjectManager());
  58.                                
  59.                                 // create a list of Text objects. --- use IEntity for the list NECESSARY
  60.                                 buttons1 = new ArrayList<IEntity>(8);
  61.                                 for (int i = 0; i < 8; i++) {
  62.                                         buttons1.add(new Text(0, 0, font, "BUTTON " + i, getVertexBufferObjectManager()));
  63.                                 }
  64.                                 // create a list of Rectangles with different colors. --- use IEntity for the list NECESSARY
  65.                                 buttons2 = new ArrayList<IEntity>(15);
  66.                                 for (int i = 0; i < 15; i++) {
  67.                                         buttons2.add(new Rectangle(0, 0, 200, 200, getVertexBufferObjectManager()));
  68.                                         buttons2.get(i).setColor(MathUtils.random(0f, 1f), MathUtils.random(0f, 1f), MathUtils.random(0f, 1f));
  69.                                 }
  70.                                
  71.                                 // create a default LSM using the Text list and register/attach it to the scene
  72.                                 loopMenu1 = new LoopScrollMenu(buttons1, camW * 0.5f, camH * 0.2f, camW, 64);
  73.                                 scene.registerTouchArea(loopMenu1);
  74.                                 scene.attachChild(loopMenu1);
  75.                                
  76.                                 // create another LSM using the Rectangle list and add a few modifications to it
  77.                                 loopMenu2 = new LoopScrollMenu(buttons2, camW * 0.5f, camH * 0.5f, camW - 20, camH * 0.2f){
  78.                                         @Override
  79.                                         public void onFocusOffset(ArrayList<IEntity> pMenuList, float pOffset) {
  80.                                                 // override onFocusOffset to control how the middle three items look
  81.                                                 pMenuList.get(this.getFocusIndex()).setScale(1.5f - (abs(pOffset) * 0.25f));
  82.                                                 pMenuList.get(this.getFocusIndex() - 1).setScale(1.25f - (abs((pOffset - 1) * 0.5f) * 0.25f));
  83.                                                 pMenuList.get(this.getFocusIndex() + 1).setScale(1.25f - (abs((pOffset + 1) * 0.5f) * 0.25f));
  84.                                         }
  85.                                        
  86.                                         @Override
  87.                                         public void onSettle(ArrayList<IEntity> pMenuList, int pFocusItemIndex) {
  88.                                                 // override onSettle to change the background color to match the focused menu color on every settle
  89.                                                 final IEntity e = pMenuList.get(pFocusItemIndex);
  90.                                                 background.registerEntityModifier(new ColorModifier(0.5f, background.getRed(), e.getRed(), background.getGreen(), e.getGreen(), background.getBlue(), e.getBlue()));
  91.                                                 super.onSettle(pMenuList, pFocusItemIndex);
  92.                                         }
  93.                                 };
  94.                                 // lets add a background to the LSM simply by using attachChild.(see LoopScrollMenu class)
  95.                                 Rectangle r = new Rectangle(0, 0, loopMenu2.getWidth(), loopMenu2.getHeight(), getVertexBufferObjectManager());
  96.                                 r.setAnchorCenter(0, 0);
  97.                                 r.setColor(0.02f, 0.02f, 0.02f);
  98.                                 loopMenu2.attachChild(r);
  99.                                 // register a listener to catch menu presses
  100.                                 loopMenu2.registerListener(MainActivity.this);
  101.                                 // lets set the items to be shown as 7 out of 15
  102.                                 loopMenu2.setItemsShown(7);
  103.                                 // register/attach the LSM
  104.                                 scene.registerTouchArea(loopMenu2);
  105.                                 scene.attachChild(loopMenu2);
  106.                                 scene.attachChild(b);
  107.                                 scene.attachChild(title);
  108.                         }
  109.                 }));
  110.                 pOnPopulateSceneCallback.onPopulateSceneFinished();
  111.         }
  112.        
  113.         @Override
  114.         protected void onDestroy() {
  115.                 Log.d(d, "onDestroy");
  116.                 super.onDestroy();
  117.         }
  118.  
  119.         @Override
  120.         public void onMenuItemPressed(LoopScrollMenu pScrollMenu) {
  121.                 // TODO Auto-generated method stub
  122.                
  123.         }
  124.  
  125.         @Override
  126.         public void onMenuItemReleased(LoopScrollMenu pScrollMenu) {
  127.                 // catch the action up on a pressed menu item and make the title background match the button color
  128.                 IEntity n = pScrollMenu.getFocusedItem();
  129.                 b.setColor(n.getRed(), n.getGreen(), n.getBlue());
  130.         }
  131.    
  132. }
Parsed in 0.019 seconds, using GeSHi 1.0.8.4


PS. sorry for a messy post. I don't know how to use GitHub or the likes ;)
Last edited by Ungaze on Thu Aug 08, 2013 1:31 pm, edited 3 times in total.
User avatar
Ungaze
 
Posts: 409
Joined: Fri Jul 06, 2012 10:53 am

Re: Scrollable & Looping Menu

Postby Sergio » Wed Jul 10, 2013 6:14 pm

That's really cool, thank you very much.
Image
Sergio
 
Posts: 14
Joined: Wed Jul 10, 2013 6:12 pm

Re: Scrollable & Looping Menu

Postby Ungaze » Wed Jul 10, 2013 8:49 pm

Glad to have helped.(hope you didn't get lost with such a long post).

Anyway, my computer's really dying on me. Can't make a video anytime soon. If anyone can make a video from the example and go to the trouble of uploading it, then please be my guest.
User avatar
Ungaze
 
Posts: 409
Joined: Fri Jul 06, 2012 10:53 am

Re: Scrollable & Looping Menu

Postby Qkhang » Tue Aug 06, 2013 9:46 pm

Thanks. Will probably be using it for my game. Figure the least I could do was make a video of it from you example.

http://www.youtube.com/watch?v=haXfkZf- ... e=youtu.be
Qkhang
 
Posts: 116
Joined: Fri Jan 20, 2012 7:00 pm

Re: Scrollable & Looping Menu

Postby Ungaze » Wed Aug 07, 2013 1:54 am

Thanks for the video Qkhang. Didn't test the test-app on landscape, and looks like the scaling didn't show up cause the whole thing is basically a clip-entity(vertical scaling was cut-off on your video).

I'd like to add one last thing missing from this release. I was having pc problems while sharing this class so I didn't had the time to add a sensor to detect a fling-touch action on the last few touch updates. I'll try to implement it this coming week, so be sure to catch it when it comes.

Edit: done! also fixed a small bug.
User avatar
Ungaze
 
Posts: 409
Joined: Fri Jul 06, 2012 10:53 am

Re: Scrollable & Looping Menu

Postby vasanthnagarajan » Sat Nov 09, 2013 5:44 pm

:o I converted the code to scroll in Y axis. But I believe I dont understand y the items are still placed horizontally. The horizontal items are moving vertically
vasanthnagarajan
 
Posts: 12
Joined: Thu Oct 24, 2013 8:38 am

Re: Scrollable & Looping Menu

Postby Ungaze » Sat Nov 23, 2013 1:23 am

Thought no one else would further need this ;)

Anyways, I'm almost done setting up my workstation. I'll try to update it with Y axis compatibility soon.

There's a lot of scroll/movement emulation going on in the background, maybe that's why it's not working as you'd expect it to.
User avatar
Ungaze
 
Posts: 409
Joined: Fri Jul 06, 2012 10:53 am

Re: Scrollable & Looping Menu

Postby vasanthnagarajan » Tue Nov 26, 2013 9:11 am

hey i managed to get it working for Y axis :) :D I know this code works on foccused item. is there a way i can make all items clickable rather than just the focussed item ? :D
vasanthnagarajan
 
Posts: 12
Joined: Thu Oct 24, 2013 8:38 am

Re: Scrollable & Looping Menu

Postby Ungaze » Wed Nov 27, 2013 3:33 am

hey i managed to get it working for Y axis I know this code works on foccused item. is there a way i can make all items clickable rather than just the focussed item ?


Nice work. Right now, it's set to work as either:
a. click on non-focused item, item get's into focus.
b. click on the focused item, then focused action get's executed.

You can make it work like "b" on all items, but that would disable the behavior "a". Just mess up with lines 277 - 306.
User avatar
Ungaze
 
Posts: 409
Joined: Fri Jul 06, 2012 10:53 am

Re: Scrollable & Looping Menu

Postby vasanthnagarajan » Thu Nov 28, 2013 9:05 am

Hey Thanks for your reply :P Im a little confused with that part of the code. Can you please assist me in making all items clickble rather than just the focussed item :D
vasanthnagarajan
 
Posts: 12
Joined: Thu Oct 24, 2013 8:38 am

Next

Return to Features

Who is online

Users browsing this forum: No registered users and 2 guests