Reputation: 309
I'm trying to make an SKShapeNode with a very think stroke (like 0.25 pixel). It seems that lineWidth of 1 is the smallest I can go, at least that's what it looks like on screen no mater what value less than 1 is set.
SKShapeNode *buttonOutline;
buttonOutline = [[SKShapeNode alloc] init];
CGMutablePathRef myPath = CGPathCreateMutable();
CGPathAddRoundedRect(myPath, NULL, CGRectMake(0, 0, 100, 30), 10, 10);
buttonOutline.path = myPath;
buttonOutline.strokeColor=[SKColor grayColor];
buttonOutline.lineWidth= 0.25;
buttonOutline.name = [NSString stringWithFormat:@"%@-buttonOutline", thisButtonName];
buttonOutline.position = CGPointMake(thisXPos,thisYPod);
buttonOutline.alpha = 1;
Upvotes: 11
Views: 3245
Reputation: 131
Try setting the antialiased property to false. The antialias adds some extra pixels around.
// Objective-C
buttonOutline.antialiased = NO
// Swift
buttonOutline.antialiased = false
Upvotes: 13
Reputation: 41
Set scale to .25 and remember to properly upscale co-ordinates (multiply by 4 in this case)
Upvotes: 1