comparison src/video/bwindow/SDL_BView.h @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
32 }; 32 };
33 33
34 class SDL_BView:public BView 34 class SDL_BView:public BView
35 { 35 {
36 public: 36 public:
37 SDL_BView (BRect frame):BView (frame, "SDL View", B_FOLLOW_ALL_SIDES, 37 SDL_BView(BRect frame):BView(frame, "SDL View", B_FOLLOW_ALL_SIDES,
38 (B_WILL_DRAW | B_FRAME_EVENTS)) 38 (B_WILL_DRAW | B_FRAME_EVENTS))
39 { 39 {
40 image = NULL; 40 image = NULL;
41 xoff = yoff = 0; 41 xoff = yoff = 0;
42 SetViewColor (0, 0, 0, 0); 42 SetViewColor(0, 0, 0, 0);
43 SetHighColor (0, 0, 0, 0); 43 SetHighColor(0, 0, 0, 0);
44 } 44 }
45 virtual ~ SDL_BView () 45 virtual ~ SDL_BView()
46 { 46 {
47 SetBitmap (NULL); 47 SetBitmap(NULL);
48 } 48 }
49 /* Set drawing offsets for fullscreen mode */ 49 /* Set drawing offsets for fullscreen mode */
50 virtual void SetXYOffset (int x, int y) 50 virtual void SetXYOffset(int x, int y)
51 { 51 {
52 xoff = x; 52 xoff = x;
53 yoff = y; 53 yoff = y;
54 } 54 }
55 virtual void GetXYOffset (int &x, int &y) 55 virtual void GetXYOffset(int &x, int &y)
56 { 56 {
57 x = xoff; 57 x = xoff;
58 y = yoff; 58 y = yoff;
59 } 59 }
60 /* The view changed size. If it means we're in fullscreen, we 60 /* The view changed size. If it means we're in fullscreen, we
61 * draw a nice black box in the entire view to get black borders. 61 * draw a nice black box in the entire view to get black borders.
62 */ 62 */
63 virtual void FrameResized (float width, float height) 63 virtual void FrameResized(float width, float height)
64 { 64 {
65 BRect bounds; 65 BRect bounds;
66 bounds.top = bounds.left = 0; 66 bounds.top = bounds.left = 0;
67 bounds.right = width; 67 bounds.right = width;
68 bounds.bottom = height; 68 bounds.bottom = height;
69 /* Fill the entire view with black */ 69 /* Fill the entire view with black */
70 FillRect (bounds, B_SOLID_HIGH); 70 FillRect(bounds, B_SOLID_HIGH);
71 /* And if there's an image, redraw it. */ 71 /* And if there's an image, redraw it. */
72 if (image) { 72 if (image) {
73 bounds = image->Bounds (); 73 bounds = image->Bounds();
74 Draw (bounds); 74 Draw(bounds);
75 } 75 }
76 } 76 }
77 77
78 /* Drawing portion of this complete breakfast. :) */ 78 /* Drawing portion of this complete breakfast. :) */
79 virtual void SetBitmap (BBitmap * bitmap) 79 virtual void SetBitmap(BBitmap * bitmap)
80 { 80 {
81 if (image) { 81 if (image) {
82 delete image; 82 delete image;
83 } 83 }
84 image = bitmap; 84 image = bitmap;
85 } 85 }
86 virtual void Draw (BRect updateRect) 86 virtual void Draw(BRect updateRect)
87 { 87 {
88 if (image) { 88 if (image) {
89 if (xoff || yoff) { 89 if (xoff || yoff) {
90 BRect dest; 90 BRect dest;
91 dest.top = updateRect.top + yoff; 91 dest.top = updateRect.top + yoff;
92 dest.left = updateRect.left + xoff; 92 dest.left = updateRect.left + xoff;
93 dest.bottom = updateRect.bottom + yoff; 93 dest.bottom = updateRect.bottom + yoff;
94 dest.right = updateRect.right + xoff; 94 dest.right = updateRect.right + xoff;
95 DrawBitmap (image, updateRect, dest); 95 DrawBitmap(image, updateRect, dest);
96 } else { 96 } else {
97 DrawBitmap (image, updateRect, updateRect); 97 DrawBitmap(image, updateRect, updateRect);
98 } 98 }
99 } 99 }
100 } 100 }
101 virtual void DrawAsync (BRect updateRect) 101 virtual void DrawAsync(BRect updateRect)
102 { 102 {
103 if (xoff || yoff) { 103 if (xoff || yoff) {
104 BRect dest; 104 BRect dest;
105 dest.top = updateRect.top + yoff; 105 dest.top = updateRect.top + yoff;
106 dest.left = updateRect.left + xoff; 106 dest.left = updateRect.left + xoff;
107 dest.bottom = updateRect.bottom + yoff; 107 dest.bottom = updateRect.bottom + yoff;
108 dest.right = updateRect.right + xoff;; 108 dest.right = updateRect.right + xoff;;
109 DrawBitmapAsync (image, updateRect, dest); 109 DrawBitmapAsync(image, updateRect, dest);
110 } else { 110 } else {
111 DrawBitmapAsync (image, updateRect, updateRect); 111 DrawBitmapAsync(image, updateRect, updateRect);
112 } 112 }
113 } 113 }
114 114
115 private: 115 private:
116 BBitmap * image; 116 BBitmap * image;