Thread: Draw another interface on hover?

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Draw another interface on hover? 
    Donator


    Join Date
    Aug 2012
    Posts
    2,462
    Thanks given
    312
    Thanks received
    459
    Rep Power
    457
    Hello rune-server members, today i come baring questions, as usual haha. Thank you in advance for any support:

    Currently i am trying to draw a box inside the frame upon hovering over the "I" icon. I want to draw the box inside the black frames. Currently i have a version that process to cfheck if tabid 7 is open, then it checks if ur mouse is over the sprite that i want to hover over. After that i draw the box, so it kinda works right now but i contiuallsy keep drawing the box while i am hovering when i just want it to show untill u no longer are hovering.. i removed my code because im 100% sure i don't need to process the hvoer interaction...

    heres a small image.. Attached image

    please note i do not want to click the hover icon then draw the interface if i did i would just create a non visble interface...
    Attached image

    Attached image
    Reply With Quote  
     

  2. #2  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    in buildinterfacemenu, just check if the button you're hovering over has a popup interface, and then draw the interface same way as the drawtabarea interface
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Aug 2012
    Posts
    2,462
    Thanks given
    312
    Thanks received
    459
    Rep Power
    457
    Quote Originally Posted by Hitten View Post
    in buildinterfacemenu, just check if the button you're hovering over has a popup interface, and then draw the interface same way as the drawtabarea interface
    I'm not sure what you mean by popup interface but if you reffering to the actual hover sprite, then I originally had this in buildinterface


    Code:
    private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int j1) {
    		if (widget == null || widget.type != 0 || widget.children == null || widget.invisible || widget.drawingDisabled)
    			return;
    		if (k < i || i1 < l || k > i + widget.width || i1 > l + widget.height)
    			return;
    		int size = widget.children.length;
    		for (int l1 = 0; l1 < size; l1++) {
    			int i2 = widget.childX[l1] + i;
    			int j2 = (widget.childY[l1] + l) - j1;
    			Widget childInterface = Widget.interfaceCache[widget.children[l1]];
    			if (childInterface == null) {
    				continue;
    			}
    
    			i2 += childInterface.horizontalOffset;
    			j2 += childInterface.verticalOffset;
    			if ((childInterface.hoverType >= 0 || childInterface.defaultHoverColor != 0) && k >= i2 && i1 >= j2
    					&& k < i2 + childInterface.width && i1 < j2 + childInterface.height)
    				if (childInterface.hoverType >= 0)
    					anInt886 = childInterface.hoverType;
    				else
    					anInt886 = childInterface.id;
    			
    			if (tabId == 7 && Client.instance.hover(712, 212, Client.cacheSprite[792])) {
    					System.out.println("hit hover, draw overlay.");
    Using this

    Code:
    			if (tabId == 7 && Client.instance.hover(712, 212, Client.cacheSprite[792])) {
    to check if im hovering i get this result...


    Attached image
    Attached image

    Attached image
    Reply With Quote  
     

  4. #4  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Ok so then you can tell it to draw the overlay. After the tab area is rendered, make it draw the hover the same way as the tab interface.
    Reply With Quote  
     

  5. #5  
    Donator


    Join Date
    Aug 2012
    Posts
    2,462
    Thanks given
    312
    Thanks received
    459
    Rep Power
    457
    Quote Originally Posted by Hitten View Post
    Ok so then you can tell it to draw the overlay. After the tab area is rendered, make it draw the hover the same way as the tab interface.
    I am telling it to draw. If u see on the middle of my screen it draws there currently...but im not to worried about positioning.. but it removes the hover option right after..
    Attached image

    Attached image
    Reply With Quote  
     

  6. #6  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Client.instance.hover(712, 212, Client.cacheSprite[792]

    What is that function?
    Reply With Quote  
     

  7. #7  
    Donator


    Join Date
    Aug 2012
    Posts
    2,462
    Thanks given
    312
    Thanks received
    459
    Rep Power
    457
    Quote Originally Posted by Hitten View Post
    Client.instance.hover(712, 212, Client.cacheSprite[792]

    What is that function?
    would be this here

    Code:
    public boolean hover(int x1, int y1, Sprite drawnSprite) {
    		return super.mouseX >= x1 && super.mouseX <= x1 + drawnSprite.myWidth && super.mouseY >= y1
    				&& super.mouseY <= y1 + drawnSprite.myHeight;
    	}
    Attached image

    Attached image
    Reply With Quote  
     

  8. #8  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by Guruu View Post
    would be this here

    Code:
    public boolean hover(int x1, int y1, Sprite drawnSprite) {
    		return super.mouseX >= x1 && super.mouseX <= x1 + drawnSprite.myWidth && super.mouseY >= y1
    				&& super.mouseY <= y1 + drawnSprite.myHeight;
    	}
    You shouldn't hardcode it like that because it wont work in fullscreen/resizable. And all the code for checking if the button is hovered is already there for you.

    In buildInterfaceMenu

    Code:
    if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
    That will check if the component type is 1 (button) and the mouse is inside the component's boundaries. It will set the menu actions.
    So in there you can just make it check if that component should render a hover interface, and set your variable to render it.
    Reply With Quote  
     

  9. #9  
    Community Veteran

    mige5's Avatar
    Join Date
    Aug 2008
    Posts
    5,528
    Thanks given
    573
    Thanks received
    1,410
    Rep Power
    2114
    If I understood correctly u want stuff to showup when u hover over... like it does show the spell requirements in the spellbook. - why not do it the same way then?
    Number of page #1 releases with most views & posts: (Updated: 2023)
    RS2 server section: 1
    RS2 client section: 2
    Reply With Quote  
     

  10. #10  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by mige5 View Post
    If I understood correctly u want stuff to showup when u hover over... like it does show the spell requirements in the spellbook. - why not do it the same way then?
    Spellbook hovers stay in the same spot (unless modified system), he probably wants it to be drawn based on the mouse position.
    Reply With Quote  
     

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. Send Another Player On Interface
    By OS Rsps in forum Requests
    Replies: 3
    Last Post: 01-29-2014, 05:39 PM
  2. Replies: 10
    Last Post: 05-30-2009, 06:57 AM
  3. Magic interface with hovering
    By Dexter Morgan in forum Tutorials
    Replies: 12
    Last Post: 04-16-2009, 06:41 AM
  4. uhhh, another interface prob.
    By TrollCount++ in forum Help
    Replies: 0
    Last Post: 04-11-2009, 12:32 PM
  5. How to make an Object open an Interface on Devolution.
    By Soul Breaker in forum Tutorials
    Replies: 5
    Last Post: 01-30-2008, 03:46 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
  •