Thread: better button hovering.

Results 1 to 8 of 8
  1. #1 better button hovering. 
    Member Market Banned Market Banned

    Robin Spud's Avatar
    Join Date
    Aug 2008
    Age
    28
    Posts
    2,338
    Thanks given
    46
    Thanks received
    73
    Rep Power
    1068
    well. the way people use atm requires 3 methods...and uses like 4 ids. this way uses 1 id as usual and only 1 method.

    add this type to your client.java


    Code:
    						if(class9_1.type == 10)
    						{
    							Sprite sprite = class9_1.sprite1;
    							Sprite sprite2 = class9_1.sprite2;
    							if(sprite != null)
    								sprite.drawSprite(k2, l2);
    							if(sprite2 != null && super.mouseX >= k2
    							&& super.mouseX <= k2+class9_1.width && super.mouseY >= l2
    							&& super.mouseY <= l2+class9_1.height)
    								sprite2.drawSprite(k2, l2);
    						}
    and and then make your button type 10.


    How to use:

    Sprite1 and Sprite2 in your addButton methods are the hover and non hover sprites

    so:

    Sprite1 = new Sprite("button");
    Sprite2 = new Sprite("button_hover");
    ILY Stewie.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Jammy780's Avatar
    Join Date
    May 2008
    Posts
    1,320
    Thanks given
    13
    Thanks received
    47
    Rep Power
    619
    This is a lot more efficant. Good work
    Reply With Quote  
     

  3. #3  
    Derp.
    BenjaR's Avatar
    Join Date
    May 2008
    Age
    26
    Posts
    2,086
    Thanks given
    167
    Thanks received
    125
    Rep Power
    915
    More efficient, but I like using the original way; Sprite + mouseOverInterToTrigger, layer(mouseOvered content).
    Reply With Quote  
     

  4. #4  
    Retired. Stop PMing me.

    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    14
    Posts
    7,528
    Thanks given
    1,783
    Thanks received
    2,822
    Discord
    View profile
    Rep Power
    5000
    Doesn't work unless it's a game screen interface.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #5  
    I'm Back

    Stewie's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    7,989
    Thanks given
    1,877
    Thanks received
    1,491
    Rep Power
    5000
    It works perfectly fine for me for side panel and chat panel interfaces. Just make it redraw the side panel and chat panel whenever it draws the child and it works fine.


    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Registered Member
    Rupps's Avatar
    Join Date
    Oct 2008
    Age
    25
    Posts
    905
    Thanks given
    317
    Thanks received
    24
    Rep Power
    194
    But what if it's a button that turns on and off?
    Current Project: [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    I'm Back

    Stewie's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    7,989
    Thanks given
    1,877
    Thanks received
    1,491
    Rep Power
    5000
    Quote Originally Posted by Jack R View Post
    But what if it's a button that turns on and off?
    Code:
    if(class9_1.type == 10)
    						{
    							Sprite sprite;
    							Sprite sprite2; 
    							if(!interfaceIsSelected(class9_1)){
    								sprite = class9_1.sprite1;
    								sprite2 = class9_1.hoverSprite1;
    							}else{
    								sprite = class9_1.sprite2;
    								sprite2 = class9_1.hoverSprite2;
    							}
    							if(sprite != null)
    								sprite.drawSprite(k2, l2);
    							if(sprite2 != null && super.mouseX >= k2
    							&& super.mouseX <= k2+class9_1.width && super.mouseY >= l2
    							&& super.mouseY <= l2+class9_1.height)
    								sprite2.drawSprite(k2, l2);
    						}
    Then simply add these variables to RSInterface:
    Code:
    public Sprite hoverSprite1;
    public Sprite hoverSprite2;
    And initialize them in your Type 10 interface methods.


    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  8. #8  
    Registered Member
    Rupps's Avatar
    Join Date
    Oct 2008
    Age
    25
    Posts
    905
    Thanks given
    317
    Thanks received
    24
    Rep Power
    194
    Ah, nice work
    Current Project: [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

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