Drawing a black square and a white square & taking priority

Discussion in 'Rivatuner Statistics Server (RTSS) Forum' started by Skewjo, Oct 15, 2020.

  1. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Hello guys(@Unwinder & @mbk1969 =P),

    I'm am plugging away on project using RTSS and I need a bit of help understanding the "hypertext" used by the OverlayEditor feature.

    From your SharedMemorySample I've created a function that will draw a black box on the screen:

    Code:
    void CSysLat_SoftwareDlg::DrawBlack(CRTSSClient sysLatClient)
    {
        sysLatClient.UpdateOSD("<C=80000000><B=0,0>\b<C><E=-1,-1,8><C=000000><I=-2,0,384,384,128,128><C>");
    }
    
    I ripped the string straight out of the OverlayEditor once I was able to find an option where I could draw a white/black box so to be honest I have no idea what it's actually doing. I think it's using a "blank" corner of some static image...
    I also have some other problems with it such as:
    1. Is it possible to set BaseColor, BgndColor, and FillColor colors individually "per client"?
    2. Is it possible to set the opacity of those same 3 items from a sharedMemory app?
    3. Is there a way to claim priority over other apps using RTSS(such as Afterburner) so I can claim the corners? I'm setting the "dwEntry" var to 0 in the "UpdateOSD()" function, but I feel like there's also a way to use absolute coordinates in the string to make sure I'm taking over a corner...
    I've got several other questions I could bombard you with, but I'll try and figure them out on my own if I can get some answers to these.

    Thanks!
     
    Last edited: Oct 15, 2020
  2. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    @Skewjo
    You have to use "@" with user name to attract him...
     
    Skewjo likes this.
  3. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Thank you sir. Does that functionality work when you edit a post? <.<
    If it doesn't, I'll just wait patiently until he sees it I think lol
     
  4. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    Looks like it does not with editing.
    Can you imagine the amount of notifications Unwinder gets when he logs in...

    Do you have a documentation on RTSS overlay, API? I was avoiding that but if you can`t rule that out, I can dive in to help you...
     
    Skewjo likes this.

  5. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Well, there's the "C:\Program Files (x86)\RivaTuner Statistics Server\Doc\ReadMe.pdf" file that you get access to when you install RTSS, but a quick glance through it doesn't really yield what I think I'm looking for.
     
  6. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    Send it to me via e-mail.
     
    Skewjo likes this.
  7. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    Hypertext you’re using is way too complex for your needs (i.e. just drawing a black box). You do the following with “
    <C=80000000><B=0,0>\b<C><E=-1,-1,8><C=000000><I=-2,0,384,384,128,128><C>”:

    - Set text color attribute to semitransparent black (80000000 ARGB).
    - Draw solid bar using current text color. You specify both height and width as zeroes, which means that hypertext parser will scan all subsequent hypertext till the end (or till new hypertext layer definition) to calculate text extent and use it as bar dimensions
    - Return cursor to the previous position to start rendering on top of previously rendered bar
    - Restore default text color
    - Override text extent and layer content alignment mode. You specify negative width and height (-1) so it will be treated as 1 by 1 symbol
    - Set color to opaque black
    - Embed image from font texture into hypertext
    - Restore default text color again

    The same can be done with:

    <C=80000000><B=-1,-1><C>
     
    Skewjo likes this.
  8. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    It is revision history file, you won’t find it there. The best way to explore and learn hypertext formatting rules is sample code included in SDK. Source code of OverlayEditor plugin itself is the most detailed one, basic hypertext tags usage isalso demonstrated and commented in RTSSSharedMemorySample.
     
    Skewjo likes this.
  9. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Awesome, thanks for the response @Unwinder.

    I believe the reason I began using the embedded image from the font texture is because the hypertext is appearing in the box(though this is probably from some dumb modification I made to the UpdateOSD() function...)

    Here's a pic: https://imgur.com/a/59dFJjx

    Also, is there any way an "opaque"(I think this is the word I'm looking for) black vs the "semitransparent black"?
    Nevermind... I somehow missed where you said "<C=000000>" is opaque black. Whoops.
     
    Last edited: Oct 15, 2020
  10. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    No spaces inside the tags are allowed. Hypertext buffer is not endless so restriction is done on purpose to prevent anyone from wasting it.

    Set alpha to FF to make it opaque. If alpha is missing in the color definition (e.g. RRGGBB instead of AARRGGBB), it is also treated as opaque by parser.
     
    Skewjo likes this.

  11. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Awesome, removing the spaces fixed it, and the opacity settings allow me to leave the BaseColor, BgndColor, and FillColor settings alone.

    I'm a little confused on the sizing. I believe you said that the setting "<E=-1,-1,8>" makes it so that the box will be treated as 1 by 1 symbol(and I also guessed that it would make it align right, but I'm not so sure about that any more) which I believe is what I want, as <B=-1,-1> is a rectangle half of the square size and shape I wanted.

    I believe I was using the following previously to get around the sizing/justification issue:
    (referring to "<B=0,0>" I believe.)

    Sorry if this is too long-winded. Here are my questions. Feel free to tell me to frig-off if you think I should be able to figure them out on my own:
    1. Is there a way to align my box left/right or up/down relative to other OSD clients?
    2. I assumed <B=1,1> would be equivalent to <B=-1,-1>, but I guess a "B-tag" doesn't represent the size of a 1-by-1 symbol? I think I've resolved this issue by using <B=10,10>.
    3. Is there a way to retrieve the current corner and the X and Y coordinates via the RTSSSharedMemory interface? Took a quick look and didn't see them(or I didn't know what I was looking for). I feel like these options should be what I want: CoordinateSpace, PositionX, PositionY
     
  12. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    <E> tag sets the _minimum_ text extent, which can be readjusted by hypertext parser if you actually try to display more text there. You set extent to 1x1 symbols then inserted embedded image with width equal to 2 symbols. It increased horizontal extent.
     
  13. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    1. No. But there is <P> tag for positioning text explicitly.
    2. Negative values are interpreted as symbols, so they depend on current font width/height. Positive values are treated as zoomed pixels (pixels * OSD zooming ratio). That rule apply to most of coordinates/dimensions specified in other tags (including position tag mentioned above).
    3. There is profile API allowing you to control that either for global or for application specific profiles.
     
  14. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Thanks again for all of the answers, and thanks for reminding me about the <P> tag. I think I can use that and the <E> tag (nevermind... I think I just figured out that the <E> tag only affects images... right?) in combination with the profile API command for "active corner" to reposition the box so that it always appears in the corner of the screen.

    I think this will be my last question for a while: Can you provide me with that API command to control the corner? I found the following documented in the RTSSProfileInterface class, but(AFAIK) none of them look like what I need.
    Code:
            //The following properties are available:
            //AppDetectionLevel                        0..3    - Application detection level
            //Implementation                        0..1    - On-Screen Display rendering mode
            //EnableFloatingInjectionAddress        0..1    - Stealth mode
            //EnableDynamicOffsetDetection            0..1    - Custom Direct3D support
            //FramerateLimit                        ....    - Framerate limit
            //FontWeight                            ....    - font weight for Raster3D On-Screen Display rendering mode
            //FontFace                                string    - font face (e.g. "Tahoma") for Raster3D On-Screen Display rendering mode
            //EnableOSD                                0..1    - On-Screen Display support
            //EnableBgnd                            0..1    - On-Screen Display shadow
            //EnableStat                            ....    - Show own statistics
            //BaseColor, BgndColor                    ....    - On-Screen Display palette
            //PositionX, PositionY                    ....    - On-Screen Display position
            //ZoomRatio                                1..8    - On-Screen Display zoom
            //CoordinateSpace                        0..1    - On-Screen Display coordinate space
    
     
    Last edited: Oct 16, 2020
  15. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    PositionX and PositionY. Coodinates are wrapped, positive are offsets from top/left, negatives are offsets from bottom/right
     

  16. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    OHHHH, I think I got it. I probably would've seen that if I would've played around with PositionX and PositionY...

    I'm feeling pretty damn stupid here, but I'm still not wrapping my head around what the <E> tag does... does it only affect images?
     
  17. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    It affects any hypertext content, including both text and embedded objects (images and graphs and so on). By default layer extent is defined by its' content. <E> tag allows making layer bigger than its' content and apply content horizontal/vertical alignment.
     
  18. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Ok, that's what I thought! ...but it's just not behaving as I expected. The behavior I'm wanting is for my black/white box to take over the corner.

    So if the "RTSS origin" is the bottom right corner, and I set the extent of the box using this string "<C=000000><B=10,10><C><E=-1,-1,8>", my black box should display in the bottom right, correct?

    As far as I can tell, adding that <E> tag there doesn't seem to do anything for me: https://imgur.com/a/BDwInEh

    To clarfiy, I'd like the black square to align to the bottom right corner(by either appearring over the end of the word "STUFF" or by taking over that slot and pushing "STUFF" up, but that's an OSD slot issue and not an extent issue I believe).
     
  19. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,198
    Likes Received:
    6,866
    No. Coordinates origin changes from top left to bottom right when coordinates are wrapped.
    Sorry, thread is taking too much of my work time.
     
  20. Skewjo

    Skewjo Member

    Messages:
    34
    Likes Received:
    0
    GPU:
    GTX 1060 3GB
    Sorry dude! Thanks for all of your help.
     

Share This Page