⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.

Axmol Engine 3.0.0-dff292a
Loading...
Searching...
No Matches
RenderView Class Referenceabstract

By RenderView you can operate the frame information of EGL view through some function. More...

#include <RenderView.h>

Inherits Object.

Public Member Functions

virtual ~RenderView ()
 @lua NA
virtual void end ()=0
 Force destroying EGL view, subclass must implement this method.
virtual bool isGfxContextReady ()=0
 Get whether graphics context is ready, subclass must implement this method.
virtual void swapBuffers ()=0
 Exchanges the front and back buffers, subclass must implement this method.
virtual void setIMEKeyboardState (bool open)=0
 Open or close IME keyboard , subclass must implement this method.
virtual bool windowShouldClose ()
 When the window is closed, it will return false if the platforms is Ios or Android.
virtual void pollEvents ()
 Polls the events.
const Vec2getWindowSize () const
 Get the zoomed window size In general, it returns the screen size since the EGL view is a fullscreen view.
virtual void setWindowSize (float, float)
 Set the zoomed window size.
virtual void setWindowZoomFactor (float)
 Set zoom factor for frame.
virtual float getWindowZoomFactor () const
 Get zoom factor for frame.
 AX_DEPRECATED (3.0) const Vec2 &getFrameSize() const
 implicit deprecated APIs, use getWindowSize instead
virtual void setCursorVisible (bool)
 Hide or Show the mouse cursor if there is one.
virtual float getRenderScale () const
 Get render scale.
virtual Vec2 getVisibleSize () const
 Get the visible area size of render viewport.
virtual Vec2 getVisibleOrigin () const
 Get the visible origin point of render viewport.
virtual Rect getVisibleRect () const
 Get the visible rectangle of render viewport.
virtual Rect getSafeAreaRect () const
 Gets safe area rectangle.
virtual void setDesignResolutionSize (float width, float height, ResolutionPolicy resolutionPolicy)
 Set the design resolution size.
virtual const Vec2getDesignResolutionSize () const
 Get design resolution size.
virtual void setViewportInPoints (float x, float y, float w, float h)
 Set render view port rectangle with points.
virtual void setScissorInPoints (float x, float y, float w, float h)
 Set Scissor rectangle with points.
virtual bool isScissorEnabled ()
 Get whether GL_SCISSOR_TEST is enable.
virtual Rect getScissorInPoints () const
 Get the current scissor rectangle.
std::string_view getViewName () const
 Get the view name.
virtual void handleTouchesBegin (int num, intptr_t ids[], float xs[], float ys[])
 Touch events are handled by default; if you want to customize your handlers, please override this function.
virtual void handleTouchesMove (int num, intptr_t ids[], float xs[], float ys[])
 Touch events are handled by default; if you want to customize your handlers, please override this function.
virtual void handleTouchesMove (int num, intptr_t ids[], float xs[], float ys[], float fs[], float ms[])
 Touch events are handled by default; if you want to customize your handlers, please override this function.
virtual void handleTouchesEnd (int num, intptr_t ids[], float xs[], float ys[])
 Touch events are handled by default; if you want to customize your handlers, please override this function.
virtual void handleTouchesCancel (int num, intptr_t ids[], float xs[], float ys[])
 Touch events are handled by default; if you want to customize your handlers, please override this function.
virtual void setIcon (std::string_view filename) const
 Set window icon (implemented for windows and linux).
virtual void setIcon (const std::vector< std::string_view > &filelist) const
 Set window icon (implemented for windows and linux).
virtual void setDefaultIcon () const
 Set default window icon (implemented for windows and linux).
const RectgetViewportRect () const
 Get the render view port rectangle.
std::vector< Touch * > getAllTouches () const
 Get list of all active touches.
float getScaleX () const
 Get scale factor of the horizontal direction.
float getScaleY () const
 Get scale factor of the vertical direction.
ResolutionPolicy getResolutionPolicy () const
 Returns the current Resolution policy.
virtual void * getNativeWindow () const
 Get the Native Window object.
virtual void * getNativeDisplay () const
 Get the Native Display object.
virtual WindowPlatform getWindowPlatform () const
 Get the Window Platform object.
void renderScene (Scene *scene, Renderer *renderer)
 Renders a Scene with a Renderer This method is called directly by the Director.
void setInteractive (bool interactive)
 Enable or disable interactions.
void updateRenderSurface (float width, float height, uint8_t updateFlag)
 Updates the render surface size (framebuffer/render target) and synchronizes related view parameters.
Public Member Functions inherited from Object
void retain ()
 Retains the ownership.
void release ()
 Releases the ownership immediately.
Objectautorelease ()
 Releases the ownership sometime soon automatically.
unsigned int getReferenceCount () const
 Returns the Object's current reference count.
virtual ~Object ()
 Destructor.

Additional Inherited Members

Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID
int _luaID
 Lua reference id.

Detailed Description

By RenderView you can operate the frame information of EGL view through some function.

Member Function Documentation

◆ end()

virtual void end ( )
pure virtual

Force destroying EGL view, subclass must implement this method.

@lua endToLua

◆ setIMEKeyboardState()

virtual void setIMEKeyboardState ( bool open)
pure virtual

Open or close IME keyboard , subclass must implement this method.

Parameters
openOpen or close IME keyboard.

◆ windowShouldClose()

virtual bool windowShouldClose ( )
inlinevirtual

When the window is closed, it will return false if the platforms is Ios or Android.

If the platforms is windows or Mac,it will return true.

Returns
In ios and android it will return false,if in windows or Mac it will return true.

◆ getWindowSize()

const Vec2 & getWindowSize ( ) const
inline

Get the zoomed window size In general, it returns the screen size since the EGL view is a fullscreen view.

Returns
The window size (aka logic size)

◆ setWindowSize()

virtual void setWindowSize ( float ,
float  )
inlinevirtual

Set the zoomed window size.

Parameters
widthThe width of the fram size.
heightThe height of the fram size.

◆ setWindowZoomFactor()

virtual void setWindowZoomFactor ( float )
inlinevirtual

Set zoom factor for frame.

This methods are for debugging big resolution (e.g.new ipad) app on desktop.

Parameters
zoomFactorThe zoom factor for frame.

◆ getWindowZoomFactor()

virtual float getWindowZoomFactor ( ) const
inlinevirtual

Get zoom factor for frame.

This methods are for debugging big resolution (e.g.new ipad) app on desktop.

Returns
The zoom factor for frame.

◆ setCursorVisible()

virtual void setCursorVisible ( bool )
inlinevirtual

Hide or Show the mouse cursor if there is one.

Parameters
isVisibleHide or Show the mouse cursor if there is one.

◆ getRenderScale()

virtual float getRenderScale ( ) const
inlinevirtual

Get render scale.

Returns
The render scale fbSize/windowSize aka backing scale factor

◆ getVisibleSize()

virtual Vec2 getVisibleSize ( ) const
virtual

Get the visible area size of render viewport.

Returns
The visible area size of render viewport.

◆ getVisibleOrigin()

virtual Vec2 getVisibleOrigin ( ) const
virtual

Get the visible origin point of render viewport.

Returns
The visible origin point of render viewport.

◆ getVisibleRect()

virtual Rect getVisibleRect ( ) const
virtual

Get the visible rectangle of render viewport.

Returns
The visible rectangle of render viewport.

◆ setDesignResolutionSize()

virtual void setDesignResolutionSize ( float width,
float height,
ResolutionPolicy resolutionPolicy )
virtual

Set the design resolution size.

Parameters
widthDesign resolution width.
heightDesign resolution height.
resolutionPolicyThe resolution policy desired, you may choose: [1] EXACT_FIT Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. [2] NO_BORDER Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. [3] SHOW_ALL Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown.
Remarks
For applications with a static design resolution, this method should typically be called only once during initialization.

◆ getDesignResolutionSize()

virtual const Vec2 & getDesignResolutionSize ( ) const
virtual

Get design resolution size.

Default resolution size is the same as 'getWindowSize'.

Returns
The design resolution size.

◆ setViewportInPoints()

virtual void setViewportInPoints ( float x,
float y,
float w,
float h )
virtual

Set render view port rectangle with points.

Parameters
xSet the points of x.
ySet the points of y.
wSet the width of the view port
hSet the Height of the view port.

◆ setScissorInPoints()

virtual void setScissorInPoints ( float x,
float y,
float w,
float h )
virtual

Set Scissor rectangle with points.

Parameters
xSet the points of x.
ySet the points of y.
wSet the width of the view port
hSet the Height of the view port.

◆ isScissorEnabled()

virtual bool isScissorEnabled ( )
virtual

Get whether GL_SCISSOR_TEST is enable.

Returns
Whether GL_SCISSOR_TEST is enable.

◆ getScissorInPoints()

virtual Rect getScissorInPoints ( ) const
virtual

Get the current scissor rectangle.

Returns
The current scissor rectangle.

◆ getViewName()

std::string_view getViewName ( ) const

Get the view name.

Returns
The view name.

◆ handleTouchesBegin()

virtual void handleTouchesBegin ( int num,
intptr_t ids[],
float xs[],
float ys[] )
virtual

Touch events are handled by default; if you want to customize your handlers, please override this function.

Parameters
numThe number of touch.
idsThe identity of the touch.
xsThe points of x.
ysThe points of y.

◆ handleTouchesMove() [1/2]

virtual void handleTouchesMove ( int num,
intptr_t ids[],
float xs[],
float ys[] )
virtual

Touch events are handled by default; if you want to customize your handlers, please override this function.

Parameters
numThe number of touch.
idsThe identity of the touch.
xsThe points of x.
ysThe points of y.

◆ handleTouchesMove() [2/2]

virtual void handleTouchesMove ( int num,
intptr_t ids[],
float xs[],
float ys[],
float fs[],
float ms[] )
virtual

Touch events are handled by default; if you want to customize your handlers, please override this function.

Parameters
numThe number of touch.
idsThe identity of the touch.
xsThe points of x.
ysThe points of y.
fsThe force of 3d touches.

autotoc_md0

Parameters
msThe maximum force of 3d touches

◆ handleTouchesEnd()

virtual void handleTouchesEnd ( int num,
intptr_t ids[],
float xs[],
float ys[] )
virtual

Touch events are handled by default; if you want to customize your handlers, please override this function.

Parameters
numThe number of touch.
idsThe identity of the touch.
xsThe points of x.
ysThe points of y.

◆ handleTouchesCancel()

virtual void handleTouchesCancel ( int num,
intptr_t ids[],
float xs[],
float ys[] )
virtual

Touch events are handled by default; if you want to customize your handlers, please override this function.

Parameters
numThe number of touch.
idsThe identity of the touch.
xsThe points of x.
ysThe points of y.

◆ setIcon() [1/2]

virtual void setIcon ( std::string_view filename) const
inlinevirtual

Set window icon (implemented for windows and linux).

Parameters
filenameA path to image file, e.g., "icons/cusom.png".

◆ setIcon() [2/2]

virtual void setIcon ( const std::vector< std::string_view > & filelist) const
inlinevirtual

Set window icon (implemented for windows and linux).

Best icon (based on size) will be auto selected.

Parameters
filelistThe array contains icons.

◆ setDefaultIcon()

virtual void setDefaultIcon ( ) const
inlinevirtual

Set default window icon (implemented for windows and linux).

On windows it will use icon from .exe file (if included). On linux it will use default window icon.

◆ getViewportRect()

const Rect & getViewportRect ( ) const

Get the render view port rectangle.

Returns
Return the render view port rectangle.

◆ getAllTouches()

std::vector< Touch * > getAllTouches ( ) const

Get list of all active touches.

Returns
A list of all active touches.

◆ getScaleX()

float getScaleX ( ) const

Get scale factor of the horizontal direction.

Returns
Scale factor of the horizontal direction.

◆ getScaleY()

float getScaleY ( ) const

Get scale factor of the vertical direction.

Returns
Scale factor of the vertical direction.

◆ getResolutionPolicy()

ResolutionPolicy getResolutionPolicy ( ) const
inline

Returns the current Resolution policy.

Returns
The current Resolution policy.

◆ getNativeWindow()

virtual void * getNativeWindow ( ) const
inlinevirtual

Get the Native Window object.

Returns
void* win32: HWND winrt: PresentTarget* linux: x11 or wayland window macOS: NSWindow* iOS: UIWindow*

◆ getNativeDisplay()

virtual void * getNativeDisplay ( ) const
inlinevirtual

Get the Native Display object.

Returns
void* linux: x11 or wayland display macOS: NSGLContext* iOS/tvOS: EARenderView*

◆ getWindowPlatform()

virtual WindowPlatform getWindowPlatform ( ) const
inlinevirtual

Get the Window Platform object.

Returns
WindowPlatform

◆ setInteractive()

void setInteractive ( bool interactive)

Enable or disable interactions.

When disabled, it prevents touches to be dispatched and will cancel current touches

◆ updateRenderSurface()

void updateRenderSurface ( float width,
float height,
uint8_t updateFlag )

Updates the render surface size (framebuffer/render target) and synchronizes related view parameters.

This method performs the following actions:

  • Sets _renderSize to the specified dimensions;
  • On mobile platforms (Android/iOS), _windowSize is synchronized to match _renderSize;
  • On desktop platforms, _windowSize is only initialized to _renderSize if it hasn't been set yet;
  • If _designResolutionSize is unset (Vec2::ZERO), it is initialized to _renderSize;
  • Calls updateDesignResolution() to recalculate _viewScale and _viewportRect based on the current ResolutionPolicy, and updates the Director's canvas size and projection matrix accordingly.
Parameters
widthThe target width of the render surface. Its meaning depends on updateFlag: it may represent the framebuffer width, logical window width, or design resolution width.
heightThe target height of the render surface. Its meaning depends on updateFlag: it may represent the framebuffer height, logical window height, or design resolution height.
updateFlagOptional flags to control which parts of the view should be updated. Defaults to SurfaceUpdateFlag::AllUpdates.
Warning
This method may initialize _windowSize and _designResolutionSize on first invocation.
Note
No update will occur if the given size is (0, 0).

The documentation for this class was generated from the following file:
  • RenderView.h