Example #1
0
void CreditsScreen::render() {
    UIShader_Prepare();
    UIBegin();
    DrawBackground(1.0f);

    const int numItems = ARRAY_SIZE(credits);
    int itemHeight = 36;
    int totalHeight = numItems * itemHeight + dp_yres + 200;
    int y = dp_yres - (frames_ % totalHeight);
    for (int i = 0; i < numItems; i++) {
        float alpha = linearInOut(y+32, 64, dp_yres - 192, 64);
        if (alpha > 0.0f) {
            UIText(dp_xres/2, y, credits[i], whiteAlpha(alpha), ease(alpha), ALIGN_HCENTER);
        }
        y += itemHeight;
    }

    if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, "Back", ALIGN_BOTTOMRIGHT)) {
        screenManager()->switchScreen(new MenuScreen());
    }

    UIEnd();

    glsl_bind(UIShader_Get());
    ui_draw2d.Flush(UIShader_Get());
}
Example #2
0
void CreditsScreen::render() {
	// TODO: This is kinda ugly, done on every frame...
	char temp[256];
	sprintf(temp, "PPSSPP %s", PPSSPP_GIT_VERSION);
	credits[0] = (const char *)temp;

	UIShader_Prepare();
	UIBegin(UIShader_Get());
	DrawBackground(1.0f);

	const int numItems = ARRAY_SIZE(credits);
	int itemHeight = 36;
	int totalHeight = numItems * itemHeight + dp_yres + 200;
	int y = dp_yres - (frames_ % totalHeight);
	for (int i = 0; i < numItems; i++) {
		float alpha = linearInOut(y+32, 64, dp_yres - 192, 64);
		if (alpha > 0.0f) {
			UIText(dp_xres/2, y, credits[i], whiteAlpha(alpha), ease(alpha), ALIGN_HCENTER);
		}
		y += itemHeight;
	}
	I18NCategory *g = GetI18NCategory("General");

	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, 0, g->T("Back"), ALIGN_BOTTOMRIGHT)) {
		screenManager()->switchScreen(new MenuScreen());
	}

	UIEnd();
}
Text* DebugOverlayText::Add(const char* textID, const char *value)
{
	Text *message = new Text();
	message->SetText(value);
	messages[textID] = UIText(message, true);
	return message;
}
Example #4
0
void UIText(int font, const LayoutManager &layout, const char *text, uint32_t color, float scale, int align)
{
	ui_draw2d.SetFontScale(scale, scale);
	float w, h;
	ui_draw2d.MeasureText(font, text, &w, &h);
	float x, y;
	layout.GetPos(&w, &h, &x, &y);
	UIText(font, x, y, text, color, scale, 0);
	ui_draw2d.SetFontScale(1.0f, 1.0f);
}
Example #5
0
void InGameMenuScreen::render() {
	UIShader_Prepare();
	UIBegin();
	DrawBackground(1.0f);

	const char *title;
	if (UTF8StringHasNonASCII(game_title.c_str())) {
		title = "(can't display japanese title)";
	} else {
		title = game_title.c_str();
	}

	ui_draw2d.DrawText(UBUNTU48, title, dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER);

	int x = 30;
	int y = 50;
	UICheckBox(GEN_ID, x, y += 50, "Show Debug Statistics", ALIGN_TOPLEFT, &g_Config.bShowDebugStats);
	UICheckBox(GEN_ID, x, y += 50, "Show FPS", ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);

	// TODO: Maybe shouldn't show this if the screen ratios are very close...
	UICheckBox(GEN_ID, x, y += 50, "Stretch to display", ALIGN_TOPLEFT, &g_Config.bStretchToDisplay);

	UICheckBox(GEN_ID, x, y += 50, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform);

	// TODO: Add UI for more than one slot.
	VLinear vlinear1(x, y + 80, 20);
	UIText(UBUNTU24, vlinear1, "Save states are experimental (and large)", 0xFFFFFFFF);
	if (UIButton(GEN_ID, vlinear1, LARGE_BUTTON_WIDTH, "Save State", ALIGN_LEFT)) {
		SaveState::SaveSlot(0, 0, 0);
		screenManager()->finishDialog(this, DR_CANCEL);
	}
	if (UIButton(GEN_ID, vlinear1, LARGE_BUTTON_WIDTH, "Load State", ALIGN_LEFT)) {
		SaveState::LoadSlot(0, 0, 0);
		screenManager()->finishDialog(this, DR_CANCEL);
	}

	VLinear vlinear(dp_xres - 10, 160, 20);
	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Continue", ALIGN_RIGHT)) {
		screenManager()->finishDialog(this, DR_CANCEL);
	}
	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Return to Menu", ALIGN_RIGHT)) {
		screenManager()->finishDialog(this, DR_OK);
	}
	
	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH*2, "Debug: Dump Next Frame", ALIGN_BOTTOMRIGHT)) {
		gpu->DumpNextFrame();
	}

	DrawWatermark();
	UIEnd();

	glsl_bind(UIShader_Get());
	ui_draw2d.Flush(UIShader_Get());
}
Example #6
0
void UIText(int x, int y, const char *text, uint32_t color, float scale, int align) {
	UIText(theme.uiFont, x, y, text, color, scale, align);
}