mirror of https://github.com/axmolengine/axmol.git
fixed #526 Wrap glScissor in CCEGLVIew::setScissorInPoints.
This commit is contained in:
parent
bf99245dbb
commit
59f37ddb5d
|
@ -231,6 +231,26 @@ void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
|
|||
(GLint)h);
|
||||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
||||
{
|
||||
if (m_bNotHVGA)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glScissor((GLint)(x * factor) + m_rcViewPort.origin.x,
|
||||
(GLint)(y * factor) + m_rcViewPort.origin.y,
|
||||
(GLint)(w * factor),
|
||||
(GLint)(h * factor));
|
||||
}
|
||||
else
|
||||
{
|
||||
glScissor((GLint)x,
|
||||
(GLint)y,
|
||||
(GLint)w,
|
||||
(GLint)h);
|
||||
}
|
||||
}
|
||||
|
||||
CCEGLView& CCEGLView::sharedOpenGLView()
|
||||
{
|
||||
static CCEGLView instance;
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
bool canSetContentScaleFactor();
|
||||
void setContentScaleFactor(float contentScaleFactor);
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
|
||||
|
|
|
@ -145,6 +145,25 @@ void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
|
|||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
||||
{
|
||||
if (m_bNotHVGA)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glScissor((GLint)(x * factor) + m_rcViewPort.origin.x,
|
||||
(GLint)(y * factor) + m_rcViewPort.origin.y,
|
||||
(GLint)(w * factor),
|
||||
(GLint)(h * factor));
|
||||
}
|
||||
else
|
||||
{
|
||||
glScissor((GLint)x,
|
||||
(GLint)y,
|
||||
(GLint)w,
|
||||
(GLint)h);
|
||||
}
|
||||
}
|
||||
|
||||
CCEGLView& CCEGLView::sharedOpenGLView()
|
||||
{
|
||||
static CCEGLView instance;
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
bool canSetContentScaleFactor();
|
||||
void setContentScaleFactor(float contentScaleFactor);
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
CCRect getViewPort();
|
||||
float getScreenScaleFactor();
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
|
|
@ -49,7 +49,8 @@ public:
|
|||
void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||
void swapBuffers();
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
|
||||
void touchesBegan(CCSet *set);
|
||||
void touchesMoved(CCSet *set);
|
||||
void touchesEnded(CCSet *set);
|
||||
|
|
|
@ -116,6 +116,11 @@ void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
|
|||
glViewport((GLint)x, (GLint)y, (GLint)w, (GLint)h);
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
||||
{
|
||||
glScissor((GLint)x, (GLint)y, (GLint)w, (GLint)h);
|
||||
}
|
||||
|
||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||
{
|
||||
if (bOpen)
|
||||
|
|
|
@ -444,6 +444,18 @@ void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
|
|||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
||||
{
|
||||
if (m_pEGL)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glScissor((GLint)(x * factor) + m_rcViewPort.left,
|
||||
(GLint)(y * factor) + m_rcViewPort.top,
|
||||
(GLint)(w * factor),
|
||||
(GLint)(h * factor));
|
||||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setIMEKeyboardState(bool /*bOpen*/)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
int setDeviceOrientation(int eOritation);
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
|
||||
|
|
|
@ -658,6 +658,18 @@ void CCEGLView::setViewPortInPoints(float x, float y, float w, float h)
|
|||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
|
||||
{
|
||||
if (m_pEGL)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glScissor((GLint)(x * factor) + m_rcViewPort.X(),
|
||||
(GLint)(y * factor) + m_rcViewPort.Y(),
|
||||
(GLint)(w * factor),
|
||||
(GLint)(h * factor));
|
||||
}
|
||||
}
|
||||
|
||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||
{
|
||||
do
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
void setContentScaleFactor(float contentScaleFactor);
|
||||
void setAnimationInterval(double interval) {};
|
||||
void setViewPortInPoints(float x, float y, float w, float h);
|
||||
void setScissorInPoints(float x, float y, float w, float h);
|
||||
void setIMEKeyboardState(bool bOpen);
|
||||
// static function
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue