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;
Try setting the antialiased property to false. The antialias adds some extra pixels around.
// Objective-C
buttonOutline.antialiased = NO
// Swift
buttonOutline.antialiased = false
Set scale to .25 and remember to properly upscale co-ordinates (multiply by 4 in this case)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With