Cavestory Mod API
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
ExternalWindow Class Reference

An external window to render stuff on. More...

#include <ExternalWindow.h>

Public Member Functions

 ExternalWindow ()
 Constructor.
 
 ~ExternalWindow ()
 Deconstructor.
 
bool Init (const char *pTitle, GUI_POINT *pPoint, GUI_POINT pSize, unsigned int iFlags=0, int iMagnification=-1, bool bStartHidden=false)
 Initialize this window. More...
 
void Free ()
 Reset this window and its memory.
 
bool IsInitialized ()
 Check to see if this window has been initialized. More...
 
void UpdateFlags ()
 Update a window's flags.
 
void RegisterTexture (VideoTexture *pTexture)
 Register a texture to this window. More...
 
void UnregisterTexture (VideoTexture *pTexture)
 Unregister a texture from this window. More...
 
void SetWindowMinimumSize (GUI_POINT pSize)
 Set the minimum size for this window. More...
 
void SetWindowMaximumSize (GUI_POINT pSize)
 Set the maximum size for this window. More...
 
void SetWindowOpacity (unsigned char iOpacity)
 Set the opacity of this window. More...
 
unsigned char GetWindowOpacity ()
 Get the visibility of this window. More...
 
void SetWindowVisible (bool bVisible)
 Set the visibility of this window. More...
 
bool IsWindowVisible ()
 Get the visibility of this window. More...
 
GUI_POINT GetWindowPosition ()
 Get the position of this window. More...
 
void SetWindowPosition (GUI_POINT pNewPosition)
 Move this window. More...
 
GUI_POINT GetWindowSize ()
 Get the size of this window. More...
 
void SetWindowSize (GUI_POINT pNewSize)
 Resize this window. More...
 
const char * GetWindowTitle ()
 Get the title of this window. More...
 
void SetWindowTitle (const char *pNewTitle)
 Rename this window. More...
 
void FocusWindow ()
 Focus this window.
 
void Maximize ()
 Maximize this window.
 
void Minimize ()
 Minimize this window.
 
void OnInputEvent (SDL_Event *pEvent)
 Handle an input. More...
 
void SetHitTestFunc (ExternalWindow_HitTestFunc pFunc, void *pUserData)
 Set the hittest function. More...
 
GUI_POINT GetMousePosition ()
 Get the mouse position relative to this window. More...
 
SDL_Texture * GetSurfaceTexture (Surface_Ids iSurfaceId)
 Get the texture specific to this window's renderer for a surface. More...
 
void FlipWindow ()
 Flip this window.
 

Static Public Member Functions

static bool TestWindowInputFocus (ExternalWindow *pWindow)
 Test a window's input focus. More...
 
static bool TestWindowMouseFocus (ExternalWindow *pWindow)
 Test a window's mouse focus. More...
 

Public Attributes

ExternalWindowprev
 Previous entry in list.
 
ExternalWindownext
 Next entry in list.
 
void * CallbackUserData
 User data for callback.
 
ExternalWindow_OnResizeFunc OnResize
 Called every time the window's size is changed.
 
ExternalWindowm_pParent
 This window's parent window. More...
 
ExternalWindow_HitTestFunc m_pHitTestFunc
 A pointer to the hit test function.
 
void * m_pHitTestUserData
 The user data for the hitfunc.
 
SDL_Renderer * m_pRenderer
 The SDL renderer pointer for this window.
 
SDL_Window * m_pWindow
 The SDL window pointer for this window.
 
unsigned int m_iFlags
 The flags for this window. More...
 
EXTERNAL_WINDOW_TEXTURE m_pTextureList [SURFACE_ID_MAX]
 Texture array for this window.
 
VideoTexturem_pRendererTexture
 The renderer texture for this external window. More...
 
struct {
   GUI_RECT   WindowRect
 The window's rect.
 
   int   WindowID
 The window's ID.
 
m_pCache
 Cache variables stored for this window.
 

Static Public Attributes

static SDL_Window * mouse_focused
 First entry in list.
 
static ExternalWindowfirst
 First entry in list.
 

Protected Attributes

bool m_bInitialized
 Whether this window is initialized already or not.
 
VideoTexture ** m_pVideoTextureList
 Texture allocated to this window.
 
int m_iVideoTextureCount
 The number of textures allocated to this window.
 
int m_iVideoTextureSize
 The number of texture slots allocated.
 

Detailed Description

An external window to render stuff on.

Member Function Documentation

◆ GetMousePosition()

GUI_POINT ExternalWindow::GetMousePosition ( )

Get the mouse position relative to this window.

Returns
Returns the mouse position.

◆ GetSurfaceTexture()

SDL_Texture* ExternalWindow::GetSurfaceTexture ( Surface_Ids  iSurfaceId)

Get the texture specific to this window's renderer for a surface.

Parameters
iSurfaceIdThe surface's ID.
Returns
Returns the texture

◆ GetWindowOpacity()

unsigned char ExternalWindow::GetWindowOpacity ( )

Get the visibility of this window.

Returns
Returns the opacity from 0 to 255.
See also
ExternalWindow::SetWindowOpacity

◆ GetWindowPosition()

GUI_POINT ExternalWindow::GetWindowPosition ( )

Get the position of this window.

Returns
Returns the position of the window.

◆ GetWindowSize()

GUI_POINT ExternalWindow::GetWindowSize ( )

Get the size of this window.

Returns
Returns the size of the window.

◆ GetWindowTitle()

const char* ExternalWindow::GetWindowTitle ( )

Get the title of this window.

Returns
Returns the title of the window.

◆ Init()

bool ExternalWindow::Init ( const char *  pTitle,
GUI_POINT pPoint,
GUI_POINT  pSize,
unsigned int  iFlags = 0,
int  iMagnification = -1,
bool  bStartHidden = false 
)

Initialize this window.

Parameters
pTitleThe title of the window.
pPointThe initial position of the window. Pass 'NULL' here to center the window.
pSizeThe size of the window.
iFlagsThe initial flags for this window.
iMagnificationThe renderer magnification for this window. Setting this to '-1' will use the current magnification level.
bStartHiddenIf 'true', then the window will start out hidden, hiding the ugly initialization.
Returns
Returns true on success, otherwise returns false.

◆ IsInitialized()

bool ExternalWindow::IsInitialized ( )
inline

Check to see if this window has been initialized.

Returns
Returns the result.

◆ IsWindowVisible()

bool ExternalWindow::IsWindowVisible ( )

Get the visibility of this window.

Returns
Returns true if the window is visible, false if it isn't.

◆ OnInputEvent()

void ExternalWindow::OnInputEvent ( SDL_Event *  pEvent)

Handle an input.

Parameters
pEventThe event to parse.

◆ RegisterTexture()

void ExternalWindow::RegisterTexture ( VideoTexture pTexture)

Register a texture to this window.

Parameters
pTextureThe texture object.

◆ SetHitTestFunc()

void ExternalWindow::SetHitTestFunc ( ExternalWindow_HitTestFunc  pFunc,
void *  pUserData 
)

Set the hittest function.

Parameters
pFuncThe function.

◆ SetWindowMaximumSize()

void ExternalWindow::SetWindowMaximumSize ( GUI_POINT  pSize)

Set the maximum size for this window.

Parameters
pSizeThe new maximum size for this window.

◆ SetWindowMinimumSize()

void ExternalWindow::SetWindowMinimumSize ( GUI_POINT  pSize)

Set the minimum size for this window.

Parameters
pSizeThe new minimum size for this window.

◆ SetWindowOpacity()

void ExternalWindow::SetWindowOpacity ( unsigned char  iOpacity)

Set the opacity of this window.

Parameters
iOpacityThe opacity of this window, from 0 (Invisible) to 255 (Visible).

◆ SetWindowPosition()

void ExternalWindow::SetWindowPosition ( GUI_POINT  pNewPosition)

Move this window.

Parameters
pNewPositionThe new position of the window.

◆ SetWindowSize()

void ExternalWindow::SetWindowSize ( GUI_POINT  pNewSize)

Resize this window.

Parameters
pNewSizeThe new size of the window.

◆ SetWindowTitle()

void ExternalWindow::SetWindowTitle ( const char *  pNewTitle)

Rename this window.

Parameters
pNewTitleThe new title of the window.

◆ SetWindowVisible()

void ExternalWindow::SetWindowVisible ( bool  bVisible)

Set the visibility of this window.

Parameters
bVisibleIf 'true', then this window will be shown. Otherwise, this window will be hidden.

◆ TestWindowInputFocus()

static bool ExternalWindow::TestWindowInputFocus ( ExternalWindow pWindow)
static

Test a window's input focus.

Parameters
pWindowThe window to test. Set as 'NULL' test gWindow.
Returns
Returns true if the specified window has input focus.

◆ TestWindowMouseFocus()

static bool ExternalWindow::TestWindowMouseFocus ( ExternalWindow pWindow)
static

Test a window's mouse focus.

Parameters
pWindowThe window to test. Set as 'NULL' test gWindow.
Returns
Returns true if the specified window has mouse focus.

◆ UnregisterTexture()

void ExternalWindow::UnregisterTexture ( VideoTexture pTexture)

Unregister a texture from this window.

Parameters
pTextureThe texture object.

Member Data Documentation

◆ m_iFlags

unsigned int ExternalWindow::m_iFlags

The flags for this window.

Should be updated dynamically.

◆ m_pParent

ExternalWindow* ExternalWindow::m_pParent

This window's parent window.

If set to 'NULL', then it will be the child of the main window.

◆ m_pRendererTexture

VideoTexture* ExternalWindow::m_pRendererTexture

The renderer texture for this external window.

Allows one to draw directly to this window without using a middle-man texture.


The documentation for this class was generated from the following file: