mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-05 08:39:05 +00:00
Some Keyboard changes.
This commit is contained in:
@@ -11,7 +11,8 @@ namespace Input {
|
|||||||
// -1 if invaild text entered
|
// -1 if invaild text entered
|
||||||
int getUint(int max, std::string Text);
|
int getUint(int max, std::string Text);
|
||||||
std::string getString(std::string Text);
|
std::string getString(std::string Text);
|
||||||
std::string getString(uint maxLength, std::string Text);
|
std::string getStringLong(std::string Text); // For longer text.
|
||||||
|
std::string getString(uint maxLength, std::string Text, float inputTextSize = 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
extern int lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, ColorKeys, progressbarColor;
|
extern int lang, Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor, viewMode, progressbarColor;
|
||||||
extern std::string ScriptPath, MusicPath, StorePath;
|
extern std::string ScriptPath, MusicPath, StorePath;
|
||||||
extern bool Logging, UseBars;
|
extern bool Logging, UseBars;
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -82,15 +82,15 @@ extern bool touching(touchPosition touch, Structs::ButtonPos button);
|
|||||||
void Input::DrawNumpad()
|
void Input::DrawNumpad()
|
||||||
{
|
{
|
||||||
for(uint i=0;i<(sizeof(NumpadStruct)/sizeof(NumpadStruct[0]));i++) {
|
for(uint i=0;i<(sizeof(NumpadStruct)/sizeof(NumpadStruct[0]));i++) {
|
||||||
Gui::Draw_Rect(NumpadStruct[i].x, NumpadStruct[i].y, 60, 50, Config::Color2);
|
Gui::Draw_Rect(NumpadStruct[i].x, NumpadStruct[i].y, 60, 50, Config::Color1);
|
||||||
char c[2] = {NumpadStruct[i].character[0]};
|
char c[2] = {NumpadStruct[i].character[0]};
|
||||||
Gui::DrawString(NumpadStruct[i].x+25, NumpadStruct[i].y+15, 0.72f, BLACK, c, 50);
|
Gui::DrawString(NumpadStruct[i].x+25, NumpadStruct[i].y+15, 0.72f, Config::TxtColor, c, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::drawKeyboard() {
|
void Input::drawKeyboard() {
|
||||||
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
for(uint i=0;i<(sizeof(keysQWERTY)/sizeof(keysQWERTY[0]));i++) {
|
||||||
C2D_DrawRectSolid(keysQWERTY[i].x, keysQWERTY[i].y+103, 0.5f, 20, 20, Config::ColorKeys & C2D_Color32(255, 255, 255, 200));
|
C2D_DrawRectSolid(keysQWERTY[i].x, keysQWERTY[i].y+103, 0.5f, 20, 20, Config::Color1 & C2D_Color32(255, 255, 255, 200));
|
||||||
if(shift) {
|
if(shift) {
|
||||||
char c[2] = {caps ? (char)toupper(keysQWERTYShift[i].character[0]) : keysQWERTYShift[i].character[0]};
|
char c[2] = {caps ? (char)toupper(keysQWERTYShift[i].character[0]) : keysQWERTYShift[i].character[0]};
|
||||||
Gui::DrawString(keysQWERTYShift[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTYShift[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, Config::TxtColor, c);
|
Gui::DrawString(keysQWERTYShift[i].x+(10-(Gui::GetStringWidth(0.50, c)/2)), keysQWERTYShift[i].y+103+(10-(Gui::GetStringHeight(0.50, c)/2)), 0.50, Config::TxtColor, c);
|
||||||
@@ -100,7 +100,7 @@ void Input::drawKeyboard() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(uint i=0;i<(sizeof(modifierKeys)/sizeof(modifierKeys[0]));i++) {
|
for(uint i=0;i<(sizeof(modifierKeys)/sizeof(modifierKeys[0]));i++) {
|
||||||
C2D_DrawRectSolid(modifierKeys[i].x, modifierKeys[i].y+103, 0.5f, modifierKeys[i].w, 20, Config::ColorKeys & C2D_Color32(255, 255, 255, 200));
|
C2D_DrawRectSolid(modifierKeys[i].x, modifierKeys[i].y+103, 0.5f, modifierKeys[i].w, 20, Config::Color1 & C2D_Color32(255, 255, 255, 200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,8 +121,8 @@ std::string Input::Numpad(uint maxLength, std::string Text)
|
|||||||
C2D_TargetClear(top, BLACK);
|
C2D_TargetClear(top, BLACK);
|
||||||
C2D_TargetClear(bottom, BLACK);
|
C2D_TargetClear(bottom, BLACK);
|
||||||
Gui::DrawTop();
|
Gui::DrawTop();
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, WHITE, Text, 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
|
||||||
Gui::DrawString(180, 217, 0.8, WHITE, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
Gui::DrawString(180, 217, 0.8, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 400);
|
||||||
if(cursorBlink < -20) cursorBlink = 20;
|
if(cursorBlink < -20) cursorBlink = 20;
|
||||||
Gui::setDraw(bottom);
|
Gui::setDraw(bottom);
|
||||||
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
|
Gui::Draw_Rect(0, 0, 320, 240, Config::Color3);
|
||||||
@@ -188,8 +188,9 @@ int Input::getUint(int max, std::string Text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Input::getString(std::string Text) { return Input::getString(-1, Text); }
|
std::string Input::getString(std::string Text) { return Input::getString(-1, Text); }
|
||||||
|
std::string Input::getStringLong(std::string Text) { return Input::getString(-1, Text, 0.5f); } // For Long text.
|
||||||
|
|
||||||
std::string Input::getString(uint maxLength, std::string Text) {
|
std::string Input::getString(uint maxLength, std::string Text, float inputTextSize) {
|
||||||
int hDown;
|
int hDown;
|
||||||
touchPosition touch;
|
touchPosition touch;
|
||||||
std::string string;
|
std::string string;
|
||||||
@@ -201,11 +202,11 @@ std::string Input::getString(uint maxLength, std::string Text) {
|
|||||||
Gui::clearTextBufs();
|
Gui::clearTextBufs();
|
||||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||||
Gui::DrawTop();
|
Gui::DrawTop();
|
||||||
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, WHITE, Text, 400);
|
Gui::DrawString((400-Gui::GetStringWidth(0.55f, Text))/2, 2, 0.55f, Config::TxtColor, Text, 400);
|
||||||
Gui::DrawBottom();
|
Gui::DrawBottom();
|
||||||
drawKeyboard();
|
drawKeyboard();
|
||||||
C2D_DrawRectSolid(0, 81, 0.5f, 320, 20, Config::ColorKeys & C2D_Color32(200, 200, 200, 200));
|
C2D_DrawRectSolid(0, 81, 0.5f, 320, 20, Config::Color1 & C2D_Color32(200, 200, 200, 200));
|
||||||
Gui::DrawString(2, 82, 0.6, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str());
|
Gui::DrawString(2, 82, inputTextSize, Config::TxtColor, (string+(cursorBlink-- > 0 ? "_" : "")).c_str(), 316);
|
||||||
if(cursorBlink < -20) cursorBlink = 20;
|
if(cursorBlink < -20) cursorBlink = 20;
|
||||||
scanKeys();
|
scanKeys();
|
||||||
hDown = keysDown();
|
hDown = keysDown();
|
||||||
@@ -268,7 +269,6 @@ std::string Input::getString(uint maxLength, std::string Text) {
|
|||||||
}
|
}
|
||||||
} else if(hDown & KEY_B) {
|
} else if(hDown & KEY_B) {
|
||||||
string = string.substr(0, string.length()-1);
|
string = string.substr(0, string.length()-1);
|
||||||
Gui::DrawString(0, 103, 0.5, BLACK, string.c_str(), 320);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hDown & KEY_START || enter) {
|
if(hDown & KEY_START || enter) {
|
||||||
|
|||||||
@@ -855,11 +855,11 @@ void UniStore::DrawGitHubScreen(void) const {
|
|||||||
|
|
||||||
void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[0])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[0])) {
|
||||||
OwnerAndRepo = Input::getString(Lang::get("ENTER_OWNER_AND_REPO"));
|
OwnerAndRepo = Input::getStringLong(Lang::get("ENTER_OWNER_AND_REPO"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[1])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[1])) {
|
||||||
fileName = Input::getString(Lang::get("ENTER_FILENAME"));
|
fileName = Input::getStringLong(Lang::get("ENTER_FILENAME"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
||||||
@@ -904,11 +904,11 @@ void UniStore::DrawFullURLScreen(void) const {
|
|||||||
|
|
||||||
void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[0])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[0])) {
|
||||||
FullURL = Input::getString(Lang::get("ENTER_FULL_URL"));
|
FullURL = Input::getStringLong(Lang::get("ENTER_FULL_URL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[1])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[1])) {
|
||||||
fileName = Input::getString(Lang::get("ENTER_FILENAME"));
|
fileName = Input::getStringLong(Lang::get("ENTER_FILENAME"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ int Config::TxtColor;
|
|||||||
int Config::SelectedColor;
|
int Config::SelectedColor;
|
||||||
int Config::UnselectedColor;
|
int Config::UnselectedColor;
|
||||||
int Config::viewMode;
|
int Config::viewMode;
|
||||||
int Config::ColorKeys;
|
|
||||||
int Config::progressbarColor;
|
int Config::progressbarColor;
|
||||||
std::string Config::ScriptPath;
|
std::string Config::ScriptPath;
|
||||||
std::string Config::MusicPath;
|
std::string Config::MusicPath;
|
||||||
@@ -109,12 +108,6 @@ void Config::load() {
|
|||||||
Config::viewMode = getInt("VIEWMODE");
|
Config::viewMode = getInt("VIEWMODE");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!configJson.contains("COLORKEYS")) {
|
|
||||||
Config::ColorKeys = C2D_Color32(0, 0, 200, 255);
|
|
||||||
} else {
|
|
||||||
Config::ColorKeys = getInt("COLORKEYS");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!configJson.contains("PROGRESSBARCOLOR")) {
|
if(!configJson.contains("PROGRESSBARCOLOR")) {
|
||||||
Config::progressbarColor = WHITE;
|
Config::progressbarColor = WHITE;
|
||||||
} else {
|
} else {
|
||||||
@@ -156,7 +149,6 @@ void Config::load() {
|
|||||||
Config::ScriptPath = SCRIPTS_PATH;
|
Config::ScriptPath = SCRIPTS_PATH;
|
||||||
Config::lang = 2;
|
Config::lang = 2;
|
||||||
Config::viewMode = 0;
|
Config::viewMode = 0;
|
||||||
Config::ColorKeys = C2D_Color32(0, 0, 200, 255);
|
|
||||||
Config::progressbarColor = WHITE;
|
Config::progressbarColor = WHITE;
|
||||||
Config::MusicPath = MUSIC_PATH;
|
Config::MusicPath = MUSIC_PATH;
|
||||||
Config::Logging = false;
|
Config::Logging = false;
|
||||||
@@ -175,7 +167,6 @@ void Config::save() {
|
|||||||
Config::setString("SCRIPTPATH", Config::ScriptPath);
|
Config::setString("SCRIPTPATH", Config::ScriptPath);
|
||||||
Config::setInt("LANGUAGE", Config::lang);
|
Config::setInt("LANGUAGE", Config::lang);
|
||||||
Config::setInt("VIEWMODE", Config::viewMode);
|
Config::setInt("VIEWMODE", Config::viewMode);
|
||||||
Config::setInt("COLORKEYS", Config::ColorKeys);
|
|
||||||
Config::setInt("PROGRESSBARCOLOR", Config::progressbarColor);
|
Config::setInt("PROGRESSBARCOLOR", Config::progressbarColor);
|
||||||
Config::setString("MUSICPATH", Config::MusicPath);
|
Config::setString("MUSICPATH", Config::MusicPath);
|
||||||
Config::setBool("LOGGING", Config::Logging);
|
Config::setBool("LOGGING", Config::Logging);
|
||||||
@@ -198,7 +189,6 @@ void Config::initializeNewConfig() {
|
|||||||
Config::setString("SCRIPTPATH", SCRIPTS_PATH);
|
Config::setString("SCRIPTPATH", SCRIPTS_PATH);
|
||||||
Config::setInt("LANGUAGE", 2);
|
Config::setInt("LANGUAGE", 2);
|
||||||
Config::setInt("VIEWMODE", 0);
|
Config::setInt("VIEWMODE", 0);
|
||||||
Config::setInt("COLORKEYS", C2D_Color32(0, 0, 200, 255));
|
|
||||||
Config::setInt("PROGRESSBARCOLOR", WHITE);
|
Config::setInt("PROGRESSBARCOLOR", WHITE);
|
||||||
Config::setString("MUSICPATH", MUSIC_PATH);
|
Config::setString("MUSICPATH", MUSIC_PATH);
|
||||||
Config::setBool("LOGGING", false);
|
Config::setBool("LOGGING", false);
|
||||||
|
|||||||
Reference in New Issue
Block a user