void CL_DisplayWindow_OpenGL::destroy_window()
{
	install_event_handler(0, 1);

	if (context)
		aglSetCurrentContext(0);

	if (fs_context)
	{
		aglDestroyContext(fs_context);
		fs_context = 0;
	}

	if (win_context)
	{
		aglDestroyContext(win_context);
		win_context = 0;
	}

	keyboard = CL_InputDevice();
	mouse = CL_InputDevice();
	get_ic()->clear();

	if (window_ref)
		ReleaseWindow(window_ref);
	window_ref = 0;
}
예제 #2
0
파일: sread.c 프로젝트: duoduocy/xmertl
int kmain (void) 
{
	struct xmitimerval req = {{0, 200000}, {0, 0}};
	struct xmtimespec st, et;
	int count = 0;
	long tm;
	long baud = 156000;
	int ret;


	ret = serial_device_init(my_Console_ttyS, baud);

	set_timer(&req, 0);
	
	install_event_handler(0, timer_handler);

	unmask_event(0);
	enable_events_flag();
	
	//rt_serial_write(string, 30);
	while (1) { 
		suspend_domain (0, 0);
		do {
			ret = rt_serial_read(string, 1024);
			if(ret > 0) {
					count ++;
					if(count == 1) get_time(&st);
					else if(count == 100) {
							get_time(&et);
							write_scr("\n\n", 2);
							
							tm = et.tv_sec-st.tv_sec;
							hexprint(tm);
							hexprint(et.tv_nsec);
							hexprint(st.tv_nsec);
							
							count = 0;
					}
			}
		} while(ret > 0);
	}
	
	return 0;
}
void CL_DisplayWindow_OpenGL::set_fullscreen(int width, int height, int bpp, int refresh_rate)
{
	if(fullscreen)
		return;

	CGCaptureAllDisplays();
	
	aglSetCurrentContext(fs_context);
	aglSetFullScreen(fs_context, width, height, refresh_rate, 0);

	context = fs_context;
	install_event_handler(GetApplicationEventTarget());
	
	fullscreen = true;
	focus = true;

	//After toggling to the fullscreen context, nothing is going draw unless
	//we reapply the GL states/properties -mrfun 6-2-2006
	CL_GLStateChecker::from_gc(get_gc())->reinitialize_asap();
}
void CL_DisplayWindow_OpenGL::set_windowed()
{
	if(!fullscreen)
		return;

	if (context == fs_context)
	{
	    aglSetDrawable(fs_context, 0);
	}
	
	CGReleaseAllDisplays();
	aglSetCurrentContext(win_context);
	aglUpdateContext(win_context);
	install_event_handler(GetWindowEventTarget(window_ref));

	fullscreen = false;
	context = win_context;
	focus = IsWindowHilited(window_ref);
	
	//After toggling to the fullscreen context, nothing is going draw unless
	//we reapply the GL states/properties -mrfun 6-2-2006
	CL_GLStateChecker::from_gc(get_gc())->reinitialize_asap();
	
}