From 3f7f253f63de241a7c4de5dbfd87d5d79a5e6280 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 25 Aug 2025 21:04:45 +0100 Subject: [PATCH] okay actually got scanlines but fucked it over when applying it to the app --- ShhShell/Terminal/CRT.metal | 12 +++ ShhShell/Views/ContentView.swift | 168 +++++++++++++++++-------------- 2 files changed, 102 insertions(+), 78 deletions(-) diff --git a/ShhShell/Terminal/CRT.metal b/ShhShell/Terminal/CRT.metal index ae63e09..0921beb 100644 --- a/ShhShell/Terminal/CRT.metal +++ b/ShhShell/Terminal/CRT.metal @@ -9,6 +9,18 @@ #include using namespace metal; +[[ stitchable ]] half4 crt(float2 pos, half4 color, float2 size, float time) { + float2 uv = pos/size; + + // scanwave + half3 newCol = 0.75 + 0.5 + 0.5 * sin(time + uv.y*10 + half3(0)); + + //scanlines + newCol *= 0.5 + 0.5 * sin(uv.y * 1000.0 + half3(0)); + half4 output = half4(color.xyz*newCol, 1); + return output; +} + //learning shaders stuff here [[ stitchable ]] half4 sinebow(float2 pos, half4 color, float2 size, float time) { float2 uv = (pos/size.x) * 2.0 - 1.0; diff --git a/ShhShell/Views/ContentView.swift b/ShhShell/Views/ContentView.swift index 526308c..1466ed5 100644 --- a/ShhShell/Views/ContentView.swift +++ b/ShhShell/Views/ContentView.swift @@ -12,91 +12,103 @@ struct ContentView: View { @ObservedObject var hostsManager: HostsManager @ObservedObject var keyManager: KeyManager + @State private var spawnTime: Date = .now + var body: some View { - NavigationStack { - ZStack { - hostsManager.selectedTheme.background.suiColor.opacity(0.7) - .ignoresSafeArea(.all) - List { - SessionsListView( - handler: handler, - hostsManager: hostsManager, - keyManager: keyManager - ) - - RecentsView( - hostsManager: hostsManager, - keyManager: keyManager - ) - - HostsView( - handler: handler, - hostsManager: hostsManager, - keyManager: keyManager - ) - - Section() { - NavigationLink { - ThemeManagerView(hostsManager: hostsManager) - } label: { - Label("Themes", systemImage: "swatchpalette") - } - NavigationLink { - FontManagerView(hostsManager: hostsManager) - } label: { - Label("Fonts", systemImage: "textformat") - } - } - - Section { - NavigationLink { - SnippetManagerView(hostsManager: hostsManager) - } label: { - Label("Snippets", systemImage: "paperclip") - } - - NavigationLink { - KeyManagerView(hostsManager: hostsManager, keyManager: keyManager) - } label: { - Label("Keys", systemImage: "key.fill") - } - - NavigationLink { - HostkeysView(hostsManager: hostsManager) - } label: { - Label("Hostkey Fingerprints", systemImage: "lock.display") - } - } - - Section { - NavigationLink { - SettingsView(hostsManager: hostsManager, keyManager: keyManager) - } label: { - Label("Settings", systemImage: "gear") - } - NavigationLink { - AboutView(hostsManager: hostsManager) - } label: { - Label("About", systemImage: "info.square") - } - } - } - .scrollContentBackground(.hidden) - } - .navigationTitle("ShhShell") - .toolbar { - ToolbarItem(placement: .confirmationAction) { - NavigationLink { - ConnectionView( - handler: SSHHandler(host: Host.blank, keyManager: keyManager), + TimelineView(.animation) { tl in + let time = tl.date.distance(to: spawnTime) + NavigationStack { + ZStack { + hostsManager.selectedTheme.background.suiColor.opacity(0.7) + .ignoresSafeArea(.all) + List { + SessionsListView( + handler: handler, hostsManager: hostsManager, keyManager: keyManager ) - } label: { - Label("Add", systemImage: "plus") + + RecentsView( + hostsManager: hostsManager, + keyManager: keyManager + ) + + HostsView( + handler: handler, + hostsManager: hostsManager, + keyManager: keyManager + ) + + Section() { + NavigationLink { + ThemeManagerView(hostsManager: hostsManager) + } label: { + Label("Themes", systemImage: "swatchpalette") + } + NavigationLink { + FontManagerView(hostsManager: hostsManager) + } label: { + Label("Fonts", systemImage: "textformat") + } + } + + Section { + NavigationLink { + SnippetManagerView(hostsManager: hostsManager) + } label: { + Label("Snippets", systemImage: "paperclip") + } + + NavigationLink { + KeyManagerView(hostsManager: hostsManager, keyManager: keyManager) + } label: { + Label("Keys", systemImage: "key.fill") + } + + NavigationLink { + HostkeysView(hostsManager: hostsManager) + } label: { + Label("Hostkey Fingerprints", systemImage: "lock.display") + } + } + + Section { + NavigationLink { + SettingsView(hostsManager: hostsManager, keyManager: keyManager) + } label: { + Label("Settings", systemImage: "gear") + } + NavigationLink { + AboutView(hostsManager: hostsManager) + } label: { + Label("About", systemImage: "info.square") + } + } + } + .scrollContentBackground(.hidden) + } + .navigationTitle("ShhShell") + .toolbar { + ToolbarItem(placement: .confirmationAction) { + NavigationLink { + ConnectionView( + handler: SSHHandler(host: Host.blank, keyManager: keyManager), + hostsManager: hostsManager, + keyManager: keyManager + ) + } label: { + Label("Add", systemImage: "plus") + } } } } + .visualEffect { content, proxy in + content + .colorEffect(ShaderLibrary.crt( + .float2(proxy.size), + .float(time) + )) + } } } }