本文整理汇总了C++中WindowPtr::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowPtr::Width方法的具体用法?C++ WindowPtr::Width怎么用?C++ WindowPtr::Width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowPtr
的用法示例。
在下文中一共展示了WindowPtr::Width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
GLRenderWindow::GLRenderWindow()
:GLFrameBuffer(false)
{
WindowPtr win = Engine::Instance().AppInstance().MainWnd();
//callback
win->PaintEvent.connect(std::bind(&GLRenderWindow::OnPaint, this));
win->CloseEvent.connect(std::bind(&GLRenderWindow::OnClose, this));
win->ExitSizeMoveEvent.connect(std::bind(&GLRenderWindow::OnExitSizeMove, this));
win->EnterSizeMoveEvent.connect(std::bind(&GLRenderWindow::OnEnterSizeMove, this));
win->SizeEvent.connect(std::bind(&GLRenderWindow::OnSize, this, std::placeholders::_1));
win->ActiveEvent.connect(std::bind(&GLRenderWindow::OnActive, this, std::placeholders::_1));
hWnd_ = win->HWnd();
hDC_ = ::GetDC(hWnd_);
left_ = 0;
top_ = 0;
width_ = win->Width();
height_ = win->Height();
int style = WS_OVERLAPPEDWINDOW;
RECT rc = { 0, 0, static_cast<LONG>(width_), static_cast<LONG>(height_) };
::AdjustWindowRect(&rc, style, false);
::SetWindowLongPtrW(hWnd_, GWL_STYLE, style);
::SetWindowPos(hWnd_, nullptr, left_, top_, width_, height_, SWP_SHOWWINDOW | SWP_NOZORDER);
// there is no guarantee that the contents of the stack that become
// the pfd are zeroed, therefore _make sure_ to clear these bits.
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = static_cast<BYTE>(32);
pfd.cDepthBits = static_cast<BYTE>(24);
pfd.cStencilBits = static_cast<BYTE>(8);
pfd.iLayerType = PFD_MAIN_PLANE;
int pixelFormat = ::ChoosePixelFormat(hDC_, &pfd);
//static_assert(, L"sd");
::SetPixelFormat(hDC_, pixelFormat, &pfd);
HGLRC tempContext = ::wglCreateContext(hDC_);
::wglMakeCurrent(hDC_, tempContext);
GLenum err = glewInit();
if (GLEW_OK != err)
{
printf("GLEW is not initialized!");
}
int OpenGLVersion[2];
glGetIntegerv(GL_MAJOR_VERSION, &OpenGLVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &OpenGLVersion[1]);
int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, OpenGLVersion[0],
WGL_CONTEXT_MINOR_VERSION_ARB, OpenGLVersion[1],
WGL_CONTEXT_FLAGS_ARB, 0,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0
};
if (wglewIsSupported("WGL_ARB_create_context") == 1)
{
hRC_ = wglCreateContextAttribsARB(hDC_, 0, attribs);
wglMakeCurrent(NULL, NULL);
wglDeleteContext(tempContext);
wglMakeCurrent(hDC_, hRC_);
}
else
{
hRC_ = tempContext;
}
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//::ShowWindow(hWnd_, SW_SHOWNORMAL);
::UpdateWindow(hWnd_);
}