Object Text at Cursor - can you set displacement?

  • #1, by tangerinedogFriday, 08. February 2019, 19:46 5 years ago

    Right now, the Object Names in my project appear to the right of the cursor on it's center x-axis.
    I'd really like them to appear below the cursor on it's center y-axis.

    But how could I make that happen?


    Newbie

    12 Posts


  • #2, by PanSFriday, 08. February 2019, 20:46 5 years ago
    I am searching for an object text offset too. Would like fix to text position depending on the cursor type:

    Newbie

    73 Posts

  • #3, by sebastianSaturday, 09. February 2019, 13:33 5 years ago
    this would be only possible with lua and an interface.
    Interfaces have also the ability to have a centered(!) action text. Even when the text is larger than the area, it gets rendered outside.

    So you could have an interface with an action text area that is only 1px wide. Set the interface position to absolute. Current Cursor Position has the issue that it cant be corrected so easily and "move". At least when i tested it a few months ago. 

    Via an event handler, update the offset of said interface to getCursorPos().x + text height / getCursorPos().y. Because your interface has no real width. it should get centered.
    function cursorLoop()
        Interface["name"].Offset = {x=getCursorPos.x+20 , y=getCursorPos.y}
    end
    
    registerEventHandler("mainLoop", "cursorLoop")

    (untested)

    That text should get rendered even outside of the interface area and gets updated its position via the loop.
    Only downside is that the text would also disappear at the screen edges. So you may need to run some checks to prevent this and get you text clip to the screen edges.


    Hope that helps as a start.

    ~Sebastian

    PS: another way would be to render the action text completely via lua and no interfaces. But that would include more advanced lua stuff.

    Thread Captain

    2346 Posts