11

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;
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
user2887097
  • 309
  • 4
  • 12

2 Answers2

13

Try setting the antialiased property to false. The antialias adds some extra pixels around.

// Objective-C
buttonOutline.antialiased = NO

// Swift
buttonOutline.antialiased = false
bdurao
  • 555
  • 3
  • 6
1

Set scale to .25 and remember to properly upscale co-ordinates (multiply by 4 in this case)