Esempio n. 1
0
void GlDisplayService::destroyWindow(int windowHandle)
{
    GLFWwindow* window = getWindowPointer(windowHandle);
    m_freeHandles.push_back(windowHandle);
    m_context.destroyWindow(window);
    m_windows[windowHandle] = nullptr;
}
Esempio n. 2
0
LRESULT CALLBACK RunLoop::RunLoopWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    if (RunLoop* runLoop = static_cast<RunLoop*>(getWindowPointer(hWnd, 0)))
        return runLoop->wndProc(hWnd, message, wParam, lParam);

    if (message == WM_CREATE) {
        LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam);

        // Associate the RunLoop with the window.
        setWindowPointer(hWnd, 0, createStruct->lpCreateParams);
        return 0;
    }

    return ::DefWindowProc(hWnd, message, wParam, lParam);
}
Esempio n. 3
0
void Drawing::eventHandler() {
	//Event handler
	SDL_Event e;

	//While application is running
	while( Quit == false)
	{
		//Handle events on queue

		//update surface
		if(refresh) {
			SDL_UpdateWindowSurface( getWindowPointer());//Window );

			// similarly event driven
			refresh = false;
		}
		while( SDL_PollEvent( &e ) != 0 )
		{
			//User requests quit
			if( e.type == SDL_QUIT )
			{
				Quit = true;
				//break;
			}
			else if( e.type == SDL_KEYDOWN) {
				// for test
				if(e.key.keysym.sym == SDLK_a) {
					cout << "A" << endl;
					for(int i = 0; i < ScreenHeight/10; i++) {
						for(int j = 0; j < ScreenWidth/10; j++) {
							//cout << getPixel(i*10, j*10) << ' ';
							setPixel(i*10, j*10, (0xff << 16));
						}
					}
					setRefresh(true);
					restart = true;
				}
			}
		}
	}
}
Esempio n. 4
0
void GlDisplayService::swapBuffers(int windowHandle)
{
    GLFWwindow* window = getWindowPointer(windowHandle);
    m_context.swapBuffers(window);
}
Esempio n. 5
0
void GlDisplayService::setWindowTitle(int windowHandle, const char* title)
{
    GLFWwindow* window = getWindowPointer(windowHandle);
    m_context.setWindowTitle(window, title);
}
Esempio n. 6
0
bool GlDisplayService::windowShouldClose(int windowHandle) const
{
    GLFWwindow* window = getWindowPointer(windowHandle);
    return m_context.windowShouldClose(window);
}