Mercurial > sdl-ios-xcode
annotate src/video/nds/SDL_ndsrender.c @ 2683:e858ac8868b6 gsoc2008_nds
Ongoing video render work; initial work on NDS Timers.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Fri, 08 Aug 2008 08:22:08 +0000 |
parents | f7594fc66bda |
children | 2190b873ff00 |
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; |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
103 } NDS_RenderData; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
104 |
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
|
105 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
|
106 { |
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 enum { NDSTX_BG, NDSTX_SPR } type; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 } NDS_TextureData; |
2672
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
112 |
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 /* 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
|
115 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
|
116 */ |
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 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
|
119 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
|
120 { |
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 /* 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 } |
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 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
|
129 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
|
130 { |
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 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
|
132 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
|
133 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
|
134 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
|
135 } |
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 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
|
138 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
|
139 { |
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 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 } |
74ac057679d5
NDS video driver is now functional, using software rendering and framebuffer.
Darren Alton <dalton@stevens.edu>
parents:
2671
diff
changeset
|
146 |
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
|
147 /* 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
|
148 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
149 SDL_Renderer * |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
150 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
|
151 { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
152 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
|
153 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
|
154 SDL_Renderer *renderer; |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
155 NDS_RenderData *data; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
156 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
|
157 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
|
158 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
|
159 /* 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
|
160 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
|
161 */ |
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
|
162 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
|
163 |
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
|
164 /* 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
|
165 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
|
166 &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
|
167 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
|
168 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
|
169 } |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
170 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
171 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
|
172 if (!renderer) { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
173 SDL_OutOfMemory(); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
174 return NULL; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
175 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
176 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
177 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
|
178 if (!data) { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
179 NDS_DestroyRenderer(renderer); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
180 SDL_OutOfMemory(); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
181 return NULL; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
182 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
183 SDL_zerop(data); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
184 |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
185 renderer->RenderFill = NDS_RenderFill; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
186 renderer->RenderCopy = NDS_RenderCopy; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
187 renderer->RenderPresent = NDS_RenderPresent; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
188 renderer->DestroyRenderer = NDS_DestroyRenderer; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
189 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
|
190 renderer->info.flags = 0; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
191 renderer->window = window->id; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
192 renderer->driverdata = data; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
193 renderer->CreateTexture = NDS_CreateTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
194 renderer->QueryTexturePixels = NDS_QueryTexturePixels; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
195 renderer->SetTexturePalette = NDS_SetTexturePalette; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
196 renderer->GetTexturePalette = NDS_GetTexturePalette; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
197 renderer->SetTextureColorMod = NDS_SetTextureColorMod; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
198 renderer->SetTextureAlphaMod = NDS_SetTextureAlphaMod; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
199 renderer->SetTextureBlendMode = NDS_SetTextureBlendMode; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
200 renderer->SetTextureScaleMode = NDS_SetTextureScaleMode; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
201 renderer->UpdateTexture = NDS_UpdateTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
202 renderer->LockTexture = NDS_LockTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
203 renderer->UnlockTexture = NDS_UnlockTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
204 renderer->DirtyTexture = NDS_DirtyTexture; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
205 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
|
206 |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
207 renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
208 renderer->info.blend_modes = NDS_RenderDriver.info.blend_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
209 renderer->info.scale_modes = NDS_RenderDriver.info.scale_modes; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
210 renderer->info.num_texture_formats = |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
211 NDS_RenderDriver.info.num_texture_formats; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
212 SDL_memcpy(renderer->info.texture_formats, |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
213 NDS_RenderDriver.info.texture_formats, |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
214 sizeof(renderer->info.texture_formats));; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
215 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
|
216 renderer->info.max_texture_height = |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
217 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
|
218 |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
219 /*data->fb = (u16*)0x06020000;*/ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
220 data->bg = &BACKGROUND; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
221 data->bg_taken[2] = data->bg_taken[3] = 0; |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
222 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
|
223 |
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
|
224 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
|
225 return renderer; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
226 } |
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 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
|
229 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
|
230 { |
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 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
|
232 /* 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
|
233 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
|
234 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
|
235 } |
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 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
|
238 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
|
239 { |
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 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
|
241 /* 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
|
242 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
|
243 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
|
244 } |
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 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
|
247 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
|
248 { |
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 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
250 NDS_TextureData *txdat = NULL; |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
251 int i; |
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)); |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
302 for(i = 0; i < 256*256; ++i) { |
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
303 txdat->vram[i] = 0x8000|RGB15(0,31,31); |
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
304 } |
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
305 for(i = 0; i < 60; ++i) swiWaitForVBlank(); |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
306 } else { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
307 SDL_SetError("Out of NDS backgrounds."); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
308 } |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
309 } else { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
310 SDL_SetError("Texture too big for NDS hardware."); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
311 } |
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
|
312 } |
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 |
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
|
314 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
|
315 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
|
316 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
|
317 } |
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 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
|
319 } |
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 |
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
|
321 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
|
322 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
|
323 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
|
324 { |
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
|
325 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
|
326 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
|
327 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
|
328 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
|
329 } 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
|
330 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
|
331 |
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 *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
|
333 *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
|
334 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
|
335 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
|
336 } |
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 } |
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 |
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
|
339 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
|
340 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
|
341 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
|
342 { |
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
|
343 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
|
344 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
|
345 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
|
346 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
|
347 } 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
|
348 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
|
349 /* 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
|
350 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
|
351 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
|
352 } |
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 } |
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 |
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
|
355 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
|
356 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
|
357 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
|
358 { |
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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 } 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
|
364 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
|
365 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
|
366 /* 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
|
367 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
|
368 } |
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 } |
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
|
370 |
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 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
|
372 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
|
373 { |
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
|
374 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
|
375 /* 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
|
376 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
|
377 } |
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
|
378 |
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 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
|
380 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
|
381 { |
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
|
382 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
|
383 /* 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
|
384 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
|
385 } |
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
|
386 |
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 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
|
388 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
|
389 { |
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
|
390 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
|
391 /* 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
|
392 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
|
393 } |
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
|
394 |
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 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
|
396 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
|
397 { |
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
|
398 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
|
399 /* 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
|
400 (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
|
401 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
|
402 } |
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 |
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
|
404 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
|
405 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
|
406 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
|
407 { |
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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 } 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 /* 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
|
418 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
|
419 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
|
420 (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
|
421 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
|
422 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
|
423 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
|
424 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
|
425 src += pitch; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
426 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
|
427 } |
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
|
428 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
|
429 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
|
430 } |
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 } |
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 |
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 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
|
434 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
|
435 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
|
436 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
|
437 { |
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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 } 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
|
443 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
|
444 |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
445 if (markDirty) { |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
446 /*SDL_AddDirtyRect(&txdat->dirty, rect);*/ |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
447 } |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
448 |
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 *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
|
450 + 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
|
451 *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
|
452 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
|
453 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
|
454 } |
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 |
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 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
|
458 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
|
459 { |
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 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
|
461 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
|
462 } |
2683
e858ac8868b6
Ongoing video render work; initial work on NDS Timers.
Darren Alton <dalton@stevens.edu>
parents:
2682
diff
changeset
|
463 printf("+NDS_UnlockTexture\n-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
|
464 } |
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 |
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
|
466 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
|
467 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
|
468 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
|
469 { /* 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
|
470 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
|
471 } |
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
|
472 |
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
|
473 static int |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
474 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
|
475 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
|
476 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
477 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
|
478 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
|
479 u16 color; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
480 int i, j; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
481 |
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
|
482 printf("+NDS_RenderFill\n"); |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
483 /* 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
|
484 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
|
485 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
|
486 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
|
487 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
|
488 0x8000 | color; |
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
489 } |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
490 }*/ |
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
|
491 printf("-NDS_RenderFill\n"); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
492 return 0; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
493 } |
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
|
494 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
495 static int |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
496 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
|
497 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
|
498 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
499 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
|
500 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
|
501 // 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
|
502 // SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
503 int i; |
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
|
504 printf("+NDS_RenderCopy\n"); |
2683
e858ac8868b6
Ongoing video render work; initial work on NDS Timers.
Darren Alton <dalton@stevens.edu>
parents:
2682
diff
changeset
|
505 /*for(i = 0; i <= 0xFFFF; ++i) { |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
506 txdat->vram[i] = 0x8000|i; |
2683
e858ac8868b6
Ongoing video render work; initial work on NDS Timers.
Darren Alton <dalton@stevens.edu>
parents:
2682
diff
changeset
|
507 }*/ |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
508 printf("/txdat->hw_index = %d\n", txdat->hw_index); |
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
509 #if 0 |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
510 if (txdat->dirty.list) { |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
511 SDL_DirtyRect *dirty; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
512 void *pixels; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
513 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
|
514 int pitch = txdat->pitch; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
515 /* 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
|
516 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
|
517 |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
518 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
|
519 SDL_Rect *rect = &dirty->rect; |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
520 /*pixels = |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
521 (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
|
522 rect->x * bpp); |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
523 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
|
524 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
|
525 texturedata->formattype, pixels);*/ |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
526 } |
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
527 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
|
528 } |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
529 #endif |
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
|
530 printf("-NDS_RenderCopy\n"); |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
531 return 0; |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
532 } |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
533 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
534 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
535 static void |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
536 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
|
537 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
538 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
|
539 /* 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
|
540 |
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
|
541 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
|
542 /* Update the flipping chain, if any */ |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
543 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
544 swiWaitForVBlank(); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
545 } |
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
|
546 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
|
547 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
548 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
549 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
|
550 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
|
551 { |
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
|
552 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
|
553 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
|
554 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
|
555 } else { |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
556 /* 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
|
557 NDS_TextureData *txdat = texture->driverdata; |
2682
f7594fc66bda
Some debug work on the video driver, shows an error in the BG's vertical placement
Darren Alton <dalton@stevens.edu>
parents:
2681
diff
changeset
|
558 /*SDL_FreeDirtyRects(&txdat->dirty);*/ |
2681
c15b6c758be5
Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents:
2680
diff
changeset
|
559 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
|
560 } |
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
|
561 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
|
562 } |
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
|
563 |
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
|
564 static void |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
565 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
|
566 { |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
567 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
|
568 /*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
|
569 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
|
570 int i; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
571 |
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
|
572 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
|
573 if (data) { |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
574 /* TODO: free anything relevant. */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
575 /*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
|
576 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
|
577 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
|
578 } |
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
|
579 } |
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
|
580 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
|
581 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
|
582 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
|
583 } |
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
|
584 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
|
585 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
|
586 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
|
587 } |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2678
diff
changeset
|
588 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
|
589 SDL_free(data); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
590 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
591 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
|
592 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
|
593 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
594 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
595 /* vi: set ts=4 sw=4 expandtab: */ |