Mercurial > sdl-ios-xcode
annotate docs/man3/SDL_SetPalette.3 @ 4391:07b330419439 SDL-1.2
Fixed bug #849 some more:
Tim Angus 2009-11-26 14:41:04 PST
Fix to the cursor not being responsive when the app doesn't have
SDL_APPINPUTFOCUS
The problems with the directx driver are similar to the ones I introduced in
the windib driver with r4478. Basically if the application did not have focus,
the mouse position is not updated. It's not really that the mouse cursor was
invisible, it's that it is stuck underneath another window where you can't see
it. This behaviour predates my r4478 changes and is the reason I unwittingly
broke the windib driver as I had been replicating the way the directx driver
deals with focus. Prior to r4478 the directx driver could not be used in
windowed mode, so the broken focusing would not have actually been observable.
Anyway, the attached patch makes the directx driver behaves like the windib
driver in terms of focus.
Time for 1.2.15? ;)
I've added an additional change of moving the calls to WIN_GrabInput that are
made on WM_ACTIVATE messages so that they only occur when the state is
SDL_APPINPUTFOCUS. When a fullscreen application is minimised using alt-tab, it
still receives WM_ACTIVATE messages when other applications are selected. If
WIN_GrabInput is called when the SDL application doesn't have input focus, bad
things happen; it shouldn't be being called at all.
I've also added a line to make sure that SDL_APPMOUSEFOCUS state is dropped
when the application is minimised following an alt-tab.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Dec 2009 15:24:53 +0000 |
parents | 1238da4a7112 |
children |
rev | line source |
---|---|
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
1 .TH "SDL_SetPalette" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" |
0 | 2 .SH "NAME" |
4107
4e3b250c950e
Erik Heckers fixed bug #493
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
3 SDL_SetPalette \- Sets the colors in the palette of an 8-bit surface\&. |
0 | 4 .SH "SYNOPSIS" |
5 .PP | |
6 \fB#include "SDL\&.h" | |
7 .sp | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
8 \fBint \fBSDL_SetPalette\fP\fR(\fBSDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors\fR); |
0 | 9 .SH "DESCRIPTION" |
10 .PP | |
11 Sets a portion of the palette for the given 8-bit surface\&. | |
12 .PP | |
13 Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display)\&. \fISDL_BlitSurface\fR always uses the logical palette when blitting surfaces (if it has to convert between surface pixel formats)\&. Because of this, it is often useful to modify only one or the other palette to achieve various special color effects (e\&.g\&., screen fading, color flashes, screen dimming)\&. | |
14 .PP | |
15 This function can modify either the logical or physical palette by specifing \fBSDL_LOGPAL\fP or \fBSDL_PHYSPAL\fPthe in the \fBflags\fR parameter\&. | |
16 .PP | |
17 When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetPalette\fP will always return \fB1\fR, and the palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation\&. | |
18 .PP | |
19 The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3=16777216 colors\&. | |
20 .SH "RETURN VALUE" | |
21 .PP | |
22 If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetPalette\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&. | |
23 .SH "EXAMPLE" | |
24 .PP | |
25 .nf | |
26 \f(CW /* Create a display surface with a grayscale palette */ | |
27 SDL_Surface *screen; | |
28 SDL_Color colors[256]; | |
29 int i; | |
30 \&. | |
31 \&. | |
32 \&. | |
33 /* Fill colors with color information */ | |
34 for(i=0;i<256;i++){ | |
35 colors[i]\&.r=i; | |
36 colors[i]\&.g=i; | |
37 colors[i]\&.b=i; | |
38 } | |
39 | |
40 /* Create display */ | |
41 screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); | |
42 if(!screen){ | |
43 printf("Couldn\&'t set video mode: %s | |
44 ", SDL_GetError()); | |
45 exit(-1); | |
46 } | |
47 | |
48 /* Set palette */ | |
49 SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256); | |
50 \&. | |
51 \&. | |
52 \&. | |
53 \&.\fR | |
54 .fi | |
55 .PP | |
56 .SH "SEE ALSO" | |
57 .PP | |
58 \fISDL_SetColors\fR, \fISDL_SetVideoMode\fR, \fISDL_Surface\fR, \fISDL_Color\fR | |
4311
1238da4a7112
Debian patch: f230_manpages.diff
Sam Lantinga <slouken@libsdl.org>
parents:
4107
diff
changeset
|
59 .\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 |