Esempio n. 1
0
void UGUI() {
    int i;
    UpdatePads();
    mainWindow->Draw();

#ifdef HW_RVL
    for (i = 3; i >= 0; i--) // so that player 1's cursor appears on top!
    {
        if (userInput[i].wpad->ir.valid)
            Menu_DrawImg(userInput[i].wpad->ir.x - 48, userInput[i].wpad->ir.y - 48,
                96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
        DoRumble(i);
    }
#endif
    Menu_Render();

    for (i = 0; i < 4; i++)
        mainWindow->Update(&userInput[i]);

    if (ExitRequested) {
        for (i = 0; i <= 255; i += 15) {
            mainWindow->Draw();

            Menu_DrawRectangle(0, 0, screenwidth, screenheight, (GXColor) {
                0, 0, 0, i
            }, 1);
            Menu_Render();
        }
        ExitApp();
    }
}
Esempio n. 2
0
/**
 * Draw the button on screen
 */
void GuiImage::Draw() {
    if (!image || !this->IsVisible() || tile == 0)
        return;

    float currScaleX = this->GetScaleX();
    float currScaleY = this->GetScaleY();
    int currLeft = this->GetLeft();
    int thisTop = this->GetTop();

    if (tile > 0) {
        int alpha = this->GetAlpha();
        for (int i = 0; i < tile; ++i) {
            Menu_DrawImg(currLeft + width*i, thisTop, width, height, image, imageangle, currScaleX, currScaleY, alpha);
        }
    } else {
        Menu_DrawImg(currLeft, thisTop, width, height, image, imageangle, currScaleX, currScaleY, this->GetAlpha());
    }

    if (stripe > 0) {
        int thisHeight = this->GetHeight();
        int thisWidth = this->GetWidth();

        for (int y = 0; y < thisHeight; y += 6)
            Menu_DrawRectangle(currLeft, thisTop + y, thisWidth, 3, (XeColor) {
                stripe, 0, 0, 0}, 1);
    }
    this->UpdateEffects();
}
Esempio n. 3
0
void Window::Draw()
{
	// If the title is held, move the window
	if (isMovable && isMoving)
	{
		POINT prevPoint = clickedPoint;

		// Get the current point
		clickedPoint.x = userInput[clickedChannel].wpad->ir.x;
		clickedPoint.y = userInput[clickedChannel].wpad->ir.y;

		// Move the window, based on the top and left of this window
		// Therefor, we need to calculate the difference between the mouse down point and the topleft point of this window
		int newX = GetLeft() + (clickedPoint.x - prevPoint.x);
		int newY = GetTop() + (clickedPoint.y - prevPoint.y);

		// Move the window to newX and newY, but stay within the boundaries
		if (newX > 0 && newY > 0 && (GetParent() == NULL || (newX + GetWidth() < GetParent() -> GetWidth() && newY + GetHeight() < GetParent() -> GetHeight()))) {
			SetPosition(newX, newY);
		}
	}

	GXColor backgroundColor = (GXColor){226, 230, 237, 255};

	Menu_DrawRectangle(this->GetLeft()+window_tile_vertical_left->GetWidth(), this->GetTop()+window_tile_horizontal_top->GetHeight(), GetZPosition(), width-window_tile_vertical_left->GetWidth()*2, height-window_tile_horizontal_top->GetHeight()*2, &backgroundColor, false, true);

	GuiFrame::Draw();
}
Esempio n. 4
0
void GuiWindow::Draw()
{
	if(_elements.size() == 0 || !this->IsVisible())
		return;

	u32 elemSize = _elements.size();
	for (u32 i = 0; i < elemSize; ++i)
	{
		try	{ _elements.at(i)->Draw(); }
		catch (const std::exception& e) { }
	}

	this->UpdateEffects();

	if(parentElement && state == STATE_DISABLED)
		Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0xbe, 0xca, 0xd5, 0x70},1);
}
Esempio n. 5
0
/****************************************************************************
 * UpdateGUI
 *
 * Primary thread to allow GUI to respond to state changes, and draws GUI
 ***************************************************************************/
static void * UpdateGUI(void *arg)
{
    u8 i;

    while (!ExitRequested)
    {
        if (guiHalt)
        {
            LWP_SuspendThread(guithread);
            continue;
        }

        UpdatePads();

        mainWindow->Draw();
        if (Settings.tooltips && Theme::ShowTooltips && mainWindow->GetState() != STATE_DISABLED)
            mainWindow->DrawTooltip();

        // Pointer modifies wpad data struct for easy implementation of "virtual pointer" with PAD-Sticks
        // That is why it has to be called right before updating other gui elements with the triggers
        i = 4;
        while(i--)
            pointer[i]->Draw(&userInput[i]);

        for (i = 0; i < 4; i++)
            mainWindow->Update(&userInput[i]);

        Menu_Render();

        if (bgMusic) bgMusic->UpdateState();
    }

    for (i = 5; i < 255; i += 10)
    {
        mainWindow->Draw();
        Menu_DrawRectangle(0, 0, screenwidth, screenheight, (GXColor) {
            0, 0, 0, i
        }, 1);
        Menu_Render();
    }

    mainWindow->RemoveAll();
    ShutoffRumble();

    return NULL;
}
Esempio n. 6
0
static void *
UpdateGUI (void *arg)
{
	int i;

	while(1)
	{
		if(guiHalt)
		{
			LWP_SuspendThread(guithread);
		}
		else
		{
			UpdatePads();
			mainWindow->Draw();

			#ifdef HW_RVL
			for(i=3; i >= 0; i--) // so that player 1's cursor appears on top!
			{
				if(userInput[i].wpad->ir.valid)
					Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48,
						96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
				DoRumble(i);
			}
			#endif

			Menu_Render();

			for(i=0; i < 4; i++)
				mainWindow->Update(&userInput[i]);

			if(ExitRequested)
			{
				for(i = 0; i < 255; i += 15)
				{
					mainWindow->Draw();
					Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1);
					Menu_Render();
				}
				ExitApp();
			}
		}
	}
	return NULL;
}
void BannerWindow::Draw(void)
{
	bool btnAGrow = (settingsBtn->GetState() == STATE_SELECTED || backBtn->GetState() == STATE_SELECTED);
	bannerFrame.SetButtonAGrow(btnAGrow);
	bannerFrame.SetButtonBGrow(startBtn->GetState() == STATE_SELECTED);

	//! Start playing banner sound after last animation frame if animation after zoom is enabled
	//! or on first frame if during zoom is enable
	if( AnimZoomIn && gameSound && (((Settings.BannerAnimStart == BANNER_START_ON_ZOOM) && AnimStep == 0)
	   || ((Settings.BannerAnimStart == BANNER_START_AFTER_ZOOM) && ((AnimStep + 1) == MaxAnimSteps))))
	{
		reducedVol = true;
		gameSound->Play();
	}

	// Run window animation
	Animate();

	// draw a black background image first
	Menu_DrawRectangle(0.0f, 0.0f, ScreenProps.x, ScreenProps.y, (GXColor) {0, 0, 0, BGAlpha}, true);

	// no banner alpha means its the start of the animation
	if(BannerAlpha == 0)
		return;

	// cut the unneeded stuff
	Mtx mv1, mv2, mv3;
	guMtxIdentity (mv2);
	guMtxIdentity (mv3);
	guMtxScaleApply(modelview,mv1, 1.f, -1.f, 1.f);
	guMtxTransApply(mv1,mv1, 0.5f * ScreenProps.x, 0.5f * ScreenProps.y, 0.f);
	guMtxTransApply(mv2,mv2, -0.5f * fBannerWidth, 0.5f * fBannerHeight, 0.f);
	guMtxTransApply(mv3,mv3, 0.5f * fBannerWidth, -0.5f * fBannerHeight, 0.f);
	guMtxConcat (mv1, mv2, mv2);
	guMtxConcat (mv1, mv3, mv3);

	f32 viewportv[6];
	f32 projectionv[7];

	GX_GetViewportv(viewportv, vmode);
	GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC);

	guVector vecTL;
	guVector vecBR;
	GX_Project(0.0f, 0.0f, 0.0f, mv2, projectionv, viewportv, &vecTL.x, &vecTL.y, &vecTL.z);
	GX_Project(0.0f, 0.0f, 0.0f, mv3, projectionv, viewportv, &vecBR.x, &vecBR.y, &vecBR.z);

	// round up scissor box offset and round down the size
	u32 scissorX = (u32)(0.5f + std::max(vecTL.x, 0.0f));
	u32 scissorY = (u32)(0.5f + std::max(vecTL.y, 0.0f));
	u32 scissorW = (u32)std::max(vecBR.x - vecTL.x, 0.0f);
	u32 scissorH = (u32)std::max(vecBR.y - vecTL.y, 0.0f);

	GX_SetScissor( scissorX, scissorY, scissorW, scissorH );

	// load projection matrix
	GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);

	if(gameBanner->getBanner())
	{
		gameBanner->getBanner()->Render(modelview, ScreenProps, Settings.widescreen, BannerAlpha);

		// advance only when animation isnt running on certain options
		if(Settings.BannerAnimStart != BANNER_START_AFTER_ZOOM || !AnimationRunning)
		{
			gameBanner->getBanner()->AdvanceFrame();

			// skip every 6th frame on PAL50 since all banners are 60 Hz
			if(Settings.PAL50 && (frameCount % 6 == 0)) {
				gameBanner->getBanner()->AdvanceFrame();
			}
		}
	}

	// render big frame and animate button over effects
	bannerFrame.Render(modelview, ScreenProps, Settings.widescreen, BannerAlpha);
	bannerFrame.AdvanceFrame();

	// Setup GX
	ReSetup_GX();

	if(AnimationRunning) {
		// remove scissors again as we draw the background layout too
		GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);

		// only render gui stuff when animation is done
		return;
	}

	GuiWindow::Draw();
}
Esempio n. 8
0
static void *
UpdateGUI (void *arg)
{
	int i;

	while(1)
	{
		if(guiHalt)
		{
			LWP_SuspendThread(guithread);
		}
		else
		{
			UpdatePads();
			mainWindow->Draw();

			#ifdef HW_RVL
		//	for(i=3; i >= 0; i--) // so that player 1's cursor appears on top!
		//	{
				if(userInput[0].wpad->ir.valid)
					Menu_DrawImg(userInput[0].wpad->ir.x-48, userInput[0].wpad->ir.y-48,
						96, 96, pointer->GetImage(), userInput[0].wpad->ir.angle, 1, 1, 255);
		//	}
			#endif

			Menu_Render();

		//	for(i=0; i < 4; i++)
				mainWindow->Update(&userInput[0]);

			if(ExitRequested)
			{
				for(i = 0; i < 255; i += 15)
				{
					mainWindow->Draw();
					GXColor Color = (GXColor) {0, 0, 0, i};
					Menu_DrawRectangle(0,0,screenwidth,screenheight,&Color,false,true);
					Menu_Render();
				}

				if (boothomebrew)
				{
					LoadHomebrew(Settings.forwarder_path.c_str());

					string startingAppName = Settings.forwarder_path;

					if((signed)startingAppName.rfind("/") != -1)
						startingAppName.erase(startingAppName.rfind("/"));

					startingAppName.erase(0, startingAppName.rfind("/") +1);

					if(IOS_GetVersion() != GetAppIOS(startingAppName))
						addAppIos(Settings.startingAppName, SelectedIOS());
				}
				if (!goneek2o)
					ExitApp();
			}

			// sd check
			if(Settings.device == "sd1")
				check_sd();

			// usb check
			else if(Settings.device == "usb1")
				check_usb();

			// sd und usb check
			else if(Settings.device == "sd_usb")
			{
				check_sd();
				check_usb();
			}

			else if(Settings.device == "dvd")
				check_dvd();
#ifndef VWII
			else if(Settings.device == "gca")
				check_gca();

			else if(Settings.device == "gcb")
				check_gcb();
#endif
			else if(Settings.device == "all")
			{
				check_sd();
				check_usb();
				check_dvd();
#ifndef VWII
				check_gca();
				check_gcb();
#endif
			}

			// screenshoot
			if(WPAD_ButtonsDown(0) & WPAD_BUTTON_1 && WPAD_ButtonsDown(0) & WPAD_BUTTON_2)
				Screenshot();
		}
	}
	return NULL;
}