Skip to content

Commit

Permalink
Preparation for 0.8 release and a small refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdoe committed Aug 29, 2021
1 parent 56689ed commit aafb4cb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Thoughtworks 2021 screen saver

A screensaver in Thoughtworks' 2021 design

This is currently in early access. Please provide feedback on your preferred settings.

Bug reports are very welcome, too!
2 changes: 1 addition & 1 deletion ScreenSaver/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.6</string>
<string>0.8</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
Expand Down
8 changes: 2 additions & 6 deletions ScreenSaver/view/Thoughtworks2021View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,12 @@ class Thoughtworks2021View: ScreenSaverView, CALayerDelegate
let grid = Configuration.sharedInstance.grid
var p = NSMakePoint(grid.width, -grid.height/2)
while p.x < bounds.width {
let builder = VerticalBuilder(start: p, size: bounds.size)
let view = TrackView(frame: bounds, colors: colorSequence, lines: builder.build())
views.append(view)
views.append(TrackView.verticalView(frame: bounds, startAt: p, colorSequence: colorSequence))
p.x += grid.width * CGFloat(4 - Configuration.sharedInstance.verticalDensity + 2)
}
p = NSMakePoint(-grid.width, 3/2 * grid.height)
while p.y < bounds.height - grid.height {
let builder = HorizontalBuilder(start: p, size: bounds.size)
let view = TrackView(frame: bounds, colors: colorSequence, lines: builder.build())
views.append(view)
views.append(TrackView.horizontalView(frame: bounds, startAt: p, colorSequence: colorSequence))
p.y += grid.height * 2
}
views.shuffle()
Expand Down
14 changes: 14 additions & 0 deletions ScreenSaver/view/TrackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ class TrackView : NSView, CALayerDelegate {
var laneMarkerPaths: [NSBezierPath]
var tracePaths: [NSBezierPath]


public class func verticalView(frame: NSRect, startAt p: NSPoint, colorSequence: ColorSequence) -> TrackView
{
let builder = VerticalBuilder(start: p, size: frame.size)
return TrackView(frame: frame, colors: colorSequence, lines: builder.build())
}

public class func horizontalView(frame: NSRect, startAt p: NSPoint, colorSequence: ColorSequence) -> TrackView
{
let builder = HorizontalBuilder(start: p, size: frame.size)
return TrackView(frame: frame, colors: colorSequence, lines: builder.build())
}


init(frame: NSRect, colors: ColorSequence, lines: [[NSPoint]])
{
self.colors = colors
Expand Down

0 comments on commit aafb4cb

Please sign in to comment.