From 7568b74599ff0e60bacf95bb343f190580288d4e Mon Sep 17 00:00:00 2001 From: Uli Kusterer Date: Sun, 8 Mar 2015 17:56:49 +0100 Subject: [PATCH] Allow for use of alpha channel in the back buffer, so emulators can e.g. set the desktop background color to transparent. --- RootlessForEmulators/AppDelegate.m | 1 + RootlessForEmulators/EmulatorMain.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RootlessForEmulators/AppDelegate.m b/RootlessForEmulators/AppDelegate.m index f21fd93..e89fa38 100644 --- a/RootlessForEmulators/AppDelegate.m +++ b/RootlessForEmulators/AppDelegate.m @@ -216,6 +216,7 @@ { NSWindow* theWindow = [[NSWindow alloc] initWithContentRect: waf.frame styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer: NO]; theWindow.releasedWhenClosed = NO; + theWindow.opaque = NO; [theWindow setContentView: [[RootlessWindowContentView alloc] initWithFrame: NSMakeRect(0, 0, 100, 100)]]; diff --git a/RootlessForEmulators/EmulatorMain.c b/RootlessForEmulators/EmulatorMain.c index 53c0a9f..746e868 100644 --- a/RootlessForEmulators/EmulatorMain.c +++ b/RootlessForEmulators/EmulatorMain.c @@ -30,7 +30,7 @@ int EmulatorMain( int argc, const char** argv ) uint32_t* backBuffer = malloc(screenWidth * screenHeight * 4); for( int x = 0; x < (screenWidth * screenHeight); x++ ) - backBuffer[x] = 0xFF0000FF; // Red with 100% alpha. + backBuffer[x] = 0x880000FF; // Red with 50% alpha. BackBufferChanged( backBuffer, screenWidth * 4, screenWidth, screenHeight ); // And tell the rootless code to load it. You do that every time something changes. // Everything that should show up as a window should be registered using this call: