mirror of https://github.com/axmolengine/axmol.git
issue #2460: optimize EGLView interface
This commit is contained in:
parent
d73b8e8b23
commit
99f88df8d2
|
@ -132,9 +132,13 @@ EGLView::~EGLView()
|
||||||
s_pEglView = nullptr;
|
s_pEglView = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EGLView::create()
|
bool EGLView::init(const char* viewName, float width, float height)
|
||||||
{
|
{
|
||||||
if(nullptr != _mainWindow) return true;
|
if(nullptr != _mainWindow) return true;
|
||||||
|
|
||||||
|
setViewName(viewName);
|
||||||
|
setFrameSize(width, height);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||||
glfwMakeContextCurrent(_mainWindow);
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
|
|
@ -32,8 +32,7 @@ public:
|
||||||
virtual void setFrameSize(float width, float height);
|
virtual void setFrameSize(float width, float height);
|
||||||
virtual void setIMEKeyboardState(bool bOpen);
|
virtual void setIMEKeyboardState(bool bOpen);
|
||||||
|
|
||||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
bool init(const char* viewName, float width, float height);
|
||||||
virtual bool create();
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//void resize(int width, int height);
|
//void resize(int width, int height);
|
||||||
|
|
|
@ -44,8 +44,7 @@ public:
|
||||||
virtual void setFrameSize(float width, float height);
|
virtual void setFrameSize(float width, float height);
|
||||||
virtual void setIMEKeyboardState(bool bOpen);
|
virtual void setIMEKeyboardState(bool bOpen);
|
||||||
|
|
||||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
bool init(const char* viewName, float width, float height);
|
||||||
virtual bool create();
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//void resize(int width, int height);
|
//void resize(int width, int height);
|
||||||
|
|
|
@ -149,9 +149,13 @@ EGLView::~EGLView()
|
||||||
s_pEglView = nullptr;
|
s_pEglView = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EGLView::create()
|
bool EGLView::init(const char *viewName, float width, float height)
|
||||||
{
|
{
|
||||||
if(nullptr != _mainWindow) return true;
|
if(nullptr != _mainWindow) return true;
|
||||||
|
|
||||||
|
setViewName(viewName);
|
||||||
|
setFrameSize(width, height);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||||
glfwMakeContextCurrent(_mainWindow);
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
|
|
@ -245,9 +245,13 @@ EGLView::~EGLView()
|
||||||
s_pEglView = nullptr;
|
s_pEglView = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EGLView::create()
|
bool EGLView::init(const char* viewName, float width, float height)
|
||||||
{
|
{
|
||||||
if(nullptr != _mainWindow) return true;
|
if(nullptr != _mainWindow) return true;
|
||||||
|
|
||||||
|
setViewName(viewName);
|
||||||
|
setFrameSize(width, height);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||||
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
_mainWindow = glfwCreateWindow(_screenSize.width, _screenSize.height, _viewName, nullptr, nullptr);
|
||||||
glfwMakeContextCurrent(_mainWindow);
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
|
|
@ -49,8 +49,7 @@ public:
|
||||||
virtual void setFrameSize(float width, float height);
|
virtual void setFrameSize(float width, float height);
|
||||||
virtual void setIMEKeyboardState(bool bOpen);
|
virtual void setIMEKeyboardState(bool bOpen);
|
||||||
|
|
||||||
//void setWndProc(CUSTOM_WND_PROC proc);
|
bool init(const char* viewName, float width, float height);
|
||||||
virtual bool create();
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//void resize(int width, int height);
|
//void resize(int width, int height);
|
||||||
|
|
|
@ -14,8 +14,6 @@ int main(int argc, char **argv)
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = new EGLView();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("TestCpp");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(900, 640);
|
|
||||||
eglView->create();
|
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = new EGLView();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("TestCpp");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(900, 640);
|
|
||||||
eglView->create();
|
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView *eglView = new EGLView();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("TestCpp");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(480, 320);
|
|
||||||
eglView->create();
|
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue