atb-agg demo fixes for retina displays#140
Conversation
|
Thanks. Actually, I think all the demos get the same problem on mac book pro retina. I opened issue #91 some time ago but I've never found the time to make a proper fix. Do you have an idea how we could factorize your fix ? |
|
For #91, I believe that the different demos will require different changes (as we don't want them all to be really tiny on high density displays right?), and this PR partially fixes the problem (does it for atb-agg). |
demos/atb-agg.c
Outdated
| int pixWidth, pixHeight, winWidth, winHeight; | ||
| glfwGetFramebufferSize( window, &pixWidth, &pixHeight ); | ||
| glfwGetWindowSize( window, &winWidth, &winHeight ); | ||
| is_scaled = pixWidth > winWidth || pixHeight > winHeight; |
There was a problem hiding this comment.
bool to int type conversion. for what reason?
There was a problem hiding this comment.
If is_scaled is defined as bool, I get the following compilation error:
demos/atb-agg.c:433:5: error: use of undeclared identifier 'bool'
bool is_scaled;
^
I'm used to using bool in C++, but afaik it isn't available in plain C, which I haven't used in quite a while, so I'm not sure what to use.. What do you suggest?
There was a problem hiding this comment.
Thanks, Done. Now I know of <stdbool.h> in C99 :)
|
#include <stdbool.h> ?
…On Dec 22, 2016 11:01, "Yair Chuchem" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In demos/atb-agg.c <#140>:
> @@ -423,6 +423,18 @@ void TW_CALL get_tertiary( void *value, void *data )
// ------------------------------------------------------------------- init ---
void init( GLFWwindow* window )
{
+ int is_scaled;
+ {
+ int pixWidth, pixHeight, winWidth, winHeight;
+ glfwGetFramebufferSize( window, &pixWidth, &pixHeight );
+ glfwGetWindowSize( window, &winWidth, &winHeight );
+ is_scaled = pixWidth > winWidth || pixHeight > winHeight;
If is_scaled is defined as bool, I get the following compilation error:
demos/atb-agg.c:433:5: error: use of undeclared identifier 'bool'
bool is_scaled;
^
I'm used to using bool in C++, but afaik it isn't available in plain C,
which I haven't used in quite a while, so I'm not sure what to use.. What
do you suggest?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#140>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AArOi6M72V8MwEHh8qQGDhvufzcHVQbNks5rKkqFgaJpZM4LRw9o>
.
|
|
Fixed, thanks. |
demos/atb-agg.c
Outdated
| if (is_scaled) | ||
| TwDefine("TweakBar " | ||
| "size = '560 800' " | ||
| "position = '1000 40' "); |
There was a problem hiding this comment.
It's better to calculate correct position by multiplying it on fontscaling factor.
| "min = 6.0 " | ||
| "max = 24.0 " | ||
| "step = 0.05 " | ||
| "max = 60.0 " |
There was a problem hiding this comment.
Does it still works fine for non-retina systems?
There was a problem hiding this comment.
It should, it will just allow large fonts. If you happen to have such a system, could you check?
There was a problem hiding this comment.
just checked on a friend's laptop and it indeed works fine
|
@bagobor does it look ok now? |
The atb fonts are pixelized but at least legible.
as suggested by @bagobor
The atb-agg demo looks like this on my MacBook Pro (Retina, 13-inch, Late 2012):

And the atb widgets do not respond to the mouse at their displayed locations.
This change fixes these issues.