Loading [MathJax]/extensions/tex2jax.js

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

 
Axmol Engine 2.4.0-ce063c5
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Loading...
Searching...
No Matches
GLView Class Referenceabstract

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

#include <GLView.h>

Inherits Object.

Public Member Functions

 GLView ()
 @js ctor
 
virtual ~GLView ()
 @js NA @lua NA
 
virtual void end ()=0
 Force destroying EGL view, subclass must implement this method.
 
virtual bool isOpenGLReady ()=0
 Get whether opengl render system 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.
 
virtual Vec2 getFrameSize () const
 Get the frame size of EGL view.
 
virtual void setFrameSize (float width, float height)
 Set the frame size of EGL view.
 
virtual void setFrameZoomFactor (float)
 Set zoom factor for frame.
 
virtual float getFrameZoomFactor () const
 Get zoom factor for frame.
 
virtual void setCursorVisible (bool)
 Hide or Show the mouse cursor if there is one.
 
virtual int getRetinaFactor () const
 Get retina factor.
 
virtual bool setContentScaleFactor (float)
 Only works on ios platform.
 
virtual float getContentScaleFactor () const
 Only works on ios platform.
 
virtual bool isRetinaDisplay () const
 Returns whether or not the view is in Retina Display mode.
 
virtual Vec2 getVisibleSize () const
 Get the visible area size of opengl viewport.
 
virtual Vec2 getVisibleOrigin () const
 Get the visible origin point of opengl viewport.
 
virtual Rect getVisibleRect () const
 Get the visible rectangle of opengl 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 opengl 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 getScissorRect () const
 Get the current scissor rectangle.
 
virtual void setViewName (std::string_view viewname)
 Set the view name.
 
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 opengl 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.
 
void renderScene (Scene *scene, Renderer *renderer)
 Renders a Scene with a Renderer This method is called directly by the Director.
 
- 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.
 

Static Public Member Functions

static void setGLContextAttrs (GLContextAttrs &glContextAttrs)
 Static method and member so that we can modify it on all platforms before create OpenGL context.
 
static GLContextAttrs getGLContextAttrs ()
 Return the OpenGL context attrs.
 

Static Public Attributes

static GLContextAttrs _glContextAttrs
 The OpenGL context attrs.
 

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 GLView 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.

◆ setGLContextAttrs()

static void setGLContextAttrs ( GLContextAttrs & glContextAttrs)
static

Static method and member so that we can modify it on all platforms before create OpenGL context.

Parameters
glContextAttrsThe OpenGL context attrs.

◆ getGLContextAttrs()

static GLContextAttrs getGLContextAttrs ( )
static

Return the OpenGL context attrs.

Returns
Return the OpenGL context attrs.

◆ getFrameSize()

virtual Vec2 getFrameSize ( ) const
virtual

Get the frame size of EGL view.

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

Returns
The frame size of EGL view.

◆ setFrameSize()

virtual void setFrameSize ( float width,
float height )
virtual

Set the frame size of EGL view.

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

◆ setFrameZoomFactor()

virtual void setFrameZoomFactor ( 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.

◆ getFrameZoomFactor()

virtual float getFrameZoomFactor ( ) 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.

◆ getRetinaFactor()

virtual int getRetinaFactor ( ) const
inlinevirtual

Get retina factor.

Returns
The retina factor.

◆ setContentScaleFactor()

virtual bool setContentScaleFactor ( float )
inlinevirtual

Only works on ios platform.

Set Content Scale of the Factor.

◆ getContentScaleFactor()

virtual float getContentScaleFactor ( ) const
inlinevirtual

Only works on ios platform.

Get Content Scale of the Factor.

◆ isRetinaDisplay()

virtual bool isRetinaDisplay ( ) const
inlinevirtual

Returns whether or not the view is in Retina Display mode.

Returns
Returns whether or not the view is in Retina Display mode.

◆ getVisibleSize()

virtual Vec2 getVisibleSize ( ) const
virtual

Get the visible area size of opengl viewport.

Returns
The visible area size of opengl viewport.

◆ getVisibleOrigin()

virtual Vec2 getVisibleOrigin ( ) const
virtual

Get the visible origin point of opengl viewport.

Returns
The visible origin point of opengl viewport.

◆ getVisibleRect()

virtual Rect getVisibleRect ( ) const
virtual

Get the visible rectangle of opengl viewport.

Returns
The visible rectangle of opengl 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.

◆ getDesignResolutionSize()

virtual const Vec2 & getDesignResolutionSize ( ) const
virtual

Get design resolution size.

Default resolution size is the same as 'getFrameSize'.

Returns
The design resolution size.

◆ setViewPortInPoints()

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

Set opengl 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.

◆ getScissorRect()

virtual Rect getScissorRect ( ) const
virtual

Get the current scissor rectangle.

Returns
The current scissor rectangle.

◆ setViewName()

virtual void setViewName ( std::string_view viewname)
virtual

Set the view name.

Parameters
viewnameA string will be set to the view as name.

◆ 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 opengl view port rectangle.

Returns
Return the opengl 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.

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