You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
To abstract the screen scaling and OS detection away from the end developer?
What I did was move all TUIGraphics* functions into a new .h/.m TUIGraphics.m, and add those functions into TUIKit.h/.m. Then I proceeded to remove #import "TUIKit.h"'s and replaced them with #import "TUIGraphics.h" to make more sense.
The text was updated successfully, but these errors were encountered:
Wouldn't it be far better to do something like:
TUIKit.h:
// Test for Lion support.
extern BOOL isAtleastLion(void);
// Set and get global screen scale factor.
extern float screenScale(void);
extern void setScreenScale(float);
TUIKit.m:
static BOOL initialized = NO;
static float screen_scale = 0.0;
static BOOL is_lion = NO;
BOOL isAtleastLion() {
if(!initialized) {
SInt32 major = 0;
SInt32 minor = 0;
Gestalt(gestaltSystemVersionMajor, &major);
Gestalt(gestaltSystemVersionMinor, &minor);
if((major == 10 && minor >= 7) || major >= 11) {
is_lion = YES;
} else is_lion = NO;
}
float screenScale() {
if(screen_scale <= CGFLOAT_MIN)
screen_scale = [[NSScreen mainScreen] userSpaceScaleFactor];
}
void setScreenScale(float scale) {
if((scale > CGFLOAT_MIN)) {
screen_scale = scale;
}
}
To abstract the screen scaling and OS detection away from the end developer?
What I did was move all TUIGraphics* functions into a new .h/.m TUIGraphics.m, and add those functions into TUIKit.h/.m. Then I proceeded to remove #import "TUIKit.h"'s and replaced them with #import "TUIGraphics.h" to make more sense.
The text was updated successfully, but these errors were encountered: