justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: Again a reascript question (sorry about that): What is the proper way to support retina/hidpi in scripts? We tried to figure it out, but I think nobody has got it 100% right yet. forum.cockos.com/showthread.php?t=230120
Asked by amagalma (91.140.81.x) on October 28 2021, 5:00pm
Reply on October 29 2021, 2:41am:
    the proper way is to set gfx.ext_retina to 1 at script start, then after gfx.init() check it to see if is set to a value greater than 1. It will be automatically updated based on the monitor that contains your window.


Comments:
  • Posted by amagalma (91.140.81.x) on October 29 2021, 11:55am:
    Thank you! :)

  • Posted by amagalma (91.140.81.x) on October 29 2021, 9:34pm:
    So, in order to set the size of the gfx window according to the retina scale, do I have to gfx.init, gfx.quit, get the scale and then gfx.init with the correct width and height? Or is there any other way to set the correct gfx window size according to the scale?

  • Posted by Justin on October 30 2021, 1:47am:
    It's undocumented (I'll update the docs!) but if you call gfx.init("",w,h) it will resize the window. Of course, you don't want to scale on macOS, because its units are independent of DPI (sanity!) -- so you want to do os = reaper.GetOS() if os ~= "OSX64" and os ~= "OSX32" and os ~= "macOS-arm64" then ...

  • Posted by amagalma (91.140.81.x) on October 30 2021, 5:20pm:
    gfx.init("", width, height) seems to resize indeed, but after the resize nothing is drawn if the the script is not deferring. But even if it is deferring, gfx.drawstr seems to not work (I can send you some test code if you want)... Regarding macOS, does this mean that there is no need to scale the size of the gfx window? It will be done automatically? And I need to scale only the contents? Did I understand right? Thanks!

  • Posted by Justin on October 30 2021, 11:38pm:
    Send me an email to continue this conversation


Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2021 Justin Frankel. | RSS