示例#1
0
int StimulusWebcam::Main() {
	Uint32 msStart, msDone, msDelay;

	// Activate streaming
	m_pCam->ActivateStreaming();

	while (s_bContinue) {
		msStart = ClockFn();
		// TODO: do work
		ShowFrame(m_pCam->GrabFrame());
		msDone = ClockFn();
		if ((msDone - msStart) <= StimulusWebcam::s_msFrameInterval) {
			msDelay = s_msFrameInterval - (msDone - msStart);
		} else {
			msDelay = 0;
		}
		// g_pErr->Debug(pastestr::paste("sdsd", " ", 
		// "elapsed:", (long) (msDone - msStart),
		// "delaying:", (long) msDelay));
		SDL_Delay(msDelay);
	}

	// m_pCam->DeactivateStreaming();

	return 0;
}
示例#2
0
void WebAddressDlg::SetDialogChangedState()
{	
	
	//If the dialog is still in its initial state...
	if (fDialogIsInInitialState)
	{
		//Then we need to change some things

		//First, let's find the state of the Web Address attributes applied to the 
		//selection
		WebCommonAttributeResult aasApplied=FindCommonWebAttribute();

		//If anything at all is selected
		if (aasApplied!=WCA_NOSELECTION)
		{
			//Then we need to ungrey the Add/Change button
			EnableAdd(TRUE);

			//We also need to clear any intermediate values from the dialog

			//If the URL field says <MANY>, clear that field
			if (GetURL()==String_256(_R(IDS_WEBADDRESSDLG_MANY)))
				ShowURL();

			//If the Frame field says <MANY>, put "self" into that field
			if (GetFrame()==String_256(_R(IDS_WEBADDRESSDLG_MANY)))
				ShowFrame(String_256(_R(IDS_WEBADDRESS_COMBO_SELF)));

			//If the clickable area is indeterminate, show the
			//recommended value for the selection in the radio buttons
			if (GetClickableArea()==2)
				ShowClickableArea(SelectionConsistsOfText());
		}



		//If there is no Web Address on the selection, tell the user
		//so
		if (aasApplied==WCA_DEFAULT)
			ShowWebAddressOnSelection(FALSE);
												
		//If there is any sort of Web Address on the selection, tell the
		//user
		if (aasApplied==WCA_SINGLE || aasApplied==WCA_MANY)
			ShowWebAddressOnSelection(TRUE);
		
	}

	//The dialog is no longer in its initial state
	fDialogIsInInitialState=FALSE;
}
void CPlayerLoop::timerEvent(QTimerEvent *event)
{
    if (event->timerId() == m_FrameTimer.timerId()) //если сработал таймер кадров
    {

        if(!m_Log.is_open())
        {
            std::cerr << "Ошибка открытия файла журнала!!!" << std::endl << std::flush;
            m_FrameTimer.stop();
            return;
        }
        //читаем очередной блок из файла журнала
        //создаем объект - парсер файла жкрнала
        CLogParser logParser;

        //Читаем блок из входного потока, пока не встретится пустая строка, признак конца файла или ошибка в данных

        if(!ReadBlockFromStream(m_Log, &logParser) && !m_Log.eof())
        {
            if(logParser.IsError())
            {
                std::cerr << "Ошибка в CLogParser: " << logParser.GetErrorMessage().c_str() << std::endl << std::flush;
            }
            else
            {
                std::cerr << "Ошибка чтения файла!!!" << std::endl << std::flush;
            }

            m_FrameTimer.stop();
            return;
        }
        else
        {
            // отладочный вывод на консоль прочитанных из файла данных
            // ShowMapInText(logParser.GetFrame());

            if (m_Log.eof())
            {
                std::cerr << "Файл успешно прочитан!!!\n";
                m_FrameTimer.stop();
                return;
            }

            UpdatePlayer(logParser);
            ShowFrame();
        }
    }
}
示例#4
0
void eae6320::Graphics::Render()
{
	ClearFrame();
	StartFrame();

	// Drawing Opaque list
	s_boxes_obj->DrawObject();
	s_ceiling_obj->DrawObject();
	s_floor_obj->DrawObject();
	s_innerWalls_obj->DrawObject();
	s_metal_obj->DrawObject();
	s_outerWalls_obj->DrawObject();
	s_railing_obj->DrawObject();

	// Drawing Transparent list
	//


	// Drawing Debug Shapes
#ifdef _DEBUG
	s_debugLine1.DrawLine();
	s_debugLine2.DrawLine();
	s_snowmanLine->DrawLine();
	s_debugBox1.DrawBox();
	s_debugBox2.DrawBox();

	if (s_debugMenuCheckBox->m_isChecked)
	{
		s_debugSphere1->DrawSphere();
		//s_debugSphere2.DrawSphere();
	}

	Graphics::GetLocalDirect3dDevice()->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
	s_debugCylinder1->DrawObject();
	s_debugCylinder2->DrawObject();
	Graphics::GetLocalDirect3dDevice()->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
#endif

	// Drawing Game Sprites
	//s_logo.Draw();
	s_numbers->Draw();

	// Drawing third person snowman
	s_snowman->DrawObject();
	s_snowmanClient->DrawObject();

	// Draw Capture the Flag Stuff
	s_flag1->DrawObject();
	s_flag2->DrawObject();
	if(s_bullet1->m_isActive)
		s_bullet1->DrawObject();
	if (s_bullet2->m_isActive)
		s_bullet2->DrawObject();
	s_sprintBar->DrawDebugBar(150);
	s_snowmanScore->DrawDebugText(100);
	if(s_clientJoined)
		s_snowmanClientScore->DrawDebugText(100);

	// Drawing Debug Menu Items
#ifdef _DEBUG
	if (s_debugMenuEnabled)
	{
		float fpsCount = 1 / Time::GetSecondsElapsedThisFrame();
		s_debugMenuTextFPS.SetFPS(fpsCount);

		switch (s_activeMenuItem)
		{
		case DebugMenuSelection::Text:
			s_debugMenuTextFPS.DrawDebugText(255);
			s_debugMenuCheckBox->DrawDebugCheckBox(0);
			s_debugMenuSlider->DrawDebugSlider(0);
			s_debugMenuButton->DrawDebugButton(0);
			s_toggleFPSCheckBox->DrawDebugCheckBox(0);
			break;

		case DebugMenuSelection::CheckBox:
			s_debugMenuTextFPS.DrawDebugText(0);
			s_debugMenuCheckBox->DrawDebugCheckBox(255);
			s_debugMenuSlider->DrawDebugSlider(0);
			s_debugMenuButton->DrawDebugButton(0);
			s_toggleFPSCheckBox->DrawDebugCheckBox(0);
			break;

		case DebugMenuSelection::Slider:
			s_debugMenuTextFPS.DrawDebugText(0);
			s_debugMenuCheckBox->DrawDebugCheckBox(0);
			s_debugMenuSlider->DrawDebugSlider(255);
			s_debugMenuButton->DrawDebugButton(0);
			s_toggleFPSCheckBox->DrawDebugCheckBox(0);
			break;

		case DebugMenuSelection::Button:
			s_debugMenuTextFPS.DrawDebugText(0);
			s_debugMenuCheckBox->DrawDebugCheckBox(0);
			s_debugMenuSlider->DrawDebugSlider(0);
			s_debugMenuButton->DrawDebugButton(255);
			s_toggleFPSCheckBox->DrawDebugCheckBox(0);
			break;

		case DebugMenuSelection::ToggleCam:
			s_debugMenuTextFPS.DrawDebugText(0);
			s_debugMenuCheckBox->DrawDebugCheckBox(0);
			s_debugMenuSlider->DrawDebugSlider(0);
			s_debugMenuButton->DrawDebugButton(0);
			s_toggleFPSCheckBox->DrawDebugCheckBox(255);
			break;

		default:
			break;
		}
	}
#endif

	EndFrame();
	ShowFrame();
}
示例#5
0
void WebAddressDlg::SetDialogInitialControls()
{	
	//First, we want to know what the WebAddressAttribute applied to the selection
	//is.

	//This variable will hold that attribute
	WebAddressAttribute waaApplied;

	//Then call this function to find the state of the WebAddressAttribute(s)
	//applied to the selection
	WebCommonAttributeResult aasApplied=FindCommonWebAttribute(&waaApplied);
								 
	//Edit field and combo box

	//First set up the combo box list
	DeleteAllValues(_R(IDC_WEBADDRESS_FRAME));
	
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_SELF), FALSE, 0);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_PARENT), FALSE, 1);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_TOP), FALSE, 2);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_BLANK), FALSE, 3);
	SetStringGadgetValue(_R(IDC_WEBADDRESS_FRAME), _R(IDS_WEBADDRESS_COMBO_DEFAULT), FALSE, 4);

	SetComboListLength(_R(IDC_WEBADDRESS_FRAME));

	// If a single attribute is applied or the default attribute
	// is applied, set it into the edit fields
	if (aasApplied==WCA_SINGLE || aasApplied==WCA_DEFAULT)
	{
		ShowURL(waaApplied.m_url.GetWebAddress());
		ShowFrame(waaApplied.m_pcFrame);
	}

	//If many attributes are applied, put <Many> into the edit fields
	if (aasApplied==WCA_MANY)
	{
		ShowURL(String_256(_R(IDS_WEBADDRESSDLG_MANY)));
		ShowFrame(String_256(_R(IDS_WEBADDRESSDLG_MANY)));
	}

	//If nothing is selected, clear the edit fields
	if (aasApplied==WCA_NOSELECTION)
	{
		ShowURL();
		ShowFrame();
	}

	//Radio buttons

	//If a single attribute is applied, set the radio buttons accordingly
	if (aasApplied==WCA_SINGLE)
		ShowClickableArea(waaApplied.m_fBounding); 
	
	//If many attributes are applied, or if nothing is selected,
	//give the radio buttons an indeterminate value
	if (aasApplied==WCA_MANY || aasApplied==WCA_NOSELECTION)
		ShowClickableArea(2);
	
	//If the default attribute is applied to the selection...
	if (aasApplied==WCA_DEFAULT)
		//Then if the selection consists only of text, set the "Rectangle" radio button.
		//Otherwise, set the "Object shape" radio button
		ShowClickableArea(SelectionConsistsOfText());

	//AutoCorrect switch
	ShowCorrect(ms_fCorrect);

	//Buttons

	//Grey the Add/Change button
	EnableAdd(FALSE);

	//If one or many attributes are applied to the selection, enable the Remove button.
	//Otherwise, grey the Remove button
	EnableRemove((aasApplied==WCA_SINGLE || aasApplied==WCA_MANY));
}
示例#6
0
/*----------------------------------------------------------------------
|       main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
    FILE*           input;
#if ! defined (MLO_DECODER_TEST_FAST)
    FILE*           outfile_ptr;
#endif   /* MLO_DECODER_TEST_FAST */
    MLO_Decoder*    decoder;
    MLO_AdtsParser* parser;
    MLO_Result      result;

    /* check command line args */
    if (argc != 3) {
        fprintf(stderr, "DecderTest <input_filename> <output_filename>\n");
        return 1;
    }

    /* open the file */
    input = fopen(argv[1], "rb");
    if (input == NULL) {
        fprintf(stderr, "ERROR: cannot open input '%s' (%s)\n", argv[1], strerror(errno));
        return 1;
    }

#if ! defined (MLO_DECODER_TEST_FAST)
    outfile_ptr = fopen (argv [2], "wb");
    if (outfile_ptr == 0)
    {
       fprintf(stderr, "ERROR: cannot open output '%s' (%s)\n", argv[2], strerror(errno));
       return (1);
    }
#endif   /* MLO_DECODER_TEST_FAST */

    /* create a decoder */
    result = MLO_Decoder_Create(&decoder);
   if (MLO_FAILED(result))
   {
      fprintf (stderr, "Cannot create decoder.\n");
      return (1);
   }

    /* create a frame parser */
    result = MLO_AdtsParser_Create(&parser);
   if (MLO_FAILED(result))
   {
      fprintf (stderr, "Cannot create the ADTS parser.\n");
      return (1);
   }

    for (;;) {
        /* read some data */
        unsigned char input_buffer[2048];
        unsigned int offset = 0;
        size_t read = fread(input_buffer, 1, sizeof(input_buffer), input);
        if (read <= 0) break;

        while (offset < read) {
            /* feed as much as we can */
            MLO_Size size = (MLO_Size)(read - offset);
            MLO_Size free_bytes = MLO_AdtsParser_GetBytesFree (parser);
            if (size > free_bytes)
            {
               size = free_bytes;
            }
            result = MLO_AdtsParser_Feed(parser, &input_buffer[offset], &size, 0);
            if (MLO_FAILED(result)) {
                fprintf(stderr, "MLO_AdtsParser_Feed failed (%d)\n", result);
                return 1;
            }
            /* adjust size to account for what was consumed */
            offset += size;

#if ! defined (MLO_DECODER_TEST_CONTINUOUS_STREAM)
            /* find all the frames in what was fed so far */
            do
#endif
            {
               MLO_FrameData frame;
               MLO_SampleBuffer output_buffer;
               output_buffer.samples = NULL;
               output_buffer.size = 0;
               result = MLO_AdtsParser_FindFrame(parser, &frame);
               if (MLO_SUCCEEDED(result))
               {
                  size_t         buf_size;
                  ShowFrame (&frame);
                  result = MLO_Decoder_DecodeFrame(decoder, &frame, &output_buffer);
                  if (MLO_FAILED(result)) {
                      fprintf(stderr, "DecodeFrame failed (%d)\n", result);
                      break;
                  }
                  buf_size = output_buffer.sample_count * output_buffer.format.channel_count * output_buffer.format.bits_per_sample / CHAR_BIT;
#if ! defined (MLO_DECODER_TEST_FAST)
                  {
                     const size_t   written = fwrite (output_buffer.samples, 1, buf_size, outfile_ptr);
                     if (written != buf_size)
                     {
                        fprintf(stderr, "ERROR: cannot open write output file.\n");
                        return (1);
                     }
                  }
#endif   /* MLO_DECODER_TEST_FAST */
               }
            }
#if ! defined (MLO_DECODER_TEST_CONTINUOUS_STREAM)
            while (MLO_SUCCEEDED(result) || result == MLO_ERROR_CORRUPTED_BITSTREAM);
            if (MLO_FAILED (result) && result != MLO_ERROR_NOT_ENOUGH_DATA) {
                fprintf(stderr, "MLO_AdtsParser_FindFrame failed (%d)\n", result);
                return 0;
            }
#endif
        }
    }
    
    /* destroy the decoder */
    MLO_Decoder_Destroy(decoder);

    /* close the files */
    fclose(input);

#if ! defined (MLO_DECODER_TEST_FAST)
    fclose (outfile_ptr);
#endif   /* MLO_DECODER_TEST_FAST */

    return 0;
}