Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
b231d0b9
Commit
b231d0b9
authored
Feb 01, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split the rendering API out into a separate header file.
parent
6539ab9c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
642 additions
and
581 deletions
+642
-581
Makefile.in
Makefile.in
+1
-0
SDL.h
include/SDL.h
+1
-0
SDL_compat.h
include/SDL_compat.h
+0
-1
SDL_render.h
include/SDL_render.h
+639
-0
SDL_video.h
include/SDL_video.h
+0
-580
SDL_sysvideo.h
src/video/SDL_sysvideo.h
+1
-0
No files found.
Makefile.in
View file @
b231d0b9
...
...
@@ -69,6 +69,7 @@ HDRS = \
SDL_power.h
\
SDL_quit.h
\
SDL_rect.h
\
SDL_render.h
\
SDL_revision.h
\
SDL_rwops.h
\
SDL_scancode.h
\
...
...
include/SDL.h
View file @
b231d0b9
...
...
@@ -86,6 +86,7 @@
#include "SDL_loadso.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
...
...
include/SDL_compat.h
View file @
b231d0b9
...
...
@@ -328,7 +328,6 @@ extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
extern
DECLSPEC
void
SDLCALL
SDL_GetKeyRepeat
(
int
*
delay
,
int
*
interval
);
extern
DECLSPEC
int
SDLCALL
SDL_EnableUNICODE
(
int
enable
);
typedef
SDL_Texture
*
SDL_TextureID
;
typedef
SDL_Window
*
SDL_WindowID
;
#define SDL_RenderPoint SDL_RenderDrawPoint
...
...
include/SDL_render.h
0 → 100644
View file @
b231d0b9
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
/**
* \file SDL_render.h
*
* Header file for SDL 2D rendering functions.
*/
#ifndef _SDL_render_h
#define _SDL_render_h
#include "SDL_stdinc.h"
//#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
extern
"C"
{
/* *INDENT-ON* */
#endif
/**
* \brief Flags used when creating a rendering context
*/
typedef
enum
{
SDL_RENDERER_ACCELERATED
=
0x00000001
,
/**< The renderer uses hardware
acceleration */
SDL_RENDERER_PRESENTVSYNC
=
0x00000002
/**< Present is synchronized
with the refresh rate */
}
SDL_RendererFlags
;
/**
* \brief Information on the capabilities of a render driver or context.
*/
typedef
struct
SDL_RendererInfo
{
const
char
*
name
;
/**< The name of the renderer */
Uint32
flags
;
/**< Supported ::SDL_RendererFlags */
Uint32
num_texture_formats
;
/**< The number of available texture formats */
Uint32
texture_formats
[
50
];
/**< The available texture formats */
int
max_texture_width
;
/**< The maximimum texture width */
int
max_texture_height
;
/**< The maximimum texture height */
}
SDL_RendererInfo
;
/**
* \brief The access pattern allowed for a texture.
*/
typedef
enum
{
SDL_TEXTUREACCESS_STATIC
,
/**< Changes rarely, not lockable */
SDL_TEXTUREACCESS_STREAMING
/**< Changes frequently, lockable */
}
SDL_TextureAccess
;
/**
* \brief The texture channel modulation used in SDL_RenderCopy().
*/
typedef
enum
{
SDL_TEXTUREMODULATE_NONE
=
0x00000000
,
/**< No modulation */
SDL_TEXTUREMODULATE_COLOR
=
0x00000001
,
/**< srcC = srcC * color */
SDL_TEXTUREMODULATE_ALPHA
=
0x00000002
/**< srcA = srcA * alpha */
}
SDL_TextureModulate
;
/**
* \brief An efficient driver-specific representation of pixel data
*/
struct
SDL_Texture
;
typedef
struct
SDL_Texture
SDL_Texture
;
/* Function prototypes */
/**
* \brief Get the number of 2D rendering drivers available for the current
* display.
*
* A render driver is a set of code that handles rendering and texture
* management on a particular display. Normally there is only one, but
* some drivers may have several available with different capabilities.
*
* \sa SDL_GetRenderDriverInfo()
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetNumRenderDrivers
(
void
);
/**
* \brief Get information about a specific 2D rendering driver for the current
* display.
*
* \param index The index of the driver to query information about.
* \param info A pointer to an SDL_RendererInfo struct to be filled with
* information on the rendering driver.
*
* \return 0 on success, -1 if the index was out of range.
*
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRenderDriverInfo
(
int
index
,
SDL_RendererInfo
*
info
);
/**
* \brief Create and make active a 2D rendering context for a window.
*
* \param window The window where rendering is displayed.
* \param index The index of the rendering driver to initialize, or -1 to
* initialize the first one supporting the requested flags.
* \param flags ::SDL_RendererFlags.
*
* \return 0 on success, -1 if there was an error creating the renderer.
*
* \sa SDL_SelectRenderer()
* \sa SDL_GetRendererInfo()
* \sa SDL_DestroyRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_CreateRenderer
(
SDL_Window
*
window
,
int
index
,
Uint32
flags
);
/**
* \brief Select the rendering context for a particular window.
*
* \return 0 on success, -1 if the selected window doesn't have a
* rendering context.
*/
extern
DECLSPEC
int
SDLCALL
SDL_SelectRenderer
(
SDL_Window
*
window
);
/**
* \brief Get information about the current rendering context.
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRendererInfo
(
SDL_RendererInfo
*
info
);
/**
* \brief Create a texture for the current rendering context.
*
* \param format The format of the texture.
* \param access One of the enumerated values in ::SDL_TextureAccess.
* \param w The width of the texture in pixels.
* \param h The height of the texture in pixels.
*
* \return The created texture is returned, or 0 if no rendering context was
* active, the format was unsupported, or the width or height were out
* of range.
*
* \sa SDL_QueryTexture()
* \sa SDL_DestroyTexture()
*/
extern
DECLSPEC
SDL_Texture
*
SDLCALL
SDL_CreateTexture
(
Uint32
format
,
int
access
,
int
w
,
int
h
);
/**
* \brief Create a texture from an existing surface.
*
* \param format The format of the texture, or 0 to pick an appropriate format.
* \param surface The surface containing pixel data used to fill the texture.
*
* \return The created texture is returned, or 0 if no rendering context was
* active, the format was unsupported, or the surface width or height
* were out of range.
*
* \note The surface is not modified or freed by this function.
*
* \sa SDL_QueryTexture()
* \sa SDL_DestroyTexture()
*/
extern
DECLSPEC
SDL_Texture
*
SDLCALL
SDL_CreateTextureFromSurface
(
Uint32
format
,
SDL_Surface
*
surface
);
/**
* \brief Query the attributes of a texture
*
* \param texture A texture to be queried.
* \param format A pointer filled in with the raw format of the texture. The
* actual format may differ, but pixel transfers will use this
* format.
* \param access A pointer filled in with the actual access to the texture.
* \param w A pointer filled in with the width of the texture in pixels.
* \param h A pointer filled in with the height of the texture in pixels.
*
* \return 0 on success, or -1 if the texture is not valid.
*/
extern
DECLSPEC
int
SDLCALL
SDL_QueryTexture
(
SDL_Texture
*
texture
,
Uint32
*
format
,
int
*
access
,
int
*
w
,
int
*
h
);
/**
* \brief Query the pixels of a texture, if the texture does not need to be
* locked for pixel access.
*
* \param texture A texture to be queried, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param pixels A pointer filled with a pointer to the pixels for the
* texture.
* \param pitch A pointer filled in with the pitch of the pixel data.
*
* \return 0 on success, or -1 if the texture is not valid, or must be locked
* for pixel access.
*/
extern
DECLSPEC
int
SDLCALL
SDL_QueryTexturePixels
(
SDL_Texture
*
texture
,
void
**
pixels
,
int
*
pitch
);
/**
* \brief Set the color palette of an indexed texture.
*
* \param texture The texture to update.
* \param colors The array of RGB color data.
* \param firstcolor The first index to update.
* \param ncolors The number of palette entries to fill with the color data.
*
* \return 0 on success, or -1 if the texture is not valid or not an indexed
* texture.
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTexturePalette
(
SDL_Texture
*
texture
,
const
SDL_Color
*
colors
,
int
firstcolor
,
int
ncolors
);
/**
* \brief Get the color palette from an indexed texture if it has one.
*
* \param texture The texture to update.
* \param colors The array to fill with RGB color data.
* \param firstcolor The first index to retrieve.
* \param ncolors The number of palette entries to retrieve.
*
* \return 0 on success, or -1 if the texture is not valid or not an indexed
* texture.
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTexturePalette
(
SDL_Texture
*
texture
,
SDL_Color
*
colors
,
int
firstcolor
,
int
ncolors
);
/**
* \brief Set an additional color value used in render copy operations.
*
* \param texture The texture to update.
* \param r The red color value multiplied into copy operations.
* \param g The green color value multiplied into copy operations.
* \param b The blue color value multiplied into copy operations.
*
* \return 0 on success, or -1 if the texture is not valid or color modulation
* is not supported.
*
* \sa SDL_GetTextureColorMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureColorMod
(
SDL_Texture
*
texture
,
Uint8
r
,
Uint8
g
,
Uint8
b
);
/**
* \brief Get the additional color value used in render copy operations.
*
* \param texture The texture to query.
* \param r A pointer filled in with the current red color value.
* \param g A pointer filled in with the current green color value.
* \param b A pointer filled in with the current blue color value.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureColorMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureColorMod
(
SDL_Texture
*
texture
,
Uint8
*
r
,
Uint8
*
g
,
Uint8
*
b
);
/**
* \brief Set an additional alpha value used in render copy operations.
*
* \param texture The texture to update.
* \param alpha The alpha value multiplied into copy operations.
*
* \return 0 on success, or -1 if the texture is not valid or alpha modulation
* is not supported.
*
* \sa SDL_GetTextureAlphaMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureAlphaMod
(
SDL_Texture
*
texture
,
Uint8
alpha
);
/**
* \brief Get the additional alpha value used in render copy operations.
*
* \param texture The texture to query.
* \param alpha A pointer filled in with the current alpha value.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureAlphaMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureAlphaMod
(
SDL_Texture
*
texture
,
Uint8
*
alpha
);
/**
* \brief Set the blend mode used for texture copy operations.
*
* \param texture The texture to update.
* \param blendMode ::SDL_BlendMode to use for texture blending.
*
* \return 0 on success, or -1 if the texture is not valid or the blend mode is
* not supported.
*
* \note If the blend mode is not supported, the closest supported mode is
* chosen.
*
* \sa SDL_GetTextureBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureBlendMode
(
SDL_Texture
*
texture
,
SDL_BlendMode
blendMode
);
/**
* \brief Get the blend mode used for texture copy operations.
*
* \param texture The texture to query.
* \param blendMode A pointer filled in with the current blend mode.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureBlendMode
(
SDL_Texture
*
texture
,
SDL_BlendMode
*
blendMode
);
/**
* \brief Update the given texture rectangle with new pixel data.
*
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
* \param pixels The raw pixel data.
* \param pitch The number of bytes between rows of pixel data.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \note This is a fairly slow function.
*/
extern
DECLSPEC
int
SDLCALL
SDL_UpdateTexture
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
rect
,
const
void
*
pixels
,
int
pitch
);
/**
* \brief Lock a portion of the texture for pixel access.
*
* \param texture The texture to lock for access, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param rect A pointer to the rectangle to lock for access. If the rect
* is NULL, the entire texture will be locked.
* \param markDirty If this is nonzero, the locked area will be marked dirty
* when the texture is unlocked.
* \param pixels This is filled in with a pointer to the locked pixels,
* appropriately offset by the locked area.
* \param pitch This is filled in with the pitch of the locked pixels.
*
* \return 0 on success, or -1 if the texture is not valid or was created with
* ::SDL_TEXTUREACCESS_STATIC.
*
* \sa SDL_DirtyTexture()
* \sa SDL_UnlockTexture()
*/
extern
DECLSPEC
int
SDLCALL
SDL_LockTexture
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
rect
,
int
markDirty
,
void
**
pixels
,
int
*
pitch
);
/**
* \brief Unlock a texture, uploading the changes to renderer memory, if needed.
*
* \sa SDL_LockTexture()
* \sa SDL_DirtyTexture()
*/
extern
DECLSPEC
void
SDLCALL
SDL_UnlockTexture
(
SDL_Texture
*
texture
);
/**
* \brief Mark the specified rectangles of the texture as dirty.
*
* \param texture The texture to mark dirty, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param numrects The number of rectangles pointed to by rects.
* \param rects The pointer to an array of dirty rectangles.
*
* \sa SDL_LockTexture()
* \sa SDL_UnlockTexture()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DirtyTexture
(
SDL_Texture
*
texture
,
int
numrects
,
const
SDL_Rect
*
rects
);
/**
* \brief Set the color used for drawing operations (Fill and Line).
*
* \param r The red value used to draw on the rendering target.
* \param g The green value used to draw on the rendering target.
* \param b The blue value used to draw on the rendering target.
* \param a The alpha value used to draw on the rendering target, usually
* ::SDL_ALPHA_OPAQUE (255).
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDL_SetRenderDrawColor
(
Uint8
r
,
Uint8
g
,
Uint8
b
,
Uint8
a
);
/**
* \brief Get the color used for drawing operations (Fill and Line).
*
* \param r A pointer to the red value used to draw on the rendering target.
* \param g A pointer to the green value used to draw on the rendering target.
* \param b A pointer to the blue value used to draw on the rendering target.
* \param a A pointer to the alpha value used to draw on the rendering target,
* usually ::SDL_ALPHA_OPAQUE (255).
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDL_GetRenderDrawColor
(
Uint8
*
r
,
Uint8
*
g
,
Uint8
*
b
,
Uint8
*
a
);
/**
* \brief Set the blend mode used for drawing operations (Fill and Line).
*
* \param blendMode ::SDL_BlendMode to use for blending.
*
* \return 0 on success, or -1 if there is no rendering context current.
*
* \note If the blend mode is not supported, the closest supported mode is
* chosen.
*
* \sa SDL_GetRenderDrawBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetRenderDrawBlendMode
(
SDL_BlendMode
blendMode
);
/**
* \brief Get the blend mode used for drawing operations.
*
* \param blendMode A pointer filled in with the current blend mode.
*
* \return 0 on success, or -1 if there is no rendering context current.
*
* \sa SDL_SetRenderDrawBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRenderDrawBlendMode
(
SDL_BlendMode
*
blendMode
);
/**
* \brief Clear the current rendering target with the drawing color
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderClear
(
void
);
/**
* \brief Draw a point on the current rendering target.
*
* \param x The x coordinate of the point.
* \param y The y coordinate of the point.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawPoint
(
int
x
,
int
y
);
/**
* \brief Draw multiple points on the current rendering target.
*
* \param points The points to draw
* \param count The number of points to draw
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawPoints
(
const
SDL_Point
*
points
,
int
count
);
/**
* \brief Draw a line on the current rendering target.
*
* \param x1 The x coordinate of the start point.
* \param y1 The y coordinate of the start point.
* \param x2 The x coordinate of the end point.
* \param y2 The y coordinate of the end point.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawLine
(
int
x1
,
int
y1
,
int
x2
,
int
y2
);
/**
* \brief Draw a series of connected lines on the current rendering target.
*
* \param points The points along the lines
* \param count The number of points, drawing count-1 lines
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawLines
(
const
SDL_Point
*
points
,
int
count
);
/**
* \brief Draw a rectangle on the current rendering target.
*
* \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawRect
(
const
SDL_Rect
*
rect
);
/**
* \brief Draw some number of rectangles on the current rendering target.
*
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawRects
(
const
SDL_Rect
**
rects
,
int
count
);
/**
* \brief Fill a rectangle on the current rendering target with the drawing color.
*
* \param rect A pointer to the destination rectangle, or NULL for the entire
* rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderFillRect
(
const
SDL_Rect
*
rect
);
/**
* \brief Fill some number of rectangles on the current rendering target with the drawing color.
*
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderFillRects
(
const
SDL_Rect
**
rect
,
int
count
);
/**
* \brief Copy a portion of the texture to the current rendering target.
*
* \param texture The source texture.
* \param srcrect A pointer to the source rectangle, or NULL for the entire
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current, or the
* driver doesn't support the requested operation.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderCopy
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
srcrect
,
const
SDL_Rect
*
dstrect
);
/**
* \brief Read pixels from the current rendering target.
*
* \param rect A pointer to the rectangle to read, or NULL for the entire
* render target.
* \param format The desired format of the pixel data, or 0 to use the format
* of the rendering target
* \param pixels A pointer to be filled in with the pixel data
* \param pitch The pitch of the pixels parameter.
*
* \return 0 on success, or -1 if pixel reading is not supported.
*
* \warning This is a very slow operation, and should not be used frequently.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderReadPixels
(
const
SDL_Rect
*
rect
,
Uint32
format
,
void
*
pixels
,
int
pitch
);
/**
* \brief Write pixels to the current rendering target.
*
* \param rect A pointer to the rectangle to write, or NULL for the entire
* render target.
* \param format The format of the pixel data, or 0 to use the format
* of the rendering target
* \param pixels A pointer to the pixel data to write.
* \param pitch The pitch of the pixels parameter.
*
* \return 0 on success, or -1 if pixel writing is not supported.
*
* \warning This is a very slow operation, and should not be used frequently.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderWritePixels
(
const
SDL_Rect
*
rect
,
Uint32
format
,
const
void
*
pixels
,
int
pitch
);
/**
* \brief Update the screen with rendering performed.
*/
extern
DECLSPEC
void
SDLCALL
SDL_RenderPresent
(
void
);
/**
* \brief Destroy the specified texture.
*
* \sa SDL_CreateTexture()
* \sa SDL_CreateTextureFromSurface()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DestroyTexture
(
SDL_Texture
*
texture
);
/**
* \brief Destroy the rendering context for a window and free associated
* textures.
*
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DestroyRenderer
(
SDL_Window
*
window
);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif
/* _SDL_render_h */
/* vi: set ts=4 sw=4 expandtab: */
include/SDL_video.h
View file @
b231d0b9
...
...
@@ -32,7 +32,6 @@
#include "SDL_stdinc.h"
#include "SDL_pixels.h"
#include "SDL_rect.h"
#include "SDL_blendmode.h"
#include "SDL_surface.h"
#include "begin_code.h"
...
...
@@ -146,55 +145,6 @@ typedef enum
window be closed */
}
SDL_WindowEventID
;
/**
* \brief Flags used when creating a rendering context
*/
typedef
enum
{
SDL_RENDERER_ACCELERATED
=
0x00000001
,
/**< The renderer uses hardware
acceleration */
SDL_RENDERER_PRESENTVSYNC
=
0x00000002
/**< Present is synchronized
with the refresh rate */
}
SDL_RendererFlags
;
/**
* \brief Information on the capabilities of a render driver or context.
*/
typedef
struct
SDL_RendererInfo
{
const
char
*
name
;
/**< The name of the renderer */
Uint32
flags
;
/**< Supported ::SDL_RendererFlags */
Uint32
num_texture_formats
;
/**< The number of available texture formats */
Uint32
texture_formats
[
50
];
/**< The available texture formats */
int
max_texture_width
;
/**< The maximimum texture width */
int
max_texture_height
;
/**< The maximimum texture height */
}
SDL_RendererInfo
;
/**
* \brief The access pattern allowed for a texture.
*/
typedef
enum
{
SDL_TEXTUREACCESS_STATIC
,
/**< Changes rarely, not lockable */
SDL_TEXTUREACCESS_STREAMING
/**< Changes frequently, lockable */
}
SDL_TextureAccess
;
/**
* \brief The texture channel modulation used in SDL_RenderCopy().
*/
typedef
enum
{
SDL_TEXTUREMODULATE_NONE
=
0x00000000
,
/**< No modulation */
SDL_TEXTUREMODULATE_COLOR
=
0x00000001
,
/**< srcC = srcC * color */
SDL_TEXTUREMODULATE_ALPHA
=
0x00000002
/**< srcA = srcA * alpha */
}
SDL_TextureModulate
;
/**
* \brief An efficient driver-specific representation of pixel data
*/
struct
SDL_Texture
;
typedef
struct
SDL_Texture
SDL_Texture
;
/**
* \brief An opaque handle to an OpenGL context.
*/
...
...
@@ -690,536 +640,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
*/
extern
DECLSPEC
void
SDLCALL
SDL_DestroyWindow
(
SDL_Window
*
window
);
/**
* \brief Get the number of 2D rendering drivers available for the current
* display.
*
* A render driver is a set of code that handles rendering and texture
* management on a particular display. Normally there is only one, but
* some drivers may have several available with different capabilities.
*
* \sa SDL_GetRenderDriverInfo()
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetNumRenderDrivers
(
void
);
/**
* \brief Get information about a specific 2D rendering driver for the current
* display.
*
* \param index The index of the driver to query information about.
* \param info A pointer to an SDL_RendererInfo struct to be filled with
* information on the rendering driver.
*
* \return 0 on success, -1 if the index was out of range.
*
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRenderDriverInfo
(
int
index
,
SDL_RendererInfo
*
info
);
/**
* \brief Create and make active a 2D rendering context for a window.
*
* \param window The window where rendering is displayed.
* \param index The index of the rendering driver to initialize, or -1 to
* initialize the first one supporting the requested flags.
* \param flags ::SDL_RendererFlags.
*
* \return 0 on success, -1 if there was an error creating the renderer.
*
* \sa SDL_SelectRenderer()
* \sa SDL_GetRendererInfo()
* \sa SDL_DestroyRenderer()
*/
extern
DECLSPEC
int
SDLCALL
SDL_CreateRenderer
(
SDL_Window
*
window
,
int
index
,
Uint32
flags
);
/**
* \brief Select the rendering context for a particular window.
*
* \return 0 on success, -1 if the selected window doesn't have a
* rendering context.
*/
extern
DECLSPEC
int
SDLCALL
SDL_SelectRenderer
(
SDL_Window
*
window
);
/**
* \brief Get information about the current rendering context.
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRendererInfo
(
SDL_RendererInfo
*
info
);
/**
* \brief Create a texture for the current rendering context.
*
* \param format The format of the texture.
* \param access One of the enumerated values in ::SDL_TextureAccess.
* \param w The width of the texture in pixels.
* \param h The height of the texture in pixels.
*
* \return The created texture is returned, or 0 if no rendering context was
* active, the format was unsupported, or the width or height were out
* of range.
*
* \sa SDL_QueryTexture()
* \sa SDL_DestroyTexture()
*/
extern
DECLSPEC
SDL_Texture
*
SDLCALL
SDL_CreateTexture
(
Uint32
format
,
int
access
,
int
w
,
int
h
);
/**
* \brief Create a texture from an existing surface.
*
* \param format The format of the texture, or 0 to pick an appropriate format.
* \param surface The surface containing pixel data used to fill the texture.
*
* \return The created texture is returned, or 0 if no rendering context was
* active, the format was unsupported, or the surface width or height
* were out of range.
*
* \note The surface is not modified or freed by this function.
*
* \sa SDL_QueryTexture()
* \sa SDL_DestroyTexture()
*/
extern
DECLSPEC
SDL_Texture
*
SDLCALL
SDL_CreateTextureFromSurface
(
Uint32
format
,
SDL_Surface
*
surface
);
/**
* \brief Query the attributes of a texture
*
* \param texture A texture to be queried.
* \param format A pointer filled in with the raw format of the texture. The
* actual format may differ, but pixel transfers will use this
* format.
* \param access A pointer filled in with the actual access to the texture.
* \param w A pointer filled in with the width of the texture in pixels.
* \param h A pointer filled in with the height of the texture in pixels.
*
* \return 0 on success, or -1 if the texture is not valid.
*/
extern
DECLSPEC
int
SDLCALL
SDL_QueryTexture
(
SDL_Texture
*
texture
,
Uint32
*
format
,
int
*
access
,
int
*
w
,
int
*
h
);
/**
* \brief Query the pixels of a texture, if the texture does not need to be
* locked for pixel access.
*
* \param texture A texture to be queried, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param pixels A pointer filled with a pointer to the pixels for the
* texture.
* \param pitch A pointer filled in with the pitch of the pixel data.
*
* \return 0 on success, or -1 if the texture is not valid, or must be locked
* for pixel access.
*/
extern
DECLSPEC
int
SDLCALL
SDL_QueryTexturePixels
(
SDL_Texture
*
texture
,
void
**
pixels
,
int
*
pitch
);
/**
* \brief Set the color palette of an indexed texture.
*
* \param texture The texture to update.
* \param colors The array of RGB color data.
* \param firstcolor The first index to update.
* \param ncolors The number of palette entries to fill with the color data.
*
* \return 0 on success, or -1 if the texture is not valid or not an indexed
* texture.
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTexturePalette
(
SDL_Texture
*
texture
,
const
SDL_Color
*
colors
,
int
firstcolor
,
int
ncolors
);
/**
* \brief Get the color palette from an indexed texture if it has one.
*
* \param texture The texture to update.
* \param colors The array to fill with RGB color data.
* \param firstcolor The first index to retrieve.
* \param ncolors The number of palette entries to retrieve.
*
* \return 0 on success, or -1 if the texture is not valid or not an indexed
* texture.
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTexturePalette
(
SDL_Texture
*
texture
,
SDL_Color
*
colors
,
int
firstcolor
,
int
ncolors
);
/**
* \brief Set an additional color value used in render copy operations.
*
* \param texture The texture to update.
* \param r The red color value multiplied into copy operations.
* \param g The green color value multiplied into copy operations.
* \param b The blue color value multiplied into copy operations.
*
* \return 0 on success, or -1 if the texture is not valid or color modulation
* is not supported.
*
* \sa SDL_GetTextureColorMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureColorMod
(
SDL_Texture
*
texture
,
Uint8
r
,
Uint8
g
,
Uint8
b
);
/**
* \brief Get the additional color value used in render copy operations.
*
* \param texture The texture to query.
* \param r A pointer filled in with the current red color value.
* \param g A pointer filled in with the current green color value.
* \param b A pointer filled in with the current blue color value.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureColorMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureColorMod
(
SDL_Texture
*
texture
,
Uint8
*
r
,
Uint8
*
g
,
Uint8
*
b
);
/**
* \brief Set an additional alpha value used in render copy operations.
*
* \param texture The texture to update.
* \param alpha The alpha value multiplied into copy operations.
*
* \return 0 on success, or -1 if the texture is not valid or alpha modulation
* is not supported.
*
* \sa SDL_GetTextureAlphaMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureAlphaMod
(
SDL_Texture
*
texture
,
Uint8
alpha
);
/**
* \brief Get the additional alpha value used in render copy operations.
*
* \param texture The texture to query.
* \param alpha A pointer filled in with the current alpha value.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureAlphaMod()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureAlphaMod
(
SDL_Texture
*
texture
,
Uint8
*
alpha
);
/**
* \brief Set the blend mode used for texture copy operations.
*
* \param texture The texture to update.
* \param blendMode ::SDL_BlendMode to use for texture blending.
*
* \return 0 on success, or -1 if the texture is not valid or the blend mode is
* not supported.
*
* \note If the blend mode is not supported, the closest supported mode is
* chosen.
*
* \sa SDL_GetTextureBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetTextureBlendMode
(
SDL_Texture
*
texture
,
SDL_BlendMode
blendMode
);
/**
* \brief Get the blend mode used for texture copy operations.
*
* \param texture The texture to query.
* \param blendMode A pointer filled in with the current blend mode.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \sa SDL_SetTextureBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetTextureBlendMode
(
SDL_Texture
*
texture
,
SDL_BlendMode
*
blendMode
);
/**
* \brief Update the given texture rectangle with new pixel data.
*
* \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture.
* \param pixels The raw pixel data.
* \param pitch The number of bytes between rows of pixel data.
*
* \return 0 on success, or -1 if the texture is not valid.
*
* \note This is a fairly slow function.
*/
extern
DECLSPEC
int
SDLCALL
SDL_UpdateTexture
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
rect
,
const
void
*
pixels
,
int
pitch
);
/**
* \brief Lock a portion of the texture for pixel access.
*
* \param texture The texture to lock for access, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param rect A pointer to the rectangle to lock for access. If the rect
* is NULL, the entire texture will be locked.
* \param markDirty If this is nonzero, the locked area will be marked dirty
* when the texture is unlocked.
* \param pixels This is filled in with a pointer to the locked pixels,
* appropriately offset by the locked area.
* \param pitch This is filled in with the pitch of the locked pixels.
*
* \return 0 on success, or -1 if the texture is not valid or was created with
* ::SDL_TEXTUREACCESS_STATIC.
*
* \sa SDL_DirtyTexture()
* \sa SDL_UnlockTexture()
*/
extern
DECLSPEC
int
SDLCALL
SDL_LockTexture
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
rect
,
int
markDirty
,
void
**
pixels
,
int
*
pitch
);
/**
* \brief Unlock a texture, uploading the changes to video memory, if needed.
*
* \sa SDL_LockTexture()
* \sa SDL_DirtyTexture()
*/
extern
DECLSPEC
void
SDLCALL
SDL_UnlockTexture
(
SDL_Texture
*
texture
);
/**
* \brief Mark the specified rectangles of the texture as dirty.
*
* \param texture The texture to mark dirty, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param numrects The number of rectangles pointed to by rects.
* \param rects The pointer to an array of dirty rectangles.
*
* \sa SDL_LockTexture()
* \sa SDL_UnlockTexture()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DirtyTexture
(
SDL_Texture
*
texture
,
int
numrects
,
const
SDL_Rect
*
rects
);
/**
* \brief Set the color used for drawing operations (Fill and Line).
*
* \param r The red value used to draw on the rendering target.
* \param g The green value used to draw on the rendering target.
* \param b The blue value used to draw on the rendering target.
* \param a The alpha value used to draw on the rendering target, usually
* ::SDL_ALPHA_OPAQUE (255).
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDL_SetRenderDrawColor
(
Uint8
r
,
Uint8
g
,
Uint8
b
,
Uint8
a
);
/**
* \brief Get the color used for drawing operations (Fill and Line).
*
* \param r A pointer to the red value used to draw on the rendering target.
* \param g A pointer to the green value used to draw on the rendering target.
* \param b A pointer to the blue value used to draw on the rendering target.
* \param a A pointer to the alpha value used to draw on the rendering target,
* usually ::SDL_ALPHA_OPAQUE (255).
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDL_GetRenderDrawColor
(
Uint8
*
r
,
Uint8
*
g
,
Uint8
*
b
,
Uint8
*
a
);
/**
* \brief Set the blend mode used for drawing operations (Fill and Line).
*
* \param blendMode ::SDL_BlendMode to use for blending.
*
* \return 0 on success, or -1 if there is no rendering context current.
*
* \note If the blend mode is not supported, the closest supported mode is
* chosen.
*
* \sa SDL_GetRenderDrawBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_SetRenderDrawBlendMode
(
SDL_BlendMode
blendMode
);
/**
* \brief Get the blend mode used for drawing operations.
*
* \param blendMode A pointer filled in with the current blend mode.
*
* \return 0 on success, or -1 if there is no rendering context current.
*
* \sa SDL_SetRenderDrawBlendMode()
*/
extern
DECLSPEC
int
SDLCALL
SDL_GetRenderDrawBlendMode
(
SDL_BlendMode
*
blendMode
);
/**
* \brief Clear the current rendering target with the drawing color
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderClear
(
void
);
/**
* \brief Draw a point on the current rendering target.
*
* \param x The x coordinate of the point.
* \param y The y coordinate of the point.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawPoint
(
int
x
,
int
y
);
/**
* \brief Draw multiple points on the current rendering target.
*
* \param points The points to draw
* \param count The number of points to draw
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawPoints
(
const
SDL_Point
*
points
,
int
count
);
/**
* \brief Draw a line on the current rendering target.
*
* \param x1 The x coordinate of the start point.
* \param y1 The y coordinate of the start point.
* \param x2 The x coordinate of the end point.
* \param y2 The y coordinate of the end point.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawLine
(
int
x1
,
int
y1
,
int
x2
,
int
y2
);
/**
* \brief Draw a series of connected lines on the current rendering target.
*
* \param points The points along the lines
* \param count The number of points, drawing count-1 lines
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawLines
(
const
SDL_Point
*
points
,
int
count
);
/**
* \brief Draw a rectangle on the current rendering target.
*
* \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawRect
(
const
SDL_Rect
*
rect
);
/**
* \brief Draw some number of rectangles on the current rendering target.
*
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderDrawRects
(
const
SDL_Rect
**
rects
,
int
count
);
/**
* \brief Fill a rectangle on the current rendering target with the drawing color.
*
* \param rect A pointer to the destination rectangle, or NULL for the entire
* rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderFillRect
(
const
SDL_Rect
*
rect
);
/**
* \brief Fill some number of rectangles on the current rendering target with the drawing color.
*
* \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles.
*
* \return 0 on success, or -1 if there is no rendering context current.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderFillRects
(
const
SDL_Rect
**
rect
,
int
count
);
/**
* \brief Copy a portion of the texture to the current rendering target.
*
* \param texture The source texture.
* \param srcrect A pointer to the source rectangle, or NULL for the entire
* texture.
* \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target.
*
* \return 0 on success, or -1 if there is no rendering context current, or the
* driver doesn't support the requested operation.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderCopy
(
SDL_Texture
*
texture
,
const
SDL_Rect
*
srcrect
,
const
SDL_Rect
*
dstrect
);
/**
* \brief Read pixels from the current rendering target.
*
* \param rect A pointer to the rectangle to read, or NULL for the entire
* render target.
* \param format The desired format of the pixel data, or 0 to use the format
* of the rendering target
* \param pixels A pointer to be filled in with the pixel data
* \param pitch The pitch of the pixels parameter.
*
* \return 0 on success, or -1 if pixel reading is not supported.
*
* \warning This is a very slow operation, and should not be used frequently.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderReadPixels
(
const
SDL_Rect
*
rect
,
Uint32
format
,
void
*
pixels
,
int
pitch
);
/**
* \brief Write pixels to the current rendering target.
*
* \param rect A pointer to the rectangle to write, or NULL for the entire
* render target.
* \param format The format of the pixel data, or 0 to use the format
* of the rendering target
* \param pixels A pointer to the pixel data to write.
* \param pitch The pitch of the pixels parameter.
*
* \return 0 on success, or -1 if pixel writing is not supported.
*
* \warning This is a very slow operation, and should not be used frequently.
*/
extern
DECLSPEC
int
SDLCALL
SDL_RenderWritePixels
(
const
SDL_Rect
*
rect
,
Uint32
format
,
const
void
*
pixels
,
int
pitch
);
/**
* \brief Update the screen with rendering performed.
*/
extern
DECLSPEC
void
SDLCALL
SDL_RenderPresent
(
void
);
/**
* \brief Destroy the specified texture.
*
* \sa SDL_CreateTexture()
* \sa SDL_CreateTextureFromSurface()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DestroyTexture
(
SDL_Texture
*
texture
);
/**
* \brief Destroy the rendering context for a window and free associated
* textures.
*
* \sa SDL_CreateRenderer()
*/
extern
DECLSPEC
void
SDLCALL
SDL_DestroyRenderer
(
SDL_Window
*
window
);
/**
* \brief Returns whether the screensaver is currently enabled (default on).
...
...
src/video/SDL_sysvideo.h
View file @
b231d0b9
...
...
@@ -26,6 +26,7 @@
#include "SDL_mouse.h"
#include "SDL_keysym.h"
#include "SDL_render.h"
#include "SDL_shape.h"
/* The SDL video driver */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment