Mercurial > sdl-ios-xcode
diff src/video/bwindow/SDL_BView.h @ 4012:4e29535b821b SDL-1.2
Fixed bug #360
Fixed fullscreen video modes and improved the mouse grab code.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 07 Jul 2007 19:20:28 +0000 |
parents | 678576473849 |
children | a1b03ba2fcd0 |
line wrap: on
line diff
--- a/src/video/bwindow/SDL_BView.h Fri Jul 06 13:39:03 2007 +0000 +++ b/src/video/bwindow/SDL_BView.h Sat Jul 07 19:20:28 2007 +0000 @@ -37,12 +37,26 @@ BView(frame, "SDL View", B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS)) { image = NULL; + xoff = yoff = 0; SetViewColor(0,0,0,0); SetHighColor(0,0,0,0); } virtual ~SDL_BView() { SetBitmap(NULL); } + /* Set drawing offsets for fullscreen mode */ + virtual void SetXYOffset(int x, int y) { + xoff = x; + yoff = y; + } + virtual void GetXYOffset(int &x, int &y) { + x = xoff; + y = yoff; + } + virtual void GetXYOffset(float &x, float &y) { + x = (float)xoff; + y = (float)yoff; + } /* The view changed size. If it means we're in fullscreen, we * draw a nice black box in the entire view to get black borders. */ @@ -52,14 +66,14 @@ bounds.right = width; bounds.bottom = height; /* Fill the entire view with black */ -// FillRect(bounds, B_SOLID_HIGH); + FillRect(bounds, B_SOLID_HIGH); /* And if there's an image, redraw it. */ if( image ) { bounds = image->Bounds(); Draw(bounds); } } - + /* Drawing portion of this complete breakfast. :) */ virtual void SetBitmap(BBitmap *bitmap) { if ( image ) { @@ -69,17 +83,34 @@ } virtual void Draw(BRect updateRect) { if ( image ) { - DrawBitmap(image, updateRect, updateRect); + if(xoff || yoff) { + BRect dest; + dest.top = updateRect.top + yoff; + dest.left = updateRect.left + xoff; + dest.bottom = updateRect.bottom + yoff; + dest.right = updateRect.right + xoff; + DrawBitmap(image, updateRect, dest); + } else { + DrawBitmap(image, updateRect, updateRect); + } } } virtual void DrawAsync(BRect updateRect) { - if ( image ) { + if(xoff || yoff) { + BRect dest; + dest.top = updateRect.top + yoff; + dest.left = updateRect.left + xoff; + dest.bottom = updateRect.bottom + yoff; + dest.right = updateRect.right + xoff;; + DrawBitmapAsync(image, updateRect, dest); + } else { DrawBitmapAsync(image, updateRect, updateRect); } } private: BBitmap *image; + int xoff, yoff; }; #endif /* _SDL_BView_h */