void
MediaWindow::InitWindow()
{
	fListView = new BListView("media_list_view");
	fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));

	// Add ScrollView to Media Menu for pretty border
	BScrollView* scrollView = new BScrollView("listscroller",
		fListView, 0, false, false, B_FANCY_BORDER);

	// Create the Views
	fTitleView = new BSeparatorView(B_HORIZONTAL, B_FANCY_BORDER);
	fTitleView->SetLabel(B_TRANSLATE("Audio settings"));
	fTitleView->SetFont(be_bold_font);

	fContentLayout = new BCardLayout();
	new BView("content view", 0, fContentLayout);
	fContentLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fAudioView = new AudioSettingsView();
	fContentLayout->AddView(fAudioView);

	fVideoView = new VideoSettingsView();
	fContentLayout->AddView(fVideoView);


	// Layout all views
	BLayoutBuilder::Group<>(this, B_HORIZONTAL)
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.Add(scrollView)
		.AddGroup(B_VERTICAL)
			.SetInsets(0, 0, 0, 0)
			.Add(fTitleView)
			.Add(fContentLayout);

	// Start the window
	fInitCheck = InitMedia(true);
	if (fInitCheck != B_OK) {
		PostMessage(B_QUIT_REQUESTED);
	} else 	if (IsHidden()) {
			Show();
	}
}
Beispiel #2
0
 void CSimulator::Init() {
    /* General configuration */
    InitFramework(GetNode(m_tConfigurationRoot, "framework"));
    /* Initialize controllers */
    InitControllers(GetNode(m_tConfigurationRoot, "controllers"));
    /* Create loop functions */
    if(NodeExists(m_tConfigurationRoot, "loop_functions")) {
       /* User specified a loop_functions section in the XML */
       InitLoopFunctions(GetNode(m_tConfigurationRoot, "loop_functions"));
    }
    else {
       /* No loop_functions in the XML */
       m_pcLoopFunctions = new CLoopFunctions;
    }
    /* Physics engines */
    InitPhysics(GetNode(m_tConfigurationRoot, "physics_engines"));
    /* Media */
    InitMedia(GetNode(m_tConfigurationRoot, "media"));
    /* Space */
    InitSpace(GetNode(m_tConfigurationRoot, "arena"));
    /* Call user init function */
    if(NodeExists(m_tConfigurationRoot, "loop_functions")) {
       m_pcLoopFunctions->Init(GetNode(m_tConfigurationRoot, "loop_functions"));
    }
    /* Physics engines */
    InitPhysics2();
    /* Media */
    InitMedia2();
    /* Initialise visualization */
    TConfigurationNodeIterator itVisualization;
    if(NodeExists(m_tConfigurationRoot, "visualization") &&
       ((itVisualization = itVisualization.begin(&GetNode(m_tConfigurationRoot, "visualization"))) != itVisualization.end())) {
       InitVisualization(GetNode(m_tConfigurationRoot, "visualization"));
    }
    else {
       LOG << "[INFO] No visualization selected." << std::endl;
       m_pcVisualization = new CDefaultVisualization();
    }
    /* Start profiling, if needed */
    if(IsProfiling()) {
       m_pcProfiler->Start();
    }
 }
Beispiel #3
0
ULONG CTransmission::SetPacket(BYTE *_pData, ULONG _ulDatalen)
{
    if (!m_bInit)
        return RET_INIT_ERROR;

    if (!m_bMediaSet)
    {
        CHECK_ERROR(InitMedia(), RET_OK)
    }
    
    ULONG ret;

    if (m_bDemuxNeeded)
    {
        // antes inicializar a thread de leitura e setar o semaphoro
        if (m_pDemuxer && m_pDemuxer->HeaderSet())
        {
            if (!m_bRunDemuxThread)
            {
                m_BufferId.SetTransmission(this);
                ret = StartDemuxThread();
            }

            if (m_bRunDemuxThread)
            {
                ret = m_pDemuxer->SetPacket(_pData, _ulDatalen, sizeof(MediaPkt));
            }
        }
        else
        {
            ret = RET_ERROR;
        }
    }
    else
    {
        ret = m_BufferId.SetPacket(_pData, _ulDatalen);
    }

    return ret;
}
Beispiel #4
0
//Initialization
void Bola::Init(SDL_Renderer *renderer){
    rect.h = BOLA_SIZE;
    rect.w = BOLA_SIZE;
    rect.y = WIN_HEIGHT/2;
    rect.x = WIN_WIDTH/2;
	//Iniciar con un angulo random, pero que nunca sea completamente horizontal o vertical
	int type = rand() % 4;
	switch (type)
	{
	case 0:	//15-75
		angle = rand() % 60 + 15;
		break;
	case 1: //105-165
		angle = rand() % 60 + 105;
		break;
	case 2: //195-255
		angle = rand() % 60 + 195;
		break;
	case 3://285-345
		angle = rand() % 60 + 285;
		break;
	}
    SDL_Surface *surf = IMG_Load("assets/pelota.png");
    imagen = SDL_CreateTextureFromSurface(renderer, surf);

	dx = dy = 0.0f;
	speed = 0.4f;
	rebotandoY = rebotandoX =  false;

	speedX = (float)cos(angle*M_PI / 180.0f) * speed;
	speedY = (float)sin(angle*M_PI / 180.0f) * speed;

	MAX_speed = speed *2;

	InitMedia();
}
void
MediaWindow::MessageReceived(BMessage* message)
{
	switch(message->what)
	{
		case ML_INIT_MEDIA:
			InitMedia(false);
			break;
		case ML_RESTART_MEDIA_SERVER:
		{
			thread_id thread = spawn_thread(&MediaWindow::RestartMediaServices,
				"restart_thread", B_NORMAL_PRIORITY, this);
			if (thread < B_OK)
				fprintf(stderr, "couldn't create restart thread\n");
			else
				resume_thread(thread);
			break;
		}
		case B_MEDIA_WEB_CHANGED:
		case ML_SELECTED_NODE:
		{
			PRINT_OBJECT(*message);

			MediaListItem* item = static_cast<MediaListItem*>(
					fListView->ItemAt(fListView->CurrentSelection()));
			if (!item)
				break;

			fCurrentNode.SetTo(NULL);
			_ClearParamView();
			item->AlterWindow(this);
			break;
		}
		case B_SOME_APP_LAUNCHED:
			{
				PRINT_OBJECT(*message);
				if (!fAlert)
					break;

				BString mimeSig;
				if (message->FindString("be:signature", &mimeSig) == B_OK
					&& (mimeSig == "application/x-vnd.Be.addon-host"
						|| mimeSig == "application/x-vnd.Be.media-server")) {
					fAlert->Lock();
					fAlert->TextView()->SetText(
						B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));
					fAlert->Unlock();
				}
			}
			break;
		case B_SOME_APP_QUIT:
			{
				PRINT_OBJECT(*message);
				BString mimeSig;
				if (message->FindString("be:signature", &mimeSig) == B_OK) {
					if (mimeSig == "application/x-vnd.Be.addon-host"
						|| mimeSig == "application/x-vnd.Be.media-server") {
						BMediaRoster* roster = BMediaRoster::CurrentRoster();
						if (roster && roster->Lock())
							roster->Quit();
					}
				}

			}
			break;
		default:
			BWindow::MessageReceived(message);
			break;
	}
}