-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindowManager.cpp
30 lines (24 loc) · 1.09 KB
/
windowManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "windowManager.h"
#include <GL/glut.h> // Include GLUT for window handling
// Constructor
WindowManager::WindowManager(int& argc, char** argv) {
glutInit(&argc, argv); // Initialize GLUT with command line arguments
}
WindowManager::~WindowManager() {
glutDestroyWindow(windowID); // Destroy the window on cleanup
}
void WindowManager::createWindow(const char* title, int width, int height, int posX, int posY) {
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // Set the display mode
glutInitWindowSize(width, height); // Set window size
glutInitWindowPosition(posX, posY); // Set window position
windowID = glutCreateWindow(title); // Create window with title and store the window ID
}
void WindowManager::setDisplayFunction(void (*displayFunc)()) {
glutDisplayFunc(displayFunc); // Set the display callback function
}
void WindowManager::setIdleFunction(void (*idleFunc)()) {
glutIdleFunc(idleFunc); // Set the idle callback function
}
void WindowManager::startEventLoop() {
glutMainLoop(); // Start the GLUT event processing loop
}