/** * @brief * Called when a control of the input controller has been activated */ void Application30::OnControl(Control &cControl) { // Get name of control String sControl = cControl.GetName(); // Display control value String sValue; if (cControl.GetType() == ControlButton) sValue = static_cast<Button&>(cControl).IsPressed() ? "<pressed>" : "<released>"; else if (cControl.GetType() == ControlAxis) sValue = String::Format("%5.2f", static_cast<Axis&>(cControl).GetValue()); System::GetInstance()->GetConsole().Print("- '" + sControl + "': " + sValue + '\n'); // LED test if ((cControl.GetName() == "Plus" || cControl.GetName() == "Minus") && static_cast<Button&>(cControl).IsPressed()) { // Get LED control LED *pLED = static_cast<LED*>(cControl.GetController()->GetControl("LED")); if (pLED) { // Change LED value uint32 nLED = pLED->GetLEDs(); if (cControl.GetName() == "Plus") nLED++; else nLED--; if (nLED > 15) nLED = 0; pLED->SetLEDs(nLED); } } // Rumble test if (cControl.GetName() == "Button1" || cControl.GetName() == "Button2") { // Get rumble control (try "Rumble3" first for joystick, then "Rumble1" for WiiMote) Effect *pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble3")); if (!pRumble) pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble1")); if (pRumble) { // Enable or disable rumble? if (cControl.GetName() == "Button1") pRumble->SetValue(1.0f); if (cControl.GetName() == "Button2") pRumble->SetValue(0.0f); } } }
void PruebaVentana::Render( double elapsed ) { m_d3ddevice.Clear(ClearFlags_Target |ClearFlags_ZBuffer, D3DCOLOR_XRGB(0,40,100),1.0f,0); m_d3ddevice.BeginScene(); static float index = 0; index += 1.5f*elapsed; Matrix matView; matView.LookAtLH(Vector3(3.0f, 1.0f, 3.0f),Vector3(0.0f,0.0f,0.0f), Vector3(0.0f,1.0f,0.0f)); m_d3ddevice.Transform.View = matView; Matrix matProjection; matProjection.PerspectiveFovLH( D3DXToRadian(45),m_aspect_ratio,1.0f,100.0f); m_d3ddevice.Transform.Projection = matProjection; Matrix matTranslate; matTranslate.RotationY(index); mesh.SetTransform(matTranslate); m_d3ddevice.Transform.World = matTranslate; effect.SetTechnique("Default"); effect.SetValue("matWorldViewProj",matTranslate*matView*matProjection); effect.SetValue("base_Tex",mesh.m_textures[0]); //effect.Begin(FX_None); //effect.BeginPass(0); mesh.Render(); char fps[100]; sprintf(fps,"FPS:%d",m_timer.m_fps); font.DrawText(NULL,fps,WRectangle(0,00,100,100),DrawTextFormat_NoClip,0xFFFFFF00); //effect.EndPass(); //effect.End(); m_d3ddevice.EndScene(); m_d3ddevice.Present(); }