Thread: [Snippet] Scrolling for all interfaces (Fixed Flicker)

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 [Snippet] Scrolling for all interfaces (Fixed Flicker) 
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    Created by me, if you'd like to say otherwise; I don't care.

    This is for 317-377 clients that don't already have scrolling for interfaces.

    Code:
    public class RSApplet extends Applet implements Runnable, MouseListener,
    		MouseMotionListener, KeyListener, FocusListener, WindowListener,
    		MouseWheelListener **
    Code:
    	public void run() **
    		getGameComponent().addMouseListener(this);
    		getGameComponent().addMouseWheelListener(this);
    		getGameComponent().addMouseMotionListener(this);
    		getGameComponent().addKeyListener(this);
    		getGameComponent().addFocusListener(this);
    		if (gameFrame != null)
    			gameFrame.addWindowListener(this);
    		drawLoadingText(0, "Loading...");

    Code:
    	public void mouseWheelMoved(MouseWheelEvent e) {
    		int Rot = e.getWheelRotation();
    		interfaceScrollCheck(e);
    
    		if (mouseX > 0 && mouseX < 512 && mouseY > 503 - 165
    				&& mouseY < 503 - 25) {
    			int ChatPosition = Game.anInt1089;
    			ChatPosition -= Rot * 28;
    
    			if (ChatPosition < 0) {
    				ChatPosition = 0;
    			}
    
    			if (ChatPosition > Game.anInt1211 - 77) {
    				ChatPosition = Game.anInt1211 - 77;
    			}
    
    			if (Game.anInt1089 != ChatPosition) {
    				Game.anInt1089 = ChatPosition;
    				Game.inputTaken = true;
    			}
    		}
    	}
    
    	public void interfaceScrollCheck(MouseWheelEvent e) {
    		try {
    			int Rotation = e.getWheelRotation();
    
    			int TAB = 0, WINDOW = 1;
    
    			int POSX = 0, POSY = 1, WIDTH = 2, HEIGHT = 3, OFFX = 4, OFFY = 5, CHILD = 6, SENSITIVITY = 7;
    
    			int[] InterfaceID = { Game.tabInterfaceIDs[Game.tabID],
    					Game.openInterfaceID };
    
    			int[] InterfaceSetting = { 0, 0, /* positionX, positionY */
    			0, 0, /* Width, Height */
    			0, 0, /* offsetX, offsetY */
    			0, 15 /* Child ID, Sensitivity */
    			};
    
    			int[] IS = InterfaceSetting;
    
    			if (InterfaceID[TAB] != -1) {
    				RSInterface Tab = RSInterface.interfaceCache[InterfaceID[TAB]];
    				InterfaceSetting[OFFX] = 547;
    				InterfaceSetting[OFFY] = 205;
    				for (int Index = 0; Index < Tab.children.length; Index++) {
    					if (RSInterface.interfaceCache[Tab.children[Index]].scrollMax > 0) {
    						InterfaceSetting[CHILD] = Index;
    						InterfaceSetting[POSX] = Tab.childX[Index];
    						InterfaceSetting[POSY] = Tab.childY[Index];
    						InterfaceSetting[WIDTH] = getChildWidth(Tab, Index);
    						InterfaceSetting[HEIGHT] = getChildHeight(Tab, Index);
    						break;
    					}
    				}
    
    				if (mouseX > IS[OFFX] + IS[POSX]
    						&& mouseY > IS[OFFY] + IS[POSY]
    						&& mouseX < IS[OFFX] + IS[POSX] + IS[WIDTH]
    						&& mouseY < IS[OFFY] + IS[POSY] + IS[HEIGHT]) {
    					switch (InterfaceID[TAB]) {
    					case 962: /* Music Tab */
    						IS[SENSITIVITY] = 30;
    						break;
    
    					case 638: /* Quest Tab */
    						IS[SENSITIVITY] = 30;
    						break;
    
    					case 1151: /* Magic Tab */
    						IS[SENSITIVITY] = 7;
    						break;
    
    					case 147: /* Emote Tab */
    						IS[SENSITIVITY] = 15;
    						break;
    
    					default:
    						IS[SENSITIVITY] = 15;
    						break;
    					}
    					;
    
    					switch (Rotation) {
    					case -1:
    						if (RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition != 0) {
    							RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition += Rotation
    									* IS[SENSITIVITY];
    							Game.needDrawTabArea = true;
    							Game.tabAreaAltered = true;
    						}
    						break;
    
    					case 1:
    						if (RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition != RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollMax
    								- RSInterface.interfaceCache[Tab.children[IS[CHILD]]].height) {
    							RSInterface.interfaceCache[Tab.children[IS[CHILD]]].scrollPosition += Rotation
    									* IS[SENSITIVITY];
    							Game.needDrawTabArea = true;
    							Game.tabAreaAltered = true;
    						}
    						break;
    					}
    				}
    			}
    
    			if (InterfaceID[WINDOW] != -1) {
    				RSInterface Window = RSInterface.interfaceCache[InterfaceID[WINDOW]];
    				InterfaceSetting[OFFX] = 4;
    				InterfaceSetting[OFFY] = 4;
    				for (int Index = 0; Index < Window.children.length; Index++) {
    					if (RSInterface.interfaceCache[Window.children[Index]].scrollMax > 0) {
    						InterfaceSetting[CHILD] = Index;
    						InterfaceSetting[POSX] = Window.childX[Index];
    						InterfaceSetting[POSY] = Window.childY[Index];
    						InterfaceSetting[WIDTH] = getChildWidth(Window, Index);
    						InterfaceSetting[HEIGHT] = getChildHeight(Window, Index);
    						break;
    					}
    				}
    
    				if (mouseX > IS[OFFX] + IS[POSX]
    						&& mouseY > IS[OFFY] + IS[POSY]
    						&& mouseX < IS[OFFX] + IS[POSX] + IS[WIDTH]
    						&& mouseY < IS[OFFY] + IS[POSY] + IS[HEIGHT]) {
    
    					switch (InterfaceID[WINDOW]) {
    					default:
    						IS[SENSITIVITY] = 30;
    						break;
    					}
    					;
    
    					switch (Rotation) {
    					case -1:
    						if (RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition != 0) {
    							RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition += Rotation
    									* IS[SENSITIVITY];
    							Game.needDrawTabArea = true;
    							Game.tabAreaAltered = true;
    						}
    						break;
    
    					case 1:
    						if (RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition != RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollMax
    								- RSInterface.interfaceCache[Window.children[IS[CHILD]]].height) {
    							RSInterface.interfaceCache[Window.children[IS[CHILD]]].scrollPosition += Rotation
    									* IS[SENSITIVITY];
    						}
    						break;
    					}
    					RSInterface.interfaceCache[Window.children[InterfaceSetting[CHILD]]].scrollPosition += Rotation * 30;
    				}
    			}
    		} catch (Exception ex) {
    			ex.printStackTrace();
    		}
    	}
    
    	public int getScrollPosition(RSInterface Interface, int Child) {
    		return RSInterface.interfaceCache[Interface.children[Child]].scrollPosition;
    	}
    
    	public int getChildWidth(RSInterface Interface, int Index) {
    		return RSInterface.interfaceCache[Interface.children[Index]].width;
    	}
    
    	public int getChildHeight(RSInterface Interface, int Index) {
    		return RSInterface.interfaceCache[Interface.children[Index]].height;
    	}
    Code:
    client Game;
    Edit: I don't know why all the brackets changed into asterisks, but that's just something you're going have to deal with.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    I don't care if you say anything is sloppy or tell me what I can improve on, just be grateful I decided to make it easier for the people who wanted this.


    Edit: Also how things show up like this:
    Code:
    switch(blah) {
          case 23423:
                break;
    }
    ;
    I don't know why eclipse puts the semi-colon one line down, don't bug me about it.
    Reply With Quote  
     

  3. #3  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    I though you cannot release property of rs2006, hahahah
    Reply With Quote  
     

  4. #4  
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    That's not property of rs2006, I created it and it's being used in the rs2006 client.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    I told you, it's not property of rs2006, rs2006 owns nothing.
    If anything EVERYTHING in rs2006 is owned by Jagex, so quit trying to start a fight.

    I made this and that's final.
    Reply With Quote  
     

  6. #6  
    Registered Wizard

    Jesse's Avatar
    Join Date
    Sep 2009
    Age
    29
    Posts
    5,119
    Thanks given
    1,519
    Thanks received
    1,148
    Rep Power
    5000
    not sure if this is serious or you joking?



    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    Quote Originally Posted by Dane View Post
    I told you, it's not property of rs2006, rs2006 owns nothing.
    If anything EVERYTHING in rs2006 is owned by Jagex, so quit trying to start a fight.

    I made this and that's final.
    Not even trying to start a fight lol,

    http://www.rune-server.org/3024480-post1496.html <--- that post

    And why are you capitalizing every int and your conventions are horrible.

    Good job tho
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Reply With Quote  
     

  11. Thankful users:


  12. #9  
    Registered Member
    Wiffles's Avatar
    Join Date
    Dec 2007
    Posts
    1,168
    Thanks given
    100
    Thanks received
    198
    Rep Power
    493
    Quote Originally Posted by Harlan View Post
    That tutorial doesn't make it so the scrolling doesn't 'flicker' the content inside, for instance if you're in the quest tab and you're constantly scrolling up while it's already up all the way, it will make it appear that you're scrolling up still and the quest names will turn white as it goes up thinking you're hovering above it.


    @Men

    Like I care what Vault says.
    Reply With Quote  
     

  13. #10  
    Registered Member
    AkZu's Avatar
    Join Date
    Jan 2008
    Age
    29
    Posts
    393
    Thanks given
    249
    Thanks received
    163
    Rep Power
    343
    Quote Originally Posted by Dane View Post
    That tutorial doesn't make it so the scrolling doesn't 'flicker' the content inside, for instance if you're in the quest tab and you're constantly scrolling up while it's already up all the way, it will make it appear that you're scrolling up still and the quest names will turn white as it goes up thinking you're hovering above it.


    @Men

    Like I care what Vault says.
    Galkon posted very effective method few months ago. Maybe he just forgot to add checking off scrollbar pos - interface height. I did fix it in few mins just to add checks so it won't overlap.

    OT: Nice work there anyways
    Spoiler for OSRS in #414:
    Reply With Quote  
     

  14. Thankful user:


Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Scrollbars..
    By No Dice in forum Help
    Replies: 0
    Last Post: 09-06-2009, 01:19 AM
  2. Scrollbars and exp
    By Muroth in forum Help
    Replies: 1
    Last Post: 08-03-2009, 10:47 PM
  3. Simpler Scrollbars
    By Stewie in forum Snippets
    Replies: 17
    Last Post: 08-03-2009, 04:15 PM
  4. Replies: 8
    Last Post: 11-17-2007, 05:44 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •