|
Cavestory Mod API
|
An editable texture API. More...
#include <VideoTexture.h>
Public Member Functions | |
| VideoTexture () | |
| Default constructor. | |
| ~VideoTexture () | |
| Default deconstructor. | |
| void | SetTextureSize (int iWidth, int iHeight) |
| Resize this video texture. More... | |
| void | RecreateTexture () |
| Recreate this texture. More... | |
| void | SetClipRect (GUI_RECT *pRect, bool bAbsoluteRect=false) |
| Set the clip rect for this texture. More... | |
| void | ClearClipRects () |
| Clear the clip rect list. | |
| GUI_RECT | GetClipRect () |
| Get the current clip rect. More... | |
| GUI_RECT | GetNonScaledClipRect () |
| Get the current clip rect (not scaled to local magnification level). More... | |
| void | SetDrawColor (unsigned char iRed, unsigned char iGreen, unsigned char iBlue, unsigned char iAlpha) |
| Set the drawing color. More... | |
| void | SetDrawColor (unsigned long iColor) |
| Set the drawing color. More... | |
| void | Lock () |
| Lock this texture for editing. | |
| void | Unlock () |
| Unlock this texture. | |
| void | ClearTexture (GUI_RECT *pRect=NULL) |
| Clear this texture. More... | |
| void | ClearPixels (GUI_POINT *pPointList, unsigned int iPointCount) |
| Clear multiple pixels. More... | |
| void | DrawPixel (GUI_POINT pPoint, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw a pixel. More... | |
| void | DrawPixels (GUI_POINT *pPointList, unsigned int iPointCount, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw multiple pixels. More... | |
| void | DrawMagnifiedPixels (GUI_POINT *pPointList, unsigned int iPointCount, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw multiple pre-magnified pixels. More... | |
| void | DrawStretchedBitmap (GUI_RECT *pRect, GUI_RECT *pSourceRect, Surface_Ids iSurfaceId, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bAbsloutePos=false) |
| Draw a stretched bitmap. More... | |
| void | DrawColoredBitmap (GUI_POINT pPoint, GUI_RECT *pSourceRect, Surface_Ids iSurfaceId, unsigned long iColor, bool bAbsolutePos=false) |
| Draw a colored bitmap. More... | |
| void | DrawBitmap (GUI_POINT pPoint, GUI_RECT *pSourceRect, Surface_Ids iSurfaceId, bool bAbsolutePos=false) |
| Draw a bitmap. More... | |
| void | DrawBitmapBox (GUI_RECT *out_rect, GUI_RECT *bmp_rects, CacheSurface::BitmapBoxType type, Surface_Ids bmp_id, int iAlpha=255) |
| Draw a bitmap box. More... | |
| void | DrawStripedRect (GUI_RECT *pRect, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw a striped rectangle to this texture. More... | |
| void | DrawRect (GUI_RECT *pRect, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bAbsolutePos=false) |
| Draw a rectangle to this texture. More... | |
| void | DrawFilledRect (GUI_RECT *pRect, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bAbsolutePos=false) |
| Draw a filled rectangle to this texture. More... | |
| void | DrawStripedLine (GUI_POINT pStart, GUI_POINT pEnd, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw a striped line. More... | |
| void | DrawLine (GUI_POINT pStart, GUI_POINT pEnd, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bAbsolutePos=false) |
| Draw a line. More... | |
| void | DrawMagnifiedLine (GUI_POINT pStart, GUI_POINT pEnd, unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw a pre-magnified line. More... | |
| void | DrawText (GUI_POINT pPoint, FontObject *pFont, const char *pText, int iTextLen=-1, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bWrap=false, int iShadowSize=0, unsigned long iShadowColor=0) |
| Draw text on this texture. More... | |
| void | DrawMagnifiedText (GUI_POINT pPoint, FontObject *pFont, const char *pText, int iTextLen=-1, unsigned long iColor=INVALID_TEXTURE_COLOR, bool bWrap=false, int iShadowSize=0, unsigned long iShadowColor=0) |
| Draw pre-magnified text on this texture. More... | |
| void | DrawRects (unsigned long iColor=INVALID_TEXTURE_COLOR) |
| Draw multiple rectangles to this texture. More... | |
| void | ClearTempRectList () |
| Reset the temporary rectangle list. | |
| void | AddTempRect (GUI_RECT pRect) |
| Add a temporary rect to the rect list. More... | |
| void | PutAlpha (int iX, int iY, int iAlpha) |
| Draw this texture onto the screen with an alpha value. More... | |
| void | PutSubPixel (int iX, int iY, int iAlpha) |
| Draw this texture onto the screen at a subpixel coordinate. More... | |
| void | Put (int iX, int iY) |
| Draw this texture onto the screen. More... | |
| void | PutStretchedAlpha (int iDstX, int iDstY, int iDstW, int iDstH, int iSrcX, int iSrcY, int iSrcW, int iSrcH, int iAlpha) |
| Draw this texture onto the screen. More... | |
| void | PutStretchedSubPixel (int iDstX, int iDstY, int iDstW, int iDstH, int iSrcX, int iSrcY, int iSrcW, int iSrcH, int iAlpha) |
| Draw this texture onto the screen. More... | |
| void | PutStretched (int iDstX, int iDstY, int iDstW, int iDstH, int iSrcX, int iSrcY, int iSrcW, int iSrcH) |
| Draw this texture onto the screen. More... | |
Static Public Member Functions | |
| static VideoTexture * | CreateTexture (int iWidth, int iHeight, int iBitsPerPixel=32, ExternalWindow *pWindow=NULL, int iMagnification=-1, bool bNoTexture=false) |
| Create a texture. More... | |
| static VideoTexture * | CreateTexture (const char *pFileName, ExternalWindow *pWindow=NULL, int iMagnification=-1) |
| Create a texture with an image. More... | |
| static bool | FreeTexture (VideoTexture *pTexture) |
| Free a texture. More... | |
| static void | ReloadRenderer (int iMagnification) |
| Reload the main renderer's texture. More... | |
Public Attributes | |
| VideoTexture * | prev |
| VideoTexture * | next |
| ExternalWindow * | m_pWindow |
| The window object this texture belongs to. | |
| GUI_COLOR | m_pDrawColor |
| The current draw color. | |
| SDL_Texture * | m_pOldLockTexture |
| The old lock texture to restore after unlocking this texture. | |
| GUI_RECT | m_pOldClipRect |
| The old clip rect to restore after unlocking this texture. | |
| bool | m_bHasOldClip |
| Whether the renderer can use the old clip rect. | |
| SDL_Texture * | m_pTexture |
| This texture's ACTUAL texture. | |
| SDL_Renderer * | m_pRenderer |
| This texture's renderer. | |
| int | m_iWidth |
| The width of this texture. | |
| int | m_iHeight |
| The height of this texture. | |
| int | m_iBitsPerPixel |
| Number of bits per pixel. | |
| GUI_RECT * | m_pClipRectList |
| A list of clip rects. | |
| int | m_iClipRectCount |
| The number of elements in the clip rect list. | |
| int | m_iClipRectSize |
| The size of the clip rect size. | |
| int | m_iMagnification |
| The local magnification for this texture. | |
| bool | m_bLocked |
| Whether this texture is currently locked or not. | |
| SDL_Rect * | m_pTempArray |
| A temporary array containing SDL rects. More... | |
| int | m_iTempCount |
| The number of rects in m_pTempArray. | |
| int | m_iTempSize |
| The size of m_pTempArray. | |
Static Public Attributes | |
| static VideoTexture * | first |
Protected Member Functions | |
| bool | InClipRect (GUI_RECT pRect) |
| Check to see if a rect is inside of the clip rect. More... | |
An editable texture API.
| void VideoTexture::AddTempRect | ( | GUI_RECT | pRect | ) |
Add a temporary rect to the rect list.
| pRect | The rect to add. |
| void VideoTexture::ClearPixels | ( | GUI_POINT * | pPointList, |
| unsigned int | iPointCount | ||
| ) |
Clear multiple pixels.
| pPointList | A list containing all points that should be drawn. |
| iPointCount | The number of points stored in pPointList. |
| iColor | The color to modulate the texture by. |
| void VideoTexture::ClearTexture | ( | GUI_RECT * | pRect = NULL | ) |
Clear this texture.
| pRect | The rect to clear. Pass 'NULL' to clear the entire texture. |
|
static |
Create a texture with an image.
| pFileName | The file path to the image. |
| pWindow | The external window this texture should belong to. |
| pRenderer | The renderer that should create this texture. Leave 'NULL' to use the default renderer. |
| iMagnification | The magnification level for this texture. Leave at '-1' to use the current screen magnification level. |
|
static |
Create a texture.
| iWidth | The width of the new texture. |
| iHeight | The height of the new texture. |
| iBitsPerPixel | Bits per pixel. |
| pWindow | The external window this texture should belong to. |
| pRenderer | The renderer that should create this texture. Leave 'NULL' to use the default renderer. |
| iMagnification | The magnification level for this texture. Leave at '-1' to use the current screen magnification level. |
| bNoTexture | If set to 'true', then no texture will be allocated. |
| void VideoTexture::DrawBitmap | ( | GUI_POINT | pPoint, |
| GUI_RECT * | pSourceRect, | ||
| Surface_Ids | iSurfaceId, | ||
| bool | bAbsolutePos = false |
||
| ) |
Draw a bitmap.
| pPoint | The point to draw the bitmap at. |
| pSourceRect | The source rect the surface should use. Pass 'NULL' to draw the entire surface. |
| iSurfaceId | The source surface id. |
| bAbsolutePos | If true, then the rect is not magnified. |
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| void VideoTexture::DrawBitmapBox | ( | GUI_RECT * | out_rect, |
| GUI_RECT * | bmp_rects, | ||
| CacheSurface::BitmapBoxType | type, | ||
| Surface_Ids | bmp_id, | ||
| int | iAlpha = 255 |
||
| ) |
Draw a bitmap box.
| out_rect | The rect in which the box will be drawn. Pass 'NULL' to fill the entire texture. |
| bmp_rects | |
| type | The source surface id. |
| bmp_id | The surface to pull the source textures from. |
| iAlpha | The alpha transparency value. |
| void VideoTexture::DrawColoredBitmap | ( | GUI_POINT | pPoint, |
| GUI_RECT * | pSourceRect, | ||
| Surface_Ids | iSurfaceId, | ||
| unsigned long | iColor, | ||
| bool | bAbsolutePos = false |
||
| ) |
Draw a colored bitmap.
| pPoint | The point to draw the bitmap at. |
| pSourceRect | The source rect the surface should use. Pass 'NULL' to draw the entire surface. |
| iSurfaceId | The source surface id. |
| iColor | The color to modulate the texture by. |
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| void VideoTexture::DrawFilledRect | ( | GUI_RECT * | pRect, |
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bAbsolutePos = false |
||
| ) |
Draw a filled rectangle to this texture.
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| iColor | The color to draw. |
| bAbsolutePos | If true, then the rect is not magnified. |
| void VideoTexture::DrawLine | ( | GUI_POINT | pStart, |
| GUI_POINT | pEnd, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bAbsolutePos = false |
||
| ) |
Draw a line.
| pStart | The starting point. |
| pEnd | The ending point. |
| bAbsolutePos | If true, then the rect is not magnified. |
| void VideoTexture::DrawMagnifiedLine | ( | GUI_POINT | pStart, |
| GUI_POINT | pEnd, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw a pre-magnified line.
| pStart | The starting point. |
| pEnd | The ending point. |
| void VideoTexture::DrawMagnifiedPixels | ( | GUI_POINT * | pPointList, |
| unsigned int | iPointCount, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw multiple pre-magnified pixels.
| pPointList | A list containing all points that should be drawn. |
| iPointCount | The number of points stored in pPointList. |
| iColor | The color to modulate the texture by. |
| void VideoTexture::DrawMagnifiedText | ( | GUI_POINT | pPoint, |
| FontObject * | pFont, | ||
| const char * | pText, | ||
| int | iTextLen = -1, |
||
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bWrap = false, |
||
| int | iShadowSize = 0, |
||
| unsigned long | iShadowColor = 0 |
||
| ) |
Draw pre-magnified text on this texture.
| pPoint | The point at which to draw the text. |
| pFont | The font object to use. |
| pText | The text to draw. |
| iTextLen | The length of the text. |
| iColor | The color of the text. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| bWrap | Wrap the text inside of the clip rect. |
| iShadowSize | The size of the text shadow. |
| iShadowColor | The color of the text shadow. |
| void VideoTexture::DrawPixel | ( | GUI_POINT | pPoint, |
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw a pixel.
| pPoint | The point to draw the pixel at. |
| iColor | The color to modulate the texture by. |
| void VideoTexture::DrawPixels | ( | GUI_POINT * | pPointList, |
| unsigned int | iPointCount, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw multiple pixels.
| pPointList | A list containing all points that should be drawn. |
| iPointCount | The number of points stored in pPointList. |
| iColor | The color to modulate the texture by. |
| void VideoTexture::DrawRect | ( | GUI_RECT * | pRect, |
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bAbsolutePos = false |
||
| ) |
Draw a rectangle to this texture.
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| iColor | The color of the rect. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| bAbsolutePos | If true, then the rect is not magnified. |
| void VideoTexture::DrawRects | ( | unsigned long | iColor = INVALID_TEXTURE_COLOR | ) |
Draw multiple rectangles to this texture.
| iColor | The color of the rect. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| void VideoTexture::DrawStretchedBitmap | ( | GUI_RECT * | pRect, |
| GUI_RECT * | pSourceRect, | ||
| Surface_Ids | iSurfaceId, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bAbsloutePos = false |
||
| ) |
Draw a stretched bitmap.
| pRect | The point to draw the bitmap inside of. Pass 'NULL' to use the entire destination texture's size. |
| pSourceRect | The source rect the surface should use. Pass 'NULL' to draw the entire surface. |
| iSurfaceId | The source surface id. |
| iColor | The color to modulate the texture by. |
| bAbsolutePos | If this is true, then pRect will not be magnified. |
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| void VideoTexture::DrawStripedLine | ( | GUI_POINT | pStart, |
| GUI_POINT | pEnd, | ||
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw a striped line.
| pStart | The starting point. |
| pEnd | The ending point. |
| iColor | The color of the rect. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| void VideoTexture::DrawStripedRect | ( | GUI_RECT * | pRect, |
| unsigned long | iColor = INVALID_TEXTURE_COLOR |
||
| ) |
Draw a striped rectangle to this texture.
| pRect | The rect to draw the rect at. Pass 'NULL' to fill the entire texture. |
| iColor | The color of the rect. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| void VideoTexture::DrawText | ( | GUI_POINT | pPoint, |
| FontObject * | pFont, | ||
| const char * | pText, | ||
| int | iTextLen = -1, |
||
| unsigned long | iColor = INVALID_TEXTURE_COLOR, |
||
| bool | bWrap = false, |
||
| int | iShadowSize = 0, |
||
| unsigned long | iShadowColor = 0 |
||
| ) |
Draw text on this texture.
| pPoint | The point at which to draw the text. |
| pFont | The font object to use. |
| pText | The text to draw. |
| iTextLen | The length of the text. |
| iColor | The color of the text. Keep as 'INVALID_TEXTURE_COLOR' to use the currently defined draw color. |
| bWrap | Wrap the text inside of the clip rect. |
| iShadowSize | The size of the text shadow. |
| iShadowColor | The color of the text shadow. |
|
static |
Free a texture.
| pTexture | The texture to free. |
| GUI_RECT VideoTexture::GetClipRect | ( | ) |
Get the current clip rect.
| GUI_RECT VideoTexture::GetNonScaledClipRect | ( | ) |
Get the current clip rect (not scaled to local magnification level).
|
inlineprotected |
Check to see if a rect is inside of the clip rect.
| pRect | The rect to check. |
| void VideoTexture::Put | ( | int | iX, |
| int | iY | ||
| ) |
Draw this texture onto the screen.
| iX | The X position to draw the texture at. |
| iY | The Y position to draw the texture at. |
| void VideoTexture::PutAlpha | ( | int | iX, |
| int | iY, | ||
| int | iAlpha | ||
| ) |
Draw this texture onto the screen with an alpha value.
| iX | The X position to draw the texture at. |
| iY | The Y position to draw the texture at. |
| iAlpha | The alpha value. |
| void VideoTexture::PutStretched | ( | int | iDstX, |
| int | iDstY, | ||
| int | iDstW, | ||
| int | iDstH, | ||
| int | iSrcX, | ||
| int | iSrcY, | ||
| int | iSrcW, | ||
| int | iSrcH | ||
| ) |
Draw this texture onto the screen.
| iDstX | The X position to draw the texture at. |
| iDstY | The Y position to draw the texture at. |
| iDstW | The destined width. |
| iDstH | The destined height. |
| iSrcX | The source X position. |
| iSrcY | The source Y position. |
| iSrcW | The source width. |
| iSrcH | The source height. |
| void VideoTexture::PutStretchedAlpha | ( | int | iDstX, |
| int | iDstY, | ||
| int | iDstW, | ||
| int | iDstH, | ||
| int | iSrcX, | ||
| int | iSrcY, | ||
| int | iSrcW, | ||
| int | iSrcH, | ||
| int | iAlpha | ||
| ) |
Draw this texture onto the screen.
| iDstX | The X position to draw the texture at. |
| iDstY | The Y position to draw the texture at. |
| iDstW | The destined width. |
| iDstH | The destined height. |
| iSrcX | The source X position. |
| iSrcY | The source Y position. |
| iSrcW | The source width. |
| iSrcH | The source height. |
| iAlpha | The alpha value. |
| void VideoTexture::PutStretchedSubPixel | ( | int | iDstX, |
| int | iDstY, | ||
| int | iDstW, | ||
| int | iDstH, | ||
| int | iSrcX, | ||
| int | iSrcY, | ||
| int | iSrcW, | ||
| int | iSrcH, | ||
| int | iAlpha | ||
| ) |
Draw this texture onto the screen.
| iDstX | The X position to draw the texture at. |
| iDstY | The Y position to draw the texture at. |
| iDstW | The destined width. |
| iDstH | The destined height. |
| iSrcX | The source X position. |
| iSrcY | The source Y position. |
| iSrcW | The source width. |
| iSrcH | The source height. |
| iAlpha | The alpha value. |
| void VideoTexture::PutSubPixel | ( | int | iX, |
| int | iY, | ||
| int | iAlpha | ||
| ) |
Draw this texture onto the screen at a subpixel coordinate.
| iX | The X position to draw the texture at. |
| iY | The Y position to draw the texture at. |
| iAlpha | The alpha value. |
| void VideoTexture::RecreateTexture | ( | ) |
Recreate this texture.
@warn This does not destroy the old texture beforehand.
|
static |
Reload the main renderer's texture.
| iMagnification | The magnification level of the new renderer texture. |
| void VideoTexture::SetClipRect | ( | GUI_RECT * | pRect, |
| bool | bAbsoluteRect = false |
||
| ) |
Set the clip rect for this texture.
| pRect | The rect to use. Pass 'NULL' to clear the last cliprect. |
| bAbsoluteRect | If this is true, then pRect will not be magnified. |
| void VideoTexture::SetDrawColor | ( | unsigned char | iRed, |
| unsigned char | iGreen, | ||
| unsigned char | iBlue, | ||
| unsigned char | iAlpha | ||
| ) |
Set the drawing color.
| iRed | The red value. |
| iGreen | The green value. |
| iBlue | The blue value. |
| iAlpha | The alpha value. |
| void VideoTexture::SetDrawColor | ( | unsigned long | iColor | ) |
Set the drawing color.
| iColor | The color. |
| void VideoTexture::SetTextureSize | ( | int | iWidth, |
| int | iHeight | ||
| ) |
Resize this video texture.
| iWidth | The new width. |
| iHeight | The new height. |
| SDL_Rect* VideoTexture::m_pTempArray |
A temporary array containing SDL rects.
Used for converting GUI_RECTs in functions like DrawRects.