void AmTrackDataView::DrawPhrase(	BRect clip,
									BView* view,
									track_id trackId,
									const AmPhraseEvent& topPhrase,
									AmPhraseEvent* pe,
									AmTime start,
									AmTime end,
									int32 properties,
									AmSelectionsI* selections)
{
	ArpASSERT(pe && pe->Phrase());
	AmNode*		n = pe->Phrase()->HeadNode();
	if (!n) return;
	AmRange		eventRange = topPhrase.EventRange( n->Event() );
	while (n && eventRange.start <= end) {
		if (eventRange.end >= start) {
			if (mTarget->IsInteresting( n->Event() )) {
				if (selections && selections->IncludesEvent(trackId, &topPhrase, n->Event() ) )
					DrawEvent(view, topPhrase, n->Event(), eventRange, ARPEVENT_SELECTED);
				else
					DrawEvent(view, topPhrase, n->Event(), eventRange, properties);
			} else if (n->Event()->Type() == n->Event()->PHRASE_TYPE) {
				AmPhraseEvent*	pe2 = dynamic_cast<AmPhraseEvent*>( n->Event() );
				if (pe2) DrawPhrase(clip, view, trackId, topPhrase, pe2, start, end, properties, selections);
			}
		}
		n = n->next;
		if (n) eventRange = topPhrase.EventRange( n->Event() );
	}
}
PF_Err HandleEvent ( 
    PF_InData       *in_data,
    PF_OutData      *out_data,
    PF_ParamDef     *params[],
    PF_LayerDef     *output,
    PF_EventExtra   *extra )
{
    PF_Err      err     = PF_Err_NONE;
    
    extra->evt_out_flags = 0;
    
    if(!err) 
    {
        switch(extra->e_type) 
        {
            case PF_Event_DRAW:
                err = DrawEvent(in_data, out_data, params, output, extra);
                break;
            
            case PF_Event_DO_CLICK:
                err = DoClick(in_data, out_data, params, output, extra);
                break;
        }
    }
    
    return err;
}
示例#3
0
static PF_Err 
HandleEvent(
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output,
	PF_EventExtra	*extra)
{

	PF_Err			err 	= PF_Err_NONE;
	
	AEGP_SuiteHandler	suites(in_data->pica_basicP);
	
	switch (extra->e_type) 	{

	case PF_Event_DO_CLICK:
		ERR(DoClick(in_data, out_data, params, output, extra));
		// Premiere Pro/Elements does not support this suite
		if (in_data->appl_id != 'PrMr')
		{
			ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Do Click Event","Adobe Systems, Inc.", NULL));
		}
		break;
	
	case PF_Event_DRAG:
		// Premiere Pro/Elements does not support this suite
		if (in_data->appl_id != 'PrMr')
		{
			ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Drag Event","Adobe Systems, Inc.", NULL));
		}
		break;
	
	case PF_Event_DRAW:
		ERR(DrawEvent(in_data, out_data, params, output, extra, params[1]->u.cd.value));
		// Premiere Pro/Elements does not support this suite
		if (in_data->appl_id != 'PrMr')
		{
			//	don't draw info palette *during* a draw event, it will mess up 
			//	the drawing and cause schmutz
			// ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Draw Event","Adobe Systems, Inc.", NULL));
		}
		break;
	
	case PF_Event_ADJUST_CURSOR:
		ERR(ChangeCursor(in_data, out_data, params, output, extra));
		// Premiere Pro/Elements does not support this suite
		if (in_data->appl_id != 'PrMr')
		{
			ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Change Cursor Event","Adobe Systems, Inc.", NULL));
		}
		break;

	default:
		break;
	
	}
	return err;
}
示例#4
0
void SetDisplayMode(PhaseWindow *window, int newMode)
{
    int changeScale, oldMode = window->displayMode;
    
    changeScale = (((newMode == BY_MOMENTUM || newMode == BY_PT) &&
    	  (oldMode != BY_MOMENTUM && oldMode != BY_PT)    ) ||
         ((newMode == BY_RAPIDITY || newMode == BY_PSEUDORAPIDITY) &&
          (oldMode != BY_RAPIDITY && oldMode != BY_PSEUDORAPIDITY)    ) ||
         (newMode == BY_USER_ROUTINE && oldMode != BY_USER_ROUTINE));
    window->displayMode = newMode;
    DrawEvent((StdHepWindow *) window, changeScale);
}
示例#5
0
static void longToTrCB(Widget w, SpaceWindow *window,caddr_t call_data)
{
     int sliderValue;
     char line[40];
     XmString s1;
     float curval;
     
    if (window->filename == NULL) return;
     
    XtVaGetValues(w, XmNvalue, &sliderValue, 0);
    curval = window->minLongToTr +
       sliderValue * (window->maxLongToTr - window->minLongToTr)/SLIDER_MAX;
    if (curval == window->currentLongToTr)  return;
    window->currentLongToTr = curval;
    sprintf(line,"Pl to Pt = %f",curval);
    s1=XmStringCreateSimple(line);
    XtVaSetValues(window->longToTrSliderValue, XmNlabelString, s1, 0);
    XmStringFree(s1);
    DrawEvent((StdHepWindow *) window, False);
}
示例#6
0
static void zTransCB(Widget w, SpaceWindow *window,caddr_t call_data)
{
     int sliderValue;
     char line[40];
     XmString s1;
     float curval;
     
    if (window->filename == NULL) return;
     
    XtVaGetValues(w, XmNvalue, &sliderValue, 0);
    curval = window->minTransl[2] +
      sliderValue * (window->maxTransl[2] - window->minTransl[2])/SLIDER_MAX;
    if (curval == window->currentTransl[2])  return;
    window->currentTransl[2] = curval;
    sprintf(line,"Z Trans. = %12.5e",curval);
    s1=XmStringCreateSimple(line);
    XtVaSetValues(window->zTranslSliderValue, XmNlabelString, s1, 0);
    XmStringFree(s1);
    DrawEvent((StdHepWindow *) window, False);
}
示例#7
0
PF_Err
HandleEvent ( 
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output,
	PF_EventExtra	*extra )
{
	PF_Err		err		= PF_Err_NONE;
	
	if (!err) 
	{
		switch (extra->e_type) 
		{
			case PF_Event_DRAW:
				err =	DrawEvent(in_data, out_data, params, output, extra);
				break;
			
			case PF_Event_DO_CLICK:
				err = DoDialog(in_data, out_data, params, output);
				extra->evt_out_flags = PF_EO_HANDLED_EVENT;
				break;
				
			case PF_Event_ADJUST_CURSOR:
			#if defined(MAC_ENV)
				#if PF_AE_PLUG_IN_VERSION >= PF_AE100_PLUG_IN_VERSION
				SetMickeyCursor(); // the cute mickey mouse hand
				#else
				SetThemeCursor(kThemePointingHandCursor);
				#endif
				extra->u.adjust_cursor.set_cursor = PF_Cursor_CUSTOM;
			#else
				extra->u.adjust_cursor.set_cursor = PF_Cursor_FINGER_POINTER;
			#endif
				extra->evt_out_flags = PF_EO_HANDLED_EVENT;
				break;
		}
	}
	
	return err;
}
示例#8
0
static void momToSpaceCB(Widget w, SpaceWindow *window,caddr_t call_data)
{
     int sliderValue;
     char line[40];
     XmString s1;
     float curval;
     
    if (window->filename == NULL) return;
     
    XtVaGetValues(w, XmNvalue, &sliderValue, 0);
    curval = 
         sliderValue * (window->maxMomToSpace)/SLIDER_MAX;
    if (curval == window->currentMomToSpace)  return;
    window->currentMomToSpace = curval;
    sprintf(line,"P to Dist = %12.5e",curval);
    s1=XmStringCreateSimple(line);
    XtVaSetValues(window->momToSpaceSliderValue, XmNlabelString, s1, 0);
    XmStringFree(s1);
    DrawEvent((StdHepWindow *) window, False);
    DrawScale((StdHepWindow *) window);
}
示例#9
0
void AmNoteRenderer::DrawEvents(BRect clip,
								BView* view,
								const AmTrack* track,
								AmNode* n,
								AmTime end,
								AmPhraseEvent* topPhrase,
								ArpLineArrayCache& lineCache)
{
	ArpASSERT(n && topPhrase);
	if (!n || !topPhrase) return;
	AmRange		eventRange = topPhrase->EventRange( n->Event() );
	while (n && (eventRange.start <= end) ) {
		if( n->Event()->Type() == n->Event()->PHRASE_TYPE ) {
			DrawPhrase(clip, view, track, dynamic_cast<AmPhraseEvent*>( n->Event() ), end, topPhrase, lineCache);
		} else if (n->Event()->Type() == n->Event()->NOTEON_TYPE) {
			DrawEvent(clip, view, dynamic_cast<AmNoteOn*>( n->Event() ), eventRange, lineCache);
		}
		n = n->next;
		if (n) eventRange = topPhrase->EventRange( n->Event() );
	}
}
示例#10
0
void Dungeon::Draw()
{
		//カメラの移動
		//target_camera = VGet(pos_x * 100 + (muki % 2 ? (muki - 1 ? 0 : 100) : 50), y * 100 - 50, (pos_z * 100 + (muki % 2 ? 50 : (muki ? 0 : 100))));
		//player_camera = VGet(pos_x * 100 + (muki % 2 ? (muki - 1 ? 100 : 0) : 50), y * 100 - 50, (pos_z * 100 + (muki % 2 ? 50 : (muki ? 100 : 0))));
		SetCameraPositionAndTarget_UpVecY(player_camera, target_camera);

		//メイン描画
		DrawMap_c(map_data, x_max, z_max);
		DrawEvent();
		if (!menuflag)
		{
			//ミニマップ
			DrawMiniMap();
		}
		else
		{
			menu->Draw();
		}
		player->drawState();
}
示例#11
0
static void scaleCB(Widget w, SpaceWindow *window,caddr_t call_data)
{
     int k, sliderValue;
     float curval, factor;
     XmString s1;
     char line[40];
     
    if (window->filename == NULL) return;
    
    XtVaGetValues(w, XmNvalue, &sliderValue, 0);
    curval = window->maxScale * 0.3678794 * 
                    exp (-1.0 * SLIDER_MAX / sliderValue );
    if (curval == window->currentScale)  return;
    window->currentScale = curval;
    sprintf(line,"Overall scale = %12.5e",curval);
    s1=XmStringCreateSimple(line);
    XtVaSetValues(window->scaleSliderValue, XmNlabelString, s1, 0);
    XmStringFree(s1);
    /* 
    ** Reset the defaul and scale of other sliders
    **
    */
    window->minTransl[2] = -curval/2.; window->maxTransl[2] = curval/2.;
    window->currentTransl[2] = 0.;
     /*
      ** Set now the Transverse to Longitudinal aspect ratio. 
      ** Currently, at the outset, this is a fixed quantity.. 
      */
     for (k=0; k<2; k++){   
       window->minTransl[k] = -1. *  curval/( 2. * window->currentLongToTr); 
       window->maxTransl[k] = curval/( 2. * window->currentLongToTr);
       window->currentTransl[k] = 0.;
    }
    
    window->currentMomToSpace = 
          2.0 * window->maxTransl[2] /window->maxMomentum;
    window->maxMomToSpace = 10. *  window->currentMomToSpace;
    SetScaleSpaceSliders(window);
    DrawEvent((StdHepWindow *) window, True);
}
示例#12
0
static void wzCB(Widget w, SpaceWindow *window, caddr_t call_data)
{
    window->wz = XmToggleButtonGetState(w);
    DrawEvent((StdHepWindow *) window, False);
}
示例#13
0
文件: TimeLine.cpp 项目: Rincer/TTyx
//----------------------------------------------------------------------------
void CTimeLine::Draw()
{
	if(!IsEnabled())
		return;

	unsigned int PrevFrame = 1 - m_CurrFrame; // draw the previously recorded frame, since the current one is still being filled
	unsigned long long FrameDuration = m_FrameEnd[PrevFrame] - m_FrameStart[PrevFrame];
	unsigned long long ClockFrequency = CTime::GetClockFrequency();
	unsigned long DurationMicroSecs = (unsigned long)(FrameDuration * 1000000 / ClockFrequency);
	unsigned int Width, Height;
	m_rRenderer->GetViewportSize(Width, Height);	

	// Draw the total frame duration	
	char FrameDurationSt[256];
	sprintf_s(FrameDurationSt, 255, "Frame %d.%dms", DurationMicroSecs / 1000, DurationMicroSecs % 1000);
	CColor White(255, 255, 255, 255);		
	m_rDebugGUI->DrawString((float)scLeftMargin, (float)scTopMargin, FrameDurationSt, White);
	
	if(m_pMaterial == NULL)
	{
		CMaterialPlainColor::CParameters Params("CTimeline.PlainColorParams", CMaterialPlainColor::eViewSpace);
		m_pMaterial = &m_rMaterialSystem->GetMaterial<CMaterialPlainColor>(&Params);
	}	
	
	unsigned int BarStart = scLeftMargin + scThreadName * 8 + 5; // 8 is the debug fonts character width
	unsigned int BarEnd = Width - scRightMargin;
	
	float PixelWidth = 2.0f / (float)Width;
	float PixelHeight = 2.0f / (float)Height;
	float ViewSpaceFrameWidth = (BarEnd - BarStart) * PixelWidth;
	float MicroSecondsToViewSpace = ViewSpaceFrameWidth / DurationMicroSecs;
			
	
	XMMATRIX LocalToWorld = XMMatrixIdentity();		
	XMFLOAT2 Uv0(0.0f, 0.0f);							
	
	m_rUtilityDraw->BeginTriangleList();	
	
	float X0;
	float X1;
	float Y0 = 1.0f - (scTopMargin + scBarHeight) * PixelHeight; // After frame duration
	float Y1 = Y0 - scBarHeight * PixelHeight;	
	
	for(unsigned int ThreadIndex = 0; ThreadIndex < scMaxThreads; ThreadIndex++)
	{
		X0 = -1.0f + BarStart * PixelWidth;
		X1 = X0; 
		const CEventDesc* pEventDesc = m_pEventDescs[ThreadIndex];
		if(pEventDesc)
		{
			if ((m_EventRead[ThreadIndex] == m_EventEnd[ThreadIndex]) && m_pActive[ThreadIndex])
			{
				CEvent* pEvent = m_pActive[ThreadIndex];
				if (pEvent->m_State == CEvent::eStarted)
				{
					DrawEvent(	pEvent,
								PrevFrame,
								ClockFrequency,
								ThreadIndex,
								MicroSecondsToViewSpace,
								X0,
								X1,
								Y0,
								Y1,
								PixelWidth,
								PixelHeight,
								pEventDesc);
				}
			}
			for ( ;(m_EventRead[ThreadIndex] != m_EventEnd[ThreadIndex]); m_EventRead[ThreadIndex] = (m_EventRead[ThreadIndex] + 1) % scMaxEvents)
			{
				unsigned int EventIndex = m_EventRead[ThreadIndex];
				CEvent* pEvent = &m_Events[ThreadIndex][EventIndex];
				DrawEvent(pEvent,
					PrevFrame,
					ClockFrequency,
					ThreadIndex,
					MicroSecondsToViewSpace,
					X0,
					X1,
					Y0,
					Y1,
					PixelWidth,
					PixelHeight,
					pEventDesc);

			}			
		}
		Y0 = Y1;
		Y1 = Y0 - scBarHeight * PixelHeight;	
	}
	m_rUtilityDraw->EndTriangleList(LocalToWorld, m_pMaterial, CRenderer::eDepthNone, CRenderer::eBlendModulate);	

	// Draw thread names	
	Y0 = scTopMargin + scBarHeight; // After frame duration, this is in pixels not view space
	X0 = scLeftMargin;
	for(unsigned int ThreadIndex = 0; ThreadIndex < scMaxThreads; ThreadIndex++)
	{
		if(m_pThreadNames[ThreadIndex])
		{
			m_rDebugGUI->DrawString(X0, Y0, m_pThreadNames[ThreadIndex], White);		
			Y0 += scBarHeight;
		}
	}			
	
	// Now draw all events for the current thread
	const CEventDesc* pEventDesc = m_pEventDescs[m_CurrentThread];
	if(pEventDesc)
	{
		while(pEventDesc->m_pName)
		{
			sprintf_s(FrameDurationSt, 255, "%-10s %d.%dms", pEventDesc->m_pName, m_Duration[pEventDesc->m_Type] / 1000, m_Duration[pEventDesc->m_Type] % 1000);
			m_rDebugGUI->DrawString(X0, Y0, FrameDurationSt, pEventDesc->m_Color);	
			Y0 += scBarHeight;	
			m_Duration[pEventDesc->m_Type] = 0;		
			pEventDesc++;
		}		
	}	
}
示例#14
0
	void Engine::StartGame()
	{
		myGameIsRunning = true;

		// Close the game when we hit the close button
		myEventHost->RegisterEvent<CloseButtonPressedEvent>([=](CloseButtonPressedEvent &ev)
		{
			myGameIsRunning = false;
		});

		// Show the window
		myRenderer->GetWindow()->SetVisible(true);

		Stopwatch stopwatch;
		std::vector<RenderCommand> *currentRenderCommands = new std::vector<RenderCommand>();

		float time = 0.f;

		while (myGameIsRunning == true)
		{
			float deltaTime = stopwatch.GetElapsedSeconds();
			time += deltaTime;
			stopwatch.Restart();

			myRenderer->TriggerEvents();

			std::swap(currentRenderCommands, myNewRenderCommands);

			float progressToNextFixedUpdate = (myTimeAccumulator / myTimeStep);

			myTimeAccumulator += deltaTime;

			Matrix33f worldToViewport;
			Transformation cameraTransformation = mySceneHost->GetCurrentScene()->GetCamera().GetTransformation();

			auto gameLogicWork = myThreadPool->QueueWorkItem(std::function<void()>([=]
			{
				while (myTimeAccumulator >= myTimeStep)
				{
					myEventHost->TriggerEvent(UpdateEvent(myTimeStep));
					myEventHost->TriggerEvent(EndUpdateEvent());
					myTimeAccumulator -= myTimeStep;
				}

				myEventHost->TriggerEvent(DrawEvent());
			}));

			Vector2f windowSize = Vector2f(myRenderer->GetWindow()->GetSize());
			worldToViewport *= Matrix33f::CreateScale(2.f / windowSize.x, -2.f / windowSize.y, 1.f) * Matrix33f::CreateTranslation(-cameraTransformation.Position.x, -cameraTransformation.Position.y) * Matrix33f::CreateRotateAroundZ(cameraTransformation.Rotation);

			myRenderer->SetWorldToViewportMatrix(worldToViewport);

			myRenderer->Clear();
			RenderTarget &renderTarget = *myRenderer->GetRenderTarget();
			
			for (size_t i = 0; i < currentRenderCommands->size(); i++)
			{
				RenderCommand currentCommand = (*currentRenderCommands)[i];

				Vector2f position = currentCommand.previousPosition + (currentCommand.currentPosition - currentCommand.previousPosition) * progressToNextFixedUpdate;

				renderTarget.Render(currentCommand.texture, position);
			}
			currentRenderCommands->clear();

			myRenderer->PresentBackBuffer();

			float beginSleep = stopwatch.GetElapsedSeconds();
			std::this_thread::sleep_for(std::chrono::microseconds(1));

			// Wait for the game logic update to finish
			gameLogicWork->Wait();

			if (mySceneHost->GetCurrentScene() == nullptr)
			{
				myGameIsRunning = false;
			}
		}

		delete currentRenderCommands;

		myEventHost->TriggerEvent(ExitingEvent());
	}