Add Settings Stuff. :P

This commit is contained in:
VoltZ
2019-11-02 04:32:23 +01:00
committed by GitHub
parent 44c31c46d5
commit 7ee50d5418
16 changed files with 907 additions and 39 deletions
+59
View File
@@ -0,0 +1,59 @@
/*
* This file is part of Universal-Updater
* 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>
#include <sstream>
#include <string>
/**
* @brief Creates a 8 byte RGBA color
* @param r red component of the color
* @param g green component of the color
* @param b blue component of the color
* @param a alpha component of the color
*/
#define RGBA8(r, g, b, a) ((((r)&0xFF)<<0) | (((g)&0xFF)<<8) | (((b)&0xFF)<<16) | (((a)&0xFF)<<24))
#define BarColor C2D_Color32(57, 84, 114, 255)
#define TopBGColor C2D_Color32(96, 168, 192, 255)
#define BottomBGColor C2D_Color32(38, 44, 77, 255)
#define SelectedColordefault C2D_Color32(120, 192, 216, 255)
#define UnselectedColordefault C2D_Color32(77, 118, 132, 255)
#define BLACK C2D_Color32(0, 0, 0, 255)
#define WHITE C2D_Color32(255, 255, 255, 255)
typedef u32 Color;
namespace ColorHelper {
int getColorValue(int color, int bgr);
std::string getColorName(int color, int bgr);
}
#endif
+1 -9
View File
@@ -27,6 +27,7 @@
#ifndef GUI_HPP
#define GUI_HPP
#include "colors.hpp"
#include "screens/screen.hpp"
#include <3ds.h>
@@ -38,15 +39,6 @@
#include <unordered_map>
#include <wchar.h>
#define BarColor C2D_Color32(57, 84, 114, 255)
#define TopBGColor C2D_Color32(96, 168, 192, 255)
#define BottomBGColor C2D_Color32(38, 44, 77, 255)
#define SelectedColor C2D_Color32(120, 192, 216, 255)
#define UnselectedColor C2D_Color32(77, 118, 132, 255)
#define BLACK C2D_Color32(0, 0, 0, 255)
#define WHITE C2D_Color32(255, 255, 255, 255)
#define TextColor C2D_Color32(102, 179, 255, 255)
namespace Gui
{
// Init and Exit of the GUI.
+14
View File
@@ -0,0 +1,14 @@
#ifndef KEYBOARD_HPP
#define KEYBOARD_HPP
#include <string>
namespace Input {
void DrawNumpad();
std::string Numpad(std::string Text);
std::string Numpad(uint maxLength, std::string Text);
// -1 if invaild text entered
int getUint(int max, std::string Text);
}
#endif
+4 -1
View File
@@ -31,15 +31,18 @@
#include "utils/structs.hpp"
#include <vector>
class MainMenu : public Screen
{
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
int Selection = 0;
std::vector<Structs::ButtonPos> mainButtons = {
{90, 40, 140, 35, -1}, // ScriptList.
{90, 160, 140, 35, -1}, // Settings?
{90, 100, 140, 35, -1}, // Language.
{90, 160, 140, 35, -1}, // Colors.
};
};
+67
View File
@@ -0,0 +1,67 @@
/*
* This file is part of Universal-Updater
* 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 SETTINGS_HPP
#define SETTINGS_HPP
#include "screens/screen.hpp"
#include "screens/screenCommon.hpp"
#include "utils/structs.hpp"
#include <vector>
class Settings : public Screen
{
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
void DrawLanguageSelection(void) const;
void DrawColorChanging(void) const;
void LanguageSelection(u32 hDown, touchPosition touch);
void colorChanging(u32 hDown, touchPosition touch);
std::vector<Structs::ButtonPos> langBlocks = {
{37, 52, 20, 20, -1},
{37, 92, 20, 20, -1},
{37, 132, 20, 20, -1},
{37, 172, 20, 20, -1},
{177, 52, 20, 20, -1},
{177, 92, 20, 20, -1},
{177, 132, 20, 20, -1},
{177, 172, 20, 20, -1},
{293, 213, 27, 27, -1},
};
std::vector<Structs::ButtonPos> buttons = {
{10, 85, 95, 41, -1},
{115, 85, 95, 41, -1},
{220, 85, 95, 41, -1},
};
};
#endif
+42
View File
@@ -0,0 +1,42 @@
/*
* This file is part of Universal-Updater
* 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 CONFIG_HPP
#define CONFIG_HPP
#include <string>
namespace Config {
// [UI]
extern int lang; // The current Language.
extern int Color1, Color2, Color3, TxtColor, SelectedColor, UnselectedColor; // Colors!
void loadConfig();
void saveConfig();
}
#endif
+6
View File
@@ -39,6 +39,12 @@ public:
int h;
int link;
};
struct Key {
std::string character;
int x;
int y;
};
private:
};