diff --git a/DesktopDuck.xcodeproj/project.pbxproj b/DesktopDuck.xcodeproj/project.pbxproj index 04a087e..0b6549a 100644 --- a/DesktopDuck.xcodeproj/project.pbxproj +++ b/DesktopDuck.xcodeproj/project.pbxproj @@ -6,18 +6,27 @@ objectVersion = 77; objects = { +/* Begin PBXBuildFile section */ + A94675A23074F1A30089DE14 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A946759B3074F1A30089DE14 /* AppDelegate.swift */; }; + A94675A33074F1A30089DE14 /* GooseWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A946759D3074F1A30089DE14 /* GooseWindow.swift */; }; + A94675A43074F1A30089DE14 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94675A03074F1A30089DE14 /* ViewController.swift */; }; + A94675A53074F1A30089DE14 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A946759C3074F1A30089DE14 /* Assets.xcassets */; }; + A94675A63074F1A30089DE14 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A946759F3074F1A30089DE14 /* Main.storyboard */; }; + A94675A83074F2800089DE14 /* Goose.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94675A73074F2800089DE14 /* Goose.swift */; }; + A94675AA3074F2880089DE14 /* GooseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94675A93074F2880089DE14 /* GooseView.swift */; }; +/* End PBXBuildFile section */ + /* Begin PBXFileReference section */ A94675683074E8D80089DE14 /* DesktopDuck.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesktopDuck.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A946759B3074F1A30089DE14 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A946759C3074F1A30089DE14 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + A946759D3074F1A30089DE14 /* GooseWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GooseWindow.swift; sourceTree = ""; }; + A946759E3074F1A30089DE14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + A94675A03074F1A30089DE14 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + A94675A73074F2800089DE14 /* Goose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Goose.swift; sourceTree = ""; }; + A94675A93074F2880089DE14 /* GooseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GooseView.swift; sourceTree = ""; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedRootGroup section */ - A946756A3074E8D80089DE14 /* DesktopDuck */ = { - isa = PBXFileSystemSynchronizedRootGroup; - path = DesktopDuck; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ A94675653074E8D80089DE14 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -32,7 +41,7 @@ A946755F3074E8D80089DE14 = { isa = PBXGroup; children = ( - A946756A3074E8D80089DE14 /* DesktopDuck */, + A94675A13074F1A30089DE14 /* DesktopDuck */, A94675693074E8D80089DE14 /* Products */, ); sourceTree = ""; @@ -45,6 +54,20 @@ name = Products; sourceTree = ""; }; + A94675A13074F1A30089DE14 /* DesktopDuck */ = { + isa = PBXGroup; + children = ( + A946759B3074F1A30089DE14 /* AppDelegate.swift */, + A946759D3074F1A30089DE14 /* GooseWindow.swift */, + A94675A73074F2800089DE14 /* Goose.swift */, + A94675A93074F2880089DE14 /* GooseView.swift */, + A94675A03074F1A30089DE14 /* ViewController.swift */, + A946759F3074F1A30089DE14 /* Main.storyboard */, + A946759C3074F1A30089DE14 /* Assets.xcassets */, + ); + path = DesktopDuck; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -60,9 +83,6 @@ ); dependencies = ( ); - fileSystemSynchronizedGroups = ( - A946756A3074E8D80089DE14 /* DesktopDuck */, - ); name = DesktopDuck; packageProductDependencies = ( ); @@ -109,6 +129,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A94675A53074F1A30089DE14 /* Assets.xcassets in Resources */, + A94675A63074F1A30089DE14 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -119,11 +141,27 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A94675AA3074F2880089DE14 /* GooseView.swift in Sources */, + A94675A23074F1A30089DE14 /* AppDelegate.swift in Sources */, + A94675A33074F1A30089DE14 /* GooseWindow.swift in Sources */, + A94675A43074F1A30089DE14 /* ViewController.swift in Sources */, + A94675A83074F2800089DE14 /* Goose.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + A946759F3074F1A30089DE14 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + A946759E3074F1A30089DE14 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ A94675743074E8D90089DE14 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/DesktopDuck/AppDelegate.swift b/DesktopDuck/AppDelegate.swift index 1143938..0ef175c 100644 --- a/DesktopDuck/AppDelegate.swift +++ b/DesktopDuck/AppDelegate.swift @@ -11,9 +11,10 @@ import Cocoa class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application - let window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: .borderless, backing: .buffered, defer: false) - window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1) - window.orderFront(nil) +// let window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: .borderless, backing: .buffered, defer: false) +// window.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1) +// window.orderFront(nil) + let x = GooseWindow() } func applicationWillTerminate(_ aNotification: Notification) { diff --git a/DesktopDuck/Assets.xcassets/body.imageset/Contents.json b/DesktopDuck/Assets.xcassets/body.imageset/Contents.json new file mode 100644 index 0000000..7387992 --- /dev/null +++ b/DesktopDuck/Assets.xcassets/body.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "body.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DesktopDuck/Assets.xcassets/body.imageset/body.png b/DesktopDuck/Assets.xcassets/body.imageset/body.png new file mode 100644 index 0000000..4ff623c Binary files /dev/null and b/DesktopDuck/Assets.xcassets/body.imageset/body.png differ diff --git a/DesktopDuck/Goose.swift b/DesktopDuck/Goose.swift new file mode 100644 index 0000000..18946d8 --- /dev/null +++ b/DesktopDuck/Goose.swift @@ -0,0 +1,58 @@ +// +// Goose.swift +// DesktopDuck +// +// Created by neon443 on 06/10/2026. +// + +import Foundation +import Cocoa + +class Goose: NSViewController { + var state: GooseState + var gooseView: NSView + + init() { + self.state = .idle + self.gooseView = NSView(frame: .zero) + super.init(nibName: nil, bundle: nil) + self.view.frame = NSScreen.main!.frame + setup() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func setup() { + gooseView.frame = NSRect(x: 100, y: 100, width: 25, height: 25) + self.view.addSubview(gooseView) + + let bodyView = NSImageView(image: NSImage(named: "body")!) + gooseView.addSubview(bodyView) + bodyView.translatesAutoresizingMaskIntoConstraints = false + bodyView.rotate(byDegrees: 50) + NSLayoutConstraint.activate([ + bodyView.widthAnchor.constraint(equalToConstant: 50), + bodyView.heightAnchor.constraint(equalToConstant: 50) + ]) + + let neckView = NSImageView(image: NSImage(named: "body")!) + gooseView.addSubview(neckView) + neckView.translatesAutoresizingMaskIntoConstraints = false + neckView.rotate(byDegrees: 90) + NSLayoutConstraint.activate([ + neckView.widthAnchor.constraint(equalToConstant: 25), + neckView.heightAnchor.constraint(equalToConstant: 25) + ]) + } +} + +enum GooseState { + case idle + case wander + case draggingMessage + case draggingMouse + case running + case aggro +} diff --git a/DesktopDuck/GooseView.swift b/DesktopDuck/GooseView.swift new file mode 100644 index 0000000..fdd6526 --- /dev/null +++ b/DesktopDuck/GooseView.swift @@ -0,0 +1,8 @@ +// +// GooseView.swift +// DesktopDuck +// +// Created by neon443 on 06/10/2026. +// + +import Foundation diff --git a/DesktopDuck/GooseWindow.swift b/DesktopDuck/GooseWindow.swift index 93a0f5b..90e0eab 100644 --- a/DesktopDuck/GooseWindow.swift +++ b/DesktopDuck/GooseWindow.swift @@ -10,13 +10,14 @@ import Cocoa class GooseWindow { private var window: NSWindow - private var duck: NSImageView + private var goose: Goose private var angle: CGFloat = 90 var shown: Bool = false private var x = 1 private var time: Timer? init() { + goose = Goose() self.window = NSWindow( contentRect: CGRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.width), styleMask: .borderless, @@ -28,14 +29,12 @@ class GooseWindow { window.level = NSWindow.Level.screenSaver + 1 window.ignoresMouseEvents = true window.hasShadow = false - window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary) - - duck = .init(image: NSImage(named: "pond")!) - window.contentView?.addSubview(duck) - duck.frame.origin.x = NSScreen.main!.frame.width/2 - duck.frame.origin.y = NSScreen.main!.frame.height/2 + window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces) showHide() + +// window.contentView?.addSubview(NSTextField(labelWithString: "hi")) + window.contentView?.addSubview(goose.view) } func showHide() { diff --git a/Sprites/body.pxd b/Sprites/body.pxd new file mode 100644 index 0000000..a8a8edf Binary files /dev/null and b/Sprites/body.pxd differ diff --git a/body.png b/body.png new file mode 100644 index 0000000..73e0160 Binary files /dev/null and b/body.png differ