base stuff done

This commit is contained in:
Nihaal Sharma committed 2026-10-14 08:58:26 +01:00
1 parent 42173d056c
commit 93a02f9a48
9 files changed
+147 -22

No files matched your search

+50 -12
View File
@@ -6,18 +6,27 @@
objectVersion = 77; objectVersion = 77;
objects = { 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 */ /* Begin PBXFileReference section */
A94675683074E8D80089DE14 /* DesktopDuck.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesktopDuck.app; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = "<group>"; };
A946759C3074F1A30089DE14 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A946759D3074F1A30089DE14 /* GooseWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GooseWindow.swift; sourceTree = "<group>"; };
A946759E3074F1A30089DE14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
A94675A03074F1A30089DE14 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
A94675A73074F2800089DE14 /* Goose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Goose.swift; sourceTree = "<group>"; };
A94675A93074F2880089DE14 /* GooseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GooseView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
A946756A3074E8D80089DE14 /* DesktopDuck */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = DesktopDuck;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
A94675653074E8D80089DE14 /* Frameworks */ = { A94675653074E8D80089DE14 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
@@ -32,7 +41,7 @@
A946755F3074E8D80089DE14 = { A946755F3074E8D80089DE14 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A946756A3074E8D80089DE14 /* DesktopDuck */, A94675A13074F1A30089DE14 /* DesktopDuck */,
A94675693074E8D80089DE14 /* Products */, A94675693074E8D80089DE14 /* Products */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
@@ -45,6 +54,20 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
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 = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@@ -60,9 +83,6 @@
); );
dependencies = ( dependencies = (
); );
fileSystemSynchronizedGroups = (
A946756A3074E8D80089DE14 /* DesktopDuck */,
);
name = DesktopDuck; name = DesktopDuck;
packageProductDependencies = ( packageProductDependencies = (
); );
@@ -109,6 +129,8 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
A94675A53074F1A30089DE14 /* Assets.xcassets in Resources */,
A94675A63074F1A30089DE14 /* Main.storyboard in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -119,11 +141,27 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( 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; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
A946759F3074F1A30089DE14 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
A946759E3074F1A30089DE14 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
A94675743074E8D90089DE14 /* Debug */ = { A94675743074E8D90089DE14 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
+4 -3
View File
@@ -11,9 +11,10 @@ import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) { func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application // Insert code here to initialize your application
let window = NSWindow(contentRect: NSScreen.main!.frame, styleMask: .borderless, backing: .buffered, defer: false) // 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.backgroundColor = .init(srgbRed: 1, green: 1, blue: 1, alpha: 0.1)
window.orderFront(nil) // window.orderFront(nil)
let x = GooseWindow()
} }
func applicationWillTerminate(_ aNotification: Notification) { func applicationWillTerminate(_ aNotification: Notification) {
+21
View File
@@ -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
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

+58
View File
@@ -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
}
+8
View File
@@ -0,0 +1,8 @@
//
// GooseView.swift
// DesktopDuck
//
// Created by neon443 on 06/10/2026.
//
import Foundation
+6 -7
View File
@@ -10,13 +10,14 @@ import Cocoa
class GooseWindow { class GooseWindow {
private var window: NSWindow private var window: NSWindow
private var duck: NSImageView private var goose: Goose
private var angle: CGFloat = 90 private var angle: CGFloat = 90
var shown: Bool = false var shown: Bool = false
private var x = 1 private var x = 1
private var time: Timer? private var time: Timer?
init() { init() {
goose = Goose()
self.window = NSWindow( self.window = NSWindow(
contentRect: CGRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.width), contentRect: CGRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: NSScreen.main!.frame.width),
styleMask: .borderless, styleMask: .borderless,
@@ -28,14 +29,12 @@ class GooseWindow {
window.level = NSWindow.Level.screenSaver + 1 window.level = NSWindow.Level.screenSaver + 1
window.ignoresMouseEvents = true window.ignoresMouseEvents = true
window.hasShadow = false window.hasShadow = false
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary) window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllApplications.union(.stationary).union(.canJoinAllSpaces)
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
showHide() showHide()
// window.contentView?.addSubview(NSTextField(labelWithString: "hi"))
window.contentView?.addSubview(goose.view)
} }
func showHide() { func showHide() {
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.