예제 #1
0
파일: main.c 프로젝트: WhatDream/LCUI
/*
 * 功能:用于对LCUI进行初始化操作
 * 说明:每个使用LCUI实现图形界面的程序,都需要先调用此函数进行LCUI的初始化
 * */
int LCUI_Init(void)
{
	if( System.is_inited ) {
		return -1;
	}
	System.is_inited = TRUE;
	System.func_atexit = NULL;
	System.exit_code = 0;
	System.state = STATE_ACTIVE;
	System.main_tid = LCUIThread_SelfID();
	LCUI_ShowCopyrightText();
	LCUIApp_Init();
	/* 初始化各个模块 */
	LCUI_InitEvent();
	LCUI_InitFont();
	LCUI_InitTimer();
	LCUI_InitDevice();
	LCUI_InitKeyboard();
	LCUI_InitMouse();
	LCUI_InitCursor();
	LCUI_InitWidget();
	LCUI_InitDisplay();
	{
		LCUI_Pos pos;
		pos.x = LCUIDisplay_GetWidth()/2;
		pos.y = LCUIDisplay_GetHeight()/2;
		/* 让鼠标游标居中显示 */
		LCUICursor_SetPos( pos );
		LCUICursor_Show();
	}
	return 0;
}
예제 #2
0
파일: main.c 프로젝트: yydaor/LCUI
/* 
 * 功能:用于对LCUI进行初始化操作 
 * 说明:每个使用LCUI实现图形界面的程序,都需要先调用此函数进行LCUI的初始化
 * */
LCUI_API int
LCUI_Init( int mode, void *arg )
{
	int temp;
	/* 如果LCUI没有初始化过 */
	if( !LCUI_Sys.init ) {
		LCUI_Sys.init = TRUE;
		LCUI_Sys.state = ACTIVE;
		srand(time(NULL));
		LCUI_ShowCopyrightText();
		
		LCUI_Sys.mode = mode;
#ifdef LCUI_BUILD_IN_WIN32
		Win32_LCUI_Init((HINSTANCE)arg );
#endif
		LCUIAppList_Init();
		/* 注册程序 */
		temp = LCUIAppList_Add();
		if(temp != 0) {
			printf(APP_ERROR_REGISTER_ERROR);
			abort();
		}
		/* 初始化各个模块 */
		LCUIModule_Thread_Init();
		LCUIModule_Event_Init();
		LCUIModule_IME_Init();
		LCUIModule_Font_Init();
		LCUIModule_Timer_Init();
		LCUIModule_Device_Init();
		LCUIModule_Keyboard_Init();
		LCUIModule_Mouse_Init();
		LCUIModule_TouchScreen_Init();
		LCUIModule_Video_Init();
		LCUIModule_Cursor_Init();
		LCUIModule_Widget_Init();
		/* 让鼠标游标居中显示 */
		LCUICursor_SetPos( LCUIScreen_GetCenter() );  
		LCUICursor_Show();
	} else {
		temp = LCUIAppList_Add();
		if(temp != 0) {
			printf(APP_ERROR_REGISTER_ERROR);
			abort();
		}
	}
	/* 注册默认部件类型 */
	Register_DefaultWidgetType();
	return 0;
}