comparison src/video/bwindow/SDL_BView.h @ 3878:678576473849 SDL-1.2

Fixed bug #286 Date: Thu, 9 Feb 2006 17:06:51 +0300 From: "Oleg K [BeSman]" Subject: BeOS SDL patches Hello all. My name is Oleg K. [BeSman], Im a BeOS user from Russia.This mail contain a BeOs-specific patches to SDL (implementation of InputGrabbing and mouse_relative mode). See the source in attached file for details.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 24 Sep 2006 15:31:42 +0000
parents d910939febfa
children 4e29535b821b
comparison
equal deleted inserted replaced
3877:81f66f258d77 3878:678576473849
35 public: 35 public:
36 SDL_BView(BRect frame) : 36 SDL_BView(BRect frame) :
37 BView(frame, "SDL View", B_FOLLOW_ALL_SIDES, 37 BView(frame, "SDL View", B_FOLLOW_ALL_SIDES,
38 (B_WILL_DRAW|B_FRAME_EVENTS)) { 38 (B_WILL_DRAW|B_FRAME_EVENTS)) {
39 image = NULL; 39 image = NULL;
40 xoff = yoff = 0;
41 SetViewColor(0,0,0,0); 40 SetViewColor(0,0,0,0);
42 SetHighColor(0,0,0,0); 41 SetHighColor(0,0,0,0);
43 } 42 }
44 virtual ~SDL_BView() { 43 virtual ~SDL_BView() {
45 SetBitmap(NULL); 44 SetBitmap(NULL);
46 }
47 /* Set drawing offsets for fullscreen mode */
48 virtual void SetXYOffset(int x, int y) {
49 xoff = x;
50 yoff = y;
51 }
52 virtual void GetXYOffset(int &x, int &y) {
53 x = xoff;
54 y = yoff;
55 } 45 }
56 /* The view changed size. If it means we're in fullscreen, we 46 /* The view changed size. If it means we're in fullscreen, we
57 * draw a nice black box in the entire view to get black borders. 47 * draw a nice black box in the entire view to get black borders.
58 */ 48 */
59 virtual void FrameResized(float width, float height) { 49 virtual void FrameResized(float width, float height) {
60 BRect bounds; 50 BRect bounds;
61 bounds.top = bounds.left = 0; 51 bounds.top = bounds.left = 0;
62 bounds.right = width; 52 bounds.right = width;
63 bounds.bottom = height; 53 bounds.bottom = height;
64 /* Fill the entire view with black */ 54 /* Fill the entire view with black */
65 FillRect(bounds, B_SOLID_HIGH); 55 // FillRect(bounds, B_SOLID_HIGH);
66 /* And if there's an image, redraw it. */ 56 /* And if there's an image, redraw it. */
67 if( image ) { 57 if( image ) {
68 bounds = image->Bounds(); 58 bounds = image->Bounds();
69 Draw(bounds); 59 Draw(bounds);
70 } 60 }
71 } 61 }
72 62
73 /* Drawing portion of this complete breakfast. :) */ 63 /* Drawing portion of this complete breakfast. :) */
74 virtual void SetBitmap(BBitmap *bitmap) { 64 virtual void SetBitmap(BBitmap *bitmap) {
75 if ( image ) { 65 if ( image ) {
76 delete image; 66 delete image;
77 } 67 }
78 image = bitmap; 68 image = bitmap;
79 } 69 }
80 virtual void Draw(BRect updateRect) { 70 virtual void Draw(BRect updateRect) {
81 if ( image ) { 71 if ( image ) {
82 if(xoff || yoff) { 72 DrawBitmap(image, updateRect, updateRect);
83 BRect dest;
84 dest.top = updateRect.top + yoff;
85 dest.left = updateRect.left + xoff;
86 dest.bottom = updateRect.bottom + yoff;
87 dest.right = updateRect.right + xoff;
88 DrawBitmap(image, updateRect, dest);
89 } else {
90 DrawBitmap(image, updateRect, updateRect);
91 }
92 } 73 }
93 } 74 }
94 virtual void DrawAsync(BRect updateRect) { 75 virtual void DrawAsync(BRect updateRect) {
95 if(xoff || yoff) { 76 if ( image ) {
96 BRect dest;
97 dest.top = updateRect.top + yoff;
98 dest.left = updateRect.left + xoff;
99 dest.bottom = updateRect.bottom + yoff;
100 dest.right = updateRect.right + xoff;;
101 DrawBitmapAsync(image, updateRect, dest);
102 } else {
103 DrawBitmapAsync(image, updateRect, updateRect); 77 DrawBitmapAsync(image, updateRect, updateRect);
104 } 78 }
105 } 79 }
106 80
107 private: 81 private:
108 BBitmap *image; 82 BBitmap *image;
109 int xoff, yoff;
110 }; 83 };
111 84
112 #endif /* _SDL_BView_h */ 85 #endif /* _SDL_BView_h */