예제 #1
0
ULONG ASMCALL
gw_SetEffect( REG(a0, ULONG*                   effect),
              REG(a2, struct AHIPrivAudioCtrl* audioctrl),
              REG(a6, struct AHIBase*          AHIBase) )
{
  return SetEffect( effect, audioctrl, AHIBase );
}
예제 #2
0
파일: palette.cpp 프로젝트: paud/d2x-xl
void CPaletteManager::SetEffect (bool bForce)
{
if (gameStates.render.vr.bUseRegCode)
	;//GrPaletteStepUpVR (r, g, b, VR_WHITE_INDEX, VR_BLACK_INDEX);
else
	SetEffect (m_data.effect.red, m_data.effect.green, m_data.effect.blue, bForce);
}
HomebrewPrompt::~HomebrewPrompt()
{
	ResumeGui();

	SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
	while(parentElement && this->GetEffect() > 0) usleep(100);

	if(parentElement)
		((GuiWindow *) parentElement)->Remove(this);
	parentElement = NULL;

	RemoveAll();
	
	delete btnUp;
	delete btnDown;
	delete btnLeft;
	delete btnRight;
	delete trigU;
	delete trigD;
	delete trigL;
	delete trigR;

	delete whiteBox;
	delete iconImg;
	delete whiteBoxImg;
	delete nameTxt;
	delete coderTxt;
	delete versionTxt;
	delete release_dateTxt;
	delete long_descriptionTxt;
	delete filesizeTxt;
	delete scrollBar;
}
예제 #4
0
WDMMenu::~WDMMenu()
{
	ResumeGui();

	SetEffect(EFFECT_FADE, -50);
	while(this->GetEffect() > 0)
		usleep(100);

	HaltGui();
	if(parentElement)
		((GuiWindow *) parentElement)->Remove(this);

	RemoveAll();

	delete btnOutline;

	delete backBtnTxt;
	delete backBtnImg;
	delete backBtn;

	delete defaultBtnTxt;
	delete defaultBtnImg;
	delete defaultBtn;

	delete trigA;
	delete trigB;

	delete optionBrowser;
	delete wdmFile;

	ResumeGui();
}
SettingsMenu::~SettingsMenu()
{
	ResumeGui();

	SetEffect(EFFECT_FADE, -50);
	while(this->GetEffect() > 0)
		usleep(100);

	HaltGui();
	if(parentElement)
		((GuiWindow *) parentElement)->Remove(this);

	RemoveAll();

	if(btnOutline)
		delete btnOutline;

	if(backBtnTxt)
		delete backBtnTxt;
	if(backBtnImg)
		delete backBtnImg;
	if(backBtn)
		delete backBtn;

	if(trigA)
		delete trigA;
	if(trigB)
		delete trigB;

	delete titleTxt;

	delete optionBrowser;

	ResumeGui();
}
예제 #6
0
EffectEditor::EffectEditor(Effect* effect, MaterialView* view, QWidget *parent)
  : BaseMaterialEditorWidget(parent)
  , _materialView(view)
  , _effect (0)
{
  _gui.setupUi(this);
  _groupView = new GroupTreeItemView(this);
  QGridLayout* layout = new QGridLayout(_gui.widgetCategory);
  layout->setContentsMargins(QMargins (0, 0, 0, 0));
  layout->addWidget (_groupView, 0, 0);


	_stagesModel = new EffectStagesModel ();
	_gui.listViewStages->setModel (_stagesModel);

	_programsModel = new EffectProgramsModel ();
	_gui.treeViewPrograms->setModel (_programsModel);

	_gui.pushButtonAddStage->setEnabled (false);
	_gui.pushButtonRemoveStage->setEnabled (false);
  if (effect)
    {
      SetEffect(effect);
    }
}
예제 #7
0
Scared::Scared(vec3* pacmanPos, Effect *effect, vec3 lastDir)
{
	mPacmanPos = pacmanPos;
	SetEffect(effect);
	SetLastDir(lastDir);
	enterCross = true;
}
예제 #8
0
PromptWindow::~PromptWindow()
{
	ResumeGui();

	SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
	while(parentElement && this->GetEffect() > 0) usleep(100);

	HaltGui();
	if(parentElement)
		((GuiWindow *) parentElement)->Remove(this);
	parentElement = NULL;

	RemoveAll();

	delete btnOutline;
	delete dialogBox;

	delete trigA;
	delete trigB;

	delete dialogBoxImg;

	delete titleTxt;
	delete msgTxt;

	for(u32 i = 0; i < Button.size(); ++i)
	{
		delete ButtonTxt[i];
		delete ButtonImg[i];
		delete Button[i];
	}

	ResumeGui();
}
예제 #9
0
파일: palette.cpp 프로젝트: paud/d2x-xl
void CPaletteManager::LoadEffect (CPalette *palette)
{
SetEffect (m_data.lastEffect.red, m_data.lastEffect.green, m_data.lastEffect.blue);
//	Forces flash effect to fixup palette next frame.
if (palette)
	Activate (palette);
m_data.xLastEffectTime = 0;
}
예제 #10
0
ULONG 
gw_SetEffect( struct _Regs* regs )
{
  ULONG*                   effect    = (ULONG*)                   GET_LONG( regs->a0 );
  struct AHIPrivAudioCtrl* audioctrl = (struct AHIPrivAudioCtrl*) GET_LONG( regs->a2 );
  struct AHIBase*          AHIBase   = (struct AHIBase*)          GET_LONG( regs->a6 );

  return SetEffect( effect, audioctrl, AHIBase );
}
예제 #11
0
ULONG 
gw_SetEffect( void )
{
  ULONG*                   effect    = (ULONG*)                   REG_A0;
  struct AHIPrivAudioCtrl* audioctrl = (struct AHIPrivAudioCtrl*) REG_A2;
  struct AHIBase*          AHIBase   = (struct AHIBase*)          REG_A6;

  return SetEffect( effect, audioctrl, AHIBase );
}
예제 #12
0
파일: palette.cpp 프로젝트: paud/d2x-xl
void CPaletteManager::ResetEffect (void)
{
m_data.effect.red =
m_data.effect.green =
m_data.effect.blue= 0;
m_data.xFlashDuration = 0;
m_data.xLastEffectTime = 0;
SetEffect (0, 0, 0);
}
예제 #13
0
/////////////////////////////////////
// Purpose:	reset the obj's materials
// Output:	set obj's material from
///			its model.
// Return:	none
/////////////////////////////////////
void IgfxObject::ResetMaterial()
{
	u32 numMat = m_mdl->GetNumMaterial();

	for(u32 i = 0; i < numMat; i++)
	{
		SetTxt(i, m_mdl->GetTxt(i, 0));
		SetEffect(i, m_mdl->GetEffect(i));
		m_mdl->GetMaterial(i, &m_pObjMats[i].mat);
	}
}
예제 #14
0
void GuiTooltip::Draw()
{
	if(!IsVisible())
		return;

	if(parentElement->GetState() != oldParentState)
	{
		timer.reset();
		oldParentState = parentElement->GetState();
	}

	if(  (parentElement->GetState() == STATE_SELECTED)
	   && bIsHidden
	   && timer.elapsedMilliSecs() >= (u32)Settings.TooltipDelay)
	{
		SetEffect(EFFECT_FADE, 50);
		bIsHidden = false;
		timer.reset();
	}
	else if(   !bIsHidden
			&& (parentElement->GetState() != STATE_SELECTED))
	{
		SetEffect(EFFECT_FADE, -50);
		bIsHidden = true;
		timer.reset();
	}

	if(!bIsHidden || (GetEffect() != 0))
	{
		leftImage->Draw();
		tileImage->Draw();
		rightImage->Draw();
		if(text)
			text->Draw();
	}

	this->UpdateEffects();
}
예제 #15
0
void DragEffectBitmapButton::DoSetSizeHints(int minW, int minH,
                                            int maxW, int maxH,
                                            int incW, int incH ) {
    int offset = 0;
    #ifdef LINUX
        offset = 12; //Linux puts a 6 pixel border around it
    #endif // LINUX
    SetEffect(mEffect, minW);
    wxBitmapButton::DoSetSizeHints(minW + offset,
                                   minH + offset,
                                   maxW + offset,
                                   maxH + offset,
                                   incW, incH);
}
예제 #16
0
파일: palette.cpp 프로젝트: paud/d2x-xl
void CPaletteManager::FadeEffect (void)
{
	float	nDecAmount = 0;
	bool	bForce = false;

	//	Diminish at FADE_RATE units/second.
	//	For frame rates > FADE_RATE Hz, use randomness to achieve this.
if (gameData.time.xFrame < I2X (1) / FADE_RATE) {
	if (d_rand () < gameData.time.xFrame * FADE_RATE / 2)	
		nDecAmount = 1;
	}
else {
	if (!(nDecAmount = X2F (gameData.time.xFrame * FADE_RATE)))		// one second = FADE_RATE counts
		nDecAmount = 1;						// make sure we decrement by something
	}
nDecAmount /= 64.0f;

if (m_data.xFlashDuration) {
	//	Part of hack system to force update of palette after exiting a menu.
	if (m_data.xLastEffectTime)
		bForce = true;

	if ((m_data.xLastEffectTime + I2X (1)/8 < gameData.time.xGame) || (m_data.xLastEffectTime > gameData.time.xGame)) {
		audio.PlaySound (SOUND_CLOAK_OFF, SOUNDCLASS_GENERIC, m_data.xFlashDuration / 4);
		m_data.xLastEffectTime = gameData.time.xGame;
		}

	m_data.xFlashDuration -= gameData.time.xFrame;
	if (m_data.xFlashDuration < 0)
		m_data.xFlashDuration = 0;

	if (bForce || (d_rand () > 4096)) {
      if ((gameData.demo.nState == ND_STATE_RECORDING) && (m_data.effect.red || m_data.effect.green || m_data.effect.blue))
	      NDRecordPaletteEffect (short (m_data.effect.red * 64), short (m_data.effect.green * 64), short (m_data.effect.blue * 64));
		paletteManager.SetEffect ();
		return;
		}
	}

m_data.effect.red = UpdateEffect (m_data.effect.red, nDecAmount);
m_data.effect.green = UpdateEffect (m_data.effect.green, nDecAmount);
m_data.effect.blue = UpdateEffect (m_data.effect.blue, nDecAmount);

if ((gameData.demo.nState == ND_STATE_RECORDING) && (m_data.effect.red || m_data.effect.green || m_data.effect.blue))
     NDRecordPaletteEffect (short (m_data.effect.red * 64), short (m_data.effect.green * 64), short (m_data.effect.blue * 64));
SetEffect (bForce);
}
예제 #17
0
WDMMenu::WDMMenu(const struct discHdr * header)
	: GuiWindow(screenwidth, screenheight)
{
	Options = new OptionList;

	btnOutline = Resources::GetImageData("button_dialogue_box.png");

	trigA = new GuiTrigger();
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);

	trigB = new GuiTrigger();
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	defaultBtnTxt = new GuiText(tr("Default"), 22, (GXColor){0, 0, 0, 255});
	defaultBtnImg = new GuiImage(btnOutline);
	defaultBtn = new GuiButton(defaultBtnImg, defaultBtnImg, 2, 3, 130, 400, trigA, btnSoundOver, btnSoundClick2, 1);
	defaultBtn->SetLabel(defaultBtnTxt);
	Append(defaultBtn);

	backBtnTxt = new GuiText(tr("Back"), 22, (GXColor){0, 0, 0, 255});
	backBtnImg = new GuiImage(btnOutline);
	backBtn = new GuiButton(backBtnImg, backBtnImg, 2, 3, -130, 400, trigA, btnSoundOver, btnSoundClick2, 1);
	backBtn->SetLabel(backBtnTxt);
	backBtn->SetTrigger(trigB);
	Append(backBtn);

	optionBrowser = new GuiOptionBrowser(396, 280, Options, "bg_options_settings.png");
	optionBrowser->SetPosition(0, 90);
	optionBrowser->SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	Append(optionBrowser);

	SetEffect(EFFECT_FADE, 50);

	char WDMPath[200];
	snprintf(WDMPath, sizeof(WDMPath), "%s/%.3s.wdm", Settings.WDMpath, (char *) header->id);

	if(!CheckFile(WDMPath))
	{
		snprintf(WDMPath, sizeof(WDMPath), "%s/%.6s.wdm", Settings.WDMpath, (char *) header->id);
		if(!CheckFile(WDMPath))
			snprintf(WDMPath, sizeof(WDMPath), "%s/%.4s.wdm", Settings.WDMpath, (char *) header->id);
	}

	wdmFile = new WDMFile(WDMPath);

	CheckGameFiles(header);
}
예제 #18
0
SettingsMenu::SettingsMenu(const char * title, OptionList * opts, int returnTo)
	: GuiWindow(screenwidth, screenheight)
{
	Options = opts;
	returnToMenu = returnTo;
	trigA = NULL;
	trigB = NULL;
	backBtnTxt = NULL;
	backBtnImg = NULL;
	backBtn = NULL;
	btnOutline = NULL;

	//! Skipping back button if there is no menu defined to go back to
	if(returnToMenu != MENU_NONE)
	{
		btnOutline = Resources::GetImageData("button_dialogue_box.png");

		trigA = new GuiTrigger();
		trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);

		trigB = new GuiTrigger();
		trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

		backBtnTxt = new GuiText(tr("Back"), 22, (GXColor){0, 0, 0, 255});
		backBtnImg = new GuiImage(btnOutline);
		backBtn = new GuiButton(backBtnImg, backBtnImg, 2, 3, -180, 400, trigA, btnSoundOver, btnSoundClick2, 1);
		backBtn->SetLabel(backBtnTxt);
		backBtn->SetTrigger(trigB);
		Append(backBtn);
	}

	optionBrowser = new GuiOptionBrowser(396, 280, Options, "bg_options_settings.png");
	optionBrowser->SetAlignment(thAlign("center - settings option browser align hor"), thAlign("top - settings option browser align ver"));
	optionBrowser->SetPosition(thInt("0 - settings option browser pos x"), thInt("90 - settings option browser pos y"));

	titleTxt = new GuiText(title, 28, thColor("r=0 g=0 b=0 a=255 - settings title text color"));
	titleTxt->SetAlignment(thAlign("center - settings title text align hor"), thAlign("top - settings title text align ver"));
	titleTxt->SetPosition(thInt("0 - settings title text pos x"), thInt("40 - settings title text pos y"));
	titleTxt->SetMaxWidth(thInt("310 - settings title text max width"), SCROLL_HORIZONTAL);

	Append(optionBrowser);
	Append(titleTxt);

	SetEffect(EFFECT_FADE, 50);
}
예제 #19
0
LUAMTA_FUNCTION(particle_emitter, LoadEffect)
{
	auto self = my->ToParticleEmitter(1);

	auto effect = gEnv->p3DEngine->GetParticleManager()->FindEffect(my->ToString(2));

	if (effect)
	{
		self->SetEffect(effect);

		my->Push(true);

		return 1;
	}

	my->Push(false);

	return 1;
}
예제 #20
0
PromptWindow::PromptWindow(const char *title, const char *msg)
	: GuiWindow(472, 320)
{
	SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	SetPosition(0, -10);

	btnOutline = Resources::GetImageData("button_dialogue_box.png");
	dialogBox = Resources::GetImageData("dialogue_box.png");

	width = dialogBox->GetWidth();
	height = dialogBox->GetHeight();

	trigA = new GuiTrigger;
	trigA->SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB = new GuiTrigger;
	trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	dialogBoxImg = new GuiImage(dialogBox);
	if(Settings.wsprompt)
		dialogBoxImg->SetWidescreen(Settings.widescreen);
	Append(dialogBoxImg);

	titleTxt = new GuiText(title, 26, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_TOP);
	titleTxt->SetPosition(0, 55);
	if(Settings.wsprompt && Settings.widescreen)
		titleTxt->SetMaxWidth(width-140, DOTTED);
	else
		titleTxt->SetMaxWidth(width-40, DOTTED);
	Append(titleTxt);

	msgTxt = new GuiText(msg, 22, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
	msgTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
	msgTxt->SetPosition(0, -40);
	if(Settings.wsprompt && Settings.widescreen)
		msgTxt->SetMaxWidth(width-140, WRAP);
	else
		msgTxt->SetMaxWidth(width-40, WRAP);
	Append(msgTxt);

	SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
}
예제 #21
0
void CGUIButton::Draw( CGame2D* g2d )
{
	if (m_img)
	{
		SetEffect(fxBlend);
		if (m_bPushed)
		{
			g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 3, &m_rtPush);
		}else
		{
			D3DCOLOR color1 = D3DXCOLOR(1, 1, 1, 1 - m_counter);
			D3DCOLOR color2 = D3DXCOLOR(1, 1, 1, m_counter);

			g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 3, 
								&m_rtNormal, color1);
			g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 3, 
								&m_rtFocus, color2);
		}
	}
}
예제 #22
0
SettingsMenu::SettingsMenu()
	: GuiFrame(screenwidth, screenheight)
{
	globalSettings = NULL;
	settingsBrowser = NULL;
	
	BtnSoundClick = Resources::GetSound("button_click.wav");
	BtnSoundOver = Resources::GetSound("button_over.wav");
	BtnSoundClick->SetVolume(Settings.SFXVolume);
	BtnSoundOver->SetVolume(Settings.SFXVolume);
	
	trigA.SetSimpleTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);
	trigB.SetButtonOnlyTrigger(-1, WiiControls.BackButton | ClassicControls.BackButton << 16, GCControls.BackButton);
	
	BgImgData = Resources::GetImageData("settings_background.png");
	BgImg = new GuiImage(BgImgData);
	
	Title = new GuiText(tr("Global Settings"), 28, thColor("r=0 g=0 b=0 a=255 - settings menu title text color"));
	Title->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	Title->SetPosition(170, 38);
	Title->SetMaxWidth(310, SCROLL_HORIZONTAL);
	
	BackBtnTxt = new GuiText(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - settings menu back button text color"));
	BackBtn = new PictureButton("settings_menu_button.png", "settings_menu_button.png", BtnSoundClick, BtnSoundOver);
	BackBtn->SetAlignment(thAlign("center - settings menu back button align hor") | thAlign("top - settings menu back button align ver"));
	BackBtn->SetPosition(thInt("-195 - settings menu back button pos x"), thInt("400 - settings menu back button pos y"));
	BackBtn->SetLabel(BackBtnTxt);
	BackBtn->SetTrigger(&trigA);
	BackBtn->SetTrigger(&trigB);
	BackBtn->Clicked.connect(this, &SettingsMenu::OnBackButtonClick);
	
	globalSettings = new GlobalSettings();
	globalSettings->FlyingBtnMenuClicked.connect(this, &SettingsMenu::OnFlyingButtonClick);
	
	Append(BgImg);
	Append(Title);
	Append(BackBtn);
	Append(globalSettings);
	
	SetEffect(EFFECT_FADE, 20);
}
예제 #23
0
void SettingsMenu::quit()
{
	if(settingsBrowser)
	{
		Application::Instance()->PushForDelete(settingsBrowser);
		Application::Instance()->updateEvents();
	}
	
	if(globalSettings && (globalSettings->GetState() == STATE_DEFAULT))
		globalSettings->FadeOut();
	
	Settings.Save();

	SetEffect(EFFECT_FADE, -20);
	while(this->IsAnimated())
		Application::Instance()->updateEvents();
	
	Application::Instance()->UnsetUpdateOnly(this);
	Application::Instance()->Remove(this);
	Application::Instance()->updateEvents();
	
	instance->DestroyInstance();
}
예제 #24
0
void CGUIList::Draw(CGame2D* g2d)
{
	if (m_imgBk)
	{
		SetEffect(fxBlend);
		g2d->DrawImageScale(m_imgBk, X + Parent->GetX(), Y + Parent->GetY(), Width, Height);
	}

	for (int i = m_topline; i < (int)Items.size() && i < m_topline + m_lines; i++)
	{
		RECT rt = MakeBounds((int)(X + Parent->GetX() + m_offsetX + 10), 
							(int)(Y + Parent->GetY() + m_offsetY + m_itemHeight * (i - m_topline)),
							 (int)(Width + 0.5f - m_offsetX * 2), (int)(m_itemHeight + 0.5f));
		if (m_index != i)
		{
			g2d->DrawString(m_font, Items[i].c_str(), &rt, m_textColor, DT_VCENTER);
		}else
		{
			g2d->DrawImageScale(m_imgSel, (float)rt.left - 10, (float)rt.top, Width - m_offsetX * 2, m_itemHeight);
			g2d->DrawString(m_font, Items[i].c_str(), &rt, m_selColor, DT_VCENTER);
		}
		
	}
}
예제 #25
0
void CGUICheckBox::Draw( CGame2D* g2d )
{
    if (m_img)
    {
        SetEffect(fxBlend);
        D3DCOLOR color1 = D3DXCOLOR(1, 1, 1, 1 - m_counter);
        D3DCOLOR color2 = D3DXCOLOR(1, 1, 1, m_counter);

        if (m_bChecked)
        {
            g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 4, 
                &m_rtCheck, color1);
            g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 4, 
                &m_rtFocusCheck, color2);
        }else
        {

            g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 4, 
                &m_rtUncheck, color1);
            g2d->DrawImageScale(m_img, X + Parent->GetX(), Y + Parent->GetY(), Width, Height * 4, 
                &m_rtFocusUncheck, color2);
        }
    }
}
예제 #26
0
HomeMenu::~HomeMenu()
{
	MainWindow::Instance()->ResumeGui();
	SetEffect(EFFECT_FADE, -50);
	while(this->GetEffect() > 0) usleep(100);

	MainWindow::Instance()->HaltGui();
	if(parentElement)
		((GuiWindow *) parentElement)->Remove(this);

	RemoveAll();

	delete WiimoteBtn;
	delete ShutdownBtn;
	delete ExitBtn;
	delete CloseBtn;
	delete TopBtn;
	delete BottomBtn;

	delete TopBtnImg;
	delete TopBtnOverImg;
	delete BottomBtnImg;
	delete BottomBtnOverImg;
	delete CloseBtnImg;
	delete ExitBtnImg;
	delete ShutdownBtnImg;
	delete WiimoteBtnImg;

	Resources::Remove(TopBtnImgData);
	Resources::Remove(TopBtnOverImgData);
	Resources::Remove(BottomBtnImgData);
	Resources::Remove(BottomBtnOverImgData);
	Resources::Remove(CloseBtnImgData);
	Resources::Remove(StandardBtnImgData);
	Resources::Remove(WiimoteBtnImgData);
	Resources::Remove(BatteryImgData);
	Resources::Remove(BatteryBarImgData);
	Resources::Remove(BatteryRedImgData);
	Resources::Remove(BatteryBarRedImgData);

	delete TitleText;
	delete ShutdownBtnText;
	delete ExitBtnText;
	delete CloseBtnText;

	for (int i = 0; i < 4; i++)
	{
		delete PlayerText[i];
		delete BatteryBarImg[i];
		delete BatteryImg[i];
		delete BatteryBarRedImg[i];
		delete BatteryRedImg[i];
		delete BatteryBtn[i];
	}

	delete trigA;
	delete trigB;
	delete trigHome;

	Resources::Remove(ButtonClickSnd);
	Resources::Remove(ButtonOverSnd);
	
	homeout->Stop();
	Resources::Remove(homein);
    Resources::Remove(homeout);
	
	bgMusic->Play();
	MainWindow::Instance()->ResumeGui();
}
예제 #27
0
//! Remove me later
void BoxCover::WiiPADControl(GuiTrigger *t)
{
	if((t->wpad.btns_d & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A))
	{
		if(t->wpad.ir.valid)
		{
			moveChan = t->chan;
			moveStartPosX = t->wpad.ir.x;
			moveStartPosY = t->wpad.ir.y;
			PosX += movePosX;
			PosY += movePosY;
			movePosX = 0.0f;
			movePosY = 0.0f;
			
			// GameCube and Classic Controller
			s8 movX = fabs(t->pad.stickX) > 10.0f ? t->pad.stickX : t->WPAD_Stick(0, 0);
			s8 movY = fabs(t->pad.stickY) > 10.0f ? t->pad.stickY : t->WPAD_Stick(0, 1);
			
			// WiiU Pro Classic Controller
			// Todo : Proper stick calibration required to allow moving cover
			
			//! Drop stick moves of less than 10 because of sensitivity
			if(fabs(movX) < 10.0f) movX = 0;
			if(fabs(movY) < 10.0f) movY = 0;
			if(movX < -PADCAL)
				PosX += (movX + PADCAL)  * Settings.PointerSpeed * fabs(PosZ)/3400.f;
			if(movX > PADCAL)
				PosX += (movX - PADCAL)  * Settings.PointerSpeed * fabs(PosZ)/3400.f;
			if(movY < -PADCAL)
				PosY += (movY + PADCAL)  * Settings.PointerSpeed * fabs(PosZ)/3400.f;
			if(movY > PADCAL)
				PosY += (movY - PADCAL)  * Settings.PointerSpeed * fabs(PosZ)/3400.f;
			
			if(moveChan >= 0 && moveChan < 4)
			{
				char name[50];
				snprintf(name, sizeof(name), "player%i_grab.png", moveChan+1);
				pointer[moveChan]->SetImage(name);
			}
		}
		else
			moveChan = -1;
	}
	else if(((t->wpad.btns_h & WPAD_BUTTON_A) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) || (t->pad.btns_h & PAD_BUTTON_A)) && moveChan == t->chan && t->wpad.ir.valid && !effects)
	{
		movePosX = (t->wpad.ir.x-moveStartPosX) * fabs(PosZ)/3400.f;
		movePosY = (moveStartPosY-t->wpad.ir.y) * fabs(PosZ)/3400.f;
		last_manual_move_frame = frameCount;
	}
	else if(!(t->wpad.btns_h & WPAD_BUTTON_A) && !(t->wpad.btns_h & WPAD_CLASSIC_BUTTON_A) && !(t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_A) && !(t->pad.btns_h & PAD_BUTTON_A) && moveChan == t->chan)
	{
		if(moveChan >= 0 && moveChan < 4)
		{
			char name[50];
			snprintf(name, sizeof(name), "player%i_point.png", moveChan+1);
			pointer[moveChan]->SetImage(name);
		}
	}

	if((t->wpad.btns_h & WPAD_BUTTON_UP) || (t->pad.substickY > PADCAL) || (t->wupcdata.substickY > WUPCCAL))
	{
		RotX -= 2.0f;
		last_manual_move_frame = frameCount;
	}
	if((t->wpad.btns_h & WPAD_BUTTON_DOWN) || (t->pad.substickY < -PADCAL) || (t->wupcdata.substickY < -WUPCCAL))
	{
		RotX += 2.0f;
		last_manual_move_frame = frameCount;
	}
	if((t->wpad.btns_h & WPAD_BUTTON_LEFT) || (t->pad.substickX < -PADCAL) || (t->wupcdata.substickX < -WUPCCAL))
	{
		RotY -= 2.0f;
		last_manual_move_frame = frameCount;
	}
	if((t->wpad.btns_h & WPAD_BUTTON_RIGHT) || (t->pad.substickX > PADCAL) || (t->wupcdata.substickX > WUPCCAL))
	{
		RotY += 2.0f;
		last_manual_move_frame = frameCount;
	}
	if((t->wpad.btns_d & WPAD_BUTTON_2) || (t->pad.btns_d & PAD_BUTTON_X) || (t->wpad.btns_d & WPAD_CLASSIC_BUTTON_X) || (t->wupcdata.btns_d & WPAD_CLASSIC_BUTTON_X))
	{
		if(RotY < 180.0f)
			SetEffect(EFFECT_BOX_ROTATE_X, 10, 180);
		else
			SetEffect(EFFECT_BOX_ROTATE_X, -10, -180);
		last_manual_move_frame = frameCount;
	}
	if((t->wpad.btns_h & WPAD_BUTTON_PLUS) || (t->pad.btns_h & PAD_TRIGGER_R) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_R) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_FULL_R))
	{
		if(PosZ < -2.8f)
			PosZ += 0.4f*fabs(PosZ)/19.f;
	}
	if((t->wpad.btns_h & WPAD_BUTTON_MINUS) || (t->pad.btns_h & PAD_TRIGGER_L) || (t->wpad.btns_h & WPAD_CLASSIC_BUTTON_FULL_L) || (t->wupcdata.btns_h & WPAD_CLASSIC_BUTTON_FULL_L))
	{
		if(PosZ > -43.0f)
			PosZ -= 0.4f*fabs(PosZ)/19.f;
	}
}
ArchiveProperties::ArchiveProperties(ArchiveHandle *archive, ItemMarker *Marker)
	:GuiFrame(0,0)
{
	int Position_X = 40;
	int Position_Y = 40;
	char temp[MAXPATHLEN];

	int lastItem = Marker->GetItemcount()-1;
	const char *filenamePtr = 0;
	bool isDir = false;
	if(lastItem >= 0)
	{
		isDir = Marker->IsItemDir(lastItem);

		filenamePtr = strrchr(Marker->GetItemPath(lastItem), '/');
		if(!filenamePtr)
			filenamePtr = Marker->GetItemPath(lastItem);
		else
			filenamePtr++;
	}

	u64 ModTime = 0;
	u8 archiveType = 0;
	u64 totalSize = 0;
	u64 compSize = 0;
	u32 fileCount = 0;

	for(u32 i = 0; i < archive->GetItemCount(); ++i)
	{
		ArchiveFileStruct *fileStruct = archive->GetFileStruct(i);

		if(fileStruct->isdir)
			continue;

		for(int n = 0; n < Marker->GetItemcount(); ++n)
		{
			bool isMarked = false;
			const char *path = Marker->GetItemPath(n);
			if(Marker->IsItemDir(n))
			{
				if(   strlen(path) < strlen(fileStruct->filename)
				   && strncasecmp(path, fileStruct->filename, strlen(path)) == 0)
				{
					isMarked = true;
				}
			}
			else if(strcasecmp(path, fileStruct->filename) == 0)
					isMarked = true;

			if(isMarked)
			{
				// save the last
				archiveType = fileStruct->archiveType;
				ModTime = fileStruct->ModTime;
				totalSize += fileStruct->length;
				compSize += fileStruct->comp_length;
				fileCount++;
			}
		}
	}


	dialogBox = Resources::GetImageData("bg_properties.png");
	titleData = Resources::GetImageData("icon_folder.png");
	arrowUp = Resources::GetImageData("close.png");
	arrowUpOver = Resources::GetImageData("close_over.png");

	btnClick = Resources::GetSound("button_click.wav");

	dialogBoxImg = new GuiImage(dialogBox);

	width = dialogBox->GetWidth();
	height = dialogBox->GetHeight();

	trigA = new SimpleGuiTrigger(-1, WiiControls.ClickButton | ClassicControls.ClickButton << 16, GCControls.ClickButton);
	trigB = new GuiTrigger();
	trigB->SetButtonOnlyTrigger(-1, WiiControls.BackButton | ClassicControls.BackButton << 16, GCControls.BackButton);

	int maxTxtWidth = dialogBox->GetWidth()-Position_X;
	TitleTxt = new GuiText(filenamePtr, 22, (GXColor){0, 0, 0, 255});
	TitleTxt->SetAlignment(ALIGN_CENTER | ALIGN_TOP);
	TitleTxt->SetPosition(0, Position_Y);
	TitleTxt->SetMaxWidth(maxTxtWidth, DOTTED);

	int ImgPos = (TitleTxt->GetTextWidth() > maxTxtWidth ? maxTxtWidth : TitleTxt->GetTextWidth());
	TitleImg = new GuiImage(titleData);
	TitleImg->SetAlignment(ALIGN_CENTER | ALIGN_TOP);
	int IconPosition = -(ImgPos/2+titleData->GetWidth())+10;
	if(IconPosition < (30-width/2))
		IconPosition = 30-width/2;
	TitleImg->SetPosition(IconPosition, Position_Y);
	Position_Y += 80;

	sprintf(temp, tr("Filepath:  %s"), Marker->GetItemPath(lastItem) ? Marker->GetItemPath(lastItem) : "");

	filepathTxt =  new GuiText(temp, 20, (GXColor){0, 0, 0, 255});
	filepathTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filepathTxt->SetPosition(Position_X, Position_Y);
	filepathTxt->SetMaxWidth(dialogBox->GetWidth()-Position_X-10, DOTTED);
	Position_Y += 30;

	filecountTxt = new GuiText(tr("Files:"), 20, (GXColor){0, 0, 0, 255});
	filecountTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filecountTxt->SetPosition(Position_X, Position_Y);

	filecountTxtVal = new GuiText(fmt("%i", fileCount), 20, (GXColor){0, 0, 0, 255});
	filecountTxtVal->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filecountTxtVal->SetPosition(Position_X+180, Position_Y);
	Position_Y += 30;

	if(totalSize > (u64) GBSIZE)
		sprintf(temp, "%0.2fGB", totalSize/GBSIZE);
	else if(totalSize > (u64) MBSIZE)
		sprintf(temp, "%0.2fMB", totalSize/MBSIZE);
	else if(totalSize > (u64) KBSIZE)
		sprintf(temp, "%0.2fKB", totalSize/KBSIZE);
	else
		sprintf(temp, "%iB", (u32) totalSize);

	filesizeTxt = new GuiText(tr("Size:"), 20, (GXColor){0, 0, 0, 255});
	filesizeTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filesizeTxt->SetPosition(Position_X, Position_Y);

	filesizeTxtVal = new GuiText(temp, 20, (GXColor){0, 0, 0, 255});
	filesizeTxtVal->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filesizeTxtVal->SetPosition(Position_X+180, Position_Y);
	Position_Y += 30;

	if(compSize > (u64) GBSIZE)
		sprintf(temp, "%0.2fGB", compSize/GBSIZE);
	else if(compSize > (u64) MBSIZE)
		sprintf(temp, "%0.2fMB", compSize/MBSIZE);
	else if(compSize > (u64) KBSIZE)
		sprintf(temp, "%0.2fKB", compSize/KBSIZE);
	else
		sprintf(temp, "%iB", (u32) compSize);

	filesizeCompTxt = new GuiText(tr("Compressed Size:"), 20, (GXColor){0, 0, 0, 255});
	filesizeCompTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filesizeCompTxt->SetPosition(Position_X, Position_Y);

	filesizeCompTxtVal = new GuiText(temp, 20, (GXColor){0, 0, 0, 255});
	filesizeCompTxtVal->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filesizeCompTxtVal->SetPosition(Position_X+180, Position_Y);
	Position_Y += 30;

	const char * pch = NULL;
	if(isDir)
	{
		snprintf(temp, sizeof(temp), tr("Folder"));
		TitleTxt->SetMaxWidth(dialogBox->GetWidth()-75, DOTTED);
	}
	else if(filenamePtr)
	{
		pch = strrchr(filenamePtr, '.');
		if(pch)
			pch += 1;
		else
			pch = filenamePtr;
		snprintf(temp, sizeof(temp), "%s", pch);
	}
	else
		temp[0] = 0;

	filetypeTxt = new GuiText(tr("Filetype:"), 20, (GXColor){0, 0, 0, 255});
	filetypeTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filetypeTxt->SetPosition(Position_X, Position_Y);

	filetypeTxtVal = new GuiText(temp, 20, (GXColor){0, 0, 0, 255});
	filetypeTxtVal->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	filetypeTxtVal->SetPosition(Position_X+180, Position_Y);
	Position_Y += 30;

	last_modifTxt = new GuiText(tr("Last modified:"), 20, (GXColor){0, 0, 0, 255});
	last_modifTxt->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	last_modifTxt->SetPosition(Position_X, Position_Y);

	TimeStruct ptm;
	if(archiveType == SZIP)
	{
		ConvertNTFSDate(ModTime, &ptm);
	}
	else
	{
		ConvertDosDate(ModTime, &ptm);
	}
	snprintf(temp, sizeof(temp), "%02d:%02d  %02d.%02d.%04d", ptm.tm_hour, ptm.tm_min, ptm.tm_mday, ptm.tm_mon, ptm.tm_year);
	last_modifTxtVal = new GuiText(temp, 20, (GXColor){0, 0, 0, 255});
	last_modifTxtVal->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
	last_modifTxtVal->SetPosition(Position_X+180, Position_Y);
	Position_Y += 30;

	arrowUpImg = new GuiImage(arrowUp);
	arrowUpImgOver = new GuiImage(arrowUpOver);
	CloseBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
	CloseBtn->SetAlignment(ALIGN_RIGHT | ALIGN_TOP);
	CloseBtn->SetSoundClick(btnClick);
	CloseBtn->SetImage(arrowUpImg);
	CloseBtn->SetImageOver(arrowUpImgOver);
	CloseBtn->SetPosition(-20, 20);
	CloseBtn->SetEffectGrow();
	CloseBtn->SetTrigger(trigA);
	CloseBtn->SetTrigger(trigB);
	CloseBtn->Clicked.connect(this, &ArchiveProperties::OnButtonClick);

	Append(dialogBoxImg);
	Append(TitleTxt);
	if(isDir)
		Append(TitleImg);
	Append(filepathTxt);
	Append(filecountTxt);
	Append(filecountTxtVal);
	Append(filesizeTxt);
	Append(filesizeTxtVal);
	Append(filesizeCompTxt);
	Append(filesizeCompTxtVal);
	Append(filetypeTxt);
	Append(filetypeTxtVal);
	Append(last_modifTxt);
	Append(last_modifTxtVal);
	Append(CloseBtn);

	SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 40);
}
 /// \brief
 ///   Adds an effect to this config. Currently the same as SetEffect.
 inline void AddEffect(VCompiledEffect* pFX)
 {
   SetEffect(pFX);
 }
예제 #30
0
Hunt::Hunt(vec3* pacmanPos, Effect *effect) : mPacmanPos(pacmanPos), enterCross(true)
{
	SetEffect(effect);
	SetLastDir(vec3 (0,0,-1));
}