Mercurial > sdl-ios-xcode
annotate src/video/nds/SDL_ndsrender.c @ 2681:c15b6c758be5 gsoc2008_nds
Some small bug fixes and more work on video
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Fri, 25 Jul 2008 23:39:14 +0000 |
parents | 4135aa9c5645 |
children | f7594fc66bda |
rev | line source |
---|---|
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
1 /* |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
4 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
9 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
14 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
18 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
19 Sam Lantinga |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
20 slouken@libsdl.org |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
21 */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
22 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
23 #include <stdio.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
24 #include <stdlib.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
25 #include <nds.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
26 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
27 #include "SDL_config.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
28 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
29 #include "SDL_video.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
30 #include "../SDL_sysvideo.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
31 #include "../SDL_yuv_sw_c.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
32 #include "../SDL_renderer_sw.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
33 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
34 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
35 /* SDL surface based renderer implementation */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
36 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
37 static SDL_Renderer *NDS_CreateRenderer(SDL_Window * window, Uint32 flags); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
38 static int NDS_ActivateRenderer(SDL_Renderer * renderer); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
39 static int NDS_DisplayModeChanged(SDL_Renderer * renderer); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
40 static int NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
41 static int NDS_QueryTexturePixels(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
42 SDL_Texture * texture, void **pixels, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
43 int *pitch); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
44 static int NDS_SetTexturePalette(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
45 SDL_Texture * texture, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
46 const SDL_Color * colors, int firstcolor, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
47 int ncolors); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
48 static int NDS_GetTexturePalette(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
49 SDL_Texture * texture, SDL_Color * colors, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
50 int firstcolor, int ncolors); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
51 static int NDS_SetTextureColorMod(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
52 SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
53 static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
54 SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
55 static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
56 SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
57 static int NDS_SetTextureScaleMode(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
58 SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
59 static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
60 const SDL_Rect * rect, const void *pixels, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
61 int pitch); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
62 static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
63 const SDL_Rect * rect, int markDirty, void **pixels, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
64 int *pitch); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
65 static void NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
66 static void NDS_DirtyTexture(SDL_Renderer * renderer, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
67 SDL_Texture * texture, int numrects, |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
68 const SDL_Rect * rects); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
69 static int NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
70 Uint8 b, Uint8 a, const SDL_Rect * rect); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
71 static int NDS_RenderCopy(SDL_Renderer * renderer, |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
72 SDL_Texture * texture, |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
73 const SDL_Rect * srcrect, |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
74 const SDL_Rect * dstrect); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
75 static void NDS_RenderPresent(SDL_Renderer * renderer); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
76 static void NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
77 static void NDS_DestroyRenderer(SDL_Renderer * renderer); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
78 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
79 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
80 SDL_RenderDriver NDS_RenderDriver = { |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
81 NDS_CreateRenderer, |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
82 { "nds", /* char* name */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
83 (SDL_RENDERER_SINGLEBUFFER|SDL_RENDERER_ACCELERATED), /* u32 flags */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
84 (SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
85 (SDL_TEXTUREBLENDMODE_NONE), /* u32 blend_modes */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
86 (SDL_TEXTURESCALEMODE_NONE), /* u32 scale_modes */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
87 3, /* u32 num_texture_formats */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
88 { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
89 SDL_PIXELFORMAT_INDEX8, |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
90 SDL_PIXELFORMAT_ABGR1555, |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
91 SDL_PIXELFORMAT_BGR555, |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
92 }, /* u32 texture_formats[20] */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
93 (256), /* int max_texture_width */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
94 (256), /* int max_texture_height */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
95 } |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
96 }; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
97 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
98 typedef struct |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
99 { |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
100 bg_attribute *bg; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
101 u8 bg_taken[4]; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
102 int sub; |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
103 SDL_DirtyRectList dirty; |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
104 } NDS_RenderData; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
105 |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
106 typedef struct |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
107 { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
108 enum { NDSTX_BG, NDSTX_SPR } type; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
109 int hw_index; |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
110 struct { int w, h, pitch, bpp; } dim; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
111 u16 *vram; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
112 } NDS_TextureData; |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
113 |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
114 |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
115 /* this is mainly hackish testing/debugging stuff to get cleaned up soon |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
116 anything named sdlds_blah shouldn't make it into the stable version |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
117 */ |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
118 |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
119 u16 |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
120 sdlds_rgb2bgr(u16 c) |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
121 { |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
122 /* hack to get the proper colors until I actually get BGR555 to work right */ |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
123 u16 Rmask = 0x7C00, Bmask = 0x001F, GAmask = 0x83E0, r, b; |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
124 r = (c & Rmask) >> 10; |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
125 b = (c & Bmask) << 10; |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
126 return (c & GAmask) | r | b; |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
127 } |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
128 |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
129 void |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
130 sdlds_print_pixfmt_info(SDL_PixelFormat * f) |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
131 { |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
132 if (!f) |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
133 return; |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
134 printf("bpp: %d\nRGBA: %x %x %x %x\n", |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
135 f->BitsPerPixel, f->Rmask, f->Gmask, f->Bmask, f->Amask); |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
136 } |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
137 |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
138 void |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
139 sdlds_print_surface_info(SDL_Surface * s) |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
140 { |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
141 if (!s) |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
142 return; |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
143 printf("flags: %x\nsize: %dx%d, pitch: %d\nlocked: %d, refcount: %d\n", |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
144 s->flags, s->w, s->h, s->pitch, s->locked, s->refcount); |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
145 sdlds_print_pixfmt_info(s->format); |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
146 } |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
147 |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
148 /* again the above shouldn't make it into the stable version */ |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
149 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
150 SDL_Renderer * |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
151 NDS_CreateRenderer(SDL_Window * window, Uint32 flags) |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
152 { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
153 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
154 SDL_DisplayMode *displayMode = &display->current_mode; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
155 SDL_Renderer *renderer; |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
156 NDS_RenderData *data; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
157 int i, n; |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
158 int bpp = 15; |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
159 Uint32 Rmask, Gmask, Bmask, Amask; |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
160 /* Uint32 Rmask = 0x7C00, Gmask = 0x03E0, Bmask = 0x001F, Amask = 0x8000; |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
161 Uint32 Rmask = 0x001F, Gmask = 0x03E0, Bmask = 0x7C00, Amask = 0x8000; |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
162 */ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
163 printf("+NDS_CreateRenderer\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
164 |
2673
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
165 /* hard coded this to BGR555 for now */ |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
166 if (!SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_BGR555, &bpp, |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
167 &Rmask, &Gmask, &Bmask, &Amask)) { |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
168 SDL_SetError("Unknown display format"); |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
169 return NULL; |
24a6b3588eac
Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents:
2672
diff
changeset
|
170 } |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
171 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
172 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
173 if (!renderer) { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
174 SDL_OutOfMemory(); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
175 return NULL; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
176 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
177 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
178 data = (NDS_RenderData *) SDL_malloc(sizeof(*data)); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
179 if (!data) { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
180 NDS_DestroyRenderer(renderer); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
181 SDL_OutOfMemory(); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
182 return NULL; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
183 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
184 SDL_zerop(data); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
185 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
186 renderer->RenderFill = NDS_RenderFill; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
187 renderer->RenderCopy = NDS_RenderCopy; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
188 renderer->RenderPresent = NDS_RenderPresent; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
189 renderer->DestroyRenderer = NDS_DestroyRenderer; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
190 renderer->info.name = NDS_RenderDriver.info.name; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
191 renderer->info.flags = 0; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
192 renderer->window = window->id; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
193 renderer->driverdata = data; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
194 renderer->CreateTexture = NDS_CreateTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
195 renderer->QueryTexturePixels = NDS_QueryTexturePixels; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
196 renderer->SetTexturePalette = NDS_SetTexturePalette; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
197 renderer->GetTexturePalette = NDS_GetTexturePalette; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
198 renderer->SetTextureColorMod = NDS_SetTextureColorMod; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
199 renderer->SetTextureAlphaMod = NDS_SetTextureAlphaMod; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
200 renderer->SetTextureBlendMode = NDS_SetTextureBlendMode; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
201 renderer->SetTextureScaleMode = NDS_SetTextureScaleMode; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
202 renderer->UpdateTexture = NDS_UpdateTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
203 renderer->LockTexture = NDS_LockTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
204 renderer->UnlockTexture = NDS_UnlockTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
205 renderer->DirtyTexture = NDS_DirtyTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
206 renderer->DestroyTexture = NDS_DestroyTexture; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
207 |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
208 renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
209 renderer->info.blend_modes = NDS_RenderDriver.info.blend_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
210 renderer->info.scale_modes = NDS_RenderDriver.info.scale_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
211 renderer->info.num_texture_formats = |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
212 NDS_RenderDriver.info.num_texture_formats; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
213 SDL_memcpy(renderer->info.texture_formats, |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
214 NDS_RenderDriver.info.texture_formats, |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
215 sizeof(renderer->info.texture_formats));; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
216 renderer->info.max_texture_width = NDS_RenderDriver.info.max_texture_width; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
217 renderer->info.max_texture_height = |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
218 NDS_RenderDriver.info.max_texture_height; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
219 |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
220 /*data->fb = (u16*)0x06020000;*/ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
221 data->bg = &BACKGROUND; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
222 data->bg_taken[2] = data->bg_taken[3] = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
223 data->sub = 0; |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
224 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
225 printf("-NDS_CreateRenderer\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
226 return renderer; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
227 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
228 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
229 static int |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
230 NDS_ActivateRenderer(SDL_Renderer * renderer) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
231 { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
232 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
233 /* stub. TODO: figure out what needs to be done, if anything. */ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
234 printf("!NDS_ActivateRenderer\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
235 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
236 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
237 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
238 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
239 NDS_DisplayModeChanged(SDL_Renderer * renderer) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
240 { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
241 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
242 /* stub. TODO: figure out what needs to be done */ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
243 printf("!NDS_DisplayModeChanged\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
244 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
245 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
246 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
247 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
248 NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
249 { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
250 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
251 NDS_TextureData *txdat = NULL; |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
252 printf("+NDS_CreateTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
253 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
254 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
255 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
256 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
257 int bpp; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
258 Uint32 Rmask, Gmask, Bmask, Amask; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
259 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
260 if (!SDL_PixelFormatEnumToMasks |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
261 (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
262 SDL_SetError("Unknown texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
263 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
264 } |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
265 /* conditional statements on w/h to place it as bg/sprite */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
266 /*if(texture->w <= 64 && texture->h <= 64) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
267 sprites not implemented yet. elegant, I know. |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
268 } else*/ if(texture->w <= 256 && texture->h <= 256) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
269 int whichbg = -1; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
270 if(!data->bg_taken[2]) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
271 whichbg = 2; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
272 data->bg->bg2_rotation.xdx = 0x100; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
273 data->bg->bg2_rotation.xdy = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
274 data->bg->bg2_rotation.ydx = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
275 data->bg->bg2_rotation.ydy = 0x100; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
276 data->bg->bg2_rotation.centerX = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
277 data->bg->bg2_rotation.centerY = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
278 } else if(!data->bg_taken[3]) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
279 whichbg = 3; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
280 data->bg->bg3_rotation.xdx = 0x100; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
281 data->bg->bg3_rotation.xdy = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
282 data->bg->bg3_rotation.ydx = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
283 data->bg->bg3_rotation.ydy = 0x100; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
284 data->bg->bg3_rotation.centerX = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
285 data->bg->bg3_rotation.centerY = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
286 } |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
287 if(whichbg >= 0) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
288 data->bg->control[whichbg] = (bpp == 8) ? |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
289 BG_BMP8_256x256 : BG_BMP16_256x256; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
290 data->bg->scroll[whichbg].x = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
291 data->bg->scroll[whichbg].y = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
292 texture->driverdata = SDL_calloc(1, sizeof(NDS_TextureData)); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
293 txdat = (NDS_TextureData*)texture->driverdata; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
294 txdat->type = NDSTX_BG; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
295 txdat->hw_index = whichbg; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
296 txdat->dim.w = texture->w; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
297 txdat->dim.h = texture->h; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
298 txdat->dim.pitch = 256 * (bpp/8); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
299 txdat->dim.bpp = bpp; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
300 txdat->vram = (u16*)(data->sub ? |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
301 BG_BMP_RAM_SUB(whichbg) : BG_BMP_RAM(whichbg)); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
302 } else { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
303 SDL_SetError("Out of NDS backgrounds."); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
304 } |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
305 } else { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
306 SDL_SetError("Texture too big for NDS hardware."); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
307 } |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
308 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
309 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
310 printf("-NDS_CreateTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
311 if (!texture->driverdata) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
312 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
313 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
314 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
315 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
316 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
317 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
318 NDS_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
319 void **pixels, int *pitch) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
320 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
321 printf("+NDS_QueryTexturePixels\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
322 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
323 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
324 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
325 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
326 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
327 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
328 *pixels = txdat->vram; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
329 *pitch = txdat->dim.pitch; |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
330 printf("-NDS_QueryTexturePixels\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
331 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
332 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
333 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
334 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
335 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
336 NDS_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
337 const SDL_Color * colors, int firstcolor, int ncolors) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
338 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
339 printf("+NDS_SetTexturePalette\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
340 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
341 SDL_SetError("YUV textures don't have a palette"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
342 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
343 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
344 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
345 /* TODO: mess with 8-bit modes and/or 16-color palette modes */ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
346 printf("-NDS_SetTexturePalette\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
347 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
348 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
349 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
350 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
351 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
352 NDS_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
353 SDL_Color * colors, int firstcolor, int ncolors) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
354 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
355 printf("+NDS_GetTexturePalette\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
356 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
357 SDL_SetError("YUV textures don't have a palette"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
358 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
359 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
360 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
361 printf("-NDS_GetTexturePalette\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
362 /* TODO: mess with 8-bit modes and/or 16-color palette modes */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
363 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
364 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
365 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
366 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
367 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
368 NDS_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
369 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
370 printf("!NDS_SetTextureColorMod\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
371 /* stub. TODO: figure out what needs to be done, if anything */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
372 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
373 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
374 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
375 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
376 NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
377 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
378 printf("!NDS_SetTextureAlphaMod\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
379 /* stub. TODO: figure out what needs to be done, if anything */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
380 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
381 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
382 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
383 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
384 NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
385 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
386 printf("!NDS_SetTextureBlendMode\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
387 /* stub. TODO: figure out what needs to be done, if anything */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
388 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
389 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
390 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
391 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
392 NDS_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
393 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
394 printf("!NDS_SetTextureScaleMode\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
395 /* stub. TODO: figure out what needs to be done. |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
396 (NDS hardware scaling is nearest neighbor.) */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
397 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
398 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
399 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
400 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
401 NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
402 const SDL_Rect * rect, const void *pixels, int pitch) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
403 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
404 printf("+NDS_UpdateTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
405 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
406 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
407 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
408 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
409 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
410 Uint8 *src, *dst; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
411 int row; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
412 size_t length; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
413 /* IMPORTANT! copy the new pixels into the sprite or bg. */ |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
414 src = (Uint8 *) pixels; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
415 dst = |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
416 (Uint8 *) txdat->vram + rect->y * txdat->dim.pitch + |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
417 rect->x * (txdat->dim.bpp/8); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
418 length = rect->w * (txdat->dim.bpp/8); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
419 for (row = 0; row < rect->h; ++row) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
420 SDL_memcpy(dst, src, length); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
421 src += pitch; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
422 dst += txdat->dim.pitch; |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
423 } |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
424 printf("-NDS_UpdateTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
425 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
426 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
427 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
428 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
429 static int |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
430 NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
431 const SDL_Rect * rect, int markDirty, void **pixels, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
432 int *pitch) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
433 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
434 printf("+NDS_LockTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
435 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
436 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
437 return -1; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
438 } else { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
439 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
440 |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
441 if (markDirty) { |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
442 SDL_AddDirtyRect(&txdat->dirty, rect); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
443 } |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
444 |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
445 *pixels = (void *) ((u8 *)txdat->vram + rect->y * txdat->dim.pitch |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
446 + rect->x * (txdat->dim.bpp/8)); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
447 *pitch = txdat->dim.pitch; |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
448 printf("-NDS_LockTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
449 return 0; |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
450 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
451 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
452 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
453 static void |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
454 NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
455 { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
456 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
457 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
458 } |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
459 printf("!NDS_UnlockTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
460 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
461 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
462 static void |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
463 NDS_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
464 int numrects, const SDL_Rect * rects) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
465 { /* stub */ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
466 printf("!NDS_DirtyTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
467 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
468 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
469 static int |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
470 NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
471 Uint8 a, const SDL_Rect * rect) |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
472 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
473 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
474 SDL_Rect real_rect = *rect; |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
475 u16 color; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
476 int i, j; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
477 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
478 printf("+NDS_RenderFill\n"); |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
479 /* TODO: make a single-color sprite and stretch it. |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
480 color = RGB15(r>>3,g>>3,b>>3); |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
481 for (i = real_rect.x; i < real_rect.x+real_rect.w; ++i) { |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
482 for (j = real_rect.y; j < real_rect.y+real_rect.h; ++j) { |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
483 data->fb[(j + real_rect.y) * 256 + i + real_rect.x] = |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
484 0x8000 | color; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
485 } |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
486 }*/ |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
487 printf("-NDS_RenderFill\n"); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
488 return 0; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
489 } |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
490 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
491 static int |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
492 NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
493 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
494 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
495 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
496 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
497 // SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
498 // SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
499 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
500 printf("+NDS_RenderCopy\n"); |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
501 |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
502 if (txdat->dirty.list) { |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
503 SDL_DirtyRect *dirty; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
504 void *pixels; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
505 int bpp = SDL_BYTESPERPIXEL(texture->format); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
506 int pitch = txdat->pitch; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
507 /* below was borrowed from SDL_renderer_gl.c. doesn't work, obv. |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
508 figure out how to get the graphics data into VRAM. */ |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
509 |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
510 for (dirty = txdat->dirty.list; dirty; dirty = dirty->next) { |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
511 SDL_Rect *rect = &dirty->rect; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
512 /*pixels = |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
513 (void *) ((Uint8 *) txdat->vram + rect->y * pitch + |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
514 rect->x * bpp); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
515 data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y, |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
516 rect->w, rect->h, texturedata->format, |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
517 texturedata->formattype, pixels);*/ |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
518 } |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
519 SDL_ClearDirtyRects(&txdat->dirty); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
520 } |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
521 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
522 printf("-NDS_RenderCopy\n"); |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
523 return status; |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
524 } |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
525 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
526 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
527 static void |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
528 NDS_RenderPresent(SDL_Renderer * renderer) |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
529 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
530 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
531 /* Send the data to the display TODO */ |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
532 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
533 printf("+NDS_RenderPresent\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
534 /* Update the flipping chain, if any */ |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
535 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
536 swiWaitForVBlank(); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
537 } |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
538 printf("-NDS_RenderPresent\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
539 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
540 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
541 static void |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
542 NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
543 { |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
544 printf("+NDS_DestroyTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
545 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
546 SDL_SetError("Unsupported texture format"); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
547 } else { |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
548 /* free anything else allocated for texture */ |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
549 NDS_TextureData *txdat = texture->driverdata; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
550 SDL_FreeDirtyRects(&txdat->dirty); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
551 SDL_free(txdat); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
552 } |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
553 printf("-NDS_DestroyTexture\n"); |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
554 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
555 |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
556 static void |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
557 NDS_DestroyRenderer(SDL_Renderer * renderer) |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
558 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
559 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
560 /*SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
561 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);*/ |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
562 int i; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
563 |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
564 printf("+NDS_DestroyRenderer\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
565 if (data) { |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
566 /* TODO: free anything relevant. */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
567 /*for (i = 0; i < SDL_arraysize(data->texture); ++i) { |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
568 if (data->texture[i]) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
569 DestroyTexture(data->renderer, data->texture[i]); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
570 } |
2678
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
571 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
572 if (data->surface.format) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
573 SDL_SetSurfacePalette(&data->surface, NULL); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
574 SDL_FreeFormat(data->surface.format); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
575 } |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
576 if (display->palette) { |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
577 SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
578 data); |
3895761db26a
Removed old touchscreen system, starting to implement mouse-based touchscreen. Also, more work on a non-software-rendering video driver
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
579 } |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
580 SDL_FreeDirtyRects(&data->dirty);*/ |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
581 SDL_free(data); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
582 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
583 SDL_free(renderer); |
2680
4135aa9c5645
More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents:
2679
diff
changeset
|
584 printf("-NDS_DestroyRenderer\n"); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
585 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
586 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
587 /* vi: set ts=4 sw=4 expandtab: */ |