WIP: Switch over to Universal-Core. (#4)

This commit is contained in:
StackZ 2020-02-08 05:39:07 +01:00 committed by GitHub
parent 3d3cd9783b
commit 6f90411724
14 changed files with 279 additions and 446 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
*.d
*.o
*.exe
*.t3x
*.3dsx
*.cia
*.elf
*.smdh
*.map
*.lst

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Universal-Core"]
path = Universal-Core
url = https://github.com/Universal-Team/Universal-Core.git

View File

@ -50,9 +50,10 @@ VERSION_MICRO := 0
#---------------------------------------------------------------------------------
TARGET := SavvyManager
BUILD := build
SOURCES := source source/utils
UNIVCORE := Universal-Core
SOURCES := $(UNIVCORE) source source/utils
DATA := data
INCLUDES := include include/utils
INCLUDES := $(UNIVCORE) include include/utils
GRAPHICS := assets/gfx assets/gfx_chars assets/gfx_charprevbg
ROMFS := romfs
GFXBUILD := $(ROMFS)/gfx

1
Universal-Core Submodule

@ -0,0 +1 @@
Subproject commit c82ad8d6e11e4842c6099b53595aa3692f24910b

40
include/gfx.hpp Normal file
View File

@ -0,0 +1,40 @@
#ifndef GFX_HPP
#define GFX_HPP
#include "sprites.h"
#include <3ds.h>
#include <citro2d.h>
// Colors.
#define TRANSPARENT C2D_Color32(0, 0, 0, 0)
#define BLACK C2D_Color32(0, 0, 0, 255)
#define WHITE C2D_Color32(255, 255, 255, 255)
#define GRAY C2D_Color32(127, 127, 127, 255)
#define BLUE C2D_Color32(0, 0, 255, 255)
#define GREEN C2D_Color32(0, 255, 0, 255)
#define RED C2D_Color32(255, 0, 0, 255)
#define MSG_BUTTONTEXT C2D_Color32(181, 48, 0, 255)
#define TIME C2D_Color32(16, 0, 0, 223)
typedef u32 Color;
namespace GFX
{
// Load & Unload default sheets.
Result loadSheets();
Result unloadSheets();
// Sprirte Functions.
bool loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason);
void showBgSprite(int zoomIn);
void showCharSprite(int zoomIn, int fadeAlpha);
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
void DrawSpriteBlend(int key, float x, float y, u32 color, float ScaleX = 1, float ScaleY = 1);
// Draw Cursor.
void drawCursor(void);
}
#endif

View File

@ -1,76 +0,0 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef GUI_HPP
#define GUI_HPP
#include <stack>
#include <string.h>
#include "common.hpp"
// Spritesheets.
#include "sprites.h"
#include "colors.hpp"
#define FONT_SIZE_18 0.72f
#define FONT_SIZE_17 0.7f
#define FONT_SIZE_15 0.6f
#define FONT_SIZE_14 0.56f
#define FONT_SIZE_12 0.50f
#define FONT_SIZE_11 0.46f
#define FONT_SIZE_9 0.37f
namespace Gui {
// Init and Exit of the GUI. Also Character sprite loading.
Result init(void);
bool loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason);
void exit(void);
C3D_RenderTarget* target(gfxScreen_t t);
void setDraw(C3D_RenderTarget * screen);
// Clear Text Buffer.
void clearTextBufs(void);
// Draw a Sprite from the sheet.
void sprite(int key, float x, float y, float ScaleX = 1, float ScaleY = 1);
void showBgSprite(int zoomIn);
void showCharSprite(int zoomIn, int fadeAlpha);
void Draw_ImageBlend(int key, float x, float y, u32 color);
// Text / String Functions.
void DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0);
void DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0);
void GetStringSize(float size, float *width, float *height, std::string Text);
float GetStringWidth(float size, std::string Text);
float GetStringHeight(float size, std::string Text);
// Misc.
bool Draw_Rect(float x, float y, float w, float h, u32 color);
}
#endif

View File

@ -1,45 +0,0 @@
/*
* This file is part of Universal-Manager
* Copyright (C) 2019 VoltZ, Epicpkmn11, Flame, RocketRobz, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef COLORS_HPP
#define COLORS_HPP
#include <citro2d.h>
#include <citro3d.h>
#define TRANSPARENT C2D_Color32(0, 0, 0, 0)
#define BLACK C2D_Color32(0, 0, 0, 255)
#define WHITE C2D_Color32(255, 255, 255, 255)
#define GRAY C2D_Color32(127, 127, 127, 255)
#define BLUE C2D_Color32(0, 0, 255, 255)
#define GREEN C2D_Color32(0, 255, 0, 255)
#define RED C2D_Color32(255, 0, 0, 255)
#define MSG_BUTTONTEXT C2D_Color32(181, 48, 0, 255)
#define TIME C2D_Color32(16, 0, 0, 223)
typedef u32 Color;
#endif

View File

@ -14,6 +14,10 @@ extern "C" {
#ifdef __cplusplus
}
#include "gfx.hpp"
#include "gui.hpp"
#include "screenCommon.hpp"
#include <cstdio>
#include <iostream>
#include <string>

View File

@ -6,7 +6,7 @@
#include <unistd.h> // access
#include <sys/stat.h>
#include "gui.hpp"
#include "common.hpp"
#include "savedata.h"
#include "file_browse.h"
@ -18,9 +18,6 @@
#include "import_ss4charnames.h"
#include "import_everycharnames.h"
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
@ -84,8 +81,6 @@ extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern void drawCursor(void);
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
@ -166,9 +161,9 @@ static int messageNo = 0;
static char chararacterImported[48];
static void drawMsg(void) {
Gui::sprite(sprites_msg_idx, 0, 8, 2, 1);
Gui::sprite(sprites_msg_idx, 160, 8, -2, 1);
Gui::sprite(messageNo==4 ? sprites_icon_question_idx : sprites_icon_msg_idx, 132, -2);
GFX::DrawSprite(sprites_msg_idx, 0, 8, 2, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -2, 1);
GFX::DrawSprite(messageNo==4 ? sprites_icon_question_idx : sprites_icon_msg_idx, 132, -2);
if (messageNo == 5) {
Gui::DrawStringCentered(0, 68, 0.60, BLACK, "Everyone is now in Fashion Forward!");
Gui::DrawStringCentered(0, 88, 0.60, BLACK, "(Except for customers and reps.)");
@ -197,15 +192,15 @@ static void drawMsg(void) {
//Gui::DrawStringCentered(0, 104, 0.60, BLACK, "yet.");
}
if (messageNo == 4) {
Gui::sprite(sprites_button_msg_shadow_idx, 52, 197);
Gui::sprite(sprites_button_msg_idx, 53, 188);
Gui::sprite(sprites_button_msg_shadow_idx, 176, 197);
Gui::sprite(sprites_button_msg_idx, 177, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 52, 197);
GFX::DrawSprite(sprites_button_msg_idx, 53, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 176, 197);
GFX::DrawSprite(sprites_button_msg_idx, 177, 188);
Gui::DrawString(72, 196, 0.70, MSG_BUTTONTEXT, " No");
Gui::DrawString(196, 196, 0.70, MSG_BUTTONTEXT, " Yes");
} else {
Gui::sprite(sprites_button_msg_shadow_idx, 114, 197);
Gui::sprite(sprites_button_msg_idx, 115, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
}
@ -219,11 +214,11 @@ void loadChrImage(bool Robz) {
} else {
sprintf(chrFilePath, "romfs:/gfx/null.t3x"); // All Seasons
}
previewCharacterFound = Gui::loadCharSprite(chrFilePath, chrFilePath);
previewCharacterFound = GFX::loadCharSprite(chrFilePath, chrFilePath);
} else {
sprintf(chrFilePath, "romfs:/gfx/ss%i_%s.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName())); // All Seasons
sprintf(chrFilePath2, "romfs:/gfx/ss%i_%s%i.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName()), seasonNo); // One Season
previewCharacterFound = Gui::loadCharSprite(chrFilePath, chrFilePath2);
previewCharacterFound = GFX::loadCharSprite(chrFilePath, chrFilePath2);
}
previewCharacter = true;
}
@ -287,15 +282,15 @@ void changeCharacterGraphics(void) {
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
Gui::showBgSprite(zoomIn);
GFX::showBgSprite(zoomIn);
if (previewCharacter) {
if (previewCharacterFound) {
Gui::showCharSprite(zoomIn, charFadeAlpha);
GFX::showCharSprite(zoomIn, charFadeAlpha);
} else {
Gui::DrawStringCentered(0, 104, 0.65, WHITE, (import_highlightedGame==4 ? "Preview not found." : "Preview unavailable."));
}
@ -315,11 +310,11 @@ void changeCharacterGraphics(void) {
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
@ -360,24 +355,24 @@ void changeCharacterGraphics(void) {
for (int i = import_characterShownFirst; i < import_characterShownFirst+3; i++) {
if (import_highlightedGame == 4) {
if (i >= numberOfExportedCharacters) break;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
Gui::sprite((getExportedCharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((getExportedCharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, getExportedCharacterName(i));
} else if (import_highlightedGame == 3) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
Gui::sprite((import_ss4CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss4CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss4CharacterNames[i]);
} else if (import_highlightedGame == 2) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
Gui::sprite((import_ss3CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss3CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss3CharacterNames[i]);
} else if (import_highlightedGame == 1) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
Gui::sprite((import_ss2CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss2CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss2CharacterNames[i]);
} else if (import_highlightedGame == 0) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
Gui::sprite((import_ss1CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss1CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss1CharacterNames[i]);
}
i2 += 48;
@ -391,20 +386,20 @@ void changeCharacterGraphics(void) {
int i2 = 0;
if (characterChangeMenu_optionShownFirst == 0) {
i2 += 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change attributes");
}
if (highlightedGame == 3) {
i2 += 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change bow placement");
}
i2 += 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Import character");
if (highlightedGame < 3 || characterChangeMenu_optionShownFirst == 1) {
i2 += 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Export character");
}
} else {
@ -419,25 +414,25 @@ void changeCharacterGraphics(void) {
if (!displayNothing) {
int i2 = 48;
for (int i = characterShownFirst; i < characterShownFirst+3; i++) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (highlightedGame == 3) {
if (i==0) {
Gui::sprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4PlayerName);
} else {
Gui::sprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4CharacterNames[i]);
}
} else if (highlightedGame == 2) {
if (i==0) {
Gui::sprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3PlayerName);
} else {
Gui::sprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3CharacterNames[i]);
}
} else if (highlightedGame == 1) {
Gui::sprite((getSS2CharacterGender() ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
GFX::DrawSprite((getSS2CharacterGender() ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss2PlayerName);
break;
}
@ -446,12 +441,12 @@ void changeCharacterGraphics(void) {
}
}
Gui::sprite(sprites_button_shadow_idx, 5, 199);
Gui::sprite(sprites_button_red_idx, 5, 195);
Gui::sprite(sprites_arrow_back_idx, 19, 195);
Gui::sprite(sprites_button_b_idx, 44, 218);
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
drawCursor();
GFX::drawCursor();
if (showMessage) {
drawMsg();

View File

@ -6,15 +6,12 @@
#include <unistd.h> // access
#include <sys/stat.h>
#include "gui.hpp"
#include "common.hpp"
#include "savedata.h"
#include "file_browse.h"
#include "import_emblemnames.h"
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
@ -57,8 +54,6 @@ extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern void drawCursor(void);
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
@ -201,9 +196,9 @@ static int messageNo = 0;
static char emblemImported[48];
static void drawMsg(void) {
Gui::sprite(sprites_msg_idx, 0, 8, 2, 1);
Gui::sprite(sprites_msg_idx, 160, 8, -2, 1);
Gui::sprite(sprites_icon_msg_idx, 132, -2);
GFX::DrawSprite(sprites_msg_idx, 0, 8, 2, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -2, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (messageNo == 3) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Failed to import emblem.");
} else if (messageNo == 2) {
@ -220,8 +215,8 @@ static void drawMsg(void) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "This feature is not available yet.");
//Gui::DrawStringCentered(0, 104, 0.60, BLACK, "yet.");
}
Gui::sprite(sprites_button_msg_shadow_idx, 114, 197);
Gui::sprite(sprites_button_msg_idx, 115, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
@ -248,27 +243,27 @@ void changeEmblemGraphics(void) {
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::sprite(sprites_emblem_back_idx, 100, 20, 2, 2);
GFX::DrawSprite(sprites_emblem_back_idx, 100, 20, 2, 2);
//drawEmblem(136, 56, true);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
@ -297,7 +292,7 @@ void changeEmblemGraphics(void) {
} else {
if (i > totalEmblems) break;
}
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (importPage == 1) {
Gui::DrawString(32, i2, 0.65, BLACK, getExportedEmblemName(i));
} else {
@ -318,10 +313,10 @@ void changeEmblemGraphics(void) {
Gui::DrawString(8, 8, 0.50, BLACK, emblemText);
int i2 = 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Import emblem");
i2 += 48;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Export emblem");
} else {
cursorY = 64+(48*cursorPosition);
@ -330,7 +325,7 @@ void changeEmblemGraphics(void) {
int i2 = 48;
for (int i = 0; i <= totalEmblems; i++) {
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (highlightedGame == 2) {
sprintf(emblemText, "Emblem");
} else {
@ -341,12 +336,12 @@ void changeEmblemGraphics(void) {
}
}
Gui::sprite(sprites_button_shadow_idx, 5, 199);
Gui::sprite(sprites_button_red_idx, 5, 195);
Gui::sprite(sprites_arrow_back_idx, 19, 195);
Gui::sprite(sprites_button_b_idx, 44, 218);
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
drawCursor();
GFX::drawCursor();
if (showMessage) {
drawMsg();

84
source/gfx.cpp Normal file
View File

@ -0,0 +1,84 @@
#include "common.hpp"
#include <unistd.h>
static C2D_SpriteSheet sprites;
static C2D_SpriteSheet bgSprite;
static C2D_SpriteSheet chracterSprite;
static bool dochracterSpriteFree = false;
extern bool showCursor;
extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
Result GFX::loadSheets() {
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
bgSprite = C2D_SpriteSheetLoad("romfs:/gfx/bgNight_loversBell.t3x");
return 0;
}
Result GFX::unloadSheets() {
C2D_SpriteSheetFree(sprites);
C2D_SpriteSheetFree(bgSprite);
return 0;
}
bool GFX::loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason) {
if (dochracterSpriteFree) {
C2D_SpriteSheetFree(chracterSprite);
}
if (access(t3xPathAllSeasons, F_OK) == 0) {
chracterSprite = C2D_SpriteSheetLoad(t3xPathAllSeasons);
dochracterSpriteFree = true;
return true;
} else {
dochracterSpriteFree = false;
}
if (access(t3xPathOneSeason, F_OK) == 0) {
chracterSprite = C2D_SpriteSheetLoad(t3xPathOneSeason);
dochracterSpriteFree = true;
return true;
} else {
dochracterSpriteFree = false;
}
return false;
}
void GFX::showBgSprite(int zoomIn) {
Gui::DrawSprite(bgSprite, 0, 0, -(240*zoomIn));
}
void GFX::showCharSprite(int zoomIn, int fadeAlpha) {
if (fadeAlpha == 255) {
C2D_DrawImageAt(C2D_SpriteSheetGetImage(chracterSprite, 0), 0, -(240*zoomIn), 0.5f);
} else {
C2D_ImageTint tint;
C2D_SetImageTint(&tint, C2D_TopLeft, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_TopRight, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_BotLeft, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_BotRight, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_DrawImageAt(C2D_SpriteSheetGetImage(chracterSprite, 0), 0, -(240*zoomIn), 0.5f, &tint);
}
}
void GFX::DrawSprite(int img, int x, int y, float ScaleX, float ScaleY) {
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, img), x, y, 0.5f, NULL, ScaleX, ScaleY);
}
void GFX::DrawSpriteBlend(int key, float x, float y, u32 color, float ScaleX, float ScaleY) {
C2D_ImageTint tint;
C2D_SetImageTint(&tint, C2D_TopLeft, color, 1);
C2D_SetImageTint(&tint, C2D_TopRight, color, 1);
C2D_SetImageTint(&tint, C2D_BotLeft, color, 1);
C2D_SetImageTint(&tint, C2D_BotRight, color, 1);
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint, ScaleX, ScaleY);
}
void GFX::drawCursor(void) {
if (cursorAlpha == 255) {
DrawSprite(sprites_cursor_idx, cursorX, cursorY);
} else if (cursorAlpha > 0) {
DrawSpriteBlend(sprites_cursor_idx, cursorX, cursorY, C2D_Color32(255, 255, 255, cursorAlpha));
}
}

View File

@ -1,166 +0,0 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#include "gui.hpp"
#include <unistd.h>
C3D_RenderTarget* top;
C3D_RenderTarget* bottom;
static C2D_SpriteSheet sprites;
static C2D_SpriteSheet bgSprite;
static C2D_SpriteSheet chracterSprite;
static bool dochracterSpriteFree = false;
bool currentScreen = false; // False -> Bottom, True -> Top.
C2D_TextBuf sizeBuf;
C2D_Font systemFont;
void Gui::clearTextBufs(void) {
C2D_TextBufClear(sizeBuf);
}
Result Gui::init(void) {
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(C2D_DEFAULT_MAX_OBJECTS);
C2D_Prepare();
top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
sizeBuf = C2D_TextBufNew(4096);
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
bgSprite = C2D_SpriteSheetLoad("romfs:/gfx/bgNight_loversBell.t3x");
systemFont = C2D_FontLoadSystem(CFG_REGION_USA);
return 0;
}
bool Gui::loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason) {
if (dochracterSpriteFree) {
C2D_SpriteSheetFree(chracterSprite);
}
if (access(t3xPathAllSeasons, F_OK) == 0) {
chracterSprite = C2D_SpriteSheetLoad(t3xPathAllSeasons);
dochracterSpriteFree = true;
return true;
} else {
dochracterSpriteFree = false;
}
if (access(t3xPathOneSeason, F_OK) == 0) {
chracterSprite = C2D_SpriteSheetLoad(t3xPathOneSeason);
dochracterSpriteFree = true;
return true;
} else {
dochracterSpriteFree = false;
}
return false;
}
void Gui::exit(void) {
if (sprites) {
C2D_SpriteSheetFree(sprites);
}
C2D_TextBufDelete(sizeBuf);
C2D_Fini();
C3D_Fini();
}
// Select, on which Screen should be drawn.
void Gui::setDraw(C3D_RenderTarget * screen)
{
C2D_SceneBegin(screen);
currentScreen = screen == top ? 1 : 0;
}
void Gui::sprite(int key, float x, float y, float ScaleX, float ScaleY) {
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, NULL, ScaleX, ScaleY);
}
void Gui::showBgSprite(int zoomIn) {
C2D_DrawImageAt(C2D_SpriteSheetGetImage(bgSprite, 0), 0, -(240*zoomIn), 0.5f);
}
void Gui::showCharSprite(int zoomIn, int fadeAlpha) {
if (fadeAlpha == 255) {
C2D_DrawImageAt(C2D_SpriteSheetGetImage(chracterSprite, 0), 0, -(240*zoomIn), 0.5f);
} else {
C2D_ImageTint tint;
C2D_SetImageTint(&tint, C2D_TopLeft, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_TopRight, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_BotLeft, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_SetImageTint(&tint, C2D_BotRight, C2D_Color32(255, 255, 255, fadeAlpha), 1);
C2D_DrawImageAt(C2D_SpriteSheetGetImage(chracterSprite, 0), 0, -(240*zoomIn), 0.5f, &tint);
}
}
void Gui::Draw_ImageBlend(int key, float x, float y, u32 color) {
C2D_ImageTint tint;
C2D_SetImageTint(&tint, C2D_TopLeft, color, 1);
C2D_SetImageTint(&tint, C2D_TopRight, color, 1);
C2D_SetImageTint(&tint, C2D_BotLeft, color, 1);
C2D_SetImageTint(&tint, C2D_BotRight, color, 1);
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint);
}
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth) {
Gui::DrawString((currentScreen ? 200 : 160)+x-((maxWidth == 0 ? (int)Gui::GetStringWidth(size, Text) : std::min(maxWidth, (int)Gui::GetStringWidth(size, Text)))/2), y, size, color, Text, maxWidth);
}
// Draw String or Text.
void Gui::DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth) {
C2D_Text c2d_text;
C2D_TextParse(&c2d_text, sizeBuf, Text.c_str());
C2D_TextOptimize(&c2d_text);
if(maxWidth == 0) {
C2D_DrawText(&c2d_text, C2D_WithColor, x, y, 0.5f, size, size, color);
} else {
C2D_DrawText(&c2d_text, C2D_WithColor, x, y, 0.5f, std::min(size, size*(maxWidth/Gui::GetStringWidth(size, Text))), size, color);
}
}
// Get String or Text Width.
float Gui::GetStringWidth(float size, std::string Text) {
float width = 0;
GetStringSize(size, &width, NULL, Text);
return width;
}
// Get String or Text Size.
void Gui::GetStringSize(float size, float *width, float *height, std::string Text) {
C2D_Text c2d_text;
C2D_TextParse(&c2d_text, sizeBuf, Text.c_str());
C2D_TextGetDimensions(&c2d_text, size, size, width, height);
}
// Get String or Text Height.
float Gui::GetStringHeight(float size, std::string Text) {
float height = 0;
GetStringSize(size, NULL, &height, Text.c_str());
return height;
}
bool Gui::Draw_Rect(float x, float y, float w, float h, u32 color) {
return C2D_DrawRectSolid(x, y, 0.5f, w, h, color);
}

View File

@ -6,8 +6,8 @@
#include <unistd.h> // access
#include <sys/stat.h>
#include "common.hpp"
#include "dumpdsp.h"
#include "gui.hpp"
#include "savedata.h"
//#include "settings.h"
#include "sound.h"
@ -21,9 +21,6 @@ static char verText[32];
extern void loadSettings(void);
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
// Current screen mode.
enum ScreenMode {
SCREEN_MODE_ROCKETROBZ = 0, // RocketRobz logo
@ -120,21 +117,13 @@ int cursorY = 0;
static int whatToChange_cursorPosition = 0;
int cursorAlpha = 0;
void drawCursor(void) {
if (cursorAlpha == 255) {
Gui::sprite(sprites_cursor_idx, cursorX, cursorY);
} else if (cursorAlpha > 0) {
Gui::Draw_ImageBlend(sprites_cursor_idx, cursorX, cursorY, C2D_Color32(255, 255, 255, cursorAlpha));
}
}
static bool showMessage = false;
static int messageNo = 0;
static void drawCannotEditMsg(void) {
Gui::sprite(sprites_msg_idx, 0, 8, 2, 1);
Gui::sprite(sprites_msg_idx, 160, 8, -2, 1);
Gui::sprite(sprites_icon_msg_idx, 132, -2);
GFX::DrawSprite(sprites_msg_idx, 0, 8, 2, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -2, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (messageNo == 1) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Save data not found.");
Gui::DrawStringCentered(0, 90, 0.60, BLACK, highlightedGame==3 ? "Please back up the extra data using" : "Please back it up using");
@ -144,8 +133,8 @@ static void drawCannotEditMsg(void) {
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Style Savvy's");
Gui::DrawStringCentered(0, 112, 0.60, BLACK, "save data yet.");
}
Gui::sprite(sprites_button_msg_shadow_idx, 114, 197);
Gui::sprite(sprites_button_msg_idx, 115, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
@ -310,6 +299,7 @@ int main()
gfxInitDefault();
Gui::init();
GFX::loadSheets();
// make folders if they don't exist
mkdir("sdmc:/3ds", 0777);
@ -341,7 +331,7 @@ int main()
dspfirmfound = true;
}else{
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::DrawString(12, 16, 0.5f, WHITE, "Dumping DSP firm...");
C3D_FrameEnd(0);
screenon();
@ -351,8 +341,8 @@ int main()
dspfirmfound = true;
} else {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(bottom, TRANSPARENT); // clear Bottom Screen to avoid Text overdraw.
Gui::setDraw(bottom);
C2D_TargetClear(Bottom, TRANSPARENT); // clear Bottom Screen to avoid Text overdraw.
Gui::ScreenDraw(Bottom);
Gui::DrawString(12, 16, 0.5f, WHITE, "DSP firm dumping failed.\n"
"Running without sound.");
C3D_FrameEnd(0);
@ -399,22 +389,22 @@ int main()
if (screenmode == SCREEN_MODE_ROCKETROBZ) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
Gui::sprite(sprites_logo_rocketrobz_idx, 0, 0);
GFX::DrawSprite(sprites_logo_rocketrobz_idx, 0, 0);
Gui::DrawString(8, 220, 0.50, BLACK, yeartext);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE);
/*text_width = 104;
Gui::DrawString(((320-text_width)/2), 100, 0.50, BLACK, yeartext);
text_width = 264;
Gui::DrawString(((320-text_width)/2), 116, 0.50, BLACK, yeartext2);*/
Gui::sprite(sprites_logo_SSanniversary_idx, 32, 24);
GFX::DrawSprite(sprites_logo_SSanniversary_idx, 32, 24);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
@ -425,10 +415,10 @@ int main()
}
} else if (screenmode == SCREEN_MODE_GAME_SELECT) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
/*for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
@ -438,41 +428,41 @@ int main()
switch(highlightedGame) {
case 0:
default:
Gui::sprite(sprites_title1_screenshot_idx, 0, 0);
GFX::DrawSprite(sprites_title1_screenshot_idx, 0, 0);
break;
case 1:
Gui::sprite(sprites_title2_screenshot_idx, 0, 0);
GFX::DrawSprite(sprites_title2_screenshot_idx, 0, 0);
break;
case 2:
Gui::sprite(sprites_title3_screenshot_idx, 0, 0);
GFX::DrawSprite(sprites_title3_screenshot_idx, 0, 0);
break;
case 3:
Gui::sprite(sprites_title4_screenshot_idx, 0, 0);
GFX::DrawSprite(sprites_title4_screenshot_idx, 0, 0);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "Select a game to manage it's save data.");
switch(highlightedGame) {
case 0:
default:
Gui::sprite(sprites_title1_idx, 0, 56);
GFX::DrawSprite(sprites_title1_idx, 0, 56);
break;
case 1:
Gui::sprite(sprites_title2_idx, 0, 56);
GFX::DrawSprite(sprites_title2_idx, 0, 56);
break;
case 2:
Gui::sprite(sprites_title3_idx, 0, 56);
GFX::DrawSprite(sprites_title3_idx, 0, 56);
break;
case 3:
Gui::sprite(sprites_title4_idx, 0, 56);
GFX::DrawSprite(sprites_title4_idx, 0, 56);
break;
}
Gui::DrawString(8, 112, 0.55, BLACK, "<");
@ -507,52 +497,52 @@ int main()
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "What do you want to change?");
int iconXpos = 64;
Gui::Draw_ImageBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
Gui::sprite(sprites_icon_profile_idx, iconXpos, 80);
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_profile_idx, iconXpos, 80);
Gui::DrawString(iconXpos-2, 140, 0.50, RED, "Characters");
iconXpos += 64;
if (highlightedGame == 1) {
// Show music pack option for Trendsetters
Gui::Draw_ImageBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
Gui::sprite(sprites_icon_music_idx, iconXpos, 80);
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_music_idx, iconXpos, 80);
Gui::DrawString(iconXpos+14, 140, 0.50, RED, "Music");
}
iconXpos += 64;
if (highlightedGame > 1) {
// Show emblem option for Fashion Forward and Styling Star
Gui::Draw_ImageBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
Gui::sprite(sprites_icon_emblem_idx, iconXpos, 80);
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_emblem_idx, iconXpos, 80);
Gui::DrawString(iconXpos+8, 140, 0.50, RED, "Emblem");
}
Gui::sprite(sprites_button_shadow_idx, 5, 199);
Gui::sprite(sprites_button_red_idx, 5, 195);
Gui::sprite(sprites_arrow_back_idx, 19, 195);
Gui::sprite(sprites_button_b_idx, 44, 218);
/*Gui::sprite(sprites_button_shadow_idx, 251, 199);
Gui::sprite(sprites_button_blue_idx, 251, 195);*/
drawCursor();
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
/*GFX::DrawSprite(sprites_button_shadow_idx, 251, 199);
GFX::DrawSprite(sprites_button_blue_idx, 251, 195);*/
GFX::drawCursor();
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
} else if (screenmode == SCREEN_MODE_CHANGE_CHARACTER) {
@ -637,6 +627,7 @@ int main()
svcCloseHandle(threadRequest);
Gui::exit();
GFX::unloadSheets();
gfxExit();
hidExit();

View File

@ -5,7 +5,7 @@
#include <malloc.h>
#include <sys/stat.h>
#include "gui.hpp"
#include "common.hpp"
#include "savedata.h"
//#include "settings.h"
#include "file_browse.h"
@ -13,9 +13,6 @@
extern std::string currentMusicPack;
extern void saveSettings(void);
extern C3D_RenderTarget* top;
extern C3D_RenderTarget* bottom;
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
@ -51,8 +48,6 @@ extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern void drawCursor(void);
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
@ -68,16 +63,16 @@ static bool showMessage = false;
static int messageNo = 0;
static void drawMsg(void) {
Gui::sprite(sprites_msg_idx, 0, 8, 2, 1);
Gui::sprite(sprites_msg_idx, 160, 8, -2, 1);
Gui::sprite(sprites_icon_msg_idx, 132, -2);
GFX::DrawSprite(sprites_msg_idx, 0, 8, 2, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -2, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (messageNo == 1) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Failed to apply music pack.");
} else {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Successfully applied music pack.");
}
Gui::sprite(sprites_button_msg_shadow_idx, 114, 197);
Gui::sprite(sprites_button_msg_idx, 115, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
@ -88,15 +83,15 @@ void changeMusicGraphics(void) {
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(top, TRANSPARENT);
C2D_TargetClear(bottom, TRANSPARENT);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::setDraw(top);
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
@ -105,11 +100,11 @@ void changeMusicGraphics(void) {
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::setDraw(bottom);
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
@ -122,7 +117,7 @@ void changeMusicGraphics(void) {
for (int i = musicPackShownFirst; i < musicPackShownFirst+3; i++) {
if (i > numberOfMusicPacks) break;
Gui::sprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (i == 0) {
Gui::DrawString(32, i2, 0.65, BLACK, "Original/Revert");
} else {
@ -131,12 +126,12 @@ void changeMusicGraphics(void) {
i2 += 48;
}
Gui::sprite(sprites_button_shadow_idx, 5, 199);
Gui::sprite(sprites_button_red_idx, 5, 195);
Gui::sprite(sprites_arrow_back_idx, 19, 195);
Gui::sprite(sprites_button_b_idx, 44, 218);
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
drawCursor();
GFX::drawCursor();
if (showMessage) {
drawMsg();