Mercurial > sdl-ios-xcode
annotate docs/man3/SDL_SetColors.3 @ 1180:bdcb8bb4c831
From: Tyler Montbriand <tsm@accesscomm.ca>
To: sdl@libsdl.org
Date: Fri, 30 Sep 2005 02:24:50 -0600
Subject: [SDL] WinCE timers, continued
Here's a strange timer for Windows CE that doesn't ignore time across
suspends. It uses GetSystemTime to keep the time continuous, and GetTicks to
get finer-grained readings than 1 second. It detects the difference between
the GetTicks time and GetSystemTime time on power-on to keep the error within
one second max.
It's not a patch on the current win32 timer code -- took one look at that and
figured it had more than enough #ifdefs already. It's windows-ce specific.
Another thing I've noticed is that the Windows CE 4.0 and newer API has
functions warn processes about suspends. This is something SDL REALLY needs
for audio in particular, because turning it off while it's playing causes
anything that uses audio to hardlock the system on power-on. Unfortunately I
don't have 4.0 to play with. :(
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 22 Nov 2005 07:10:07 +0000 |
parents | e5bc29de3f0a |
children | 546f7c1eb755 |
rev | line source |
---|---|
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
1 .TH "SDL_SetColors" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" |
0 | 2 .SH "NAME" |
3 SDL_SetColors\- Sets a portion of the colormap for the given 8-bit surface\&. | |
4 .SH "SYNOPSIS" | |
5 .PP | |
6 \fB#include "SDL\&.h" | |
7 .sp | |
8 \fBint \fBSDL_SetColors\fP\fR(\fBSDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors\fR); | |
9 .SH "DESCRIPTION" | |
10 .PP | |
11 Sets a portion of the colormap for the given 8-bit surface\&. | |
12 .PP | |
13 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_SetColors\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\&. | |
14 .PP | |
15 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\&. | |
16 .PP | |
17 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)\&. \fBSDL_SetColors\fP modifies both palettes (if present), and is equivalent to calling \fISDL_SetPalette\fR with the \fBflags\fR set to \fB(SDL_LOGPAL | SDL_PHYSPAL)\fP\&. | |
18 .SH "RETURN VALUE" | |
19 .PP | |
20 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_SetColors\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\&. | |
21 .SH "EXAMPLE" | |
22 .PP | |
23 .nf | |
24 \f(CW/* Create a display surface with a grayscale palette */ | |
25 SDL_Surface *screen; | |
26 SDL_Color colors[256]; | |
27 int i; | |
28 \&. | |
29 \&. | |
30 \&. | |
31 /* Fill colors with color information */ | |
32 for(i=0;i<256;i++){ | |
33 colors[i]\&.r=i; | |
34 colors[i]\&.g=i; | |
35 colors[i]\&.b=i; | |
36 } | |
37 | |
38 /* Create display */ | |
39 screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); | |
40 if(!screen){ | |
41 printf("Couldn\&'t set video mode: %s | |
42 ", SDL_GetError()); | |
43 exit(-1); | |
44 } | |
45 | |
46 /* Set palette */ | |
47 SDL_SetColors(screen, colors, 0, 256); | |
48 \&. | |
49 \&. | |
50 \&. | |
51 \&.\fR | |
52 .fi | |
53 .PP | |
54 .SH "SEE ALSO" | |
55 .PP | |
56 \fI\fBSDL_Color\fR\fR \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_SetPalette\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
57 ...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 |