-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
atb-agg demo fixes for retina displays #140
base: master
Are you sure you want to change the base?
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). |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool to int type conversion. for what reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
if (is_scaled) | ||
TwDefine("TweakBar " | ||
"size = '560 800' " | ||
"position = '1000 40' "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to calculate correct position by multiplying it on fontscaling factor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, done now
@@ -479,8 +479,8 @@ void init( GLFWwindow* window ) | |||
"label = 'Size' " | |||
"group = 'Font' " | |||
"min = 6.0 " | |||
"max = 24.0 " | |||
"step = 0.05 " | |||
"max = 60.0 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it still works fine for non-retina systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.