mirror of
https://github.com/neon443/DesktopGoose2.git
synced 2026-11-30 20:54:52 +00:00
base stuff done
This commit is contained in:
9 files changed
+147
-22
No files matched your search
@@ -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
|
||||
}
|
||||