Mercurial > sdl-ios-xcode
annotate src/video/bwindow/SDL_BView.h @ 1869:65800e7f7146
Date: Fri, 9 Jun 2006 11:35:23 +0300
From: "Janne Junnila"
Subject: [SDL] SDL_SetGamma bug
You can't set the the gamma 'brighter' than 1.0. There's a patch attached.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Jun 2006 06:50:42 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb 678576473849 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
114
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
756
10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
24 #ifndef _SDL_BView_h |
10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
25 #define _SDL_BView_h |
10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
26 |
0 | 27 /* This is the event handling and graphics update portion of SDL_BWin */ |
28 | |
29 extern "C" { | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
30 #include "../../events/SDL_events_c.h" |
0 | 31 }; |
32 | |
33 class SDL_BView : public BView | |
34 { | |
35 public: | |
36 SDL_BView(BRect frame) : | |
37 BView(frame, "SDL View", B_FOLLOW_ALL_SIDES, | |
38 (B_WILL_DRAW|B_FRAME_EVENTS)) { | |
39 image = NULL; | |
40 xoff = yoff = 0; | |
41 SetViewColor(0,0,0,0); | |
42 SetHighColor(0,0,0,0); | |
43 } | |
44 virtual ~SDL_BView() { | |
45 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 } | |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
52 virtual void GetXYOffset(int &x, int &y) { |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
53 x = xoff; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
54 y = yoff; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
55 } |
0 | 56 /* 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. | |
58 */ | |
59 virtual void FrameResized(float width, float height) { | |
60 BRect bounds; | |
61 bounds.top = bounds.left = 0; | |
62 bounds.right = width; | |
63 bounds.bottom = height; | |
64 /* Fill the entire view with black */ | |
65 FillRect(bounds, B_SOLID_HIGH); | |
66 /* And if there's an image, redraw it. */ | |
67 if( image ) { | |
68 bounds = image->Bounds(); | |
69 Draw(bounds); | |
70 } | |
71 } | |
72 | |
73 /* Drawing portion of this complete breakfast. :) */ | |
74 virtual void SetBitmap(BBitmap *bitmap) { | |
75 if ( image ) { | |
76 delete image; | |
77 } | |
78 image = bitmap; | |
79 } | |
80 virtual void Draw(BRect updateRect) { | |
81 if ( image ) { | |
82 if(xoff || yoff) { | |
83 BRect dest; | |
84 dest.top = updateRect.top + yoff; | |
85 dest.left = updateRect.left + xoff; | |
86 dest.bottom = updateRect.bottom + yoff; | |
114
dabc453ce7f7
Now returns an error if unable to open audio on BeOS
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
87 dest.right = updateRect.right + xoff; |
0 | 88 DrawBitmap(image, updateRect, dest); |
89 } else { | |
90 DrawBitmap(image, updateRect, updateRect); | |
91 } | |
92 } | |
93 } | |
94 virtual void DrawAsync(BRect updateRect) { | |
95 if(xoff || yoff) { | |
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); | |
104 } | |
105 } | |
106 | |
107 private: | |
108 BBitmap *image; | |
109 int xoff, yoff; | |
110 }; | |
756
10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
111 |
10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
112 #endif /* _SDL_BView_h */ |