![]() |
CRM64Pro GDK v0.14.0
A free cross-platform game development kit built on top of SDL 3.0
|
Screen Object class.
Public Member Functions | |
| bool | info (Sint32 iMode=0) override |
| Request screen object information. | |
| const string & | getName () const override |
| Get the name. | |
| Uint32 | getID () const override |
| Get the ID. | |
| bool | show () |
| Show the screen. | |
| bool | hide () |
| Hide the screen. | |
| Sint32 | status () const |
| Get the screen status. | |
| bool | setIcon (SDL_Surface *suIcon) |
| Set an icon. | |
| bool | setDriver (eConfigRendererDriver eCRD) |
| Set the renderer driver. | |
| eConfigRendererDriver | getDriver () const |
| Get the renderer driver. | |
| eConfigRendererDriver | getDriverInUse () const |
| Get the renderer driver in use. | |
| bool | setVSync (bool bEnabled) |
| Set the VSync mode. | |
| bool | getVSync () const |
| Get current VSync mode. | |
| bool | setMode (eConfigScreenMode eCSM) |
| Set the screen mode. | |
| eConfigScreenMode | getMode () const |
| Get the screen mode. | |
| bool | setSize (Sint32 iWidth, Sint32 iHeight) |
| Set the size of the screen. | |
| Sint32 | getWidth () const |
| Get the screen width. | |
| Sint32 | getHeight () const |
| Get the screen height. | |
| bool | setLogicalPresentation (Sint32 iWidth, Sint32 iHeight, SDL_RendererLogicalPresentation eSDL_RLP=SDL_LOGICAL_PRESENTATION_DISABLED) |
| Set the logical presentation size of the screen. | |
| bool | getLogicalPresentation (Sint32 *iWidth=nullptr, Sint32 *iHeight=nullptr, SDL_RendererLogicalPresentation *eSDL_RLP=nullptr) const |
| Get the logical presentation size of the screen. | |
| bool | setPosition (Sint32 iX, Sint32 iY) |
| Set the position. | |
| Sint32 | getX () const |
| Get the screen X position. | |
| Sint32 | getY () const |
| Get the screen Y position. | |
| bool | setClipRect (SDL_Rect *rClip) |
| Set clipping rect. | |
| bool | getClipRect (SDL_Rect *rClip) |
| Get clipping rect. | |
| bool | isClipRectEnabled () const |
| Check if clipping rect is enabled. | |
| bool | setTitle (const string &sName) |
| Set the title. | |
| const string & | getTitle () const |
| Get the title. | |
| bool | setBorder (bool bEnabled) |
| Set the border for the screen. | |
| bool | getBorder () const |
| Get the border for the screen. | |
| SDL_Window * | getWindow () |
| Get the SDL_Window associated to this screen. | |
| SDL_Renderer * | getRenderer () |
| Get the SDL_Renderer associated to this screen. | |
| SDL_Surface * | getSnapshot () |
| Get a SDL_Surface with a screen snapshot. | |
| bool | getSnapshot (const string &sFile) |
| Save the screen snapshot to an external PNG file. | |
| bool | clear (Uint8 iR=0, Uint8 iG=0, Uint8 iB=0, Uint8 iA=255) |
| Clear the screen. | |
| bool | setRenderCallback (Sint32(*myRenderFunc)(Sint32 iMode, void *pObj), void *pObj=nullptr) |
| Set a callback function for rendering your graphics at Render Frame Rate. | |
| bool | fadeToColor (Uint8 iR, Uint8 iG, Uint8 iB, Sint32 iTime, SDL_FRect *rDst=nullptr) |
| Perform a fade effect of this screen to the given color. | |
| bool | fadeToImage (Sint32 idImage, Sint32 iTime, SDL_FRect *rDst=nullptr, SDL_FRect *rSrc=nullptr) |
| Perform a fade effect of this screen to the given Image handler. | |
|
override |
Request screen object information.
Writes screen information to the default log.
| iMode | unused for the time being. |
|
override |
Get the name.
|
override |
Get the ID.
| bool CRM64Pro::Screen::show | ( | ) |
Show the screen.
Makes the associated window visible. If the screen was not previously shown, it creates all required internal attributes and initializes the screen. If the screen was hidden, it is shown again without altering existing attributes.
| bool CRM64Pro::Screen::hide | ( | ) |
Hide the screen.
When hidden, the associated window is hidden but all attributes are kept. The screen can be shown again using show() or closed using ConfigMgr::close().
| Sint32 CRM64Pro::Screen::status | ( | ) | const |
Get the screen status.
| bool CRM64Pro::Screen::setIcon | ( | SDL_Surface * | suIcon | ) |
Set an icon.
Sets the window icon. Once called, you can free the used surface as it is no longer needed. The screen can be initialized or not when calling this method.
| suIcon | SDL_Surface pointer with the icon. |
| bool CRM64Pro::Screen::setDriver | ( | eConfigRendererDriver | eCRD | ) |
Set the renderer driver.
| eCRD | screen renderer driver. Check ::eConfigRendererDriver enum for details. |
| eConfigRendererDriver CRM64Pro::Screen::getDriver | ( | ) | const |
Get the renderer driver.
Returns the renderer driver set by default or by setDriver() method. Note that it could differ from the actual driver in use. For example, CRD_DEFAULT may resolve to CRD_SOFTWARE, CRD_OPENGL, etc. Use getDriverInUse() to get the actual driver in use.
| eConfigRendererDriver CRM64Pro::Screen::getDriverInUse | ( | ) | const |
Get the renderer driver in use.
Returns the renderer driver currently in use. The screen must be initialized. Use getDriver() to get the driver set by default or by setDriver().
| bool CRM64Pro::Screen::setVSync | ( | bool | bEnabled | ) |
Set the VSync mode.
| bEnabled | false to disable, true to enable. Common monitor refresh rates are 60, 70, 75, 120 or 155. |
| bool CRM64Pro::Screen::getVSync | ( | ) | const |
Get current VSync mode.
| bool CRM64Pro::Screen::setMode | ( | eConfigScreenMode | eCSM | ) |
Set the screen mode.
| eCSM | screen mode. Check ::eConfigScreenMode enum for details. |
| eConfigScreenMode CRM64Pro::Screen::getMode | ( | ) | const |
Get the screen mode.
| bool CRM64Pro::Screen::setSize | ( | Sint32 | iWidth, |
| Sint32 | iHeight ) |
Set the size of the screen.
| iWidth | screen width. |
| iHeight | screen height. |
| Sint32 CRM64Pro::Screen::getWidth | ( | ) | const |
Get the screen width.
| Sint32 CRM64Pro::Screen::getHeight | ( | ) | const |
Get the screen height.
| bool CRM64Pro::Screen::setLogicalPresentation | ( | Sint32 | iWidth, |
| Sint32 | iHeight, | ||
| SDL_RendererLogicalPresentation | eSDL_RLP = SDL_LOGICAL_PRESENTATION_DISABLED ) |
Set the logical presentation size of the screen.
Allows a device independent resolution rendering.
| iWidth | logical presentation width. A negative value for not modifying this value. |
| iHeight | logical presentation height. A negative value for not modifying this value. |
| eSDL_RLP | set the logical presentation mode. Check SDL_RendererLogicalPresentation for further information. By default, it is set to SDL_LOGICAL_PRESENTATION_DISABLED. |
| bool CRM64Pro::Screen::getLogicalPresentation | ( | Sint32 * | iWidth = nullptr, |
| Sint32 * | iHeight = nullptr, | ||
| SDL_RendererLogicalPresentation * | eSDL_RLP = nullptr ) const |
Get the logical presentation size of the screen.
Returns the logical presentation size and mode for this screen.
| iWidth | an integer pointer filled in with logical presentation width. If nullptr, this value is not retrieved. |
| iHeight | an integer pointer filled in with logical presentation height. If nullptr, this value is not retrieved. |
| eSDL_RLP | a SDL_RendererLogicalPresentation enum pointer filled in with the logical presentation mode. If nullptr, this value is not retrieved. |
| bool CRM64Pro::Screen::setPosition | ( | Sint32 | iX, |
| Sint32 | iY ) |
Set the position.
| iX | screen X position. |
| iY | screen Y position. |
| Sint32 CRM64Pro::Screen::getX | ( | ) | const |
Get the screen X position.
| Sint32 CRM64Pro::Screen::getY | ( | ) | const |
Get the screen Y position.
| bool CRM64Pro::Screen::setClipRect | ( | SDL_Rect * | rClip | ) |
Set clipping rect.
| rClip | pointer to SDL_Rect structure with the clipping area, or nullptr to disable clipping. |
| bool CRM64Pro::Screen::getClipRect | ( | SDL_Rect * | rClip | ) |
Get clipping rect.
| rClip | pointer to SDL_Rect structure filled in with current clipping area when clipping is enabled. |
| bool CRM64Pro::Screen::isClipRectEnabled | ( | ) | const |
Check if clipping rect is enabled.
| bool CRM64Pro::Screen::setTitle | ( | const string & | sName | ) |
Set the title.
Sets the window title. The screen can be initialized or not when calling this method.
| sName | title for the screen. |
| const string & CRM64Pro::Screen::getTitle | ( | ) | const |
Get the title.
| bool CRM64Pro::Screen::setBorder | ( | bool | bEnabled | ) |
Set the border for the screen.
The screen border is only visible on ::CSM_WINDOW mode so it only has effect on this mode.
| bEnabled | false for disabling and true for enabling it. |
| bool CRM64Pro::Screen::getBorder | ( | ) | const |
Get the border for the screen.
| SDL_Window * CRM64Pro::Screen::getWindow | ( | ) |
Get the SDL_Window associated to this screen.
| SDL_Renderer * CRM64Pro::Screen::getRenderer | ( | ) |
Get the SDL_Renderer associated to this screen.
| SDL_Surface * CRM64Pro::Screen::getSnapshot | ( | ) |
Get a SDL_Surface with a screen snapshot.
| bool CRM64Pro::Screen::getSnapshot | ( | const string & | sFile | ) |
Save the screen snapshot to an external PNG file.
| sFile | string containing the [directory]+filename+[extension]. |
| bool CRM64Pro::Screen::clear | ( | Uint8 | iR = 0, |
| Uint8 | iG = 0, | ||
| Uint8 | iB = 0, | ||
| Uint8 | iA = 255 ) |
Clear the screen.
| iR | The red color value. Default is 0. |
| iG | The green color value. Default is 0. |
| iB | The blue color value. Default is 0. |
| iA | The alpha value. Default is 255. |
| bool CRM64Pro::Screen::setRenderCallback | ( | Sint32(* | myRenderFunc )(Sint32 iMode, void *pObj), |
| void * | pObj = nullptr ) |
Set a callback function for rendering your graphics at Render Frame Rate.
| myRenderFunc | pointer to your graphics rendering function or nullptr to remove current assigned function. The iMode parameter of the callback is set to 1 right after a Logic Frame update. |
| pObj | pointer to user data passed to the callback function. By default nullptr. |
| bool CRM64Pro::Screen::fadeToColor | ( | Uint8 | iR, |
| Uint8 | iG, | ||
| Uint8 | iB, | ||
| Sint32 | iTime, | ||
| SDL_FRect * | rDst = nullptr ) |
Perform a fade effect of this screen to the given color.
| iR | The red color value. |
| iG | The green color value. |
| iB | The blue color value. |
| iTime | duration in milliseconds (minimum 50ms, maximum 10000ms). |
| rDst | the destination SDL_FRect structure or nullptr for whole screen (default). |
| bool CRM64Pro::Screen::fadeToImage | ( | Sint32 | idImage, |
| Sint32 | iTime, | ||
| SDL_FRect * | rDst = nullptr, | ||
| SDL_FRect * | rSrc = nullptr ) |
Perform a fade effect of this screen to the given Image handler.
| idImage | Image handler. |
| iTime | duration in milliseconds (minimum 50ms, maximum 10000ms). |
| rDst | the destination SDL_FRect structure or nullptr for whole screen (default). |
| rSrc | the image source SDL_FRect structure or nullptr for whole image (default). |