Add Some Tools and Assets to create cpp's for 0.9+
10
README.md
@ -1,4 +1,4 @@
|
||||
# RenderD7 <img alt="LOGO" src="https://github.com/NPI-D7/RenderD7/blob/main/logo.png" height="30">
|
||||
# RenderD7 <img alt="LOGO" src="https://github.com/NPI-D7/RenderD7/blob/main/logo.png" height="90">
|
||||
RenderD7 is now LibRenderD7.
|
||||
### Installation (Ubuntu)
|
||||
first run this
|
||||
@ -14,3 +14,11 @@ Make sure that `-lrenderd7` is before `-lcitro2d`, `-lcitro3d`, `-lctru`.
|
||||
# RenderD7 (https://npi-d7.github.io/RenderD7/)
|
||||
Simple and Easey to use UI and Graphics helper.
|
||||
Create DOCS
|
||||
|
||||
# Credits
|
||||
- NPI-D7
|
||||
- Tobi-D7 Main Dev
|
||||
|
||||
Some Icons are From
|
||||
https://icons8.de/
|
||||
See Subfolder Readmes
|
34
assets/build_assets.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Create Directorys"
|
||||
mkdir -p build
|
||||
mkdir -p code
|
||||
|
||||
echo "Generating Spritesheets"
|
||||
cd resources
|
||||
|
||||
for file in *.t3s
|
||||
do
|
||||
filename=$(basename "$file" .t3s).t3x
|
||||
tex3ds -o "../build/$filename" -i "${file}"
|
||||
done
|
||||
|
||||
echo "Converting Spritesheets into C++ Code"
|
||||
cd ../code
|
||||
|
||||
for file in ../build/*.t3x
|
||||
do
|
||||
name="${file##*/}"
|
||||
name="${name%.*}"
|
||||
../../tools/bin/file2array "${file}" "${name}"
|
||||
done
|
||||
|
||||
echo "Convert Npi-Intro to C++ Code"
|
||||
../../tools/bin/file2array ../splash/npi_intro.nvid npi_intro
|
||||
|
||||
echo "Fix The Output of file2array"
|
||||
for file in ./*.cpp
|
||||
do
|
||||
../../tools/bin/rd7f2afix "${file}" "renderd7"
|
||||
done
|
||||
echo "Finished!"
|
7
assets/clear_assets.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Deleting Directorys"
|
||||
rm -rf build
|
||||
rm -rf code
|
||||
|
||||
echo "Finished!"
|
2
assets/resources/battery/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Source
|
||||
https://icons8.de/
|
BIN
assets/resources/battery/battery_charging.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
assets/resources/battery/battery_dead.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
assets/resources/battery/battery_empty.png
Normal file
After Width: | Height: | Size: 388 B |
BIN
assets/resources/battery/battery_full.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
assets/resources/battery/battery_half.png
Normal file
After Width: | Height: | Size: 437 B |
BIN
assets/resources/battery/battery_low.png
Normal file
After Width: | Height: | Size: 445 B |
BIN
assets/resources/battery/battery_nearfull.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
assets/resources/battery/battery_verylow.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
assets/resources/battery/battery_warning.png
Normal file
After Width: | Height: | Size: 638 B |
11
assets/resources/battery_icons.t3s
Normal file
@ -0,0 +1,11 @@
|
||||
--atlas -f rgba -z auto
|
||||
|
||||
battery/battery_full.png
|
||||
battery/battery_nearfull.png
|
||||
battery/battery_half.png
|
||||
battery/battery_low.png
|
||||
battery/battery_verylow.png
|
||||
battery/battery_warning.png
|
||||
battery/battery_charging.png
|
||||
battery/battery_empty.png
|
||||
battery/battery_dead.png
|
3
assets/resources/renderd7_logo.t3s
Normal file
@ -0,0 +1,3 @@
|
||||
--atlas -f rgba -z auto
|
||||
|
||||
renderd7_logo/renderd7_logo.png
|
BIN
assets/resources/renderd7_logo/renderd7_logo.png
Normal file
After Width: | Height: | Size: 13 KiB |
19
assets/resources/ui_elements.t3s
Normal file
@ -0,0 +1,19 @@
|
||||
--atlas -f rgba -z auto
|
||||
|
||||
ui_elements/high_volume.png
|
||||
ui_elements/mid_volume.png
|
||||
ui_elements/low_volume.png
|
||||
ui_elements/speaker_v1.png
|
||||
ui_elements/no_sound.png
|
||||
ui_elements/speaker.png
|
||||
|
||||
ui_elements/wifi_connected.png
|
||||
ui_elements/wifi_disconnected.png
|
||||
ui_elements/wifi_off.png
|
||||
|
||||
ui_elements/good_connection.png
|
||||
ui_elements/mid_connection.png
|
||||
ui_elements/bad_connection.png
|
||||
ui_elements/no_connection.png
|
||||
|
||||
ui_elements/headphones.png
|
2
assets/resources/ui_elements/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Source
|
||||
https://icons8.de/
|
BIN
assets/resources/ui_elements/bad_connection.png
Normal file
After Width: | Height: | Size: 392 B |
BIN
assets/resources/ui_elements/good_connection.png
Normal file
After Width: | Height: | Size: 418 B |
BIN
assets/resources/ui_elements/headphones.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/resources/ui_elements/high_volume.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/resources/ui_elements/low_volume.png
Normal file
After Width: | Height: | Size: 964 B |
BIN
assets/resources/ui_elements/mid_connection.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
assets/resources/ui_elements/mid_volume.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/resources/ui_elements/no_connection.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
assets/resources/ui_elements/no_sound.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/resources/ui_elements/speaker.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/resources/ui_elements/speaker_v1.png
Normal file
After Width: | Height: | Size: 681 B |
BIN
assets/resources/ui_elements/wifi_connected.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/resources/ui_elements/wifi_disconnected.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/resources/ui_elements/wifi_off.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/splash/npi_intro.mp4
Normal file
BIN
assets/splash/npi_intro.nvid
Normal file
@ -1 +0,0 @@
|
||||
External Librarys
|
5
include/renderd7/battery_icons.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
|
||||
extern unsigned char battery_icons[];
|
||||
extern size_t battery_icons_size;
|
5
include/renderd7/ui_elements.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
|
||||
extern unsigned char ui_elements[];
|
||||
extern size_t ui_elements_size;
|
BIN
logo.png
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 13 KiB |
5
source/battery_icons.cpp
Normal file
29957
source/npi_intro.cpp
@ -387,7 +387,8 @@ bool RenderD7::MainLoop() {
|
||||
RenderD7::Scene::doDraw();
|
||||
RenderD7::Scene::doLogic(d7_hDown, d7_hHeld, d7_hUp, d7_touch);
|
||||
cnttttt++;
|
||||
if (cnttttt > 2) {
|
||||
//Disably Overlays For one Frame
|
||||
if (cnttttt > 1) {
|
||||
shouldbe_disabled = false;
|
||||
cnttttt = 0;
|
||||
}
|
||||
|
5
source/ui_elements.cpp
Normal file
9
tools/build_tools.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#Build Tools
|
||||
echo "Generate Directorys"
|
||||
mkdir -p bin
|
||||
echo "Building file2array"
|
||||
g++ -static -o bin/file2array file2array/file2array.cpp
|
||||
echo "Building rd7f2afix"
|
||||
g++ -static -o bin/rd7f2afix rd7f2afix/rd7f2afix.cpp
|
||||
|
||||
echo "Finished!"
|
4
tools/clear_tools.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#Delete Tools
|
||||
echo "Delete Binary Directory"
|
||||
rm -rf bin
|
||||
echo "Finished!"
|
43
tools/file2array/file2array.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 3) {
|
||||
std::cout << "Usage:\nfile2array <file> <dstfilename>\n";
|
||||
return 0;
|
||||
}
|
||||
std::string file_path = argv[1];
|
||||
std::ifstream file(file_path, std::ios::binary);
|
||||
|
||||
if (!file.is_open()) {
|
||||
std::cerr << "[-] Could not open file" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(file), {});
|
||||
|
||||
const size_t array_size = buffer.size();
|
||||
std::ofstream fout(std::string(argv[2]) + ".cpp");
|
||||
fout << "#include <" << argv[2] << ".hpp>" << std::endl;
|
||||
fout << "\nunsigned char " << argv[2] << "[] = {";
|
||||
for (std::size_t i = 0; i < buffer.size(); ++i) {
|
||||
if (i != 0) {
|
||||
fout << ", ";
|
||||
}
|
||||
fout << "0x" << std::hex << static_cast<int>(buffer[i]);
|
||||
}
|
||||
fout << "};" << std::endl;
|
||||
|
||||
fout << "\nsize_t " << argv[2] << "_size = 0x" << std::hex << array_size
|
||||
<< ";" << std::endl;
|
||||
|
||||
std::ofstream fhead(std::string(argv[2]) + ".hpp");
|
||||
fhead << "#pragma once\n#include <cstddef>\n";
|
||||
fhead << "\nextern unsigned char " << argv[2] << "[];";
|
||||
fhead << "\nextern size_t " << argv[2] << "_size;";
|
||||
|
||||
file.close();
|
||||
fout.close();
|
||||
return 0;
|
||||
}
|
46
tools/rd7f2afix/rd7f2afix.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " input_file path\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string input_filename =
|
||||
std::filesystem::path(argv[1]).filename().string();
|
||||
std::string input_path = argv[1];
|
||||
std::string path = argv[2];
|
||||
std::string header_filename =
|
||||
input_filename.substr(0, input_filename.find_last_of(".")) + ".hpp";
|
||||
std::string include_statement =
|
||||
"#include <" + path + "/" + header_filename + ">";
|
||||
|
||||
std::ifstream input_file(input_path);
|
||||
if (!input_file.is_open()) {
|
||||
std::cerr << "Error: Failed to open input file\n";
|
||||
return 1;
|
||||
}
|
||||
std::string input_contents((std::istreambuf_iterator<char>(input_file)),
|
||||
std::istreambuf_iterator<char>());
|
||||
input_file.close();
|
||||
|
||||
std::regex pattern("#include\\s+<.*\\.hpp>\\s*?");
|
||||
input_contents =
|
||||
std::regex_replace(input_contents, pattern, include_statement);
|
||||
|
||||
std::ofstream output_file(input_filename);
|
||||
if (!output_file.is_open()) {
|
||||
std::cerr << "Error: Failed to open output file for writing\n";
|
||||
return 1;
|
||||
}
|
||||
output_file << input_contents;
|
||||
output_file.close();
|
||||
|
||||
std::cout << "Done! Output written to " << input_filename << std::endl;
|
||||
std::cout << "Include statement: " << include_statement << std::endl;
|
||||
return 0;
|
||||
}
|