Mercurial > sdl-ios-xcode
annotate src/video/riscos/SDL_wimpvideo.c @ 3889:67d518069d9a SDL-1.2
A few more AmigaOS things.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 29 Oct 2006 04:08:50 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
rev | line source |
---|---|
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
634
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Library General Public License for more details. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1035
diff
changeset
|
20 slouken@libsdl.org |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 /* |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
25 File added by Alan Buckley (alan_baa@hotmail.com) for RISC OS compatability |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 27 March 2003 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
28 Implements RISC OS Wimp display. |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #include "SDL_video.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #include "SDL_mouse.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
33 #include "../SDL_sysvideo.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
34 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
35 #include "../../events/SDL_events_c.h" |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 #include "SDL_riscostask.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 #include "SDL_riscosvideo.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 #include "SDL_riscosevents_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 #include "SDL_riscosmouse_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 #include "kernel.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include "swis.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 /* Initialization/Query functions */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 SDL_Rect **WIMP_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 int WIMP_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 void WIMP_SetWMCaption(_THIS, const char *title, const char *icon); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 extern unsigned char *WIMP_CreateBuffer(int width, int height, int bpp); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 extern void WIMP_PumpEvents(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 extern void WIMP_PlotSprite(_THIS, int x, int y); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 extern void WIMP_SetupPlotInfo(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 extern void WIMP_SetFocus(int win); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 /* etc. */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 static void WIMP_UpdateRects(_THIS, int numrects, SDL_Rect *rects); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 /* RISC OS Wimp handling helpers */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 void WIMP_ReadModeInfo(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 unsigned int WIMP_SetupWindow(_THIS, SDL_Surface *surface); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 void WIMP_SetDeviceMode(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 void WIMP_DeleteWindow(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 /* FULLSCREEN function required for wimp/fullscreen toggling */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 extern int FULLSCREEN_SetMode(int width, int height, int bpp); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 /* Currently need to set this up here as it only works if you |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 start up in a Wimp mode */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 extern int RISCOS_ToggleFullScreen(_THIS, int fullscreen); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 extern int riscos_backbuffer; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 extern int mouseInWindow; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 extern int riscos_closeaction; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
634
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
78 /* Following needed to ensure window is shown immediately */ |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
79 extern int hasFocus; |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
80 extern void WIMP_Poll(_THIS, int waitTime); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current, |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 int width, int height, int bpp, Uint32 flags) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 Uint32 Rmask = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 Uint32 Gmask = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 Uint32 Bmask = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 char *buffer = NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 int bytesPerPixel = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 /* Don't support double buffering in Wimp mode */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 flags &= ~SDL_DOUBLEBUF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 flags &= ~SDL_HWSURFACE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 switch(bpp) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 case 8: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 /* Emulated palette using ColourTrans */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 flags |= SDL_HWPALETTE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 case 15: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 case 16: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 Bmask = 0x00007c00; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 Gmask = 0x000003e0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 Rmask = 0x0000001f; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 bytesPerPixel = 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 case 32: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 Bmask = 0x00ff0000; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 Gmask = 0x0000ff00; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 Rmask = 0x000000ff; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 bytesPerPixel = 4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 default: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 SDL_SetError("Pixel depth not supported"); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 return NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 /* printf("Setting mode %dx%d\n", width, height);*/ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 /* Allocate the new pixel format for the screen */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 if ( ! SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0) ) { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 SDL_SetError("Couldn't allocate new pixel format for requested mode"); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 return(NULL); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 /* Set up the new mode framebuffer */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 current->w = width; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 this->hidden->height = current->h = height; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 if (bpp == 15) bpp = 16; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 buffer = WIMP_CreateBuffer(width, height, bpp); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 if (buffer == NULL) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 SDL_SetError("Couldn't create sprite for video memory"); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 return (NULL); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 this->hidden->bank[0] = buffer + 60; /* Start of sprite data */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 if (bpp == 8) this->hidden->bank[0] += 2048; /* 8bpp sprite have palette first */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 this->hidden->bank[1] = buffer; /* Start of buffer */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 /* Remember sprite buffer so it can be freed later */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
149 if (this->hidden->alloc_bank) SDL_free(this->hidden->alloc_bank); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 this->hidden->alloc_bank = buffer; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 current->pitch = width * bytesPerPixel; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 if ((current->pitch & 3)) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 /* Sprites are 32bit word aligned */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 current->pitch += (4 - (current->pitch & 3)); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 current->flags = flags | SDL_PREALLOC; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 WIMP_ReadModeInfo(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
163 SDL_memset(this->hidden->bank[0], 0, height * current->pitch); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 this->hidden->current_bank = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 current->pixels = this->hidden->bank[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 if (WIMP_SetupWindow(this, current) == 0) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 SDL_SetError("Unable to create window to display surface"); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 return NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 /* Reset device functions for the wimp */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 WIMP_SetDeviceMode(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 |
634
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
178 /* Needs to set up plot info after window has been created */ |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
179 /* Not sure why, but plots don't work if I do it earlier */ |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
180 WIMP_SetupPlotInfo(this); |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
181 |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
182 /* Poll until window is shown */ |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
183 { |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
184 /* We wait until it gets the focus, but give up after 5 seconds |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
185 in case the focus is prevented in any way. |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
186 */ |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
187 Uint32 now = SDL_GetTicks(); |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
188 while (!hasFocus && SDL_GetTicks() - now < 5000) |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
189 { |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
190 WIMP_Poll(this, 0); |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
191 } |
44d574ed4780
Date: Thu, 05 Jun 2003 09:36:40 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
192 } |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 /* We're done */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 return(current); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 void WIMP_ReadModeInfo(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 int vars[6]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 int vals[5]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 vars[0] = 4; /* XEig */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 vars[1] = 5; /* YEig */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 vars[2] = 9; /* Log base 2 bpp */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 vars[3] = 11; /* Screen Width - 1 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 vars[4] = 12; /* Screen Depth - 1 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 vars[5] = -1; /* Terminate list */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 regs.r[0] = (int)vars; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 regs.r[1] = (int)vals; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 _kernel_swi(OS_ReadVduVariables, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 this->hidden->xeig = vals[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 this->hidden->yeig = vals[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 this->hidden->screen_bpp = 1 << vals[2]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 this->hidden->screen_width = vals[3] + 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 this->hidden->screen_height = vals[4] + 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 /* Set device function to call the correct versions for running |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 in a wimp window */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 void WIMP_SetDeviceMode(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 if (this->UpdateRects == WIMP_UpdateRects) return; /* Already set up */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 this->SetColors = WIMP_SetColors; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 this->UpdateRects = WIMP_UpdateRects; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 this->FlipHWSurface = NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 this->SetCaption = WIMP_SetWMCaption; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 this->SetIcon = NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 this->IconifyWindow = NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 this->ShowWMCursor = WIMP_ShowWMCursor; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 this->WarpWMCursor = WIMP_WarpWMCursor; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 this->ToggleFullScreen = RISCOS_ToggleFullScreen; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 this->PumpEvents = WIMP_PumpEvents; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 /* Setup the Window to display the surface */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 unsigned int WIMP_SetupWindow(_THIS, SDL_Surface *surface) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 int window_data[23]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 int *window_block = window_data+1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 int x = (this->hidden->screen_width - surface->w) / 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 int y = (this->hidden->screen_height - surface->h) / 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 int xeig = this->hidden->xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 int yeig = this->hidden->yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 mouseInWindow = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 /* Always delete the window and recreate on a change */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 if (this->hidden->window_handle) WIMP_DeleteWindow(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 /* Setup window co-ordinates */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 window_block[0] = x << xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 window_block[1] = y << yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 window_block[2] = window_block[0] + (surface->w << xeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 window_block[3] = window_block[1] + (surface->h << yeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 window_block[4] = 0; /* Scroll offsets */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 window_block[5] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 window_block[6] = -1; /* Open on top of window stack */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 window_block[7] = 0x85040042; /* Window flags */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 if (riscos_closeaction != 0) window_block[7] |= 0x2000000; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 /* TODO: Take into account surface->flags */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 window_block[8] = 0xff070207; /* Window colours */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 window_block[9] = 0x000c0103; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 window_block[10] = 0; /* Work area minimum */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 window_block[11] = -surface->h << yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 window_block[12] = surface->w << xeig; /* Work area maximum */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 window_block[13] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 window_block[14] = 0x2700013d; /* Title icon flags */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 window_block[15] = 0x00003000; /* Work area flags - Mouse click down reported */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 window_block[16] = 1; /* Sprite area control block pointer */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 window_block[17] = 0x00100010; /* Minimum window size (width & height) (16x16)*/ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 window_block[18] = (int)this->hidden->title; /* Title data */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 window_block[19] = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 window_block[20] = 256; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 window_block[21] = 0; /* Number of icons */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 regs.r[1] = (unsigned int)(window_block); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 /* Create the window */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 if (_kernel_swi(Wimp_CreateWindow, ®s, ®s) == NULL) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 this->hidden->window_handle = window_data[0] = regs.r[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 /* Show the window on the screen */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 regs.r[1] = (unsigned int)window_data; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 if (_kernel_swi(Wimp_OpenWindow, ®s, ®s) == NULL) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 WIMP_SetFocus(this->hidden->window_handle); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 WIMP_DeleteWindow(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 return this->hidden->window_handle; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 /* Destroy the Window */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 void WIMP_DeleteWindow(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 regs.r[1] = (unsigned int)&(this->hidden->window_handle); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 _kernel_swi(Wimp_DeleteWindow, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 this->hidden->window_handle = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 void WIMP_UpdateRects(_THIS, int numrects, SDL_Rect *rects) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 int update_block[12]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 int xeig = this->hidden->xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 int yeig = this->hidden->yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 int j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 update_block[0] = this->hidden->window_handle; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 for (j = 0; j < numrects; j++) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 update_block[1] = rects[j].x << xeig; /* Min X */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 update_block[4] = -(rects[j].y << yeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 update_block[3] = update_block[1] + (rects[j].w << xeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 update_block[2] = update_block[4] - (rects[j].h << yeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 regs.r[1] = (int)update_block; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 /* Update window can fail if called before first poll */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 if (_kernel_swi(Wimp_UpdateWindow, ®s, ®s) == 0) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 while (regs.r[0]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 WIMP_PlotSprite(this, update_block[1], update_block[2]); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 _kernel_swi(Wimp_GetRectangle, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 int WIMP_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 unsigned int *pal = (unsigned int *)(this->hidden->bank[1]+60); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 int j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 SDL_Rect update; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 pal += firstcolor*2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 for (j = 0; j < ncolors; j++) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 *pal = (((unsigned int)colors->r) << 8) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 + (((unsigned int)colors->g) << 16) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 + (((unsigned int)colors->b) << 24); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 pal[1] = *pal; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 pal += 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 colors++; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 WIMP_SetupPlotInfo(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 /* Need to refresh the window */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 update.x = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 update.y = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 update.w = SDL_VideoSurface->w; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 update.h = SDL_VideoSurface->h; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 WIMP_UpdateRects(this, 1, &update); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 return 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 void WIMP_SetWMCaption(_THIS, const char *title, const char *icon) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
388 SDL_strlcpy(this->hidden->title, title, SDL_arraysize(this->hidden->title)); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 if (RISCOS_GetWimpVersion() < 380) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 int block[6]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 regs.r[1] = (int)block; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 _kernel_swi(Wimp_GetCaretPosition, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 if (block[0] == (int)this->hidden->window_handle) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 regs.r[0] = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 _kernel_swi(Wimp_SetCaretPosition, ®s,®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 regs.r[0] = this->hidden->window_handle; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 regs.r[1] = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 regs.r[2] = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 regs.r[3] = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 _kernel_swi(Wimp_SetCaretPosition, ®s,®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 regs.r[0] = block[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 regs.r[1] = block[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 regs.r[2] = block[2]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 regs.r[3] = block[3]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 regs.r[4] = block[4]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 regs.r[5] = block[5]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 _kernel_swi(Wimp_SetCaretPosition, ®s,®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 regs.r[0] = this->hidden->window_handle; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 regs.r[1] = 0x4b534154; /* "TASK" */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 regs.r[2] = 3; /* Redraw title */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 _kernel_swi(Wimp_ForceRedraw, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 void WIMP_RefreshDesktop(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 int width = this->hidden->screen_width << this->hidden->xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 int height = this->hidden->screen_height << this->hidden->yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 regs.r[0] = -1; /* Whole screen */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 regs.r[1] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 regs.r[2] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 regs.r[3] = width; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 regs.r[4] = height; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 _kernel_swi(Wimp_ForceRedraw, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 /* Toggle to window from full screen */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 int WIMP_ToggleFromFullScreen(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 int width = this->screen->w; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 int height = this->screen->h; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 int bpp = this->screen->format->BitsPerPixel; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 char *buffer = NULL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 char *old_bank[2]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 char *old_alloc_bank; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 /* Ensure flags are OK */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 this->screen->flags &= ~(SDL_DOUBLEBUF|SDL_HWSURFACE); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 if (this->hidden->bank[0] == this->hidden->alloc_bank || riscos_backbuffer == 0) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 /* Need to create a sprite for the screen and copy the data to it */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 char *data; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 buffer = WIMP_CreateBuffer(width, height, bpp); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 data = buffer + 60; /* Start of sprite data */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 if (bpp == 8) data += 2048; /* 8bpp sprite have palette first */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 if (buffer == NULL) return 0; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
459 SDL_memcpy(data, this->hidden->bank[0], width * height * this->screen->format->BytesPerPixel); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 /* else We've switch to full screen before so we already have a sprite */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 old_bank[0] = this->hidden->bank[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 old_bank[1] = this->hidden->bank[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 old_alloc_bank = this->hidden->alloc_bank; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 if (buffer != NULL) this->hidden->alloc_bank = buffer; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 this->hidden->bank[1] = this->hidden->alloc_bank; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 this->hidden->bank[0] = this->hidden->bank[1] + 60; /* Start of sprite data */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 if (bpp == 8) this->hidden->bank[0] += 2048; /* 8bpp sprite have palette first */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 this->hidden->current_bank = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 this->screen->pixels = this->hidden->bank[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 RISCOS_RestoreWimpMode(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 WIMP_ReadModeInfo(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 if (WIMP_SetupWindow(this, this->screen)) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 WIMP_SetDeviceMode(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 WIMP_SetupPlotInfo(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
483 if (riscos_backbuffer == 0) riscos_backbuffer = 1; |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
485 if (buffer && old_alloc_bank) SDL_free(old_alloc_bank); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 return 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 /* Drop back to full screen mode on failure */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 this->hidden->bank[0] = old_bank[0]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 this->hidden->bank[1] = old_bank[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 this->hidden->alloc_bank = old_alloc_bank; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
494 if (buffer) SDL_free(buffer); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 RISCOS_StoreWimpMode(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 FULLSCREEN_SetMode(width, height, bpp); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 return 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 } |