Commit 483f2ba3 authored by Sam Lantinga's avatar Sam Lantinga

indent

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403608
parent 3071101f
...@@ -174,7 +174,8 @@ void ...@@ -174,7 +174,8 @@ void
drawBlank(int x, int y) drawBlank(int x, int y)
{ {
SDL_Rect rect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN }; SDL_Rect rect = { x, y, GLYPH_SIZE_SCREEN, GLYPH_SIZE_SCREEN };
SDL_SetRenderDrawColor(bg_color.r, bg_color.g, bg_color.b, bg_color.unused); SDL_SetRenderDrawColor(bg_color.r, bg_color.g, bg_color.b,
bg_color.unused);
SDL_RenderFill(&rect); SDL_RenderFill(&rect);
} }
...@@ -254,7 +255,8 @@ main(int argc, char *argv[]) ...@@ -254,7 +255,8 @@ main(int argc, char *argv[])
loadFont(); loadFont();
/* draw the background, we'll just paint over it */ /* draw the background, we'll just paint over it */
SDL_SetRenderDrawColor(bg_color.r, bg_color.g, bg_color.b, bg_color.unused); SDL_SetRenderDrawColor(bg_color.r, bg_color.g, bg_color.b,
bg_color.unused);
SDL_RenderFill(NULL); SDL_RenderFill(NULL);
SDL_RenderPresent(); SDL_RenderPresent();
......
...@@ -168,7 +168,7 @@ render(void) ...@@ -168,7 +168,7 @@ render(void)
{ {
int i; int i;
SDL_SetRenderDrawColor(50, 50, 50, 255); SDL_SetRenderDrawColor(50, 50, 50, 255);
SDL_RenderFill(NULL); /* draw background (gray) */ SDL_RenderFill(NULL); /* draw background (gray) */
/* draw the drum buttons */ /* draw the drum buttons */
for (i = 0; i < NUM_DRUMS; i++) { for (i = 0; i < NUM_DRUMS; i++) {
SDL_Color color = SDL_Color color =
......
...@@ -50,7 +50,7 @@ extern "C" ...@@ -50,7 +50,7 @@ extern "C"
#ifndef GL_API #ifndef GL_API
#define GL_API #define GL_API
#endif /* GL_API */ #endif /* GL_API */
/* /*
** License Applicability. Except to the extent portions of this file are ** License Applicability. Except to the extent portions of this file are
...@@ -347,10 +347,10 @@ extern "C" ...@@ -347,10 +347,10 @@ extern "C"
/* OpenGL ES 1.0 defines, they gone in 1.1 and 2.0 */ /* OpenGL ES 1.0 defines, they gone in 1.1 and 2.0 */
#ifndef GL_MAX_ELEMENTS_VERTICES #ifndef GL_MAX_ELEMENTS_VERTICES
#define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_VERTICES 0x80E8
#endif /* GL_MAX_ELEMENTS_VERTICES */ #endif /* GL_MAX_ELEMENTS_VERTICES */
#ifndef GL_MAX_ELEMENTS_INDICES #ifndef GL_MAX_ELEMENTS_INDICES
#define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_MAX_ELEMENTS_INDICES 0x80E9
#endif /* GL_MAX_ELEMENTS_INDICES */ #endif /* GL_MAX_ELEMENTS_INDICES */
/* GetTextureParameter */ /* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */ /* GL_TEXTURE_MAG_FILTER */
...@@ -669,7 +669,7 @@ extern "C" ...@@ -669,7 +669,7 @@ extern "C"
/* GL_OES_draw_texture */ /* GL_OES_draw_texture */
#ifndef GL_OES_draw_texture #ifndef GL_OES_draw_texture
#define GL_TEXTURE_CROP_RECT_OES 0x8B9D #define GL_TEXTURE_CROP_RECT_OES 0x8B9D
#endif /* GL_OES_draw_texture */ #endif /* GL_OES_draw_texture */
/* GL_OES_vertex_buffer_object */ /* GL_OES_vertex_buffer_object */
#ifndef GL_OES_vertex_buffer_object #ifndef GL_OES_vertex_buffer_object
...@@ -687,7 +687,7 @@ extern "C" ...@@ -687,7 +687,7 @@ extern "C"
#define GL_BUFFER_SIZE_OES 0x8764 #define GL_BUFFER_SIZE_OES 0x8764
#define GL_BUFFER_USAGE_OES 0x8765 #define GL_BUFFER_USAGE_OES 0x8765
#define GL_BUFFER_ACCESS_OES 0x88BB #define GL_BUFFER_ACCESS_OES 0x88BB
#endif /* GL_OES_vertex_buffer_object */ #endif /* GL_OES_vertex_buffer_object */
/*************************************************************/ /*************************************************************/
...@@ -973,8 +973,9 @@ extern "C" ...@@ -973,8 +973,9 @@ extern "C"
/* GL_OES_query_matrix */ /* GL_OES_query_matrix */
#ifndef GL_OES_query_matrix #ifndef GL_OES_query_matrix
#define GL_OES_query_matrix 1 #define GL_OES_query_matrix 1
GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]); GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES(GLfixed mantissa[16],
#endif /* GL_OES_query_matrix */ GLint exponent[16]);
#endif /* GL_OES_query_matrix */
/* GL_OES_point_sprite */ /* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite #ifndef GL_OES_point_sprite
...@@ -984,26 +985,35 @@ extern "C" ...@@ -984,26 +985,35 @@ extern "C"
/* GL_OES_draw_texture */ /* GL_OES_draw_texture */
#ifndef GL_OES_draw_texture #ifndef GL_OES_draw_texture
#define GL_OES_draw_texture 1 #define GL_OES_draw_texture 1
GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); GL_API void GL_APIENTRY glDrawTexsOES(GLshort x, GLshort y, GLshort z,
GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); GLshort width, GLshort height);
GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); GL_API void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z,
GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords); GLint width, GLint height);
GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords); GL_API void GL_APIENTRY glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z,
GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords); GLfixed width, GLfixed height);
GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); GL_API void GL_APIENTRY glDrawTexsvOES(const GLshort * coords);
GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords); GL_API void GL_APIENTRY glDrawTexivOES(const GLint * coords);
#endif /* GL_OES_draw_texture */ GL_API void GL_APIENTRY glDrawTexxvOES(const GLfixed * coords);
GL_API void GL_APIENTRY glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height);
GL_API void GL_APIENTRY glDrawTexfvOES(const GLfloat * coords);
#endif /* GL_OES_draw_texture */
/* GL_OES_single_precision */ /* GL_OES_single_precision */
#ifndef GL_OES_single_precision #ifndef GL_OES_single_precision
#define GL_OES_single_precision 1 #define GL_OES_single_precision 1
GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar); GL_API void GL_APIENTRY glDepthRangefOES(GLclampf zNear, GLclampf zFar);
GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); GL_API void GL_APIENTRY glFrustumfOES(GLfloat left, GLfloat right,
GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); GLfloat bottom, GLfloat top,
GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); GL_API void GL_APIENTRY glOrthofOES(GLfloat left, GLfloat right,
GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth); GLfloat bottom, GLfloat top,
#endif /* GL_OES_single_precision */ GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glClipPlanefOES(GLenum plane,
const GLfloat * equation);
GL_API void GL_APIENTRY glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]);
GL_API void GL_APIENTRY glClearDepthfOES(GLclampf depth);
#endif /* GL_OES_single_precision */
/* GL_OES_vertex_buffer_object */ /* GL_OES_vertex_buffer_object */
#ifndef GL_OES_vertex_buffer_object #ifndef GL_OES_vertex_buffer_object
...@@ -1012,10 +1022,12 @@ extern "C" ...@@ -1012,10 +1022,12 @@ extern "C"
GL_API void APIENTRY glDeleteBuffersOES(GLsizei, const GLuint *); GL_API void APIENTRY glDeleteBuffersOES(GLsizei, const GLuint *);
GL_API void APIENTRY glGenBuffersOES(GLsizei, GLuint *); GL_API void APIENTRY glGenBuffersOES(GLsizei, GLuint *);
GL_API GLboolean APIENTRY glIsBufferOES(GLuint); GL_API GLboolean APIENTRY glIsBufferOES(GLuint);
GL_API void APIENTRY glBufferDataOES(GLenum, GLsizeiptr, const GLvoid *, GLenum); GL_API void APIENTRY glBufferDataOES(GLenum, GLsizeiptr, const GLvoid *,
GL_API void APIENTRY glBufferSubDataOES(GLenum, GLintptr, GLsizeiptr, const GLvoid *); GLenum);
GL_API void APIENTRY glBufferSubDataOES(GLenum, GLintptr, GLsizeiptr,
const GLvoid *);
GL_API void APIENTRY glGetBufferParameterivOES(GLenum, GLenum, GLint *); GL_API void APIENTRY glGetBufferParameterivOES(GLenum, GLenum, GLint *);
#endif /* GL_OES_vertex_buffer_object */ #endif /* GL_OES_vertex_buffer_object */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -271,8 +271,8 @@ typedef enum ...@@ -271,8 +271,8 @@ typedef enum
SDL_GL_MULTISAMPLESAMPLES, SDL_GL_MULTISAMPLESAMPLES,
SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCELERATED_VISUAL,
SDL_GL_RETAINED_BACKING, SDL_GL_RETAINED_BACKING,
SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MAJOR_VERSION,
SDL_GL_CONTEXT_MINOR_VERSION SDL_GL_CONTEXT_MINOR_VERSION
} SDL_GLattr; } SDL_GLattr;
......
...@@ -494,7 +494,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -494,7 +494,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
return NULL; return NULL;
} }
} }
SDL_GetDesktopDisplayMode(&desktop_mode); SDL_GetDesktopDisplayMode(&desktop_mode);
if (width == 0) { if (width == 0) {
......
...@@ -477,7 +477,8 @@ SDL_RunAudio(void *devicep) ...@@ -477,7 +477,8 @@ SDL_RunAudio(void *devicep)
/* Wait for an audio buffer to become available */ /* Wait for an audio buffer to become available */
current_audio.impl.WaitDevice(device); current_audio.impl.WaitDevice(device);
} else { } else {
SDL_Delay((device->spec.samples * 1000) / device->spec.freq); SDL_Delay((device->spec.samples * 1000) /
device->spec.freq);
} }
} }
...@@ -525,7 +526,7 @@ SDL_RunAudio(void *devicep) ...@@ -525,7 +526,7 @@ SDL_RunAudio(void *devicep)
/* Wait for an audio buffer to become available */ /* Wait for an audio buffer to become available */
current_audio.impl.WaitDevice(device); current_audio.impl.WaitDevice(device);
} else { } else {
SDL_Delay((device->spec.samples * 1000) / device->spec.freq); SDL_Delay((device->spec.samples * 1000) / device->spec.freq);
} }
} }
} }
......
This diff is collapsed.
...@@ -44,7 +44,7 @@ struct SDL_PrivateAudioData ...@@ -44,7 +44,7 @@ struct SDL_PrivateAudioData
/* The audio device handle */ /* The audio device handle */
int cardno; int cardno;
int deviceno; int deviceno;
snd_pcm_t* audio_handle; snd_pcm_t *audio_handle;
/* The audio file descriptor */ /* The audio file descriptor */
int audio_fd; int audio_fd;
...@@ -53,7 +53,7 @@ struct SDL_PrivateAudioData ...@@ -53,7 +53,7 @@ struct SDL_PrivateAudioData
uint32_t timeout_on_wait; uint32_t timeout_on_wait;
/* Raw mixing buffer */ /* Raw mixing buffer */
Uint8* pcm_buf; Uint8 *pcm_buf;
Uint32 pcm_len; Uint32 pcm_len;
}; };
......
...@@ -34,9 +34,10 @@ ...@@ -34,9 +34,10 @@
/* Empty function stub to get OpenGL ES 1.0 support without */ /* Empty function stub to get OpenGL ES 1.0 support without */
/* OpenGL ES extension GL_OES_draw_texture_supported */ /* OpenGL ES extension GL_OES_draw_texture_supported */
GL_API void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) GL_API void GL_APIENTRY
glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
{ {
return; return;
} }
#endif /* __QNXNTO__ */ #endif /* __QNXNTO__ */
...@@ -105,8 +106,7 @@ SDL_RenderDriver GL_ES_RenderDriver = { ...@@ -105,8 +106,7 @@ SDL_RenderDriver GL_ES_RenderDriver = {
{ {
/* OpenGL ES 1.x supported formats list */ /* OpenGL ES 1.x supported formats list */
SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_BGR24,
SDL_PIXELFORMAT_ABGR8888 SDL_PIXELFORMAT_ABGR8888},
},
0, 0,
0} 0}
}; };
...@@ -351,7 +351,7 @@ power_of_2(int input) ...@@ -351,7 +351,7 @@ power_of_2(int input)
} }
static int static int
GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = SDL_GetWindowFromID(renderer->window);
...@@ -363,15 +363,15 @@ GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) ...@@ -363,15 +363,15 @@ GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
switch (texture->format) { switch (texture->format) {
case SDL_PIXELFORMAT_BGR24: case SDL_PIXELFORMAT_BGR24:
internalFormat = GL_RGB; internalFormat = GL_RGB;
format = GL_RGB; format = GL_RGB;
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
break; break;
case SDL_PIXELFORMAT_ABGR8888: case SDL_PIXELFORMAT_ABGR8888:
internalFormat = GL_RGBA; internalFormat = GL_RGBA;
format = GL_RGBA; format = GL_RGBA;
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
break; break;
/* /*
These formats would be supported if SDL had the necessary pixel formats These formats would be supported if SDL had the necessary pixel formats
case SDL_PIXELFORMAT_BGR565: case SDL_PIXELFORMAT_BGR565:
...@@ -389,7 +389,7 @@ GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) ...@@ -389,7 +389,7 @@ GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
format = GL_RGBA; format = GL_RGBA;
type = GL_UNSIGNED_SHORT_4_4_4_4; type = GL_UNSIGNED_SHORT_4_4_4_4;
break; break;
*/ */
default: default:
SDL_SetError("Unsupported texture format"); SDL_SetError("Unsupported texture format");
return -1; return -1;
...@@ -533,8 +533,8 @@ GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -533,8 +533,8 @@ GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
} }
static int static int
GLES_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect *rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
{ {
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
...@@ -858,7 +858,7 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -858,7 +858,7 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
} }
static void static void
GLES_RenderPresent(SDL_Renderer *renderer) GLES_RenderPresent(SDL_Renderer * renderer)
{ {
SDL_GL_SwapWindow(renderer->window); SDL_GL_SwapWindow(renderer->window);
} }
......
...@@ -1496,10 +1496,9 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) ...@@ -1496,10 +1496,9 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
window->renderer = SDL_CurrentDisplay.render_drivers[index] window->renderer = SDL_CurrentDisplay.render_drivers[index]
.CreateRenderer(window, flags); .CreateRenderer(window, flags);
if (window->renderer==NULL) if (window->renderer == NULL) {
{ /* Assuming renderer set its error */
/* Assuming renderer set its error */ return -1;
return -1;
} }
SDL_SelectRenderer(window->id); SDL_SelectRenderer(window->id);
...@@ -2719,7 +2718,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) ...@@ -2719,7 +2718,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
{ {
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
GLenum (APIENTRY * glGetErrorFunc) (void); GLenum(APIENTRY * glGetErrorFunc) (void);
GLenum attrib = 0; GLenum attrib = 0;
GLenum error = 0; GLenum error = 0;
...@@ -2734,7 +2733,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) ...@@ -2734,7 +2733,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
} }
/* Clear value in any case */ /* Clear value in any case */
*value=0; *value = 0;
switch (attr) { switch (attr) {
case SDL_GL_RETAINED_BACKING: case SDL_GL_RETAINED_BACKING:
...@@ -2842,28 +2841,26 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) ...@@ -2842,28 +2841,26 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
} }
glGetIntegervFunc(attrib, (GLint *) value); glGetIntegervFunc(attrib, (GLint *) value);
error=glGetErrorFunc(); error = glGetErrorFunc();
if (error!=GL_NO_ERROR) if (error != GL_NO_ERROR) {
{ switch (error) {
switch (error) case GL_INVALID_ENUM:
{ {
case GL_INVALID_ENUM: SDL_SetError("OpenGL error: GL_INVALID_ENUM");
{ }
SDL_SetError("OpenGL error: GL_INVALID_ENUM"); break;
} case GL_INVALID_VALUE:
break; {
case GL_INVALID_VALUE: SDL_SetError("OpenGL error: GL_INVALID_VALUE");
{ }
SDL_SetError("OpenGL error: GL_INVALID_VALUE"); break;
} default:
break; {
default: SDL_SetError("OpenGL error: %08X", error);
{ }
SDL_SetError("OpenGL error: %08X", error); break;
} }
break; return -1;
}
return -1;
} }
return 0; return 0;
#else #else
......
...@@ -88,7 +88,7 @@ SDL_RenderDriver NDS_RenderDriver = { ...@@ -88,7 +88,7 @@ SDL_RenderDriver NDS_RenderDriver = {
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_ABGR1555, SDL_PIXELFORMAT_ABGR1555,
SDL_PIXELFORMAT_BGR555, SDL_PIXELFORMAT_BGR555,
}, /* u32 texture_formats[20] */ }, /* u32 texture_formats[20] */
(256), /* int max_texture_width */ (256), /* int max_texture_width */
(256), /* int max_texture_height */ (256), /* int max_texture_height */
} }
...@@ -107,8 +107,14 @@ typedef struct ...@@ -107,8 +107,14 @@ typedef struct
{ NDSTX_BG, NDSTX_SPR } type; /* represented in a bg or sprite. */ { NDSTX_BG, NDSTX_SPR } type; /* represented in a bg or sprite. */
int hw_index; /* index of sprite in OAM or bg from libnds */ int hw_index; /* index of sprite in OAM or bg from libnds */
int pitch, bpp; /* useful information about the texture */ int pitch, bpp; /* useful information about the texture */
struct { int x,y; } scale; /* x/y stretch (24.8 fixed point) */ struct
struct { int x,y; } scroll; /* x/y offset */ {
int x, y;
} scale; /* x/y stretch (24.8 fixed point) */
struct
{
int x, y;
} scroll; /* x/y offset */
int rotate; /* -32768 to 32767, texture rotation */ int rotate; /* -32768 to 32767, texture rotation */
u16 *vram_pixels; /* where the pixel data is stored (a pointer into VRAM) */ u16 *vram_pixels; /* where the pixel data is stored (a pointer into VRAM) */
u16 *vram_palette; /* where the palette data is stored if it's indexed. */ u16 *vram_palette; /* where the palette data is stored if it's indexed. */
...@@ -197,9 +203,9 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -197,9 +203,9 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.max_texture_height = renderer->info.max_texture_height =
NDS_RenderDriver.info.max_texture_height; NDS_RenderDriver.info.max_texture_height;
data->sub = 0; /* TODO: this is hard-coded to the "main" screen. data->sub = 0; /* TODO: this is hard-coded to the "main" screen.
figure out how to detect whether to set it to figure out how to detect whether to set it to
"sub" screen. window->id, perhaps? */ "sub" screen. window->id, perhaps? */
data->bg_taken[2] = data->bg_taken[3] = 0; data->bg_taken[2] = data->bg_taken[3] = 0;
return renderer; return renderer;
...@@ -310,9 +316,10 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -310,9 +316,10 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
txdat->dim.vdy = 0x100; txdat->dim.vdy = 0x100;
txdat->dim.pitch = pitch; txdat->dim.pitch = pitch;
txdat->dim.bpp = bpp; txdat->dim.bpp = bpp;
txdat->vram_pixels = (u16 *) (data->sub ? SPRITE_GFX_SUB : SPRITE_GFX); txdat->vram_pixels =
(u16 *) (data->sub ? SPRITE_GFX_SUB : SPRITE_GFX);
/* FIXME: use tileIdx*boundary /* FIXME: use tileIdx*boundary
to point to proper location */ to point to proper location */
} else { } else {
SDL_SetError("Out of NDS sprites."); SDL_SetError("Out of NDS sprites.");
} }
...@@ -332,20 +339,26 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -332,20 +339,26 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
SDL_OutOfMemory(); SDL_OutOfMemory();
return -1; return -1;
} }
// hard-coded for 256x256 for now... // hard-coded for 256x256 for now...
// TODO: a series of if-elseif-else's to find the closest but larger size. // TODO: a series of if-elseif-else's to find the closest but larger size.
if(!data->sub) { if (!data->sub) {
if(bpp==8) { if (bpp == 8) {
txdat->hw_index = bgInit(whichbg, BgType_Bmp8, BgSize_B8_256x256, 0, 0); txdat->hw_index =
bgInit(whichbg, BgType_Bmp8, BgSize_B8_256x256, 0, 0);
} else { } else {
txdat->hw_index = bgInit(whichbg, BgType_Bmp16, BgSize_B16_256x256, 0, 0); txdat->hw_index =
bgInit(whichbg, BgType_Bmp16, BgSize_B16_256x256, 0,
0);
} }
} else { } else {
if(bpp==8) { if (bpp == 8) {
txdat->hw_index = bgInitSub(whichbg, BgType_Bmp8, BgSize_B8_256x256, 0, 0); txdat->hw_index =
bgInitSub(whichbg, BgType_Bmp8, BgSize_B8_256x256, 0,
0);
} else { } else {
txdat->hw_index = bgInitSub(whichbg, BgType_Bmp16, BgSize_B16_256x256, 0, 0); txdat->hw_index =
bgInitSub(whichbg, BgType_Bmp16, BgSize_B16_256x256,
0, 0);
} }
} }
...@@ -357,14 +370,14 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -357,14 +370,14 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
bgUpdate(bg3); bgUpdate(bg3);
*/ */
txdat->type = NDSTX_BG; txdat->type = NDSTX_BG;
txdat->pitch = (texture->w)*(bpp/8); txdat->pitch = (texture->w) * (bpp / 8);
txdat->bpp = bpp; txdat->bpp = bpp;
txdat->rotate = 0; txdat->rotate = 0;
txdat->scale.x = 0x100; txdat->scale.x = 0x100;
txdat->scale.y = 0x100; txdat->scale.y = 0x100;
txdat->scroll.x = 0; txdat->scroll.x = 0;
txdat->scroll.y = 0; txdat->scroll.y = 0;
txdat->vram_pixels = (u16*)bgGetGfxPtr(txdat->hw_index); txdat->vram_pixels = (u16 *) bgGetGfxPtr(txdat->hw_index);
bgSetCenter(txdat->hw_index, 0, 0); bgSetCenter(txdat->hw_index, 0, 0);
bgSetRotateScale(txdat->hw_index, txdat->rotate, txdat->scale.x, bgSetRotateScale(txdat->hw_index, txdat->rotate, txdat->scale.x,
...@@ -458,7 +471,7 @@ NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, ...@@ -458,7 +471,7 @@ NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
int i, j; int i, j;
printf("NDS_RenderFill: stub\n"); printf("NDS_RenderFill: stub\n");
color = RGB8(r, g, b); /* macro in libnds that makes an ARGB1555 pixel */ color = RGB8(r, g, b); /* macro in libnds that makes an ARGB1555 pixel */
/* TODO: make a single-color sprite and stretch it. /* TODO: make a single-color sprite and stretch it.
calculate the "HDX" width modifier of the sprite by: calculate the "HDX" width modifier of the sprite by:
let S be the actual sprite's width (like, 32 pixels for example) let S be the actual sprite's width (like, 32 pixels for example)
......
This diff is collapsed.
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
/* GF headers must be included first for the Photon GF functions */ /* GF headers must be included first for the Photon GF functions */
#if defined(SDL_VIDEO_OPENGL_ES) #if defined(SDL_VIDEO_OPENGL_ES)
#include <gf/gf.h> #include <gf/gf.h>
#include <GLES/egl.h> #include <GLES/egl.h>
#endif /* SDL_VIDEO_OPENGL_ES */ #endif /* SDL_VIDEO_OPENGL_ES */
#include "SDL_config.h" #include "SDL_config.h"
...@@ -45,17 +45,17 @@ ...@@ -45,17 +45,17 @@
typedef struct SDL_VideoData typedef struct SDL_VideoData
{ {
PhRid_t rid[SDL_VIDEO_PHOTON_MAX_RIDS]; PhRid_t rid[SDL_VIDEO_PHOTON_MAX_RIDS];
uint32_t avail_rids; uint32_t avail_rids;
uint32_t current_device_id; uint32_t current_device_id;
#if defined(SDL_VIDEO_OPENGL_ES) #if defined(SDL_VIDEO_OPENGL_ES)
gf_dev_t gfdev; /* GF device handle */ gf_dev_t gfdev; /* GF device handle */
gf_dev_info_t gfdev_info; /* GF device information */ gf_dev_info_t gfdev_info; /* GF device information */
SDL_bool gfinitialized; /* GF device initialization status */ SDL_bool gfinitialized; /* GF device initialization status */
EGLDisplay egldisplay; /* OpenGL ES display connection */ EGLDisplay egldisplay; /* OpenGL ES display connection */
uint32_t egl_refcount; /* OpenGL ES reference count */ uint32_t egl_refcount; /* OpenGL ES reference count */
uint32_t swapinterval; /* OpenGL ES default swap interval */ uint32_t swapinterval; /* OpenGL ES default swap interval */
#endif /* SDL_VIDEO_OPENGL_ES */ #endif /* SDL_VIDEO_OPENGL_ES */
} SDL_VideoData; } SDL_VideoData;
/* This is hardcoded value in photon/Pg.h */ /* This is hardcoded value in photon/Pg.h */
...@@ -67,19 +67,19 @@ typedef struct SDL_VideoData ...@@ -67,19 +67,19 @@ typedef struct SDL_VideoData
typedef struct SDL_DisplayData typedef struct SDL_DisplayData
{ {
uint32_t device_id; uint32_t device_id;
uint32_t custom_refresh; /* Custom refresh rate for all modes */ uint32_t custom_refresh; /* Custom refresh rate for all modes */
SDL_DisplayMode current_mode; /* Current video mode */ SDL_DisplayMode current_mode; /* Current video mode */
uint8_t description[SDL_VIDEO_PHOTON_DEVICENAME_MAX]; uint8_t description[SDL_VIDEO_PHOTON_DEVICENAME_MAX];
/* Device description */ /* Device description */
uint32_t caps; /* Device capabilities */ uint32_t caps; /* Device capabilities */
PhCursorDef_t* cursor; /* Global cursor settings */ PhCursorDef_t *cursor; /* Global cursor settings */
SDL_bool cursor_visible; /* SDL_TRUE if cursor visible */ SDL_bool cursor_visible; /* SDL_TRUE if cursor visible */
uint32_t cursor_size; /* Cursor size in memory w/ structure */ uint32_t cursor_size; /* Cursor size in memory w/ structure */
#if defined(SDL_VIDEO_OPENGL_ES) #if defined(SDL_VIDEO_OPENGL_ES)
gf_display_t display; /* GF display handle */ gf_display_t display; /* GF display handle */
gf_display_info_t display_info; /* GF display information */ gf_display_info_t display_info; /* GF display information */
#endif /* SDL_VIDEO_OPENGL_ES */ #endif /* SDL_VIDEO_OPENGL_ES */
} SDL_DisplayData; } SDL_DisplayData;
/* Maximum amount of OpenGL ES framebuffer configurations */ /* Maximum amount of OpenGL ES framebuffer configurations */
...@@ -87,18 +87,18 @@ typedef struct SDL_DisplayData ...@@ -87,18 +87,18 @@ typedef struct SDL_DisplayData
typedef struct SDL_WindowData typedef struct SDL_WindowData
{ {
SDL_bool uses_gles; /* if true window must support OpenGL ES*/ SDL_bool uses_gles; /* if true window must support OpenGL ES */
PtWidget_t* window; /* window handle */ PtWidget_t *window; /* window handle */
#if defined(SDL_VIDEO_OPENGL_ES) #if defined(SDL_VIDEO_OPENGL_ES)
EGLConfig gles_configs[SDL_VIDEO_GF_OPENGLES_CONFS]; EGLConfig gles_configs[SDL_VIDEO_GF_OPENGLES_CONFS];
/* OpenGL ES framebuffer confs */ /* OpenGL ES framebuffer confs */
EGLint gles_config; /* OpenGL ES configuration index */ EGLint gles_config; /* OpenGL ES configuration index */
EGLContext gles_context; /* OpenGL ES context */ EGLContext gles_context; /* OpenGL ES context */
EGLint gles_attributes[256]; /* OpenGL ES attributes for context */ EGLint gles_attributes[256]; /* OpenGL ES attributes for context */
EGLSurface gles_surface; /* OpenGL ES target rendering surface */ EGLSurface gles_surface; /* OpenGL ES target rendering surface */
gf_surface_t gfsurface; /* OpenGL ES GF's surface */ gf_surface_t gfsurface; /* OpenGL ES GF's surface */
PdOffscreenContext_t* phsurface; /* OpenGL ES Photon's surface */ PdOffscreenContext_t *phsurface; /* OpenGL ES Photon's surface */
#endif /* SDL_VIDEO_OPENGL_ES */ #endif /* SDL_VIDEO_OPENGL_ES */
} SDL_WindowData; } SDL_WindowData;
/****************************************************************************/ /****************************************************************************/
...@@ -106,8 +106,8 @@ typedef struct SDL_WindowData ...@@ -106,8 +106,8 @@ typedef struct SDL_WindowData
/****************************************************************************/ /****************************************************************************/
typedef struct Photon_DeviceCaps typedef struct Photon_DeviceCaps
{ {
uint8_t* name; uint8_t *name;
uint32_t caps; uint32_t caps;
} Photon_DeviceCaps; } Photon_DeviceCaps;
#define SDL_PHOTON_UNACCELERATED 0x00000000 #define SDL_PHOTON_UNACCELERATED 0x00000000
...@@ -120,41 +120,42 @@ typedef struct Photon_DeviceCaps ...@@ -120,41 +120,42 @@ typedef struct Photon_DeviceCaps
/****************************************************************************/ /****************************************************************************/
/* Display and window functions */ /* Display and window functions */
int photon_videoinit(_THIS); int photon_videoinit(_THIS);
void photon_videoquit(_THIS); void photon_videoquit(_THIS);
void photon_getdisplaymodes(_THIS); void photon_getdisplaymodes(_THIS);
int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode); int photon_setdisplaymode(_THIS, SDL_DisplayMode * mode);
int photon_setdisplaypalette(_THIS, SDL_Palette* palette); int photon_setdisplaypalette(_THIS, SDL_Palette * palette);
int photon_getdisplaypalette(_THIS, SDL_Palette* palette); int photon_getdisplaypalette(_THIS, SDL_Palette * palette);
int photon_setdisplaygammaramp(_THIS, Uint16* ramp); int photon_setdisplaygammaramp(_THIS, Uint16 * ramp);
int photon_getdisplaygammaramp(_THIS, Uint16* ramp); int photon_getdisplaygammaramp(_THIS, Uint16 * ramp);
int photon_createwindow(_THIS, SDL_Window* window); int photon_createwindow(_THIS, SDL_Window * window);
int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data); int photon_createwindowfrom(_THIS, SDL_Window * window, const void *data);
void photon_setwindowtitle(_THIS, SDL_Window* window); void photon_setwindowtitle(_THIS, SDL_Window * window);
void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon); void photon_setwindowicon(_THIS, SDL_Window * window, SDL_Surface * icon);
void photon_setwindowposition(_THIS, SDL_Window* window); void photon_setwindowposition(_THIS, SDL_Window * window);
void photon_setwindowsize(_THIS, SDL_Window* window); void photon_setwindowsize(_THIS, SDL_Window * window);
void photon_showwindow(_THIS, SDL_Window* window); void photon_showwindow(_THIS, SDL_Window * window);
void photon_hidewindow(_THIS, SDL_Window* window); void photon_hidewindow(_THIS, SDL_Window * window);
void photon_raisewindow(_THIS, SDL_Window* window); void photon_raisewindow(_THIS, SDL_Window * window);
void photon_maximizewindow(_THIS, SDL_Window* window); void photon_maximizewindow(_THIS, SDL_Window * window);
void photon_minimizewindow(_THIS, SDL_Window* window); void photon_minimizewindow(_THIS, SDL_Window * window);
void photon_restorewindow(_THIS, SDL_Window* window); void photon_restorewindow(_THIS, SDL_Window * window);
void photon_setwindowgrab(_THIS, SDL_Window* window); void photon_setwindowgrab(_THIS, SDL_Window * window);
void photon_destroywindow(_THIS, SDL_Window* window); void photon_destroywindow(_THIS, SDL_Window * window);
/* Window manager function */ /* Window manager function */
SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info); SDL_bool photon_getwindowwminfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */ /* OpenGL/OpenGL ES functions */
int photon_gl_loadlibrary(_THIS, const char* path); int photon_gl_loadlibrary(_THIS, const char *path);
void* photon_gl_getprocaddres(_THIS, const char* proc); void *photon_gl_getprocaddres(_THIS, const char *proc);
void photon_gl_unloadlibrary(_THIS); void photon_gl_unloadlibrary(_THIS);
SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window); SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window * window);
int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context); int photon_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context);
int photon_gl_setswapinterval(_THIS, int interval); int photon_gl_setswapinterval(_THIS, int interval);
int photon_gl_getswapinterval(_THIS); int photon_gl_getswapinterval(_THIS);
void photon_gl_swapwindow(_THIS, SDL_Window* window); void photon_gl_swapwindow(_THIS, SDL_Window * window);
void photon_gl_deletecontext(_THIS, SDL_GLContext context); void photon_gl_deletecontext(_THIS, SDL_GLContext context);
/* Event handling function */ /* Event handling function */
......
This diff is collapsed.
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
typedef struct SDL_MouseData typedef struct SDL_MouseData
{ {
SDL_DisplayData* didata; SDL_DisplayData *didata;
} SDL_MouseData; } SDL_MouseData;
int32_t photon_addinputdevices(_THIS); int32_t photon_addinputdevices(_THIS);
......
...@@ -104,9 +104,11 @@ ...@@ -104,9 +104,11 @@
#define PHOTON_SCANCODE_SPACE 0x39 #define PHOTON_SCANCODE_SPACE 0x39
#define PHOTON_SCANCODE_MENU 0x5D #define PHOTON_SCANCODE_MENU 0x5D
#define PHOTON_SCANCODE_PRNSCR 0x54 /* only key pressed event, no release */ #define PHOTON_SCANCODE_PRNSCR 0x54 /* only key pressed event, no release */
#define PHOTON_SCANCODE_SCROLLLOCK 0x46 #define PHOTON_SCANCODE_SCROLLLOCK 0x46
/* #define PHOTON_SCANCODE_PAUSE 0x?? */ /* pause doesn't generates a scancode */ #if 0 /* pause doesn't generates a scancode */
#define PHOTON_SCANCODE_PAUSE 0x??
#endif
#define PHOTON_SCANCODE_INSERT 0x52 #define PHOTON_SCANCODE_INSERT 0x52
#define PHOTON_SCANCODE_HOME 0x47 #define PHOTON_SCANCODE_HOME 0x47
#define PHOTON_SCANCODE_PAGEUP 0x49 #define PHOTON_SCANCODE_PAGEUP 0x49
......
...@@ -26,173 +26,173 @@ ...@@ -26,173 +26,173 @@
#include "SDL_photon_pixelfmt.h" #include "SDL_photon_pixelfmt.h"
uint32_t photon_bits_to_sdl_pixelformat(uint32_t pixelfmt) uint32_t
photon_bits_to_sdl_pixelformat(uint32_t pixelfmt)
{ {
switch(pixelfmt) switch (pixelfmt) {
{ case 8:
case 8: {
{ return SDL_PIXELFORMAT_INDEX8;
return SDL_PIXELFORMAT_INDEX8; }
} break;
break; case 15:
case 15: {
{ return SDL_PIXELFORMAT_ARGB1555;
return SDL_PIXELFORMAT_ARGB1555; }
} break;
break; case 16:
case 16: {
{ return SDL_PIXELFORMAT_RGB565;
return SDL_PIXELFORMAT_RGB565; }
} break;
break; case 24:
case 24: {
{ return SDL_PIXELFORMAT_RGB888;
return SDL_PIXELFORMAT_RGB888; }
} break;
break; case 32:
case 32: {
{ return SDL_PIXELFORMAT_ARGB8888;
return SDL_PIXELFORMAT_ARGB8888; }
} break;
break; }
}
} }
uint32_t photon_sdl_to_bits_pixelformat(uint32_t pixelfmt) uint32_t
photon_sdl_to_bits_pixelformat(uint32_t pixelfmt)
{ {
switch(pixelfmt) switch (pixelfmt) {
{ case SDL_PIXELFORMAT_INDEX8:
case SDL_PIXELFORMAT_INDEX8: {
{ return 8;
return 8; }
} break;
break; case SDL_PIXELFORMAT_ARGB1555:
case SDL_PIXELFORMAT_ARGB1555: {
{ return 15;
return 15; }
} break;
break; case SDL_PIXELFORMAT_ABGR1555:
case SDL_PIXELFORMAT_ABGR1555: {
{ return 15;
return 15; }
} break;
break; case SDL_PIXELFORMAT_RGB565:
case SDL_PIXELFORMAT_RGB565: {
{ return 16;
return 16; }
} break;
break; case SDL_PIXELFORMAT_RGB888:
case SDL_PIXELFORMAT_RGB888: {
{ return 24;
return 24; }
} break;
break; case SDL_PIXELFORMAT_BGRA8888:
case SDL_PIXELFORMAT_BGRA8888: {
{ return 32;
return 32; }
} break;
break; case SDL_PIXELFORMAT_ARGB8888:
case SDL_PIXELFORMAT_ARGB8888: {
{ return 32;
return 32; }
} break;
break; case SDL_PIXELFORMAT_YV12:
case SDL_PIXELFORMAT_YV12: {
{ return 8;
return 8; }
} break;
break; case SDL_PIXELFORMAT_YUY2:
case SDL_PIXELFORMAT_YUY2: {
{ return 16;
return 16; }
} break;
break; case SDL_PIXELFORMAT_UYVY:
case SDL_PIXELFORMAT_UYVY: {
{ return 16;
return 16; }
} break;
break; case SDL_PIXELFORMAT_YVYU:
case SDL_PIXELFORMAT_YVYU: {
{ return 16;
return 16; }
} break;
break; }
}
return 0; return 0;
} }
uint32_t photon_image_to_sdl_pixelformat(uint32_t pixelfmt) uint32_t
photon_image_to_sdl_pixelformat(uint32_t pixelfmt)
{ {
switch(pixelfmt) switch (pixelfmt) {
{ case Pg_IMAGE_PALETTE_BYTE:
case Pg_IMAGE_PALETTE_BYTE: {
{ return SDL_PIXELFORMAT_INDEX8;
return SDL_PIXELFORMAT_INDEX8; }
} break;
break; case Pg_IMAGE_DIRECT_8888:
case Pg_IMAGE_DIRECT_8888: {
{ return SDL_PIXELFORMAT_BGRA8888;
return SDL_PIXELFORMAT_BGRA8888; }
} break;
break; case Pg_IMAGE_DIRECT_888:
case Pg_IMAGE_DIRECT_888: {
{ return SDL_PIXELFORMAT_RGB888;
return SDL_PIXELFORMAT_RGB888; }
} break;
break; case Pg_IMAGE_DIRECT_565:
case Pg_IMAGE_DIRECT_565: {
{ return SDL_PIXELFORMAT_RGB565;
return SDL_PIXELFORMAT_RGB565; }
} break;
break; case Pg_IMAGE_DIRECT_555:
case Pg_IMAGE_DIRECT_555: {
{ return SDL_PIXELFORMAT_RGB555;
return SDL_PIXELFORMAT_RGB555; }
} break;
break; case Pg_IMAGE_DIRECT_1555:
case Pg_IMAGE_DIRECT_1555: {
{ return SDL_PIXELFORMAT_ARGB1555;
return SDL_PIXELFORMAT_ARGB1555; }
} break;
break; }
}
return 0; return 0;
} }
uint32_t photon_sdl_to_image_pixelformat(uint32_t pixelfmt) uint32_t
photon_sdl_to_image_pixelformat(uint32_t pixelfmt)
{ {
switch(pixelfmt) switch (pixelfmt) {
{ case SDL_PIXELFORMAT_INDEX8:
case SDL_PIXELFORMAT_INDEX8: {
{ return Pg_IMAGE_PALETTE_BYTE;
return Pg_IMAGE_PALETTE_BYTE; }
} break;
break; case SDL_PIXELFORMAT_BGRA8888:
case SDL_PIXELFORMAT_BGRA8888: {
{ return Pg_IMAGE_DIRECT_8888;
return Pg_IMAGE_DIRECT_8888; }
} break;
break; case SDL_PIXELFORMAT_RGB888:
case SDL_PIXELFORMAT_RGB888: {
{ return Pg_IMAGE_DIRECT_888;
return Pg_IMAGE_DIRECT_888; }
} break;
break; case SDL_PIXELFORMAT_RGB565:
case SDL_PIXELFORMAT_RGB565: {
{ return Pg_IMAGE_DIRECT_565;
return Pg_IMAGE_DIRECT_565; }
} break;
break; case SDL_PIXELFORMAT_ARGB1555:
case SDL_PIXELFORMAT_ARGB1555: {
{ return Pg_IMAGE_DIRECT_1555;
return Pg_IMAGE_DIRECT_1555; }
} break;
break; }
}
return 0; return 0;
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
typedef struct SDL_RenderData typedef struct SDL_RenderData
{ {
SDL_Window* window; /* SDL window type */ SDL_Window *window; /* SDL window type */
SDL_bool enable_vsync; /* VSYNC flip synchronization enable */ SDL_bool enable_vsync; /* VSYNC flip synchronization enable */
uint32_t surface_visible_idx; /* Index of visible surface */ uint32_t surface_visible_idx; /* Index of visible surface */
uint32_t surface_render_idx; /* Index of render surface */ uint32_t surface_render_idx; /* Index of render surface */
uint32_t surfaces_count; /* Amount of allocated surfaces */ uint32_t surfaces_count; /* Amount of allocated surfaces */
} SDL_RenderData; } SDL_RenderData;
typedef struct SDL_TextureData typedef struct SDL_TextureData
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
typedef struct SDL_MouseData typedef struct SDL_MouseData
{ {
SDL_DisplayData* didata; SDL_DisplayData *didata;
} SDL_MouseData; } SDL_MouseData;
int32_t gf_addinputdevices(_THIS); int32_t gf_addinputdevices(_THIS);
...@@ -65,85 +65,85 @@ int32_t gf_delinputdevices(_THIS); ...@@ -65,85 +65,85 @@ int32_t gf_delinputdevices(_THIS);
typedef struct _hid_byte typedef struct _hid_byte
{ {
uint8_t HIDB_Length; uint8_t HIDB_Length;
uint8_t HIDB_Type; uint8_t HIDB_Type;
uint8_t HIDB_Tag; uint8_t HIDB_Tag;
uint8_t reserved[1]; uint8_t reserved[1];
} hid_byte_t; } hid_byte_t;
typedef struct _hidd_global_item typedef struct _hidd_global_item
{ {
uint16_t usage_page; uint16_t usage_page;
uint16_t logical_min; uint16_t logical_min;
uint16_t logical_max; uint16_t logical_max;
uint16_t physical_min; uint16_t physical_min;
uint16_t physical_max; uint16_t physical_max;
uint16_t unit_expo; uint16_t unit_expo;
uint16_t unit; uint16_t unit;
uint16_t report_size; uint16_t report_size;
uint16_t report_id; uint16_t report_id;
uint16_t report_count; uint16_t report_count;
} hidd_global_item_t; } hidd_global_item_t;
typedef struct _hidd_local_item typedef struct _hidd_local_item
{ {
uint16_t type; uint16_t type;
uint8_t reserved[2]; uint8_t reserved[2];
uint32_t value; uint32_t value;
struct _hidd_local_item* next_local; struct _hidd_local_item *next_local;
struct _hidd_local_item* alt_local; struct _hidd_local_item *alt_local;
} hidd_local_item_t; } hidd_local_item_t;
typedef struct _hidd_local_table typedef struct _hidd_local_table
{ {
hidd_local_item_t* usage_info; hidd_local_item_t *usage_info;
hidd_local_item_t* designator_info; hidd_local_item_t *designator_info;
hidd_local_item_t* string_info; hidd_local_item_t *string_info;
uint8_t delimiter; uint8_t delimiter;
uint8_t reserved[3]; uint8_t reserved[3];
} hidd_local_table_t; } hidd_local_table_t;
typedef struct _hidd_field typedef struct _hidd_field
{ {
struct hidd_report_instance* report; struct hidd_report_instance *report;
struct hidd_collection* collection; struct hidd_collection *collection;
uint16_t report_offset; uint16_t report_offset;
uint16_t flags; uint16_t flags;
hidd_global_item_t gitem; hidd_global_item_t gitem;
hidd_local_table_t* ltable; hidd_local_table_t *ltable;
struct _hidd_field* next_field; struct _hidd_field *next_field;
void* user; void *user;
} hidd_field_t; } hidd_field_t;
typedef struct hidd_report_instance typedef struct hidd_report_instance
{ {
uint8_t report_id; uint8_t report_id;
uint8_t reserved[1]; uint8_t reserved[1];
uint16_t report_type; uint16_t report_type;
hidd_field_t* field; hidd_field_t *field;
uint16_t num_field; uint16_t num_field;
uint16_t byte_len; uint16_t byte_len;
uint16_t bit_len; uint16_t bit_len;
uint8_t reserved2[2]; uint8_t reserved2[2];
struct hidd_collection* collection; struct hidd_collection *collection;
struct hidd_report_instance* next_col_report; struct hidd_report_instance *next_col_report;
struct hidd_report_instance* next_report; struct hidd_report_instance *next_report;
} hidd_report_instance_t; } hidd_report_instance_t;
typedef struct hidd_report typedef struct hidd_report
{ {
TAILQ_ENTRY(hidd_report) link; TAILQ_ENTRY(hidd_report) link;
hidd_report_instance_t* rinst; hidd_report_instance_t *rinst;
hidd_device_instance_t* dev_inst; hidd_device_instance_t *dev_inst;
uint32_t flags; uint32_t flags;
struct hidd_connection* connection; struct hidd_connection *connection;
void* user; void *user;
} hidd_report_t; } hidd_report_t;
typedef struct hidview_device typedef struct hidview_device
{ {
struct hidd_report_instance* instance; struct hidd_report_instance *instance;
struct hidd_report* report; struct hidd_report *report;
} hidview_device_t; } hidview_device_t;
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -30,21 +30,25 @@ ...@@ -30,21 +30,25 @@
/* This is OpenGL ES 1.0 helper functions from OpenGL ES 1.1 specification, */ /* This is OpenGL ES 1.0 helper functions from OpenGL ES 1.1 specification, */
/* which could be implemented independently from hardware, just wrappers */ /* which could be implemented independently from hardware, just wrappers */
GLAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) GLAPI void APIENTRY
glTexParameteri(GLenum target, GLenum pname, GLint param)
{ {
glTexParameterx(target, pname, (GLfixed)param); glTexParameterx(target, pname, (GLfixed) param);
return; return;
} }
GLAPI void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) GLAPI void APIENTRY
glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
{ {
/* Retrieve one parameter only */ /* Retrieve one parameter only */
glTexParameterx(target, pname, (GLfixed)*params); glTexParameterx(target, pname, (GLfixed) * params);
return; return;
} }
GLAPI void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) GLAPI void APIENTRY
glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
{ {
glColor4f(((GLfloat)red)/255.f, ((GLfloat)green)/255.f, ((GLfloat)blue)/255.f, ((GLfloat)alpha)/255.f); glColor4f(((GLfloat) red) / 255.f, ((GLfloat) green) / 255.f,
return; ((GLfloat) blue) / 255.f, ((GLfloat) alpha) / 255.f);
return;
} }
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
#include <GLES/glext.h> #include <GLES/glext.h>
GLAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param); GLAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param);
GLAPI void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params); GLAPI void APIENTRY glTexParameteriv(GLenum target, GLenum pname,
GLAPI void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); const GLint * params);
GLAPI void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue,
GLubyte alpha);
#endif /* __SDL_GF_OPENGLES_H__ */ #endif /* __SDL_GF_OPENGLES_H__ */
This diff is collapsed.
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <gf/gf.h> #include <gf/gf.h>
gf_format_t qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt); gf_format_t qnxgf_sdl_to_gf_pixelformat(uint32_t pixelfmt);
uint32_t qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt); uint32_t qnxgf_gf_to_sdl_pixelformat(gf_format_t pixelfmt);
#endif /* __SDL_GF_PIXELFMT_H__ */ #endif /* __SDL_GF_PIXELFMT_H__ */
......
This diff is collapsed.
...@@ -35,19 +35,19 @@ ...@@ -35,19 +35,19 @@
typedef struct SDL_RenderData typedef struct SDL_RenderData
{ {
SDL_Window* window; /* SDL window type */ SDL_Window *window; /* SDL window type */
SDL_bool enable_vsync; /* VSYNC flip synchronization enable */ SDL_bool enable_vsync; /* VSYNC flip synchronization enable */
gf_surface_t surface[SDL_GF_MAX_SURFACES]; /* Surface handles */ gf_surface_t surface[SDL_GF_MAX_SURFACES]; /* Surface handles */
gf_surface_info_t surface_info[SDL_GF_MAX_SURFACES]; /* Surface info */ gf_surface_info_t surface_info[SDL_GF_MAX_SURFACES]; /* Surface info */
uint32_t surface_visible_idx; /* Index of visible surface */ uint32_t surface_visible_idx; /* Index of visible surface */
uint32_t surface_render_idx; /* Index of render surface */ uint32_t surface_render_idx; /* Index of render surface */
uint32_t surfaces_count; /* Amount of allocated surfaces */ uint32_t surfaces_count; /* Amount of allocated surfaces */
} SDL_RenderData; } SDL_RenderData;
typedef struct SDL_TextureData typedef struct SDL_TextureData
{ {
gf_surface_t surface; gf_surface_t surface;
gf_surface_info_t surface_info; gf_surface_info_t surface_info;
} SDL_TextureData; } SDL_TextureData;
extern void gf_addrenderdriver(_THIS); extern void gf_addrenderdriver(_THIS);
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
/* PS/2 and USB keyboards are generating this packet */ /* PS/2 and USB keyboards are generating this packet */
typedef struct key_packet typedef struct key_packet
{ {
uint8_t modifiers; uint8_t modifiers;
uint8_t data; uint8_t data;
uint8_t codes[6]; uint8_t codes[6];
} key_packet; } key_packet;
/* Key modifier codes */ /* Key modifier codes */
......
...@@ -32,38 +32,38 @@ ...@@ -32,38 +32,38 @@
/* USB keyboard multimedia keys are generating this packet */ /* USB keyboard multimedia keys are generating this packet */
typedef struct mouse_packet2 typedef struct mouse_packet2
{ {
uint8_t buttons; uint8_t buttons;
int8_t wheel; int8_t wheel;
} mouse_packet2; } mouse_packet2;
/* PS/2 mice are generating this packet */ /* PS/2 mice are generating this packet */
typedef struct mouse_packet4 typedef struct mouse_packet4
{ {
uint8_t buttons; uint8_t buttons;
int8_t horizontal; int8_t horizontal;
int8_t vertical; int8_t vertical;
int8_t wheel; int8_t wheel;
} mouse_packet4; } mouse_packet4;
/* USB keyboard with mice wheel onboard generating this packet */ /* USB keyboard with mice wheel onboard generating this packet */
typedef struct mouse_packet5 typedef struct mouse_packet5
{ {
uint8_t buttons; uint8_t buttons;
int8_t horizontal; int8_t horizontal;
int8_t vertical; int8_t vertical;
int8_t wheel; int8_t wheel;
uint8_t state; uint8_t state;
} mouse_packet5; } mouse_packet5;
/* USB multi-button mice are generating this packet */ /* USB multi-button mice are generating this packet */
typedef struct mouse_packet8 typedef struct mouse_packet8
{ {
uint8_t buttons; uint8_t buttons;
int8_t horizontal; int8_t horizontal;
int8_t vertical; int8_t vertical;
int8_t wheel; int8_t wheel;
int16_t horizontal_precision; int16_t horizontal_precision;
int16_t vertical_precision; int16_t vertical_precision;
} mouse_packet8; } mouse_packet8;
#endif /* __SDL_HIDDI_MOUSE_H__ */ #endif /* __SDL_HIDDI_MOUSE_H__ */
This diff is collapsed.
This diff is collapsed.
...@@ -481,7 +481,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -481,7 +481,7 @@ GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
/* Crap, we've lost the original pixel data... *sigh* */ /* Crap, we've lost the original pixel data... *sigh* */
} }
return 0; return 0;
#ifndef _WIN32_WCE /* WinCE has no alphablend */ #ifndef _WIN32_WCE /* WinCE has no alphablend */
case SDL_BLENDMODE_MASK: case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND: case SDL_BLENDMODE_BLEND:
if (!data->premultiplied && data->pixels) { if (!data->premultiplied && data->pixels) {
...@@ -627,7 +627,7 @@ GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -627,7 +627,7 @@ GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
pitch); pitch);
} else if (data->pixels) { } else if (data->pixels) {
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
/* WinCE has no GdiFlush */ /* WinCE has no GdiFlush */
GdiFlush(); GdiFlush();
#endif #endif
*pixels = *pixels =
......
...@@ -191,12 +191,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -191,12 +191,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
0, 0); 0, 0);
SDL_SendWindowEvent(data->windowID, SDL_SendWindowEvent(data->windowID,
SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_WINDOWEVENT_RESTORED, 0, 0);
#ifndef _WIN32_WCE /* WinCE misses IsZoomed() */ #ifndef _WIN32_WCE /* WinCE misses IsZoomed() */
if (IsZoomed(hwnd)) { if (IsZoomed(hwnd)) {
SDL_SendWindowEvent(data->windowID, SDL_SendWindowEvent(data->windowID,
SDL_WINDOWEVENT_MAXIMIZED, 0, 0); SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
} }
#endif #endif
if (keyboard && keyboard->focus != data->windowID) { if (keyboard && keyboard->focus != data->windowID) {
SDL_SetKeyboardFocus(index, data->windowID); SDL_SetKeyboardFocus(index, data->windowID);
} }
...@@ -218,18 +218,18 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -218,18 +218,18 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
*/ */
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT); SDL_SendMouseButton(0, SDL_PRESSED, SDL_BUTTON_LEFT);
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0); SDL_SendMouseMotion(0, 0, LOWORD(lParam), HIWORD(lParam), 0);
SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT); SDL_SendMouseButton(0, SDL_RELEASED, SDL_BUTTON_LEFT);
break; break;
#else /* _WIN32_WCE */ #else /* _WIN32_WCE */
case WM_INPUT: /* mouse events */ case WM_INPUT: /* mouse events */
...@@ -261,7 +261,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -261,7 +261,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
} }
} }
GetCursorPos(&point); GetCursorPos(&point);
ScreenToClient(hwnd, &point); ScreenToClient(hwnd, &point);
...@@ -314,7 +314,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -314,7 +314,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
return (0); return (0);
#endif /* _WIN32_WCE */ #endif /* _WIN32_WCE */
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
{ {
int i; int i;
...@@ -598,7 +598,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -598,7 +598,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCPAINT: case WM_NCPAINT:
{ {
if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_FOREIGN) { if (SDL_GetWindowFlags(data->windowID) & SDL_WINDOW_FOREIGN) {
return(0); return (0);
} }
break; break;
} }
......
...@@ -28,7 +28,7 @@ int ...@@ -28,7 +28,7 @@ int
WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp) WIN_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
return -1; return -1;
#else #else
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
HDC hdc; HDC hdc;
...@@ -50,7 +50,7 @@ int ...@@ -50,7 +50,7 @@ int
WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp) WIN_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
return -1; return -1;
#else #else
SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata; SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
HDC hdc; HDC hdc;
......
...@@ -55,10 +55,10 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) ...@@ -55,10 +55,10 @@ WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode)
mode->driverdata = data; mode->driverdata = data;
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
/* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation /* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation
into account but GetSystemMetrixs does. */ into account but GetSystemMetrixs does. */
if(index == ENUM_CURRENT_SETTINGS) { if (index == ENUM_CURRENT_SETTINGS) {
mode->w = GetSystemMetrics(SM_CXSCREEN); mode->w = GetSystemMetrics(SM_CXSCREEN);
mode->h = GetSystemMetrics(SM_CYSCREEN); mode->h = GetSystemMetrics(SM_CYSCREEN);
} }
#endif #endif
...@@ -211,12 +211,12 @@ WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -211,12 +211,12 @@ WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
{ {
SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
LONG status; LONG status;
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
/* TODO: implement correctly. /* TODO: implement correctly.
On my Asus MyPAL, if I execute the code below On my Asus MyPAL, if I execute the code below
I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays
visible ... (SDL_RaiseWindow() would fix that one)*/ visible ... (SDL_RaiseWindow() would fix that one) */
return 0; return 0;
#endif #endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment