/** 新建帧数控制实例 */ FrameCtrlCtx FrameControl_Create( void ) { FrameCtrlCtx ctx; ctx = (FrameCtrlCtx)malloc(sizeof(struct FrameControlContext)); ctx->temp_fps = 0; ctx->current_fps = 0; ctx->pause_time = 0; ctx->one_frame_remain_time = 10; ctx->prev_frame_start_time = LCUI_GetTickCount(); ctx->prev_fps_update_time = LCUI_GetTickCount(); LCUICond_Init( &ctx->wait_continue ); LCUICond_Init( &ctx->wait_pause ); LCUIMutex_Init( &ctx->mutex ); LCUIMutex_Lock( &ctx->mutex ); return ctx; }
LCUI_Worker LCUIWorker_New( void ) { LCUI_Worker worker = NEW( LCUI_WorkerRec, 1 ); LCUIMutex_Init( &worker->mutex ); LCUICond_Init( &worker->cond ); LinkedList_Init( &worker->tasks ); worker->active = FALSE; worker->thread = 0; return worker; }
/** 初始化程序数据结构体 */ static void LCUIApp_Init(void) { LCUICond_Init( &MainApp.loop_cond ); LCUIMutex_Init( &MainApp.loop_changed ); LCUIMutex_Init( &MainApp.loop_mutex ); LinkedList_Init( &MainApp.loop_list, sizeof(LCUI_MainLoop)); LinkedList_SetDataNeedFree( &MainApp.loop_list, FALSE ); LCUIMutex_Init( &MainApp.task_run_mutex ); LCUIMutex_Init( &MainApp.task_list_mutex ); LinkedList_Init( &MainApp.task_list, sizeof(LCUI_Task) ); LinkedList_SetDestroyFunc( &MainApp.task_list, DestroyTask ); }
FrameControl FrameControl_Create( void ) { FrameControl ctx; ctx = NEW( FrameControlRec, 1 ); ctx->temp_fps = 0; ctx->current_fps = 0; ctx->pause_time = 0; ctx->one_frame_remain_time = 10; ctx->prev_frame_start_time = LCUI_GetTime(); ctx->prev_fps_update_time = LCUI_GetTime(); LCUICond_Init( &ctx->cond ); LCUIMutex_Init( &ctx->mutex ); return ctx; }
StepTimer StepTimer_Create( void ) { StepTimer timer; timer = NEW( StepTimerRec, 1 ); timer->temp_fps = 0; timer->current_fps = 0; timer->pause_time = 0; timer->one_frame_remain_time = 10; timer->prev_frame_start_time = LCUI_GetTime(); timer->prev_fps_update_time = LCUI_GetTime(); LCUICond_Init( &timer->cond ); LCUIMutex_Init( &timer->mutex ); return timer; }
/** 初始化事件模块 */ static void LCUI_InitEvent(void) { LCUICond_Init( &System.event.cond ); System.event.box = LCUIEventBox_Create(); LCUIThread_Create( &System.event.tid, SystemEventThread, NULL ); }
static void TestWorker_Init( TestWorker worker ) { LCUIMutex_Init( &worker->mutex ); LCUICond_Init( &worker->cond ); }