Mercurial > sdl-ios-xcode
comparison src/video/xbios/SDL_xbios_centscreen.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | d910939febfa |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
30 #include <mint/falcon.h> | 30 #include <mint/falcon.h> |
31 | 31 |
32 #include "SDL_xbios.h" | 32 #include "SDL_xbios.h" |
33 #include "SDL_xbios_centscreen.h" | 33 #include "SDL_xbios_centscreen.h" |
34 | 34 |
35 int SDL_XBIOS_CentscreenInit(_THIS) | 35 int |
36 SDL_XBIOS_CentscreenInit (_THIS) | |
36 { | 37 { |
37 centscreen_mode_t curmode, listedmode; | 38 centscreen_mode_t curmode, listedmode; |
38 unsigned long result; | 39 unsigned long result; |
39 int cur_handle; /* Current Centscreen mode handle */ | 40 int cur_handle; /* Current Centscreen mode handle */ |
40 | 41 |
41 /* Reset current mode list */ | 42 /* Reset current mode list */ |
42 if (XBIOS_modelist) { | 43 if (XBIOS_modelist) { |
43 SDL_free(XBIOS_modelist); | 44 SDL_free (XBIOS_modelist); |
44 XBIOS_nummodes = 0; | 45 XBIOS_nummodes = 0; |
45 XBIOS_modelist = NULL; | 46 XBIOS_modelist = NULL; |
46 } | 47 } |
47 | 48 |
48 /* Add Centscreen modes */ | 49 /* Add Centscreen modes */ |
49 Vread(&curmode); | 50 Vread (&curmode); |
50 cur_handle = curmode.handle; | 51 cur_handle = curmode.handle; |
51 curmode.mode = curmode.physx = curmode.physy = curmode.plan = | 52 curmode.mode = curmode.physx = curmode.physy = curmode.plan = |
52 curmode.logx = curmode.logy = -1; | 53 curmode.logx = curmode.logy = -1; |
53 | 54 |
54 result = Vfirst(&curmode, &listedmode); | 55 result = Vfirst (&curmode, &listedmode); |
55 if (result==0) { | 56 if (result == 0) { |
56 while (result==0) { | 57 while (result == 0) { |
57 /* Don't add modes with virtual screen */ | 58 /* Don't add modes with virtual screen */ |
58 if ((listedmode.mode & CSCREEN_VIRTUAL)==0) { | 59 if ((listedmode.mode & CSCREEN_VIRTUAL) == 0) { |
59 /* Don't add modes with bpp<8 */ | 60 /* Don't add modes with bpp<8 */ |
60 if (listedmode.plan>=8) { | 61 if (listedmode.plan >= 8) { |
61 SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx, | 62 SDL_XBIOS_AddMode (this, listedmode.mode, |
62 listedmode.physy, listedmode.plan, SDL_FALSE | 63 listedmode.physx, |
63 ); | 64 listedmode.physy, |
64 } | 65 listedmode.plan, SDL_FALSE); |
65 } | 66 } |
66 SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t)); | 67 } |
67 curmode.mode = curmode.physx = curmode.physy = curmode.plan = | 68 SDL_memcpy (&curmode, &listedmode, sizeof (centscreen_mode_t)); |
68 curmode.logx = curmode.logy = -1; | 69 curmode.mode = curmode.physx = curmode.physy = curmode.plan = |
69 result = Vnext(&curmode, &listedmode); | 70 curmode.logx = curmode.logy = -1; |
70 } | 71 result = Vnext (&curmode, &listedmode); |
71 } else { | 72 } |
72 fprintf(stderr, "No suitable Centscreen modes\n"); | 73 } else { |
73 } | 74 fprintf (stderr, "No suitable Centscreen modes\n"); |
75 } | |
74 | 76 |
75 return cur_handle; | 77 return cur_handle; |
76 } | 78 } |
77 | 79 |
78 void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes) | 80 void |
81 SDL_XBIOS_CentscreenSetmode (_THIS, int width, int height, int planes) | |
79 { | 82 { |
80 centscreen_mode_t newmode, curmode; | 83 centscreen_mode_t newmode, curmode; |
81 | |
82 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1; | |
83 newmode.physx = width; | |
84 newmode.physy = height; | |
85 newmode.plan = planes; | |
86 Vwrite(0, &newmode, &curmode); | |
87 | 84 |
88 /* Disable screensaver */ | 85 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1; |
89 Vread(&newmode); | 86 newmode.physx = width; |
90 newmode.mode &= ~(CSCREEN_SAVER|CSCREEN_ENERGYSTAR); | 87 newmode.physy = height; |
91 Vwrite(0, &newmode, &curmode); | 88 newmode.plan = planes; |
89 Vwrite (0, &newmode, &curmode); | |
90 | |
91 /* Disable screensaver */ | |
92 Vread (&newmode); | |
93 newmode.mode &= ~(CSCREEN_SAVER | CSCREEN_ENERGYSTAR); | |
94 Vwrite (0, &newmode, &curmode); | |
92 } | 95 } |
93 | 96 |
94 void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle) | 97 void |
98 SDL_XBIOS_CentscreenRestore (_THIS, int prev_handle) | |
95 { | 99 { |
96 centscreen_mode_t newmode, curmode; | 100 centscreen_mode_t newmode, curmode; |
97 | 101 |
98 /* Restore old video mode */ | 102 /* Restore old video mode */ |
99 newmode.handle = prev_handle; | 103 newmode.handle = prev_handle; |
100 newmode.mode = newmode.physx = newmode.physy = newmode.plan = | 104 newmode.mode = newmode.physx = newmode.physy = newmode.plan = |
101 newmode.logx = newmode.logy = -1; | 105 newmode.logx = newmode.logy = -1; |
102 Vwrite(0, &newmode, &curmode); | 106 Vwrite (0, &newmode, &curmode); |
103 } | 107 } |
108 | |
109 /* vi: set ts=4 sw=4 expandtab: */ |