示例#1
0
void CLogManager::WriteLog(CLogInfo &oLogInfo, bool bSupportNet)
{
	if(m_bHold)
	{
		GetLogDate(oLogInfo.sDate);
		m_oLogBuffer.Push(oLogInfo);
	}
	else
	{
		CAfcLogAttr& oLogAttr = GetLogAttr(oLogInfo.sModuleName);
		if( (oLogAttr.nMode & FOCP_LOG_SCREEN) || (oLogAttr.nMode & FOCP_LOG_FILE) )
		{
			char sLogInfo[FOCP_LOG_MAXMSG];
			uint32 nLen = GetLogInfo(oLogAttr.nFilter, oLogInfo, sLogInfo);
			if(oLogAttr.nMode & FOCP_LOG_SCREEN)
				PrintScreen(oLogInfo.nLevel, sLogInfo, nLen);
			if(oLogAttr.nMode & FOCP_LOG_FILE)
				PrintFile(sLogInfo, nLen);
		}
		if(bSupportNet && (oLogAttr.nMode & FOCP_LOG_SERVER))
		{
			char sLogInfo[FOCP_LOG_MAXMSG];
			uint32 nLen = CreateLogMsg(oLogInfo, sLogInfo);
			PrintServer(sLogInfo, nLen);
		}
	}
}
示例#2
0
void Interface::MakePrintScreen()
{
     bool ok;
     int i = QInputDialog::getInteger(this, tr("Wait Sec. to PrintScreen...."),
                                      tr("Wait Sec. to PrintScreen....<br>Sec: from 1/10"), 1, 1, 10, 1, &ok);
    if (ok && i > 0 && i < 11) {
        QTimer::singleShot(i * 1000, this, SLOT(PrintScreen()));  
    }
}
示例#3
0
文件: Main.cpp 项目: adan830/FKEngine
	void KeyDown( FK2DEngine::CKey p_Key )
	{
		if( p_Key == FK2DEngine::EKB_Escape )
		{
			Close();
		}
		else if( p_Key == FK2DEngine::EKB_PrintScreen )
		{
			PrintScreen( FK2DEngine::ShareResourcePrefix() + L"Screen\\" + ToString( GetTime() ) + L".bmp" );
		}
	}
示例#4
0
BOOL CPKApplication::Init(const TCHAR* pszConfigFilename)
{
    if (FALSE == CPKApplication::Init(pszConfigFilename))
    {
        return FALSE;
    }

    PrintScreen(_SDT("PKApplication::Init successful"));

    if(FALSE == CPKConfig::CreateInstance())
    {
        return FALSE;
    }
    if(!CPKConfig::Instance()->Init(pszConfigFilename))
    {
        USR_INFO(_SDT("CPKConfig::Init failed!"));
        return FALSE;
    }

    if(!m_oSQLMemoryPool.Create(MAX_SQL_LEN , MAX_SQL_LEN * 4))
    {
        return FALSE;
    }

    //初始化db模块
    if(FALSE == m_oDBMgr.Init())
    {
        USR_INFO(_SDT("[%s: %d]:CDBMgr init failed"), MSG_MARK);
        return FALSE;
    }

    //初始化游戏逻辑模块
    if (FALSE == CLogicModel::CreateInstance())
    {
        USR_INFO(_SDT("[%s: %d]:Create CLogicModel failed"), MSG_MARK);
        return FALSE;
    }

    if(FALSE == CLogicModel::Instance()->Init())
    {
        USR_INFO(_SDT("[%s: %d]:Create CLogicModel Init failed"), MSG_MARK);
        return FALSE;
    }

    return TRUE;
}
示例#5
0
  void AppWindow::
  Keyboard(unsigned char key,
	   int mousex,
	   int mousey)
  {
    m_simul->m_world->DispatchKey(key);
    switch(key){
    case ' ':
      m_simul->m_step = true;
      m_simul->m_continuous = false;
      m_simul->m_printscreen = false;
      break;
    case 'c':
      m_simul->m_step = false;
      m_simul->m_continuous = true;
      m_simul->m_printscreen = false;
      break;
    case 'p':
      if( ! m_simul->m_printscreen)
	PrintScreen();
      break;
    case 'P':
      m_simul->m_step = false;
      m_simul->m_continuous = true;
      m_simul->m_printscreen = true;
      break;    
    case 'q':
      cout << "\nbye bye!\n";
      exit(EXIT_SUCCESS);
      //    default:
      //// used to have fancy layout switching... that could be
      //// resurected with a little 'layout-key' parameter for each
      //// View.
      //
      // layout_map_t::const_iterator il(m_layout.find(key));
      // if (il != m_layout.end()) {
      // 	if ((m_active_layout == m_default_layout)
      // 	    || (m_active_layout != il->second))
      // 	  m_active_layout = il->second;
      // 	else
      // 	  m_active_layout = m_default_layout;
      // }
    }
  }
示例#6
0
文件: Outputer.cpp 项目: jkrecek/SeEx
void Outputer::IncreasePhase()
{
    phaseLenght[cur_phase] = getMSTime() - phaseStart;
    phaseDLed[cur_phase] = totalDLed - phaseStartDLed;

#ifdef WIN32
    PrintLine(endline+PhaseEnd[cur_phase]);
#endif

    ++cur_phase;
    phaseStart = getMSTime();
    phaseStartDLed = totalDLed;

#ifdef WIN32
    PrintLine(endline+PhaseHeader[cur_phase]);
#else
    PrintScreen();
#endif
}
示例#7
0
int ShowOnlyInstance()
{
	char local_process_name[128] = "";
	char *pdest = NULL;
	char eMsg[1024] = "";
	GetModuleFileName(NULL, local_process_name, sizeof(local_process_name));
	pdest = strrchr(local_process_name, SPLIT1);
	memcpy(current_process_name, pdest + 1, strlen(pdest));

	HANDLE m_hMutex = CreateMutex(NULL, TRUE, current_process_name); 
	if (GetLastError() == ERROR_ALREADY_EXISTS) 
	{
		strcpy(eMsg, "实例已经激活");
		PrintScreen(PRINT_MAIN, eMsg);
		return FALSE; 
	}

	return TRUE;
}
示例#8
0
文件: Outputer.cpp 项目: jkrecek/SeEx
Outputer::Outputer()
{
    time_m = new QTime();
    cur_phase = totalDLed = phaseStartDLed = 0;
    for(uint i = 0; i < PHASE_COUNT; ++i)
        current[i] = max[i] = special[i] = error[i] = phaseLenght[i] = phaseDLed[i] = 0;

    uint par_dl = sConfig.get(CONF_UINT_PAR_DL);
    downloadStart = new int[par_dl]();
    speeds = new int[par_dl]();

    phaseStart = getMSTime();

#ifdef WIN32
     PrintLine(PhaseHeader[cur_phase]);
#else
     timer_m = new QTimer(this);
     connect(timer_m, SIGNAL(timeout()), this, SLOT(PrintScreen()));
     timer_m->start(750);
#endif
}
示例#9
0
// 执行后台功能号
int FKBDC847326(KBDCHandle ch)
{
	char eMsg[1024] = "";		// 注意尽量给出缓存为 >=1024字节
	char fvalue[1024] = "";		// 注意必须给出缓存为 >=1024字节
	int rtn = 0;
	int recno = 0;
	
	strcpy(eMsg, "Set Request to 847326");
	PrintScreen(PRINT_MAIN, eMsg);

	rtn = KBDCBeginRequest(ch, 847326, eMsg);
	if (rtn <0)
	{
		PrintScreen(PRINT_MAIN, eMsg);
		DEBUG_CARD_MSGOUT(rtn, eMsg);
		return rtn ;
	}
	
	KBDCSetFieldValue(ch, "scard0", current_func_file);			// 文件名
	sprintf(eMsg, "Send request and receive answer at Time:%u", GetTickCount());
	PrintScreen(PRINT_MAIN, eMsg);
	if (rtn = KBDCCallSvr(ch, 500000, eMsg) < 0)
	{
		PrintScreen(PRINT_MAIN, eMsg);
		DEBUG_CARD_MSGOUT(rtn, eMsg);
		return rtn;
	}

	sprintf(eMsg, "Return Code:%d at Time:%u", KBDCGetRetCode(ch), GetTickCount());
	PrintScreen(PRINT_MAIN, eMsg);
	do 
	{
		rtn = KBDCGetRetCode(ch);
		if (rtn == 0)
		{
			sprintf(eMsg, "KBDCGetRetCode=[%d]", rtn);
			PrintScreen(PRINT_MAIN, eMsg);
		}
		else
		{
			return rtn;
		}
		recno++;
	} while(KBDCNextRetRecord(ch,eMsg)>=0);
	// 结束了一个请求和应答过程的测试。。。

	return 0;
}
void CinematicWin(PLAYERNAME winner,PLAYERNAME looser)
{
    char * Playernames[]= {"Mokhtar","Haitham","Brahim","Salah","Wassim"};
    char buffer[500];
    float w,h=102,x=-10,i=0;
    IMAGE *winImage,*loseImage;

    sprintf(buffer,"Resources/Images/%s/win.png",Playernames[winner]);
    winImage=load_image(buffer);
    sprintf(buffer,"Resources/Images/%s/lose.png",Playernames[looser]);
    loseImage=load_image(buffer);

    if(looser!=HAITHAM)
    {
        w=(100/((float)loseImage->h/(float)loseImage->w))/AspectRatio;
        x=50-w/2;
    }
    if(winner==HAITHAM)
    {
        h=120;
    }
    sprintf(buffer,"You must go on without me.\nBut you can't do it alone.\nYou must take my powers in \norder to continue your\njourney... See you in\nthe real world...");
    while(!IsKeyPressed(3,ENTER) && !IsKeyPressed(3,RETURN) && i<(FPS*10))
    {
        draw_image_ex(loseImage,x,0,0,100,NONE,i-FPS);
        draw_image_ex(winImage,0,0,0,h,NONE,i-(float)FPS*2);
        draw_text(SFTransRobotics,buffer,5,80,75,CENTER,i-(float)FPS*4);
        next_frame();
        i++;
    }
    draw_image_ex(loseImage,x,0,0,100,NONE,i-FPS);
    draw_image_ex(winImage,0,0,0,h,NONE,i-(float)FPS*2);
    draw_text(SFTransRobotics,buffer,5,80,75,CENTER,i-(float)FPS*4);
    PrintScreen(1);
    for(i=100; i>=0; i-=0.8)
    {
        draw_image_ex(screenimage,0,0,100,100,NONE,i);
        next_frame();
    }
}
示例#11
0
int main() {
	PrintScreen();
}
示例#12
0
文件: Game.cpp 项目: cblop/monopoly
//-----------------------------------------------------------------------------
void Game::SetupGame()
{
    ClearScreen();
    PrintScreen("Oo      oO  .oOOOo.  o.     O  .oOOOo.  OooOOo.   .oOOOo.   o      o       O \n");
    PrintScreen("O O    o o .O     o. Oo     o .O     o. O     `O .O     o. O       O       o \n");
    PrintScreen("o  o  O  O O       o O O    O O       o o      O O       o o       `o     O' \n");
    PrintScreen("O   Oo   O o       O O  o   o o       O O     .o o       O o         O   o   \n");
    PrintScreen("O        o O       o O   o  O O       o oOooOO'  O       o O          `O'    \n");
    PrintScreen("o        O o       O o    O O o       O o        o       O O           o     \n");
    PrintScreen("o        O `o     O' o     Oo `o     O' O        `o     O' o     .     O     \n");
    PrintScreen("O        o  `OoooO'  O     `o  `OoooO'  o'        `OoooO'  OOoOooO     O     \n");

    PrintScreen("\n\n          Welcome to Monopoly! Press any key to start.");
    getch();
    int numPlayers = 2;
    std::vector<std::string> playerNames;
    std::string currentName = "";
    //std::vector<Player> players;

    ClearScreen();
    PrintScreen("Enter number of players (2 - 6): ");
    numPlayers = atoi(ReadInput().c_str());
    while (numPlayers < 2 || numPlayers > 6) {
        PrintScreen("Please enter a number between 2 and 6: ");
        refresh();
        numPlayers = atoi(ReadInput().c_str());
    }

    m_players.resize(numPlayers);

    for (int i=0;i<numPlayers;i++) {
        ClearScreen();
        printw("What's your name, player %d? ", i+1);
        refresh();
        currentName = ReadInput();
        playerNames.push_back(currentName);
    }

    ClearScreen();
    for (int i=0;i<numPlayers;i++) {
        m_players[i] = new Player(playerNames[i]);
        printw("Player %d: %s\n", i+1, m_players[i]->getName().c_str());
    }

    srand((unsigned)time(0));

    int oldwinner = 0;
    int winner = 0;
    int windex = -1;

    printw("\nNow we'll roll the dice to see who goes first.\n");
    for (int i=0;i<numPlayers;i++) {
        printw("\nPress ENTER to roll, %s.\n", m_players[i]->getName().c_str());
        refresh();
        getch();
        m_dice->roll();
        winner = m_dice->getTotal();
        printw("%s rolled: %d\n", m_players[i]->getName().c_str(), winner);
        refresh();
        if (winner > oldwinner) windex = i;
        oldwinner = winner;
    }

    printw("\n%s goes first.\n", m_players[windex]->getName().c_str());
    refresh();

    m_currentPlayer = windex;
    std::cout << std::endl;

}
示例#13
0
int _tmain(int argc, _TCHAR* argv[])
{
	int ret = 0;
	char eMsg[1024] = "";  // 注意尽量给出缓存为 >=1024字节
	char now_date[9] = "";
	char now_time[7] = "";
	KBDCHandle ch = 0;
	char share_file_name[128] = "share.ks";				// share file named share.ks
	CFileClass file;	// 文件类
	
	if (FALSE == ShowOnlyInstance()) { return FALSE; }

	printf("--------------------------------------------------------\n");
	printf("--describe: AutoRegister_v1.0---------------------------\n");
	printf("--author:   xiang.li------------------------------------\n");
	printf("--date:     2008-08-07----------------------------------\n");
	printf("--company:  kingstar------------------------------------\n");
	printf("--------------------------------------------------------\n");
	
	ret = InitConfig("CardDll.ini");
	if (ret) 
	{ 
		sprintf(eMsg, "read ini file error, errcode=[%d]\n", ret);
		printf(eMsg);
		DEBUG_CARD_MSGOUT(eMsg, ret);
	}

	if (0 == g_ini_file.file_count) 
	{ 
		DEBUG_CARD_MSGOUT(eMsg, ERR_SRCFILE_EXIT);
		return ERR_SRCFILE_EXIT; 
	}

	// 1. 寻找当前register.txt文件, 寻找到了进入2否则进入1
	// 2. 将register.txt文件传送到后台目录, 成功到3, 否则进入1
	// 3. 执行后台功能847326, 将文件解析到数据库中, 成功到4, 否则进入1
	// 4. 移动目录中的register.txt文件到其他目录存放

	// 主线程仅仅用于屏幕输出, 子线程用于传送文件和执行功能号
	///////////////////////////////// Begin1 //////////////////////////////////////
	// 以下这个函数必须在主线程内,启用其他函数之前调用,并且必须为成功才行
#ifdef _DEBUG
	if (KBDCInit(1,"",eMsg) < 0)
#else
	if (KBDCInit(0,"",eMsg) < 0)
#endif
	{
		PrintScreen(PRINT_MAIN, eMsg);
		DEBUG_CARD_MSGOUT(ERR_KBDC_INIT, eMsg);
		return ERR_KBDC_INIT;
	}
	else
	{
		while (TRUE)
		{	
			if (!file.Open(share_file_name, file.modeRead))
			{
				sprintf(eMsg, "%s不存在", share_file_name);
				PrintScreen(PRINT_MAIN, eMsg);
				SetLastErrMsg(ret, eMsg);
				DEBUG_CARD_MSGOUT(g_errcode, g_errmsg);
				Sleep(TIME_WAIT2);
				continue ;
			}
			
			sprintf(eMsg, "%s存在", share_file_name);
			PrintScreen(PRINT_MAIN, eMsg);

			memset(current_func_file, 0, sizeof(current_func_file));
			file.Read(current_func_file, sizeof(current_func_file));
			file.Close();

			if (strncmp(current_func_file, last_func_file, sizeof(current_func_file)) <= 0)
			{
				sprintf(eMsg, "没有最新的当前文件");
				PrintScreen(PRINT_MAIN, eMsg);
				SetLastErrMsg(ret, eMsg);
				DEBUG_CARD_MSGOUT(g_errcode, g_errmsg);
				Sleep(TIME_WAIT2);
				continue ;
			}
			
			Sleep(TIME_WAIT);
			ch = KBDCNewHandle(eMsg);
			if (ch == NULL)
			{
				printf("KBDCNewHandle Error:%s\n",eMsg);
				Sleep(TIME_WAIT2);
				SetLastErrMsg(ret, eMsg);
				DEBUG_CARD_MSGOUT(ret, eMsg);
				continue ;
			}

			// 执行后台功能号
			ret = FKBDC847326(ch);
			if (ret)
			{
				strcpy(eMsg, "847326功能执行失败");
			}
			else
			{
				strcpy(eMsg, "847326功能执行成功");
				memcpy(last_func_file, current_func_file, sizeof(last_func_file));
			}
			KBDCDeleteHandle(ch);
			PrintScreen(PRINT_MAIN, eMsg);
			Sleep(TIME_WAIT2);
		}
	}	

	getchar();
	/////////////////////////////////End of SUB 
	////////////////////////////////// In MainThread ////////////////////////////////////////
	KBDCExit();
	
	return 0;
}
示例#14
0
void
Credits ()
{
    InitAnimatedSkyBackground ();

    int TextPosition1 = 1;
    int TextPosition2 = 1;

    int Textline1 = "PSP-OSS";
    int Textline2 = OSSVersion;
    int Textline3 = "WwW.PsP-OsS.com";
    int Textline4 = "Coded by:";
    int Textline5 = "ELZ";
    int Textline6 = "Canti";
    int Textline7 = "Daurnimator";
    int Textline8 = "Mondy";
    int Textline8AndAHalf = "INK";
    int Textline9 = "GFX by:";
    int Textline10 = "System";
    int Textline11 = "Posty";
    int Textline12 = "Enjoy ;)";
    int Textline13 = "Check PSP-OSS[DOT]COM for updates!";
    int Textline14 = "Oh, I almost forgot; F**K YOU SASUKE!";


    while (1)
    {
        AnimateSkyBackground ();
        GetUserInput ();

        PutTextFont (TextPosition2, 262, "PSP-OSS - WwW.PsP-OsS.CoM", DARK_RED);
        PutTextFont (TextPosition2, 0, "PSP-OSS - WwW.PsP-OsS.CoM", DARK_RED);

        PutTextFont (5, TextPosition1, Textline1, BLACK);
        PutTextFont (20, (TextPosition1 + 10), Textline2, RED);
        PutTextFont (40, (TextPosition1 + 20), Textline3, RED);

        PutTextFont (5, (TextPosition1 + 50), Textline4, ORANGE);
        PutTextFont (5, (TextPosition1 + 60), Textline5, CYAN);
        PutTextFont (5, (TextPosition1 + 70), Textline6, CYAN);
        PutTextFont (5, (TextPosition1 + 80), Textline7, CYAN);
        PutTextFont (5, (TextPosition1 + 90), Textline8, CYAN);
        PutTextFont (5, (TextPosition1 + 100), Textline8AndAHalf, CYAN);

        PutTextFont (5, (TextPosition1 + 130), Textline9, ORANGE);
        PutTextFont (5, (TextPosition1 + 140), Textline10, CYAN);
        PutTextFont (5, (TextPosition1 + 150), Textline11, CYAN);

        PutTextFont (5, (TextPosition1 + 190), Textline12, BLUE);

        PutTextFont (5, (TextPosition1 + 230), Textline13, BLACK);

        PutTextFont (5, (TextPosition1 + 250), Textline14, BLACK);

        PauseVbl (5) TextPosition2++;

        if (TextPosition1 == 272)
        {
            TextPosition1 = 0;
        }

        if (TextPosition2 == 480)
        {
            TextPosition2 = 0;
        }

        PrintScreen ();

        if (pad.Buttons & PSP_CTRL_DOWN)
        {
            TextPosition1++;
        }
        if (pad.Buttons & PSP_CTRL_UP)
        {
            TextPosition1--;
        }


        if (pad.Buttons & PSP_CTRL_START)
        {
            break;
        }
    }
}
示例#15
0
static void * comp_proc(void * para)
{
    int i, j;
    int fd;
    int channel;
    int n_buffers = 0;
    unsigned int length, offset;
    int index, num;
    struct buffer_av buf_av;
    int result;
    struct pollfd pfd;
    unsigned int buf_index;
    unsigned int buf_num;
    char * packet_addr;
    struct packet_header pkt_header;
    Query_Buf_Res * buffers = NULL;				//用于保存获取视频数据
    Spct_Data comp_data;

    int got_video[CHS_PER_CARD];
    int got_audio[CHS_PER_CARD];
    struct timeval v_time_stamp[CHS_PER_CARD];
    struct timeval a_time_stamp[CHS_PER_CARD];
    unsigned int last_vtstamp[CHS_PER_CARD];
    unsigned int last_atstamp[CHS_PER_CARD];
    unsigned int duration;


    DebugPrintf("thread compress\n");

    Ip_Cam_Device * ipcam = (Ip_Cam_Device *) para;

    memset(&buf_av, 0, sizeof(buf_av));

    memset(&got_video, 0, sizeof(got_video));
    memset(&got_audio, 0, sizeof(got_audio));
    memset(&last_vtstamp, 0, sizeof(last_vtstamp));
    memset(&last_atstamp, 0, sizeof(last_atstamp));


    fd = ipcam->comp_fd;
    action_fd = fd;
    n_buffers = request_buffer(fd);

    buffers = calloc(n_buffers, sizeof(* buffers));
    if(!buffers)
            EXIT("Out of memory.");

    for(i = 0; i < n_buffers; ++i)
    {
        if(query_buffer(fd, i, &length, &offset) != 0)
                EXIT("VIDIOC_QUERYBUF");
        buffers[i].length = length;
        buffers[i].start = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset);
        DebugPrintf("buffers[%d].start = 0x%x\n",i, buffers[i].start);
        if(MAP_FAILED == buffers[i].start)
                EXIT("mmap");
    }

    for(index = 0; index < n_buffers; index++)
            if(queue_buffer(fd, index) != 0)
                    EXIT("VIDIOC_QBUF");

    if(streaming_on(fd) != 0)
            EXIT("VIDIOC_STREAMON");
    DebugPrintf("card stream on================================\n");
    pfd.fd = fd;
    pfd.events = POLLIN;

    int comp_proc_count = 0;

    //set_action(fd, catch_sen); // fd threshold time
    /*检测ipcam是否处于运行状态*/
    while(ipcam->status == CAM_STATUS_RUN)
    {
        comp_proc_count++;
        /*定时打印信息*/
        if(comp_proc_count == 3000)
        {
            comp_proc_count = 0;
            PrintScreen("\n----- comp_proc thread running -----\n");
        }

        //IsSetaction(fd);
        /*一个结构体,函数阻塞时间为15s*/
        result = poll(&pfd, 1, 15000);

        /*函数调用失败*/
        if(result < 0)
            DebugPrintf("pool ing errro ==================\n");
        /*在规定时间内没有检测到可读套接字*/
        if(result == 0)
        {
            DebugPrintf("pool ing time out --------------\n");
            exit(1);
        }

        if(result < 0)
            continue;
        if(result == 0)
            continue;

        dequeue_buffer(fd, &buf_av);
        buf_index = buf_av.buf_index;
        buf_num = buf_av.length;
        for(i = 0; i < CHS_PER_CARD; i++)
        {
            index = buf_index & 0xff;
            num = buf_num & 0xff;

            buf_index >>= 8;
            buf_num >>= 8;
            if(index != 0xff)
            {
                /*DATA PACKET*/
                channel = i;

                for(j = 0, packet_addr = buffers[index].start; j < num; j++)
                {
                    /*s数据包处理,动态处理就在此实现*/
                    parse_packet(&packet_addr, &pkt_header);

                    //pkt_header.motion_addr, 4 * 9
                    /*捕捉到动作*/
                    if(pkt_header.motion_flag)
                    {
#if RELEASE_MODE
#else
                        PrintScreen("\n-------------receive a motion------------\n\n");
#endif
                        catchonemotion = 1;
                        is_action = 1;
                    }

                    if (pkt_header.videolost_flag)
                    {
                        //DebugPrintf("video lost\n");
                    }

                    if(pkt_header.audio_flag)
                    {//length
                        if(!got_audio[channel])
                        {
                            got_audio[channel] = 1;
                            //a_time_stamp[channel] = buf_av.timestamp;
                            a_time_stamp[channel].tv_usec = ((pkt_header.audio_timestamp % 32768) * 1000ULL * 1000ULL) >> 15;
                            a_time_stamp[channel].tv_sec = (pkt_header.audio_timestamp >> 15) + (a_time_stamp[channel].tv_usec / 1000000);
                            a_time_stamp[channel].tv_usec %= 1000000;
                        }
                        else
                        {
                            duration = pkt_header.audio_timestamp - last_atstamp[channel];
                            a_time_stamp[channel].tv_usec += ((duration % 32768) * 1000ULL * 1000ULL) >> 15;
                            a_time_stamp[channel].tv_sec += (duration >> 15) + (a_time_stamp[channel].tv_usec / 1000000);
                            a_time_stamp[channel].tv_usec %= 1000000;

                        }
                        last_atstamp[channel] = pkt_header.audio_timestamp;

                        //DebugPrintf("audio frame\n");
                        comp_data.channel = channel;
                        comp_data.type = DATA_AUDIO;
                        comp_data.flags = 0;
                        comp_data.timestamp = a_time_stamp[channel];
                        comp_data.size = pkt_header.audio_length;
                        comp_data.data = pkt_header.audio_addr;
                        ipcam->fun(ipcam->datahandler, &comp_data);
                    }

                    if(pkt_header.video_flag)
                    {
                        if(!got_video[channel])
                        {
                            got_video[channel] = 1;
                            //v_time_stamp[channel] = buf_av.timestamp;
                            v_time_stamp[channel].tv_usec = ((pkt_header.video_timestamp % 32768) * 1000ULL * 1000ULL) >> 15;
                            v_time_stamp[channel].tv_sec = (pkt_header.video_timestamp >> 15) + (v_time_stamp[channel].tv_usec / 1000000);
                            v_time_stamp[channel].tv_usec %= 1000000;
                        }
                        else
                        {
                            duration = pkt_header.video_timestamp - last_vtstamp[channel];
                            v_time_stamp[channel].tv_usec += ((duration % 32768) * 1000ULL * 1000ULL) >> 15;
                            v_time_stamp[channel].tv_sec += (duration >> 15) + (v_time_stamp[channel].tv_usec / 1000000);
                            v_time_stamp[channel].tv_usec %= 1000000;
                        }
                        last_vtstamp[channel] = pkt_header.video_timestamp;

                        comp_data.channel = channel;
                        comp_data.type = DATA_VIDEO;
                        comp_data.flags = pkt_header.video_type;
                        comp_data.timestamp = v_time_stamp[channel];
                        comp_data.size = pkt_header.video_length;
                        comp_data.data = pkt_header.video_addr;
                        ipcam->fun(ipcam->datahandler, &comp_data);
                    }
示例#16
0
文件: main.c 项目: RFBGH/ugui
void TestBtn(void)
{
	PWindow pWinSon0 = NULL;
	PButton pBtnSon0 = NULL;
	PEditView pEditSon0 = NULL;
	PCheckBox pBkBoxSon0 = NULL;
	PWindow pWinParent = NULL;
	int iRnd;
	int i;
	int iParent;
	CRect rect;
	CFont font;
	CBrush brush;
	INT iID;

	iID = 1;

	InitHeapPool(INIT_HEAP_DEFAULT);

	InitGUI();
	Log("start...\n");

	pWinParent = CreateWindowE(0, pWinRoot, iID++);

	rect.m_iLeft = 10;
	rect.m_iTop = 10;
	rect.m_iHeigh = 200;
	rect.m_iWidth = 300;

	pWinParent->m_pfSelWinRect(P2H(pWinParent), &rect, NULL);
	SetWinBKColor(pWinParent, 0xFF000000);

	pBtnSon0 = CreateButton(pWinParent, iID++, "btn1", 0, WIN_MSG_BUTTON, WinOnUsrProc);
	rect.m_iLeft = 80;
	rect.m_iTop = 10;
	rect.m_iHeigh = 50;
	rect.m_iWidth = 50;
	pBtnSon0->m_pfSelWinRect(P2H(pBtnSon0), &rect, NULL);
	SetWinBKColor(&pBtnSon0->m_baseWin, 0xFF00FF00);
	font.m_color = 0xFF000000;

	pBtnSon0->m_pfSelWinFont(P2H(pBtnSon0), &font, NULL);

	pWinSon0 = CreateWindowE(0, pWinParent, iID++);
	rect.m_iLeft = 50;
	rect.m_iTop = 10;
	rect.m_iHeigh = 50;
	rect.m_iWidth = 50;
	pWinSon0->m_pfSelWinRect(P2H(pWinSon0), &rect, NULL);
	SetWinBKColor(pWinSon0, 0xFFFF0000);

	pEditSon0 = CreateEditView(pWinParent, iID++, "you are pig stupid, fool is your nick name kill youyou are pig stupid, fool is your nick name kill you", 0/*EDIT_VIEW_MULTI_LINE*/);
	rect.m_iLeft = 30;
	rect.m_iTop = 90;
	rect.m_iHeigh = 50;
	rect.m_iWidth = 100;
	pEditSon0->m_pfSelWinRect(P2H(pEditSon0), &rect, NULL);
	pEditSon0->m_pfSelWinFont(P2H(pEditSon0), &font, NULL);
	brush.m_color = 0xFFFFFFFF;
	pEditSon0->m_pfSelWinBrush(P2H(pEditSon0), &brush, NULL);
	pEditSon0->m_iCurEdit =  10;

	pBkBoxSon0 = CreateCheckBox(pWinParent, iID++, "CheckMe", TRUE, 0);
	rect.m_iLeft = 146;
	rect.m_iTop = 80;
	rect.m_iHeigh = 24;
	rect.m_iWidth = 100;
	pBkBoxSon0->m_pfSelWinRect(P2H(pBkBoxSon0), &rect, NULL);
	pBkBoxSon0->m_pfSelWinFont(P2H(pBkBoxSon0), &font, NULL);
	brush.m_color = 0xFFFF00FF;
	pBkBoxSon0->m_pfSelWinBrush(P2H(pBkBoxSon0), &brush, NULL);

	Log("window flow...\n");
	FlowWindow0(pWinRoot, WindowFlow);

	//pWinTmp = FindWindowByID(25);
	//Log("find...");
	//WindowFlow(pWinTmp);

	PrintScreen();

#if 0
	pWinTmp = FindWindowByID(2);

	if(pWinTmp == NULL)
	{
		Log("NULL pointer\r\n");
	}

	Log("OK\r\n");

	ReorderWindow(pWinTmp);
	FlowWindow0(pWinRoot, WindowFlow);
#endif


	while(TRUE)
	{
		int x;
		int y;
		int iRet;
		PPoint pPoint;
		scanf("%d %d", &x, &y);
		pPoint = (PPoint)Malloc(sizeof(CPoint));
		pPoint->m_iX = x;
		pPoint->m_iY = y;

		iRet = pWinRoot->m_pfPostMessage(P2H(pWinRoot), WIN_MSG_ID_CLICK_SCREEN_DOWN, 0, pPoint);
		Log("iRet[%d]\r\n", iRet);
		WinFlowMain();

		FlowWindow0(pWinRoot, WindowFlow);
		PrintScreen();
	}

	DeleteEditView(pEditSon0);
	DeleteButton(pBtnSon0);
}
示例#17
0
int
Keyboard (char *Keyboard_Output_Temp)
{

  Keyboard_CurrentKey = 1;
  Keyboard_Characters = 0;
  Keyboard_CharsetLowercase ();
  PauseVbl (30);		//Pause for half a second

  while (1)
    {
      GetUserInput ();

      PutGFX (0, 0, 480, 270, wallpaper, 0, 0);	//Wallpaper
      PutGFX (0, 0, 480, 15, Keyboard_Output, 0, 242);
      PutTextFont (5, 245, Keyboard_Output_Temp, KeyboardC);

      Keyboard_ButtonTemp = 1;

      while (Keyboard_ButtonTemp < 33)
	{
	  if (Keyboard_CurrentKey == Keyboard_ButtonTemp)
	    {
	      PutGFX (0, 0, 15, 15, Keyboard_Button2,(15 * (Keyboard_ButtonTemp - 1)), 257);
	    }
	  else
	    {
	      PutGFX (0, 0, 15, 15, Keyboard_Button1,(15 * (Keyboard_ButtonTemp - 1)), 257);
	    }

	  char buffer[10];
	  sprintf (buffer, "%c",Keyboard_Characters[(Keyboard_ButtonTemp - 1)]);
	  PutTextFont ((15 * (Keyboard_ButtonTemp - 1) + 3), 260, buffer,Keyboard2C);

	  Keyboard_ButtonTemp += 1;
	}

      if (pad.Buttons != old_buttons)
	{
	  old_buttons = pad.Buttons;

	  if (pad.Buttons & PSP_CTRL_CONFIRM&& strlen (Keyboard_Output_Temp) < 50)
	    {
	    	int size;
	    	size = strlen (Keyboard_Output_Temp);
	      Keyboard_Output_Temp[size] =	Keyboard_Characters[(Keyboard_CurrentKey - 1)];
	      Keyboard_Output_Temp[size+1] = '\0';	      
	    }

	  //Space
	  if (pad.Buttons & PSP_CTRL_TRIANGLE
	      && strlen (Keyboard_Output_Temp) < 50)
	    {
	      Keyboard_Output_Temp[strlen (Keyboard_Output_Temp)] = ' ';
	    }

	  //Delete
	  if (pad.Buttons & PSP_CTRL_SQUARE)
	    {
	      Keyboard_Output_Temp[strlen (Keyboard_Output_Temp) - 1] = 0;
	    }


	  //Move right
	  if (pad.Buttons & PSP_CTRL_RIGHT)
	    {

	      Keyboard_CurrentKey += 1;

	      if (Keyboard_CurrentKey == 34)
		{
		  Keyboard_CurrentKey = 1;
		}
	    }

	  //Move left
	  if (pad.Buttons & PSP_CTRL_LEFT)
	    {

	      Keyboard_CurrentKey -= 1;

	      if (Keyboard_CurrentKey == 0)
		{
		  Keyboard_CurrentKey = 33;
		}
	    }

	  //Done
	  if (pad.Buttons & PSP_CTRL_START)
	    {
	      return Keyboard_Output_Temp;
	    }


	  //Change charset
	  if (pad.Buttons & PSP_CTRL_SELECT)
	    {
	      if (Keyboard_Charset == "Lowercase")
		{
		  Keyboard_CharsetUppercase ();
		}
	      else if (Keyboard_Charset == "Uppercase")
		{
		  Keyboard_CharsetOther ();
		}
	      else if (Keyboard_Charset == "Other")
		{
		  Keyboard_CharsetLowercase ();
		}
	    }
	}
      //Fast right
      if (pad.Buttons & PSP_CTRL_RTRIGGER)
	{

	  Keyboard_CurrentKey += 1;

	  if (Keyboard_CurrentKey == 34)
	    {
	      Keyboard_CurrentKey = 1;
	    }
	}

      //Fast left
      if (pad.Buttons & PSP_CTRL_LTRIGGER)
	{

	  Keyboard_CurrentKey -= 1;

	  if (Keyboard_CurrentKey == 0)
	    {
	      Keyboard_CurrentKey = 33;
	    }
	}


      PutGFX (0, 0, 32, 32, cursor, cursorPosition.x, cursorPosition.y);
      PrintScreen ();
    }
}
void CinematicVoice(PLAYERNAME player,PLAYERNAME next, LocationName nextmap)
{
    char * Playernames[]= {"Mokhtar","Haitham","Brahim","Salah","Wassim"};
    char * Locationnames[]= {"Tunisia","Egypt","Japan","Malaysia","India"};
    char * cities[]= {"Tunis","Cairo","Tokyo","Kuala Lumpur","Taj Mahal"};
    flip f=NONE;
    char buffer[500],buffer2[500];

    IMAGE*voice[2];
    int i;

    for(i=0; i<2; i++)
    {
        sprintf(buffer,"Resources/Images/%s/voice%d.png",Playernames[player],i+1);
        voice[i]=load_image(buffer);
    }

    sprintf(buffer,"\"Good job...good job...\n"
            "I bet you are worried about\n"
            "your friend %s...\n"
            "Don't waste more time,\n"
            "head to %s,\n"
            "you'll find him\n"
            "somewhere in %s...\n"
            "I'll be watching you...\"",Playernames[next],Locationnames[nextmap],cities[nextmap]);

    sprintf(buffer2,"I should keep going.\n"
            "%s is waiting for me alone\n"
            "in another country... Better\n"
            "hurry up...",Playernames[next]);
    if(player==BRAHIM)
    {
        f=VERTICAL;
    }

    glClear(GL_COLOR_BUFFER_BIT);
    draw_text(SFTransRobotics,buffer,5,25,10,CENTER,100);
    PrintScreen(1);
    glClear(GL_COLOR_BUFFER_BIT);
    i=0;
    while(!IsKeyPressed(3,ENTER) && !IsKeyPressed(3,RETURN) & i<(FPS*8))
    {
        draw_image_ex(screenimage,0,0,100,100,NONE,i-FPS);
        draw_image_ex(voice[0],40,15,0,85,f,i-FPS);

        next_frame();
        i++;
    }
    glClear(GL_COLOR_BUFFER_BIT);
    draw_text(SFTransRobotics,buffer2,5,25,10,CENTER,100);
    PrintScreen(1);
    glClear(GL_COLOR_BUFFER_BIT);

    i=0;
    while(!IsKeyPressed(3,ENTER) && !IsKeyPressed(3,RETURN) & i<(FPS*8))
    {
        draw_image_ex(screenimage,0,0,100,100,NONE,i);
        draw_text(SFTransRobotics,buffer,5,25,10,CENTER,100-i);
        draw_image_ex(voice[0],40,15,0,85,f,100-i);
        draw_image_ex(voice[1],40,10,0,90,f,i);
        next_frame();
        i++;
    }
    draw_image_ex(screenimage,0,0,100,100,NONE,100);
    draw_image_ex(voice[1],40,10,0,90,f,100);
    PrintScreen(1);
    glClear(GL_COLOR_BUFFER_BIT);
    for(i=100; i>=0; i--)
    {
        draw_image_ex(screenimage,0,0,100,100,NONE,i);
        next_frame();
    }

}
void Cinematic1()
{
    const char Storylines[]="Once upon a time, there was a team of talented developers called Sharp-Vision.\n" \
                            "They were asked to make a video game, but a game like NO OTHER.\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "They started a brainstorming to get the perfect idea,\n" \
                            "and finally decided to go with a fight game.\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "They started the development, and SUDDENLY!\n" \
                            "somethings went wrong with the code...\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "THE MACHINE HAS SWALLOWED THEM INSIDE!!!";

    char buffer[100];
    int i,imageindex=0,timer,shaking=15;
    float xrand=0.5,yrand=0.5,TextY=100,TextSpeed=-0.025;
    IMAGE *powerups[39],*meeting[6],*swallow[2],*focuspoint,*storytext;
    int laser,laserboom;

    laser=AddVoice("Resources/Sounds/Laser.wav",1);
    laserboom=AddVoice("Resources/Sounds/Laserboom.wav",1);
    Dramatic=AddVoice("Resources/Sounds/Dramatic.wav",0);
    voice_set_playmode(Dramatic, PLAYMODE_LOOP);

    for(i=0; i<39; i++)
    {
        sprintf(buffer,"Resources/Images/Arcade/Powerup2/powerup00%.2d.png",i+1);
        powerups[i]=load_image(buffer);
    }
    for(i=0; i<6; i++)
    {
        sprintf(buffer,"Resources/Images/Arcade/%.2d.png",i+1);
        meeting[i]=load_image(buffer);
    }
    swallow[0]=load_image("Resources/Images/Arcade/swallow.png");
    swallow[1]=load_image("Resources/Images/Arcade/swallow2.png");
    focuspoint=load_image("Resources/Images/Arcade/focuspoint.png");

    glClear(GL_COLOR_BUFFER_BIT);
    draw_text(SFTransRobotics,Storylines,4.9,50,0,CENTER_X,100);
    PrintScreen(1);
    glClear(GL_COLOR_BUFFER_BIT);
    i=0;
    timer=FrameCount;
    voice_start(Dramatic);
    while( (FrameCount-timer <8*FPS) && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,100);
        draw_image_ex(meeting[0],5,5,90,0,NONE,i);
        if(FrameCount%2==0)
        {
            i++;
        }
        TextY+=TextSpeed;
        next_frame();
    }
    i=0;
    timer=FrameCount;
    while(TextY>40 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,100);
        if(i<100) draw_image_ex(meeting[imageindex],5,5,90,0,NONE,100);
        draw_image_ex(meeting[((imageindex+1)%5)+1],5,5,90,0,NONE,i);
        i+=3;

        if(FrameCount-timer >4*FPS)
        {
            timer=FrameCount;
            imageindex=((imageindex+1)%5)+1;
            i=0;
        }
        TextY+=TextSpeed;
        next_frame();
    }
    i=300;
    while(i>-150 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,i-100);
        draw_image_ex(meeting[((imageindex+1)%5)+1],5,5,90,0,NONE,i);

        i-=3;
        next_frame();
    }
    i=0;
    timer=FrameCount;
    voice_ramp_volume(Dramatic,500,128);
    voice_start(laser);
    while((FrameCount-timer <3*FPS) && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,i++);
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%shaking==0)shaking=Max(shaking-1,3);

        next_frame();
    }
    i=0;
    while(i<34 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,100);
        draw_image_ex(powerups[i],xrand+10,yrand,80,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,100);

        if(FrameCount%7==0) i++;
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%5==0)shaking=Max(shaking-1,2);
        if(i==28) voice_start(laserboom);

        next_frame();
    }
    voice_ramp_volume(laser,500,0);

    while(i<39 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,((float)(38-i)/5.0f)*100);
        draw_image_ex(powerups[i],xrand+10,yrand,80,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,((float)(38-i)/5.0f)*100);

        if(FrameCount%7==0) i++;
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%5==0)shaking=Max(shaking-1,1);

        next_frame();
    }
}