WindowsManager::WindowsManager(void) { m_window1 = -1; m_window2 = -1; //m_subWindow = true m_subWindow = false; m_fullScreen = false; m_width = IntialSize; m_height = IntialSize; getDesktopResolution(); m_previous = 0; }
/* Entry point of program */ int main(int argc, char* argv[]) { getDesktopResolution(width, height); char* message = "Dave Ogle - Assignment 1"; wrapper_glfw *glw = new wrapper_glfw(width, height, message); if (!ogl_LoadFunctions()) { fprintf(stderr, "ogl_LoadFunctions() failed. Exiting\n"); return 0; } glw->setRenderer(display); glw->setKeyCallback(keyCallback); glw->setReshapeCallback(reshape); init(glw); glw->eventLoop(); delete(glw); return 0; }
void WindowsManager::setFullScreen(bool enable) { m_fullScreen = enable; if(m_fullScreen) { if(m_subWindow) { getDesktopResolution(); if(m_window2Rect.bottom==-1)//one screen available { glutFullScreen(); } else { //Fullscreen in subwindow mode required the same resolution on both screen //and the second screen has to been on the right of the first screen glutPositionWindow(m_window1Rect.left-IntialMargin/2,m_window1Rect.top-30); glutReshapeWindow(m_window2Rect.right-m_window1Rect.left,m_window1Rect.bottom - m_window1Rect.top); } } else { getDesktopResolution(); if(m_window2Rect.bottom==-1)//one screen available { setCurrentWindow(0); glutPositionWindow(m_window1Rect.left,m_window1Rect.top); glutReshapeWindow((m_window1Rect.right- m_window1Rect.left)/2-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); setCurrentWindow(1); glutPositionWindow((m_window1Rect.right- m_window1Rect.left)/2,m_window1Rect.top); glutReshapeWindow((m_window1Rect.right - m_window1Rect.left)/2-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); } else //two screens { setCurrentWindow(0); glutPositionWindow(m_window1Rect.left,m_window1Rect.top); glutReshapeWindow(m_window1Rect.right - m_window1Rect.left-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); setCurrentWindow(1); glutPositionWindow(m_window2Rect.left,m_window2Rect.top); glutReshapeWindow(m_window2Rect.right - m_window2Rect.left-IntialMargin,m_window2Rect.bottom - m_window2Rect.top-IntialMargin); } } } else { if(m_subWindow) { setCurrentWindow(0); glutPositionWindow(IntialPosition,IntialPosition); glutReshapeWindow(IntialSize*2,IntialSize); } else { setCurrentWindow(0); glutPositionWindow(IntialPosition,IntialPosition); glutReshapeWindow(IntialSize,IntialSize); setCurrentWindow(1); glutPositionWindow(IntialPosition+IntialSize+IntialMargin,IntialPosition); glutReshapeWindow(IntialSize,IntialSize); } } }