src/render/SDL_sysrender.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 02 Feb 2011 14:34:54 -0800
changeset 5154 fb424691cfc7
child 5156 307ccc9c135e
permissions -rw-r--r--
Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library.
slouken@5154
     1
/*
slouken@5154
     2
    SDL - Simple DirectMedia Layer
slouken@5154
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@5154
     4
slouken@5154
     5
    This library is free software; you can redistribute it and/or
slouken@5154
     6
    modify it under the terms of the GNU Lesser General Public
slouken@5154
     7
    License as published by the Free Software Foundation; either
slouken@5154
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@5154
     9
slouken@5154
    10
    This library is distributed in the hope that it will be useful,
slouken@5154
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@5154
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@5154
    13
    Lesser General Public License for more details.
slouken@5154
    14
slouken@5154
    15
    You should have received a copy of the GNU Lesser General Public
slouken@5154
    16
    License along with this library; if not, write to the Free Software
slouken@5154
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@5154
    18
slouken@5154
    19
    Sam Lantinga
slouken@5154
    20
    slouken@libsdl.org
slouken@5154
    21
*/
slouken@5154
    22
#include "SDL_config.h"
slouken@5154
    23
slouken@5154
    24
#ifndef _SDL_sysrender_h
slouken@5154
    25
#define _SDL_sysrender_h
slouken@5154
    26
slouken@5154
    27
#include "SDL_render.h"
slouken@5154
    28
#include "SDL_events.h"
slouken@5154
    29
slouken@5154
    30
/* The SDL 2D rendering system */
slouken@5154
    31
slouken@5154
    32
typedef struct SDL_RenderDriver SDL_RenderDriver;
slouken@5154
    33
slouken@5154
    34
/* Define the SDL texture structure */
slouken@5154
    35
struct SDL_Texture
slouken@5154
    36
{
slouken@5154
    37
    const void *magic;
slouken@5154
    38
    Uint32 format;              /**< The pixel format of the texture */
slouken@5154
    39
    int access;                 /**< SDL_TextureAccess */
slouken@5154
    40
    int w;                      /**< The width of the texture */
slouken@5154
    41
    int h;                      /**< The height of the texture */
slouken@5154
    42
    int modMode;                /**< The texture modulation mode */
slouken@5154
    43
    SDL_BlendMode blendMode;    /**< The texture blend mode */
slouken@5154
    44
    Uint8 r, g, b, a;           /**< Texture modulation values */
slouken@5154
    45
slouken@5154
    46
    SDL_Renderer *renderer;
slouken@5154
    47
slouken@5154
    48
    void *driverdata;           /**< Driver specific texture representation */
slouken@5154
    49
slouken@5154
    50
    SDL_Texture *prev;
slouken@5154
    51
    SDL_Texture *next;
slouken@5154
    52
};
slouken@5154
    53
slouken@5154
    54
/* Define the SDL renderer structure */
slouken@5154
    55
struct SDL_Renderer
slouken@5154
    56
{
slouken@5154
    57
    const void *magic;
slouken@5154
    58
slouken@5154
    59
    void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
slouken@5154
    60
    int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    61
    int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    62
                               void **pixels, int *pitch);
slouken@5154
    63
    int (*SetTextureColorMod) (SDL_Renderer * renderer,
slouken@5154
    64
                               SDL_Texture * texture);
slouken@5154
    65
    int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
slouken@5154
    66
                               SDL_Texture * texture);
slouken@5154
    67
    int (*SetTextureBlendMode) (SDL_Renderer * renderer,
slouken@5154
    68
                                SDL_Texture * texture);
slouken@5154
    69
    int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    70
                          const SDL_Rect * rect, const void *pixels,
slouken@5154
    71
                          int pitch);
slouken@5154
    72
    int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    73
                        const SDL_Rect * rect, int markDirty, void **pixels,
slouken@5154
    74
                        int *pitch);
slouken@5154
    75
    void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    76
    void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    77
                          int numrects, const SDL_Rect * rects);
slouken@5154
    78
    int (*RenderClear) (SDL_Renderer * renderer);
slouken@5154
    79
    int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
slouken@5154
    80
                             int count);
slouken@5154
    81
    int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_Point * points,
slouken@5154
    82
                            int count);
slouken@5154
    83
    int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
slouken@5154
    84
                            int count);
slouken@5154
    85
    int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    86
                       const SDL_Rect * srcrect, const SDL_Rect * dstrect);
slouken@5154
    87
    int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
slouken@5154
    88
                             Uint32 format, void * pixels, int pitch);
slouken@5154
    89
    int (*RenderWritePixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
slouken@5154
    90
                              Uint32 format, const void * pixels, int pitch);
slouken@5154
    91
    void (*RenderPresent) (SDL_Renderer * renderer);
slouken@5154
    92
    void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    93
slouken@5154
    94
    void (*DestroyRenderer) (SDL_Renderer * renderer);
slouken@5154
    95
slouken@5154
    96
    /* The current renderer info */
slouken@5154
    97
    SDL_RendererInfo info;
slouken@5154
    98
slouken@5154
    99
    /* The window associated with the renderer */
slouken@5154
   100
    SDL_Window *window;
slouken@5154
   101
slouken@5154
   102
    /* The list of textures */
slouken@5154
   103
    SDL_Texture *textures;
slouken@5154
   104
slouken@5154
   105
    Uint8 r, g, b, a;                   /**< Color for drawing operations values */
slouken@5154
   106
    SDL_BlendMode blendMode;            /**< The drawing blend mode */
slouken@5154
   107
slouken@5154
   108
    void *driverdata;
slouken@5154
   109
};
slouken@5154
   110
slouken@5154
   111
/* Define the SDL render driver structure */
slouken@5154
   112
struct SDL_RenderDriver
slouken@5154
   113
{
slouken@5154
   114
    SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
slouken@5154
   115
slouken@5154
   116
    /* Info about the renderer capabilities */
slouken@5154
   117
    SDL_RendererInfo info;
slouken@5154
   118
};
slouken@5154
   119
slouken@5154
   120
#if SDL_VIDEO_RENDER_D3D
slouken@5154
   121
extern SDL_RenderDriver D3D_RenderDriver;
slouken@5154
   122
#endif
slouken@5154
   123
#if SDL_VIDEO_RENDER_OGL
slouken@5154
   124
extern SDL_RenderDriver GL_RenderDriver;
slouken@5154
   125
#endif
slouken@5154
   126
#if SDL_VIDEO_RENDER_OGL_ES
slouken@5154
   127
extern SDL_RenderDriver GL_ES_RenderDriver;
slouken@5154
   128
#endif
slouken@5154
   129
extern SDL_RenderDriver SW_RenderDriver;
slouken@5154
   130
slouken@5154
   131
#endif /* _SDL_sysrender_h */
slouken@5154
   132
slouken@5154
   133
/* vi: set ts=4 sw=4 expandtab: */