![]() |
|
Display capture questions - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: Game Programming Fundamentals (/forum-7.html) +--- Thread: Display capture questions (/thread-7071.html) |
Display capture questions - Mark Levin - May 22, 2003 09:22 AM I'm just starting on resolution switching, and I've run into a few issues...
Display capture questions - w_reade - May 22, 2003 01:34 PM I think you're stuck with mouse deltas, although you can do it by getting the deltaX and deltaY of NSMouseMoved events instead. That said, it would surprise me greatly if the one did anything more than wrap the other. Um, I dunno. My windows etc. stay fine, even when I unexpectedly terminate without changing back or releasing the display. How are you going about it? You do switch back to the original settings before you quit, I presume...
Display capture questions - kelvin - May 22, 2003 01:53 PM 1) When I set my app to draw fullscreen I define a frame to draw in. CoreGraphics will pick the best size resolution, and I clip to my frame. Here's the code I use to get the mouseLoc: [sourcecode]- (NSPoint)mouseLocInFrame { NSPoint mouseLoc = [NSEvent mouseLocation]; CGRect screenBounds = CGDisplayBounds(kCGDirectMainDisplay); mouseLoc.y += screenBounds.size.height; mouseLoc.y -= ([[NSScreen mainScreen] frame].size.height + 1); mouseLoc.y -= frame.origin.y; mouseLoc.x -= frame.origin.x; if ( mouseLoc.x < 0 ) mouseLoc.x = 0; if ( mouseLoc.x > [self frame].size.width-1 ) mouseLoc.x = [self frame].size.width-1; if ( mouseLoc.y < 0 ) mouseLoc.y = 0; if ( mouseLoc.y > [self frame].size.height-1 ) mouseLoc.y = [self frame].size.height-1; return mouseLoc; }[/sourcecode] 2)As long as you change the screen res only while the screen is captured, not before, not after, then your windows shouldn't move. Course you're gonna have to keep it captured the whole while. Display capture questions - Mark Levin - May 22, 2003 06:58 PM Code: foo = CGGetActiveDisplayList(32, list, &count);monitorChoice and resChoice are, naturally, integers. They are generated earlier based on the active display list, and I'm sure that part is correct. Then the game runs, and then: Code: bar = CGLClearDrawable(coreContext);Kelvin: I'm trying to stay general by not explicitly using the main display, just the one selected by the user. Guess I'll just use mouse deltas for that part. Display capture questions - Fenris - Jan 24, 2006 12:23 PM Gravedigging warning, but: thanks a lot, Kelvin. |