244 Commits

Author SHA1 Message Date
a7accb0bf5 ...? 2022-04-11 09:59:25 +02:00
c5c83a9c17 __ 2022-04-11 09:53:36 +02:00
aed653f0c8 Fix the Exit Crash?? 2022-04-11 09:50:47 +02:00
b5995e2f93 RLY 2022-04-10 15:27:43 +02:00
0977e0a80f RN STuff 2022-04-10 15:24:08 +02:00
54a9b80523 Uhh 2022-04-10 15:12:04 +02:00
72adb90757 ;;;;;;;;;;;;;; 2022-04-10 15:03:10 +02:00
f2549997ba Why Not 2022-04-10 15:00:06 +02:00
063a342ad5 Fix Error Message 2022-04-10 13:13:45 +02:00
20f7730448 ???? 2022-04-10 13:06:49 +02:00
aa5ca1a3f0 __ 2022-04-10 10:19:58 +02:00
0dab5c6599 Loader 2022-04-10 10:13:22 +02:00
3f0f8f351c Add a loader 2022-04-10 10:09:43 +02:00
e150265bc4 _ 2022-04-10 10:08:06 +02:00
6fd37ffd3d Implement the new Settings Screen 2022-04-10 09:55:05 +02:00
f7bd625610 ADD % 2022-04-10 01:34:47 +02:00
20cec2442c Add CMDBUF 2022-04-10 01:28:27 +02:00
dcf6d77979 Render D7 Update 2022-04-10 01:17:34 +02:00
0cfd1a0e42 OK 2022-04-10 01:13:16 +02:00
303e4105cb Too much problems 2022-04-10 01:09:46 +02:00
8c8613aca6 FIX 2022-04-10 01:05:26 +02:00
ead304d698 Fix 2022-04-10 01:02:06 +02:00
edb634b79d Add Overlays Engine 2022-04-10 00:59:30 +02:00
d0e4d2296c Add FrameEnd() for overlays 2022-04-10 00:41:16 +02:00
078e0d0d8b Remove The Flyppy Bird String From Setup Log 2022-04-09 19:15:29 +02:00
855e312ad4 MAIN 2022-04-08 13:45:10 +02:00
ffb313971d Update renderd7.cpp 2021-12-29 11:12:07 +01:00
ef8e4a379c Update renderd7.hpp 2021-12-26 13:16:45 +01:00
945038042a Update renderd7.cpp 2021-12-26 13:15:33 +01:00
d59cf0f9e0 Update renderd7.cpp 2021-12-26 10:51:04 +01:00
12d5b48632 Update renderd7.hpp 2021-12-26 10:49:17 +01:00
489d4f54a1 Update renderd7.hpp 2021-12-25 13:34:28 +01:00
80f53cb013 Update renderd7.hpp 2021-12-24 15:40:47 +01:00
ab71f5c84f Update renderd7.cpp 2021-12-24 03:42:13 +01:00
f3c8482c6d Update renderd7.hpp 2021-12-24 03:33:51 +01:00
4bdc38b7d9 Update renderd7.hpp 2021-12-09 20:06:22 +01:00
1f8c0fa06e Update thread.cpp 2021-12-08 16:02:10 +01:00
4ec44b0f89 Update thread.hpp 2021-12-08 16:01:47 +01:00
d82ec589bd Update renderd7.cpp 2021-12-08 16:01:09 +01:00
51276fd171 Update renderd7.cpp 2021-12-06 13:20:40 +01:00
1c5cd37a4f Update renderd7.cpp 2021-12-06 13:15:24 +01:00
f3111623c1 Update renderd7.cpp 2021-12-05 23:46:00 +01:00
4bacf86367 Update renderd7.cpp 2021-12-04 12:33:04 +01:00
f1e6109fa5 Update renderd7.cpp 2021-12-04 02:23:45 +01:00
fe2e9f0dcf Update renderd7.cpp 2021-12-04 01:05:41 +01:00
9a2525e9e5 Update renderd7.hpp 2021-12-04 00:56:49 +01:00
abef666256 Update renderd7.hpp 2021-12-03 22:52:49 +01:00
d31f63a47e d 2021-12-02 16:49:30 +01:00
d4e4dbc565 Update renderd7.hpp 2021-12-02 15:33:27 +01:00
b8cefcc12d Update renderd7.hpp 2021-12-01 21:00:41 +01:00
ca4de52619 Create tween.hpp 2021-12-01 20:52:35 +01:00
22b6f477ba Create Clock.cpp 2021-12-01 20:39:59 +01:00
fe13f3d6b4 Create Time.cpp 2021-12-01 20:38:44 +01:00
c697ae9bd1 Create Clock.hpp 2021-12-01 20:33:46 +01:00
d22b7b718c Create Time.hpp 2021-12-01 20:29:22 +01:00
61285be23e Update main.cpp 2021-11-29 12:10:36 +01:00
eb0ccc8b25 Update main.cpp 2021-11-29 12:06:23 +01:00
ca8db2564d Create main.cpp 2021-11-29 11:59:17 +01:00
c4a8c54da2 Update renderd7.cpp 2021-11-28 17:42:37 +01:00
9d4f94dba2 Update renderd7.cpp 2021-11-28 15:03:00 +01:00
4adf59193c Update renderd7.cpp 2021-11-28 12:09:07 +01:00
7766b4071c Update renderd7.cpp 2021-11-28 08:53:44 +01:00
3d0f3a3ab6 Update renderd7.cpp 2021-11-28 05:45:33 +01:00
0e7ac54ef7 Update renderd7.hpp 2021-11-28 05:44:46 +01:00
6c03dde215 Update renderd7.cpp 2021-11-28 05:37:58 +01:00
aa6c96c9a3 Update renderd7.cpp 2021-11-28 05:19:20 +01:00
28abaa62ff Update renderd7.cpp 2021-11-27 12:11:05 +01:00
c8e65e39c3 Update renderd7.cpp 2021-11-27 12:05:43 +01:00
4fe4232796 Update renderd7.cpp 2021-11-27 12:05:03 +01:00
81fa120cb7 Update renderd7.cpp 2021-11-27 11:57:40 +01:00
92fdc24a49 Update renderd7.hpp 2021-11-27 11:51:56 +01:00
237c9108bf Update renderd7.hpp 2021-11-27 11:50:44 +01:00
069cfba51b Update renderd7.cpp 2021-11-27 11:50:25 +01:00
e4ef5b55fe Update renderd7.cpp 2021-11-27 11:34:32 +01:00
a10e2aaab9 Update renderd7.hpp 2021-11-27 11:26:53 +01:00
b35ed87573 Update renderd7.cpp 2021-11-27 11:23:44 +01:00
ab867588d3 Update renderd7.hpp 2021-11-27 11:22:47 +01:00
087b2a2bb0 Update renderd7.cpp 2021-11-23 16:50:52 +01:00
c8fcce1de3 Update sound.cpp 2021-11-23 16:39:20 +01:00
a5f3e60e3a Update renderd7.cpp 2021-11-23 16:34:26 +01:00
fbc54e0065 Update renderd7.hpp 2021-11-23 16:33:36 +01:00
1bbefb259a Update renderd7.cpp 2021-11-21 21:40:08 +01:00
569e82f476 Update renderd7.hpp 2021-11-21 21:37:24 +01:00
51822aef23 Create renderd7.hpp 2021-11-21 21:25:22 +01:00
f0ae9c238c Update renderd7.hpp 2021-11-19 07:02:30 +01:00
b9578e151d Update renderd7.hpp 2021-11-18 20:51:28 +01:00
ad655021a4 Update renderd7.hpp 2021-11-15 07:02:19 +01:00
9c66052878 Update renderd7.hpp 2021-09-21 16:31:45 +02:00
d98707aa8f Update engine.hpp 2021-08-16 23:00:02 +02:00
95dc698349 Update engine.hpp 2021-08-15 22:51:56 +02:00
13916e3dff Update engine.hpp 2021-08-15 22:47:48 +02:00
44f618e9d8 Create engine.hpp 2021-08-15 22:46:41 +02:00
235c2c2d7e Update renderd7.cpp 2021-08-14 10:51:20 +02:00
dfce1b2adb Update renderd7.cpp 2021-08-14 10:08:54 +02:00
b68c7d29ae Update renderd7.hpp 2021-08-14 10:01:53 +02:00
7737cba060 Update renderd7.hpp 2021-08-14 08:15:22 +02:00
4cd82f2e25 Update renderd7.hpp 2021-08-12 22:19:15 +02:00
a15b0bdb2d Create stringtool.hpp 2021-08-12 22:17:46 +02:00
f7f0d26896 Update renderd7.hpp 2021-08-08 11:28:11 +02:00
e73ee7c6db Update renderd7.hpp 2021-08-08 11:22:42 +02:00
0d4cc6f30f Update renderd7.hpp 2021-08-07 17:07:57 +02:00
d7c02bab33 Update renderd7.cpp 2021-08-01 12:58:56 +02:00
4750ba5a6c Update renderd7.hpp 2021-08-01 12:55:26 +02:00
8dabfd58ab Update Update extlibs.yml 2021-07-30 15:09:52 +02:00
16510f5261 Update Docs.yml 2021-07-30 13:15:02 +02:00
60d85b2a5e Delete main/doc/html directory 2021-07-30 13:13:22 +02:00
69fe7d4cb4 Update Docs.yml 2021-07-30 13:11:14 +02:00
0e772b1394 Update Update extlibs.yml 2021-07-25 23:32:29 +02:00
596d2a8611 Create external.md 2021-07-25 23:27:35 +02:00
f1f71b93e2 Create Update extlibs.yml 2021-07-25 23:22:52 +02:00
b0a74a0bf6 Documentation1 2021-07-25 16:36:05 +00:00
00ec77e6a3 Delete external/tween-engine directory 2021-07-25 18:35:41 +02:00
d2145977c5 Documentation1 2021-07-25 16:35:20 +00:00
c733394277 Update log.hpp 2021-07-25 18:34:47 +02:00
43ea66236c Documentation1 2021-07-25 14:44:45 +00:00
0cd8eaa423 Update renderd7.hpp 2021-07-25 16:44:12 +02:00
af296546ff Documentation1 2021-07-25 14:36:11 +00:00
26db113a09 Update renderd7.hpp 2021-07-25 16:35:50 +02:00
e2ca5f27b6 Documentation1 2021-07-25 14:30:56 +00:00
ed2b2c4ed8 Update renderd7.hpp 2021-07-25 16:30:35 +02:00
7c3e17e820 Delete header.html 2021-07-25 16:26:02 +02:00
64045ebddf Delete d.html 2021-07-25 16:25:52 +02:00
14800862be Documentation1 2021-07-25 10:55:12 +00:00
c640a2ec38 Update log.hpp 2021-07-25 12:54:49 +02:00
1a87a2519f Update doxygen.css 2021-07-25 12:53:21 +02:00
52d7433385 Documentation1 2021-07-25 10:41:21 +00:00
03247039d3 Update Doxyfile 2021-07-25 12:40:59 +02:00
9dc3feb1f3 Documentation1 2021-07-25 10:38:19 +00:00
a64f16e371 Update renderd7.hpp 2021-07-25 12:37:58 +02:00
2327fcb284 Update doxygen.css 2021-07-25 12:36:01 +02:00
0e56aa0905 Documentation1 2021-07-25 10:33:20 +00:00
d568126176 Update Doxyfile 2021-07-25 12:32:56 +02:00
f11b74ba85 Update Docs.yml 2021-07-25 12:31:00 +02:00
a4eac5221d Update Doxyfile 2021-07-25 12:30:21 +02:00
31360d90f3 Update Docs.yml 2021-07-25 12:25:01 +02:00
d3c1a8aaa6 Update Docs.yml 2021-07-25 12:22:13 +02:00
e944cd8f55 Create d.html 2021-07-25 12:21:29 +02:00
5af0535d74 Create header.html 2021-07-25 11:53:13 +02:00
6548670e59 Update Docs.yml 2021-07-25 11:44:40 +02:00
69f8a7fd51 Rename docs/doxygen.css to doxygen.css 2021-07-25 11:39:25 +02:00
8ba4bcdc1b Update Docs.yml 2021-07-25 11:38:41 +02:00
0d104edab3 Update Docs.yml 2021-07-25 11:32:39 +02:00
2c17269f84 Create doxygen.css 2021-07-25 11:31:37 +02:00
8cf2c798e6 Documentation1 2021-07-25 09:20:48 +00:00
48cb6d4034 Update sound.hpp 2021-07-25 11:20:23 +02:00
78b3ff7f68 Documentation1 2021-07-25 09:05:33 +00:00
e304bdf00f Update renderd7.hpp 2021-07-25 11:05:06 +02:00
ad169b01cb Documentation1 2021-07-25 08:29:59 +00:00
dc7034db91 Update renderd7.hpp 2021-07-25 10:29:36 +02:00
b01393cd33 Update sound.hpp 2021-07-25 10:28:01 +02:00
54579d1f18 Documentation1 2021-07-24 22:47:54 +00:00
96dbdf3309 Update renderd7.hpp 2021-07-25 00:47:28 +02:00
b690ea5822 Documentation1 2021-07-24 22:28:17 +00:00
fbe59355ce Update renderd7.hpp 2021-07-25 00:27:55 +02:00
809ddbad47 Documentation1 2021-07-24 22:23:41 +00:00
9be2bb672a Update lang.hpp 2021-07-25 00:23:20 +02:00
469896be32 Documentation1 2021-07-24 22:13:43 +00:00
6f8ec89373 Update log.hpp 2021-07-25 00:13:11 +02:00
4368d6d7ee Update sound.hpp 2021-07-25 00:07:17 +02:00
3af5da9d3e Documentation1 2021-07-24 22:02:52 +00:00
560ee65932 Update sound.hpp 2021-07-25 00:02:30 +02:00
e42d1ec20a Documentation1 2021-07-24 21:59:50 +00:00
bfa3b0a1c6 Update sound.hpp 2021-07-24 23:59:29 +02:00
c2484c1892 Documentation1 2021-07-24 21:48:15 +00:00
fe15309b77 Update Doxyfile 2021-07-24 23:47:54 +02:00
cadb23f9e2 Documentation1 2021-07-24 21:37:33 +00:00
c401c3f2e3 Create Doxyfile 2021-07-24 23:37:10 +02:00
b2eccd5ebb Update renderd7.hpp 2021-07-24 23:32:04 +02:00
48de80fe13 Update renderd7.hpp 2021-07-24 23:31:05 +02:00
ba97c9ed70 Update Docs.yml 2021-07-24 19:21:05 +02:00
e717a52491 Delete doc/doc/html directory 2021-07-24 19:19:33 +02:00
006f16f32f Delete doc/main/doc/html directory 2021-07-24 19:19:23 +02:00
184a97b2d7 Delete Doxyfile 2021-07-24 19:19:13 +02:00
b72caa1ba0 Update renderd7.hpp 2021-07-24 19:17:20 +02:00
b81160bbd3 Update Docs.yml 2021-07-24 19:14:57 +02:00
ae4212e5a6 Update README.md 2021-07-24 19:13:40 +02:00
6821dd2bca Documentation1 2021-07-24 17:12:30 +00:00
c5a3910ccf Update Docs.yml 2021-07-24 19:12:10 +02:00
12ea3dc60f Update Docs.yml 2021-07-24 19:09:55 +02:00
3d3f26bf57 Update Docs.yml 2021-07-24 19:08:17 +02:00
66b8f6b921 Update Docs.yml 2021-07-24 19:03:41 +02:00
cc5a011a89 Update Docs.yml 2021-07-24 18:52:38 +02:00
83e0b11f8f Update Docs.yml 2021-07-24 18:51:34 +02:00
165552b439 Update Docs.yml 2021-07-24 18:49:48 +02:00
5eefebee43 Update Docs.yml 2021-07-24 18:49:23 +02:00
762b08eb08 Update Docs.yml 2021-07-24 18:46:57 +02:00
0032d26010 Update Docs.yml 2021-07-24 18:45:10 +02:00
ee4fe4f131 Update Docs.yml 2021-07-24 18:42:59 +02:00
5b926a7317 Update Docs.yml 2021-07-24 18:39:13 +02:00
f0b02d64ef Update renderd7.hpp 2021-07-24 18:16:51 +02:00
3e2af92e7e Update Docs.yml 2021-07-24 18:04:18 +02:00
7384ba6f4f Update Docs.yml 2021-07-24 17:58:12 +02:00
a1d9b4344a Update Docs.yml 2021-07-24 17:48:52 +02:00
3fc36d5b14 Update README.md 2021-07-24 17:42:49 +02:00
87f9b915e2 Update README.md 2021-07-24 17:42:29 +02:00
fa1980d47c Update README.md 2021-07-24 17:36:59 +02:00
d80017fcb5 Update Docs.yml 2021-07-24 17:22:38 +02:00
db27c91ec9 Documentation 2021-07-24 15:18:51 +00:00
9036726e92 Update Docs.yml 2021-07-24 17:18:20 +02:00
a0350b7814 Update Docs.yml 2021-07-24 17:16:53 +02:00
0cd2f330ad Update Docs.yml 2021-07-24 17:14:31 +02:00
9a5479d68b Update Docs.yml 2021-07-24 17:00:45 +02:00
595828fe84 Update Docs.yml 2021-07-24 16:52:25 +02:00
788d8f81a5 Documentation 2021-07-24 14:31:15 +00:00
d8a6a9e45c Update Docs.yml 2021-07-24 16:30:49 +02:00
113af5fabb Update Docs.yml 2021-07-24 13:19:20 +02:00
c6b7099df2 Update Docs.yml 2021-07-24 13:14:47 +02:00
db778f462a Update Docs.yml 2021-07-24 13:12:07 +02:00
5d02c2c6f2 Update Docs.yml 2021-07-24 13:07:59 +02:00
83eeee453e Update Docs.yml 2021-07-24 11:00:39 +02:00
2d05d1e7a9 Update Docs.yml 2021-07-24 10:58:57 +02:00
4d11cb9e91 Update Docs.yml 2021-07-24 10:57:25 +02:00
cbbc4d54d9 Update Docs.yml 2021-07-24 10:15:39 +02:00
22ae99f915 Update Docs.yml 2021-07-24 10:09:48 +02:00
b7a544eadd Update Docs.yml 2021-07-24 09:36:48 +02:00
328ff9d23b Update Docs.yml 2021-07-23 19:30:37 +02:00
624b59db9d Update Docs.yml 2021-07-23 19:15:31 +02:00
adf783c2a1 Update Docs.yml 2021-07-23 16:37:00 +02:00
db89d5c60f Update Docs.yml 2021-07-23 16:26:50 +02:00
9623606229 Update Docs.yml 2021-07-23 16:21:33 +02:00
5200f27182 Update Docs.yml 2021-07-23 16:17:18 +02:00
36f545855d Update Docs.yml 2021-07-23 16:14:39 +02:00
c2b35fdf83 Update Docs.yml 2021-07-23 16:12:56 +02:00
59fcc8c159 Update Docs.yml 2021-07-23 16:08:55 +02:00
8431119ff5 Create Doxyfile 2021-07-23 16:07:38 +02:00
c537fc095a BCSTM-Player | 2021-07-23 13:58:16 +00:00
f51ddecf3d Update Docs.yml 2021-07-23 15:58:01 +02:00
fd167cd675 Update Docs.yml 2021-07-23 15:55:50 +02:00
53dcfd0940 Update Docs.yml 2021-07-23 15:52:32 +02:00
dd50e2c399 Update Docs.yml 2021-07-23 15:47:12 +02:00
ccffe19a1e Update Docs.yml 2021-07-23 15:41:57 +02:00
319582b680 Update Docs.yml 2021-07-23 15:39:39 +02:00
fb0b1110d6 Update Docs.yml 2021-07-23 15:38:57 +02:00
a6aac5f5cd Update Docs.yml 2021-07-23 15:37:14 +02:00
3d1a50d2a7 Update Docs.yml 2021-07-23 15:35:58 +02:00
51800b1960 Update Docs.yml 2021-07-23 12:48:32 +02:00
4018047409 Update Docs.yml 2021-07-23 12:42:52 +02:00
3c5adeef54 Delete main.yml 2021-07-23 12:40:34 +02:00
cf5fca1ea4 Create main.yml 2021-07-23 12:40:24 +02:00
73c4485153 Update Docs.yml 2021-07-23 12:38:08 +02:00
3a6fdc9441 Update Docs.yml 2021-07-23 12:33:00 +02:00
a7295073f8 Update Docs.yml 2021-07-23 12:30:39 +02:00
f6402a095b Update Docs.yml 2021-07-23 12:26:50 +02:00
d5b66ad125 Create Docs.yml 2021-07-23 11:36:59 +02:00
32 changed files with 37994 additions and 112 deletions

49
.github/workflows/Docs.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: 📄
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "*" ]
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: branch
- name: Display branch name
shell: bash
run: echo ${{ steps.branch.outputs.branch }}
# Runs a single command using the runners shell
- name: Run a one-line script
run: |
sudo apt-get install doxygen cmake -y
doxygen
echo done
ls -r
cd ..
git clone https://github.com/NPI-D7/NPI-D7.github.io.git
mkdir -p NPI-D7.github.io/${{ steps.branch.outputs.branch }}
#rm -r NPI-D7.github.io/${{ steps.branch.outputs.branch }}/*
mv -v RenderD7/doc NPI-D7.github.io/${{ steps.branch.outputs.branch }}/
#rm -r doc
cd NPI-D7.github.io
git config --global user.email "tobid7@outlook.de"
git config --global user.name "Tobi-D7"
echo tobid7
git stage *
echo staged
git commit -m "Documentation1"
git tag doc
echo commited
git push origin main
echo pushed

50
.github/workflows/Update extlibs.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Extlibs
on:
push:
branches: [ '!*' ]
pull_request:
branches: [ '!*' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: update
run: |
#gl
cd ..
git clone https://github.com/lua/lua.git
cd RenderD7
mkdir -p extlibs/
mkdir -p extlibs/lua/
cp -r ../lua/*.c extlibs/lua/
cp -r ../lua/*.h extlibs/lua/
cp -r ../lua/*.md extlibs/lua/
#RenderD7
cd ..
git clone https://github.com/NPI-D7/RenderD7.git
cd lp-next-ctr
mkdir -p extlibs/
rm -r extlibs/RenderD7
mkdir -p extlibs/RenderD7/
cp -r ../RenderD7/*.c* extlibs/RenderD7/
cp -r ../RenderD7/*.h* extlibs/RenderD7/
cp -r ../RenderD7/*.md extlibs/RenderD7/
#config
git config --global user.email "tobid7@outlook.de"
git config --global user.name "Tobi-D7"
#commit
git stage *
git commit -m "update extlibs"
git push origin main

View File

@ -1,13 +0,0 @@
#projectlogo img{
max-height: 70px;
}
img[src="logotype.svg"]{
width:10cm;
}
div.contents{
max-width: 85%;
margin-left: 2%;
}
.textblock h1{
border-bottom: 1px solid #666;
}

View File

@ -32,14 +32,14 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = Renderd7-0.3.0 PROJECT_NAME = Renderd7-nightly
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = "v0.3.0" PROJECT_NUMBER = "v0.7.0"
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -52,7 +52,7 @@ PROJECT_BRIEF "3ds graphics helper"
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = Docs/logo.svg PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@ -855,7 +855,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = include doc/md INPUT = .
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -884,7 +884,7 @@ INPUT_ENCODING = UTF-8
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, # *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
# *.ucf, *.qsf and *.ice. # *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.hpp *.md FILE_PATTERNS = *.hpp *.h *.cpp
# The RECURSIVE tag can be used to specify whether or not subdirectories should # The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well. # be searched for input files as well.
@ -1192,7 +1192,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation. # list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = doc/custom.css HTML_EXTRA_STYLESHEET = doxygen.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note # other source files which should be copied to the HTML output directory. Note

View File

@ -1,5 +1,2 @@
# RenderD7 030 # RenderD7 (https://npi-d7.github.io/RenderD7/main/doc/html/index.html)
Simple and Easey to use UI and Graphics helper. Simple and Easey to use UI and Graphics helper.

1450
doxygen.css Normal file

File diff suppressed because it is too large Load Diff

320
external/fs.c vendored Normal file
View File

@ -0,0 +1,320 @@
#include "external/fs.h"
#include <stdio.h>
#include <string.h>
void Utils_U8_To_U16(u16 *buf, const u8 *input, size_t bufsize) {
ssize_t units = utf8_to_utf16(buf, input, bufsize);
if (units < 0)
units = 0;
buf[units] = 0;
}
FS_Archive archive, sdmc_archive, nand_archive;
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID archiveID) {
Result ret = 0;
if (R_FAILED(ret = FSUSER_OpenArchive(archive, archiveID, fsMakePath(PATH_EMPTY, ""))))
return ret;
return 0;
}
Result FS_CloseArchive(FS_Archive archive) {
Result ret = 0;
if (R_FAILED(ret = FSUSER_CloseArchive(archive)))
return ret;
return 0;
}
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenDirectory(handle, archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0;
}
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenFile(handle, archive, fsMakePath(PATH_UTF16, path_u16), flags, attributes)))
return ret;
return 0;
}
Result FS_MakeDir(FS_Archive archive, const char *path) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateDirectory(archive, fsMakePath(PATH_UTF16, path_u16), 0)))
return ret;
return 0;
}
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
return ret;
return 0;
}
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path) {
Result ret = 0;
char buf[256];
char *p = NULL;
size_t len;
snprintf(buf, sizeof(buf), "%s", path);
len = strlen(buf);
if (buf[len - 1] == '/')
buf[len - 1] = 0;
for (p = buf + 1; *p; p++) {
if (*p == '/') {
*p = 0;
if (!FS_DirExists(archive, buf))
ret = FS_MakeDir(archive, buf);
*p = '/';
}
if (!FS_DirExists(archive, buf))
ret = FS_MakeDir(archive, buf);
}
return ret;
}
bool FS_FileExists(FS_Archive archive, const char *path) {
Handle handle;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0)))
return false;
if (R_FAILED(FSFILE_Close(handle)))
return false;
return true;
}
bool FS_DirExists(FS_Archive archive, const char *path) {
Handle handle;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(FSUSER_OpenDirectory(&handle, archive, fsMakePath(PATH_UTF16, path_u16))))
return false;
if (R_FAILED(FSDIR_Close(handle)))
return false;
return true;
}
Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size) {
Result ret = 0;
Handle handle;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_READ, 0)))
return ret;
if (R_FAILED(ret = FSFILE_GetSize(handle, size))) {
FSFILE_Close(handle);
return ret;
}
if (R_FAILED(ret = FSFILE_Close(handle)))
return ret;
return 0;
}
u64 FS_GetFreeStorage(FS_SystemMediaType media_type) {
FS_ArchiveResource resource = {0};
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
return (((u64)resource.freeClusters * (u64)resource.clusterSize));
return 0;
}
u64 FS_GetTotalStorage(FS_SystemMediaType media_type) {
FS_ArchiveResource resource = {0};
if (R_SUCCEEDED(FSUSER_GetArchiveResource(&resource, media_type)))
return (((u64)resource.totalClusters * (u64)resource.clusterSize));
return 0;
}
u64 FS_GetUsedStorage(FS_SystemMediaType media_type) {
return (FS_GetTotalStorage(media_type) - FS_GetUsedStorage(media_type));
}
Result FS_RemoveFile(FS_Archive archive, const char *path) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteFile(archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0;
}
Result FS_RemoveDir(FS_Archive archive, const char *path) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteDirectory(archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0;
}
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path) {
Result ret = 0;
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_DeleteDirectoryRecursively(archive, fsMakePath(PATH_UTF16, path_u16))))
return ret;
return 0;
}
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename) {
Result ret = 0;
u16 old_filename_u16[strlen(old_filename) + 1];
Utils_U8_To_U16(old_filename_u16, (const u8 *)old_filename, strlen(old_filename) + 1);
u16 new_filename_u16[strlen(new_filename) + 1];
Utils_U8_To_U16(new_filename_u16, (const u8 *)new_filename, strlen(new_filename) + 1);
if (R_FAILED(ret = FSUSER_RenameFile(archive, fsMakePath(PATH_UTF16, old_filename_u16), archive, fsMakePath(PATH_UTF16, new_filename_u16))))
return ret;
return 0;
}
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname) {
Result ret = 0;
u16 old_dirname_u16[strlen(old_dirname) + 1];
Utils_U8_To_U16(old_dirname_u16, (const u8 *)old_dirname, strlen(old_dirname) + 1);
u16 new_dirname_u16[strlen(new_dirname) + 1];
Utils_U8_To_U16(new_dirname_u16, (const u8 *)new_dirname, strlen(new_dirname) + 1);
if (R_FAILED(ret = FSUSER_RenameDirectory(archive, fsMakePath(PATH_UTF16, old_dirname_u16), archive, fsMakePath(PATH_UTF16, new_dirname_u16))))
return ret;
return 0;
}
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf) {
Result ret = 0;
Handle handle;
u32 bytes_read = 0;
if (R_FAILED(ret = FS_OpenFile(&handle, archive, path, FS_OPEN_READ, 0)))
return ret;
if (R_FAILED(ret = FSFILE_Read(handle, &bytes_read, 0, buf, size))) {
FSFILE_Close(handle);
return ret;
}
if (R_FAILED(ret = FSFILE_Close(handle)))
return ret;
return 0;
}
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size) {
Result ret = 0;
Handle handle;
u32 bytes_written = 0;
if (FS_FileExists(archive, path))
FS_RemoveFile(archive, path);
u16 path_u16[strlen(path) + 1];
Utils_U8_To_U16(path_u16, (const u8 *)path, strlen(path) + 1);
if (R_FAILED(ret = FSUSER_CreateFile(archive, fsMakePath(PATH_UTF16, path_u16), 0, size)))
return ret;
if (R_FAILED(ret = FSUSER_OpenFile(&handle, archive, fsMakePath(PATH_UTF16, path_u16), FS_OPEN_WRITE, 0)))
return ret;
if (R_FAILED(ret = FSFILE_Write(handle, &bytes_written, 0, buf, size, FS_WRITE_FLUSH))) {
FSFILE_Close(handle);
return ret;
}
if (R_FAILED(ret = FSFILE_Close(handle)))
return ret;
return 0;
}
char *FS_GetFileTimestamp(const char *path) {
static char timeStr[60];
u64 mtime = 0;
if (R_SUCCEEDED(archive_getmtime(path, &mtime))) {
time_t mt = mtime;
struct tm *timeStruct = gmtime(&mt);
int hours = timeStruct->tm_hour;
int minutes = timeStruct->tm_min;
int day = timeStruct->tm_mday;
int month = timeStruct->tm_mon + 1; // January being 0
int year = timeStruct->tm_year + 1900;
snprintf(timeStr, 60, "%d/%d/%d %2i:%02i", year, month, day, hours, minutes);
}
else
return NULL;
return timeStr;
}

30
external/fs.h vendored Normal file
View File

@ -0,0 +1,30 @@
#ifndef _3D_SHELL_FS_H
#define _3D_SHELL_FS_H
#include <3ds.h>
extern FS_Archive archive, sdmc_archive, nand_archive;
Result FS_OpenArchive(FS_Archive *archive, FS_ArchiveID id);
Result FS_CloseArchive(FS_Archive archive);
Result FS_OpenDir(Handle *handle, FS_Archive archive, const char *path);
Result FS_OpenFile(Handle *handle, FS_Archive archive, const char *path, u32 flags, u32 attributes);
Result FS_MakeDir(FS_Archive archive, const char *path);
Result FS_CreateFile(FS_Archive archive, const char *path, u64 size);
Result FS_RecursiveMakeDir(FS_Archive archive, const char *path);
bool FS_FileExists(FS_Archive archive, const char *path);
bool FS_DirExists(FS_Archive archive, const char *path);
Result FS_GetFileSize(FS_Archive archive, const char *path, u64 *size);
u64 FS_GetFreeStorage(FS_SystemMediaType media_type);
u64 FS_GetTotalStorage(FS_SystemMediaType media_type);
u64 FS_GetUsedStorage(FS_SystemMediaType media_type);
Result FS_RemoveFile(FS_Archive archive, const char *path);
Result FS_RemoveDir(FS_Archive archive, const char *path);
Result FS_RemoveDirRecursive(FS_Archive archive, const char *path);
Result FS_RenameFile(FS_Archive archive, const char *old_filename, const char *new_filename);
Result FS_RenameDir(FS_Archive archive, const char *old_dirname, const char *new_dirname);
Result FS_Read(FS_Archive archive, const char *path, u64 size, void *buf);
Result FS_Write(FS_Archive archive, const char *path, const void *buf, u32 size);
char *FS_GetFileTimestamp(const char *path);
#endif

25447
external/json.hpp vendored Normal file

File diff suppressed because it is too large Load Diff

6464
external/lodepng.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

1977
external/lodepng.h vendored Normal file

File diff suppressed because it is too large Load Diff

1
extlibs/external.md Normal file
View File

@ -0,0 +1 @@
External Librarys

20
internal/Clock.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "Clock.hpp"
namespace rnd7 {
////////////////////////////////////////////////////////////
Time Clock::getElapsedTime() const {
return getCurrentTime() - m_startTime;
}
////////////////////////////////////////////////////////////
Time Clock::restart() {
Time now = getCurrentTime();
Time elapsed = now - m_startTime;
m_startTime = now;
return elapsed;
}
}

23
internal/Clock.hpp Normal file
View File

@ -0,0 +1,23 @@
#include <Time.hpp>
namespace rnd7 {
class Clock {
public:
Clock() {};
virtual ~Clock() {};
virtual Time getCurrentTime() const { return Time{}; };
Time getElapsedTime() const;
Time restart();
protected:
Time m_startTime; ///< Time of last reset, in microseconds
};
}

200
internal/Time.cpp Normal file
View File

@ -0,0 +1,200 @@
#include "Time.hpp"
namespace rnd7 {
////////////////////////////////////////////////////////////
const Time Time::Zero_;
////////////////////////////////////////////////////////////
Time::Time() :
m_microseconds(0) {
}
////////////////////////////////////////////////////////////
float Time::asSeconds() const {
return m_microseconds / 1000000.f;
}
////////////////////////////////////////////////////////////
int Time::asMilliseconds() const {
return static_cast<int>(m_microseconds / 1000);
}
////////////////////////////////////////////////////////////
long Time::asMicroseconds() const {
return m_microseconds;
}
////////////////////////////////////////////////////////////
Time::Time(long microseconds) :
m_microseconds(microseconds) {
}
////////////////////////////////////////////////////////////
Time seconds(float amount) {
return Time(static_cast<long>(amount * 1000000));
}
////////////////////////////////////////////////////////////
Time milliseconds(int amount) {
return Time(static_cast<long>(amount) * 1000);
}
////////////////////////////////////////////////////////////
Time microseconds(long amount) {
return Time(amount);
}
////////////////////////////////////////////////////////////
bool operator==(Time left, Time right) {
return left.asMicroseconds() == right.asMicroseconds();
}
////////////////////////////////////////////////////////////
bool operator!=(Time left, Time right) {
return left.asMicroseconds() != right.asMicroseconds();
}
////////////////////////////////////////////////////////////
bool operator<(Time left, Time right) {
return left.asMicroseconds() < right.asMicroseconds();
}
////////////////////////////////////////////////////////////
bool operator>(Time left, Time right) {
return left.asMicroseconds() > right.asMicroseconds();
}
////////////////////////////////////////////////////////////
bool operator<=(Time left, Time right) {
return left.asMicroseconds() <= right.asMicroseconds();
}
////////////////////////////////////////////////////////////
bool operator>=(Time left, Time right) {
return left.asMicroseconds() >= right.asMicroseconds();
}
////////////////////////////////////////////////////////////
Time operator-(Time right) {
return microseconds(-right.asMicroseconds());
}
////////////////////////////////////////////////////////////
Time operator+(Time left, Time right) {
return microseconds(left.asMicroseconds() + right.asMicroseconds());
}
////////////////////////////////////////////////////////////
Time &operator+=(Time &left, Time right) {
return left = left + right;
}
////////////////////////////////////////////////////////////
Time operator-(Time left, Time right) {
return microseconds(left.asMicroseconds() - right.asMicroseconds());
}
////////////////////////////////////////////////////////////
Time &operator-=(Time &left, Time right) {
return left = left - right;
}
////////////////////////////////////////////////////////////
Time operator*(Time left, float right) {
return seconds(left.asSeconds() * right);
}
////////////////////////////////////////////////////////////
Time operator*(Time left, long right) {
return microseconds(left.asMicroseconds() * right);
}
////////////////////////////////////////////////////////////
Time operator*(float left, Time right) {
return right * left;
}
////////////////////////////////////////////////////////////
Time operator*(long left, Time right) {
return right * left;
}
////////////////////////////////////////////////////////////
Time &operator*=(Time &left, float right) {
return left = left * right;
}
////////////////////////////////////////////////////////////
Time &operator*=(Time &left, long right) {
return left = left * right;
}
////////////////////////////////////////////////////////////
Time operator/(Time left, float right) {
return seconds(left.asSeconds() / right);
}
////////////////////////////////////////////////////////////
Time operator/(Time left, long right) {
return microseconds(left.asMicroseconds() / right);
}
////////////////////////////////////////////////////////////
Time &operator/=(Time &left, float right) {
return left = left / right;
}
////////////////////////////////////////////////////////////
Time &operator/=(Time &left, long right) {
return left = left / right;
}
////////////////////////////////////////////////////////////
float operator/(Time left, Time right) {
return left.asSeconds() / right.asSeconds();
}
////////////////////////////////////////////////////////////
Time operator%(Time left, Time right) {
return microseconds(left.asMicroseconds() % right.asMicroseconds());
}
////////////////////////////////////////////////////////////
Time &operator%=(Time &left, Time right) {
return left = left % right;
}
}

82
internal/Time.hpp Normal file
View File

@ -0,0 +1,82 @@
namespace rnd7 {
class Time {
public:
Time();
float asSeconds() const;
int asMilliseconds() const;
long asMicroseconds() const;
static const Time Zero_;
private:
friend Time seconds(float);
friend Time milliseconds(int);
friend Time microseconds(long);
explicit Time(long microseconds);
private:
long m_microseconds; ///< Time value stored as microseconds
};
Time seconds(float amount);
Time milliseconds(int amount);
Time microseconds(long amount);
bool operator==(Time left, Time right);
bool operator!=(Time left, Time right);
bool operator<(Time left, Time right);
bool operator>(Time left, Time right);
bool operator<=(Time left, Time right);
bool operator>=(Time left, Time right);
Time operator-(Time right);
Time operator+(Time left, Time right);
Time &operator+=(Time &left, Time right);
Time operator-(Time left, Time right);
Time &operator-=(Time &left, Time right);
Time operator*(Time left, float right);
Time operator*(Time left, long right);
Time operator*(float left, Time right);
Time operator*(long left, Time right);
Time &operator*=(Time &left, float right);
Time &operator*=(Time &left, long right);
Time operator/(Time left, float right);
Time operator/(Time left, long right);
Time &operator/=(Time &left, float right);
Time &operator/=(Time &left, long right);
float operator/(Time left, Time right);
Time operator%(Time left, Time right);
Time &operator%=(Time &left, Time right);
}

40
internal/engine.hpp Normal file
View File

@ -0,0 +1,40 @@
#pragma once
#include <3ds.h>
#include <citro2d.h>
#include <citro3d.h>
#include <memory>
#include <stack>
#include <string>
#include <functional>
#include <vector>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
#include <cstring>
#include <sys/stat.h>
#include <algorithm>
#include <iostream>
#include <codecvt>
#include <map>
#include "lang.hpp"
#include "parameter.hpp"
#include "thread.hpp"
#include "ini.hpp"
#include "stringtool.hpp"
enum EngineType
{
_2D,
_3D
};
namespace Npi
class Game {
public:
Game(EngineType, std::string name);
~Game(){}
private:
std::string g_name;
EngineType g_etype;
};
}

679
internal/ini.hpp Normal file
View File

@ -0,0 +1,679 @@
#ifndef INI_INI_H_
#define INI_INI_H_
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <vector>
#include <memory>
#include <fstream>
#include <sys/stat.h>
#include <cctype>
namespace INI
{
namespace INIStringUtil
{
const char* const whitespaceDelimiters = " \t\n\r\f\v";
inline void trim(std::string& str)
{
str.erase(str.find_last_not_of(whitespaceDelimiters) + 1);
str.erase(0, str.find_first_not_of(whitespaceDelimiters));
}
#ifndef INI_CASE_SENSITIVE
inline void toLower(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), [](const char c) {
return static_cast<const char>(std::tolower(c));
});
}
#endif
inline void replace(std::string& str, std::string const& a, std::string const& b)
{
if (!a.empty())
{
std::size_t pos = 0;
while ((pos = str.find(a, pos)) != std::string::npos)
{
str.replace(pos, a.size(), b);
pos += b.size();
}
}
}
#ifdef _WIN32
const char* const endl = "\r\n";
#else
const char* const endl = "\n";
#endif
};
template<typename T>
class INIMap
{
private:
using T_DataIndexMap = std::unordered_map<std::string, std::size_t>;
using T_DataItem = std::pair<std::string, T>;
using T_DataContainer = std::vector<T_DataItem>;
using T_MultiArgs = typename std::vector<std::pair<std::string, T>>;
T_DataIndexMap dataIndexMap;
T_DataContainer data;
inline std::size_t setEmpty(std::string& key)
{
std::size_t index = data.size();
dataIndexMap[key] = index;
data.emplace_back(key, T());
return index;
}
public:
using const_iterator = typename T_DataContainer::const_iterator;
INIMap() { }
INIMap(INIMap const& other)
{
std::size_t data_size = other.data.size();
for (std::size_t i = 0; i < data_size; ++i)
{
auto const& key = other.data[i].first;
auto const& obj = other.data[i].second;
data.emplace_back(key, obj);
}
dataIndexMap = T_DataIndexMap(other.dataIndexMap);
}
T& operator[](std::string key)
{
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
bool hasIt = (it != dataIndexMap.end());
std::size_t index = (hasIt) ? it->second : setEmpty(key);
return data[index].second;
}
T get(std::string key) const
{
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it == dataIndexMap.end())
{
return T();
}
return T(data[it->second].second);
}
bool has(std::string key) const
{
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
return (dataIndexMap.count(key) == 1);
}
void set(std::string key, T obj)
{
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it != dataIndexMap.end())
{
data[it->second].second = obj;
}
else
{
dataIndexMap[key] = data.size();
data.emplace_back(key, obj);
}
}
void set(T_MultiArgs const& multiArgs)
{
for (auto const& it : multiArgs)
{
auto const& key = it.first;
auto const& obj = it.second;
set(key, obj);
}
}
bool remove(std::string key)
{
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it != dataIndexMap.end())
{
std::size_t index = it->second;
data.erase(data.begin() + index);
dataIndexMap.erase(it);
for (auto& it2 : dataIndexMap)
{
auto& vi = it2.second;
if (vi > index)
{
vi--;
}
}
return true;
}
return false;
}
void clear()
{
data.clear();
dataIndexMap.clear();
}
std::size_t size() const
{
return data.size();
}
const_iterator begin() const { return data.begin(); }
const_iterator end() const { return data.end(); }
};
using INIStructure = INIMap<INIMap<std::string>>;
namespace INIParser
{
using T_ParseValues = std::pair<std::string, std::string>;
enum class PDataType : char
{
PDATA_NONE,
PDATA_COMMENT,
PDATA_SECTION,
PDATA_KEYVALUE,
PDATA_UNKNOWN
};
inline PDataType parseLine(std::string line, T_ParseValues& parseData)
{
parseData.first.clear();
parseData.second.clear();
INIStringUtil::trim(line);
if (line.empty())
{
return PDataType::PDATA_NONE;
}
char firstCharacter = line[0];
if (firstCharacter == ';')
{
return PDataType::PDATA_COMMENT;
}
if (firstCharacter == '[')
{
auto commentAt = line.find_first_of(';');
if (commentAt != std::string::npos)
{
line = line.substr(0, commentAt);
}
auto closingBracketAt = line.find_last_of(']');
if (closingBracketAt != std::string::npos)
{
auto section = line.substr(1, closingBracketAt - 1);
INIStringUtil::trim(section);
parseData.first = section;
return PDataType::PDATA_SECTION;
}
}
auto lineNorm = line;
INIStringUtil::replace(lineNorm, "\\=", " ");
auto equalsAt = lineNorm.find_first_of('=');
if (equalsAt != std::string::npos)
{
auto key = line.substr(0, equalsAt);
INIStringUtil::trim(key);
INIStringUtil::replace(key, "\\=", "=");
auto value = line.substr(equalsAt + 1);
INIStringUtil::trim(value);
parseData.first = key;
parseData.second = value;
return PDataType::PDATA_KEYVALUE;
}
return PDataType::PDATA_UNKNOWN;
}
};
class INIReader
{
public:
using T_LineData = std::vector<std::string>;
using T_LineDataPtr = std::shared_ptr<T_LineData>;
private:
std::ifstream fileReadStream;
T_LineDataPtr lineData;
T_LineData readFile()
{
std::string fileContents;
fileReadStream.seekg(0, std::ios::end);
fileContents.resize(fileReadStream.tellg());
fileReadStream.seekg(0, std::ios::beg);
std::size_t fileSize = fileContents.size();
fileReadStream.read(&fileContents[0], fileSize);
fileReadStream.close();
T_LineData output;
if (fileSize == 0)
{
return output;
}
std::string buffer;
buffer.reserve(50);
for (std::size_t i = 0; i < fileSize; ++i)
{
char& c = fileContents[i];
if (c == '\n')
{
output.emplace_back(buffer);
buffer.clear();
continue;
}
if (c != '\0' && c != '\r')
{
buffer += c;
}
}
output.emplace_back(buffer);
return output;
}
public:
INIReader(std::string const& filename, bool keepLineData = false)
{
fileReadStream.open(filename, std::ios::in | std::ios::binary);
if (keepLineData)
{
lineData = std::make_shared<T_LineData>();
}
}
~INIReader() { }
bool operator>>(INIStructure& data)
{
if (!fileReadStream.is_open())
{
return false;
}
T_LineData fileLines = readFile();
std::string section;
bool inSection = false;
INIParser::T_ParseValues parseData;
for (auto const& line : fileLines)
{
auto parseResult = INIParser::parseLine(line, parseData);
if (parseResult == INIParser::PDataType::PDATA_SECTION)
{
inSection = true;
data[section = parseData.first];
}
else if (inSection && parseResult == INIParser::PDataType::PDATA_KEYVALUE)
{
auto const& key = parseData.first;
auto const& value = parseData.second;
data[section][key] = value;
}
if (lineData && parseResult != INIParser::PDataType::PDATA_UNKNOWN)
{
if (parseResult == INIParser::PDataType::PDATA_KEYVALUE && !inSection)
{
continue;
}
lineData->emplace_back(line);
}
}
return true;
}
T_LineDataPtr getLines()
{
return lineData;
}
};
class INIGenerator
{
private:
std::ofstream fileWriteStream;
public:
bool prettyPrint = false;
INIGenerator(std::string const& filename)
{
fileWriteStream.open(filename, std::ios::out | std::ios::binary);
}
~INIGenerator() { }
bool operator<<(INIStructure const& data)
{
if (!fileWriteStream.is_open())
{
return false;
}
if (!data.size())
{
return true;
}
auto it = data.begin();
for (;;)
{
auto const& section = it->first;
auto const& collection = it->second;
fileWriteStream
<< "["
<< section
<< "]";
if (collection.size())
{
fileWriteStream << INIStringUtil::endl;
auto it2 = collection.begin();
for (;;)
{
auto key = it2->first;
INIStringUtil::replace(key, "=", "\\=");
auto value = it2->second;
INIStringUtil::trim(value);
fileWriteStream
<< key
<< ((prettyPrint) ? " = " : "=")
<< value;
if (++it2 == collection.end())
{
break;
}
fileWriteStream << INIStringUtil::endl;
}
}
if (++it == data.end())
{
break;
}
fileWriteStream << INIStringUtil::endl;
if (prettyPrint)
{
fileWriteStream << INIStringUtil::endl;
}
}
return true;
}
};
class INIWriter
{
private:
using T_LineData = std::vector<std::string>;
using T_LineDataPtr = std::shared_ptr<T_LineData>;
std::string filename;
T_LineData getLazyOutput(T_LineDataPtr const& lineData, INIStructure& data, INIStructure& original)
{
T_LineData output;
INIParser::T_ParseValues parseData;
std::string sectionCurrent;
bool parsingSection = false;
bool continueToNextSection = false;
bool discardNextEmpty = false;
bool writeNewKeys = false;
std::size_t lastKeyLine = 0;
for (auto line = lineData->begin(); line != lineData->end(); ++line)
{
if (!writeNewKeys)
{
auto parseResult = INIParser::parseLine(*line, parseData);
if (parseResult == INIParser::PDataType::PDATA_SECTION)
{
if (parsingSection)
{
writeNewKeys = true;
parsingSection = false;
--line;
continue;
}
sectionCurrent = parseData.first;
if (data.has(sectionCurrent))
{
parsingSection = true;
continueToNextSection = false;
discardNextEmpty = false;
output.emplace_back(*line);
lastKeyLine = output.size();
}
else
{
continueToNextSection = true;
discardNextEmpty = true;
continue;
}
}
else if (parseResult == INIParser::PDataType::PDATA_KEYVALUE)
{
if (continueToNextSection)
{
continue;
}
if (data.has(sectionCurrent))
{
auto& collection = data[sectionCurrent];
auto const& key = parseData.first;
auto const& value = parseData.second;
if (collection.has(key))
{
auto outputValue = collection[key];
if (value == outputValue)
{
output.emplace_back(*line);
}
else
{
INIStringUtil::trim(outputValue);
auto lineNorm = *line;
INIStringUtil::replace(lineNorm, "\\=", " ");
auto equalsAt = lineNorm.find_first_of('=');
auto valueAt = lineNorm.find_first_not_of(
INIStringUtil::whitespaceDelimiters,
equalsAt + 1
);
std::string outputLine = line->substr(0, valueAt);
if (prettyPrint && equalsAt + 1 == valueAt)
{
outputLine += " ";
}
outputLine += outputValue;
output.emplace_back(outputLine);
}
lastKeyLine = output.size();
}
}
}
else
{
if (discardNextEmpty && line->empty())
{
discardNextEmpty = false;
}
else if (parseResult != INIParser::PDataType::PDATA_UNKNOWN)
{
output.emplace_back(*line);
}
}
}
if (writeNewKeys || std::next(line) == lineData->end())
{
T_LineData linesToAdd;
if (data.has(sectionCurrent) && original.has(sectionCurrent))
{
auto const& collection = data[sectionCurrent];
auto const& collectionOriginal = original[sectionCurrent];
for (auto const& it : collection)
{
auto key = it.first;
if (collectionOriginal.has(key))
{
continue;
}
auto value = it.second;
INIStringUtil::replace(key, "=", "\\=");
INIStringUtil::trim(value);
linesToAdd.emplace_back(
key + ((prettyPrint) ? " = " : "=") + value
);
}
}
if (!linesToAdd.empty())
{
output.insert(
output.begin() + lastKeyLine,
linesToAdd.begin(),
linesToAdd.end()
);
}
if (writeNewKeys)
{
writeNewKeys = false;
--line;
}
}
}
for (auto const& it : data)
{
auto const& section = it.first;
if (original.has(section))
{
continue;
}
if (prettyPrint && output.size() > 0 && !output.back().empty())
{
output.emplace_back();
}
output.emplace_back("[" + section + "]");
auto const& collection = it.second;
for (auto const& it2 : collection)
{
auto key = it2.first;
auto value = it2.second;
INIStringUtil::replace(key, "=", "\\=");
INIStringUtil::trim(value);
output.emplace_back(
key + ((prettyPrint) ? " = " : "=") + value
);
}
}
return output;
}
public:
bool prettyPrint = false;
INIWriter(std::string const& filename)
: filename(filename)
{
}
~INIWriter() { }
bool operator<<(INIStructure& data)
{
struct stat buf;
bool fileExists = (stat(filename.c_str(), &buf) == 0);
if (!fileExists)
{
INIGenerator generator(filename);
generator.prettyPrint = prettyPrint;
return generator << data;
}
INIStructure originalData;
T_LineDataPtr lineData;
bool readSuccess = false;
{
INIReader reader(filename, true);
if ((readSuccess = reader >> originalData))
{
lineData = reader.getLines();
}
}
if (!readSuccess)
{
return false;
}
T_LineData output = getLazyOutput(lineData, data, originalData);
std::ofstream fileWriteStream(filename, std::ios::out | std::ios::binary);
if (fileWriteStream.is_open())
{
if (output.size())
{
auto line = output.begin();
for (;;)
{
fileWriteStream << *line;
if (++line == output.end())
{
break;
}
fileWriteStream << INIStringUtil::endl;
}
}
return true;
}
return false;
}
};
class INIFile
{
private:
std::string filename;
public:
INIFile(std::string const& filename)
: filename(filename)
{ }
~INIFile() { }
bool read(INIStructure& data) const
{
if (data.size())
{
data.clear();
}
if (filename.empty())
{
return false;
}
INIReader reader(filename);
return reader >> data;
}
bool generate(INIStructure const& data, bool pretty = false) const
{
if (filename.empty())
{
return false;
}
INIGenerator generator(filename);
generator.prettyPrint = pretty;
return generator << data;
}
bool write(INIStructure& data, bool pretty = false) const
{
if (filename.empty())
{
return false;
}
INIWriter writer(filename);
writer.prettyPrint = pretty;
return writer << data;
}
};
}
#endif

98
internal/lang.cpp Normal file
View File

@ -0,0 +1,98 @@
#include "lang.hpp"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <3ds.h>
static nlohmann::json appJson;
std::string RenderD7::Lang::getSys()
{
u8 language = 1;
CFGU_GetSystemLanguage(&language);
switch(language) {
case 0:
return "jp"; // Japanese
break;
case 1:
return "en"; // English
break;
case 2:
return "fr"; // French
break;
case 3:
return "de"; // German
break;
case 4:
return "it"; // Italian
break;
case 5:
return "es"; // Spanish
break;
case 6:
return "zh-CN"; // Chinese (Simplified)
break;
// case 7:
// return "ko"; // Korean
// break;
// case 8:
// return "nl"; // Dutch
// break;
case 9:
return "pt"; // Portuguese
break;
case 10:
return "ru"; // Russian
break;
case 11:
return "zh-TW"; // Chinese (Traditional)
break;
default:
return "en"; // Fall back to English if missing
break;
}
}
std::string RenderD7::Lang::get(const std::string &key) {
if (!appJson.contains(key)) return key;
return appJson.at(key).get_ref<const std::string&>();
}
void RenderD7::Lang::load(const std::string &lang) {
FILE *values;
if (access(("romfs:/lang/" + lang + "/app.json").c_str(), F_OK) == 0) {
values = fopen(("romfs:/lang/" + lang + "/app.json").c_str(), "rt");
if (values) {
appJson = nlohmann::json::parse(values, nullptr, false);
fclose(values);
}
if (appJson.is_discarded())
appJson = { };
return;
} else {
values = fopen("romfs:/lang/en/app.json", "rt");
if (values) {
appJson = nlohmann::json::parse(values, nullptr, false);
fclose(values);
}
if (appJson.is_discarded())
appJson = { };
return;
}
}

16
internal/lang.hpp Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <string>
#include "json.hpp"
/// RenderD7::Lang
namespace RenderD7::Lang
{
/// Get the 3ds System Language
std::string getSys();
/// Get a translated string
/// key: The Key so the code can find your string
std::string get(const std::string &key);
/// Load the lang file from dir structure en/app.json for sample
/// lang: the folder name en, fr, de ... . I prefer geSys()
void load(const std::string &lang);
} /// RenderD7::Lang

112
internal/parameter.hpp Normal file
View File

@ -0,0 +1,112 @@
#pragma once
#include <tuple>
namespace RenderD7{
class Parameter
{
private:
using id = size_t;
template<typename T>
struct type { static void id() { } };
template<typename T>
static id type_id() { return reinterpret_cast<id>(&type<T>::id); }
template<typename T>
using decay = typename std::decay<T>::type;
template<typename T>
using none = typename std::enable_if<!std::is_same<Parameter, T>::value>::type;
struct base
{
virtual ~base() { }
virtual bool is(id) const = 0;
virtual base *copy() const = 0;
} *p = nullptr;
template<typename T>
struct data : base, std::tuple<T>
{
using std::tuple<T>::tuple;
T &get() & { return std::get<0>(*this); }
T const &get() const& { return std::get<0>(*this); }
bool is(id i) const override { return i == type_id<T>(); }
base *copy() const override { return new data{get()}; }
};
template<typename T>
T &stat() { return static_cast<data<T>&>(*p).get(); }
template<typename T>
T const &stat() const { return static_cast<data<T> const&>(*p).get(); }
template<typename T>
T &dyn() { return dynamic_cast<data<T>&>(*p).get(); }
template<typename T>
T const &dyn() const { return dynamic_cast<data<T> const&>(*p).get(); }
public:
/**
* @brief Default constructor
*/
Parameter() { }
/**
* @brief Destructs the Parameter
*/
~Parameter() { delete p; }
/**
* @brief Copy constructor
* @param s The Parameter to copy
*/
Parameter(Parameter &&s) : p{s.p} { s.p = nullptr; }
/**
* @brief Const copy constructor
* @param s The Parameter to copy
*/
Parameter(Parameter const &s) : p{s.p->copy()} { }
/**
* @brief Initializes the Parameter with the given value
* @param x The value to initialize the Parameter with
*/
template<typename T, typename U = decay<T>, typename = none<U>>
Parameter(T &&x) : p{new data<U>{std::forward<T>(x)}} { }
/**
* @brief Overloads the assignment operator
* @param s The value to set the Parameter to
*/
Parameter &operator=(Parameter s) { swap(*this, s); return *this; }
friend void swap(Parameter &s, Parameter &r) { std::swap(s.p, r.p); }
/**
* @brief Clears the Parameter
*/
void clear() { delete p; p = nullptr; }
/**
* @brief Checks whether the Parameter is the given type
* @tparam T The type to check
* @return Whether the Parameter has the given type or not
*/
template<typename T>
bool is() const { return p ? p->is(type_id<T>()) : false; }
/**
* @brief Returns the value of the Parameter
* @tparam T The type of the Parameter
* @return The value of the Parameter
* @warning If the type of the Parameter doesn't match the type of it's stored value, it will result in undefined behaviour.
*/
template<typename T> T &get() & { return stat<T>(); }
};
}

11
internal/stringtool.hpp Normal file
View File

@ -0,0 +1,11 @@
template<class T>
T GetFileName(T const & path, T const & delims = "/\\")
{
return path.substr(path.find_last_of(delims) + 1);
}
template<class T>
T remove_ext(T const & filename)
{
typename T::size_type const p(filename.find_last_of('.'));
return p > 0 && p != T::npos ? filename.substr(0, p) : filename;
}

81
internal/thread.cpp Normal file
View File

@ -0,0 +1,81 @@
#include "thread.hpp"
namespace RenderD7 {
void Threads::Exit()
{
}
Thread::Thread() :
m_started(false),
m_running(false) { /* do nothing */ }
Thread::Thread(std::function<void(RenderD7::Parameter)> t_function, RenderD7::Parameter t_parameter, bool t_autostart, bool t_detached, unsigned long long int t_stackSize) :
m_started(false),
m_running(false) {
initialize(t_function, t_parameter, t_autostart, t_detached, t_stackSize);
}
Thread::~Thread() {
join();
if (m_started) threadFree(m_thread);
}
void Thread::initialize(std::function<void(RenderD7::Parameter)> t_function, RenderD7::Parameter t_parameter, bool t_autostart, bool t_detached, unsigned long long int t_stackSize) {
m_stackSize = t_stackSize;
m_data.m_parameter = t_parameter;
m_data.m_function = t_function;
m_data.m_running = &m_running;
if (t_autostart) {
start(t_detached);
}
}
void Thread::setStackSize(unsigned long long int t_stackSize) {
m_stackSize = t_stackSize;
}
void Thread::start(bool t_detached) {
if (!m_running) {
m_started = true;
m_running = true;
s32 prio;
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
m_thread = threadCreate(threadFunction, &m_data, m_stackSize, prio + 1, -2, t_detached);
}
}
void Thread::kill() {
threadDetach(m_thread);
m_running = false;
m_started = false;
}
void Thread::join(long long unsigned int t_timeout) {
if (m_running) {
threadJoin(m_thread, t_timeout);
threadFree(m_thread);
m_running = false;
m_started = false;
}
}
bool Thread::isRunning() {
return m_running;
}
void Thread::sleep() {
svcSleepThread(0);
}
void Thread::sleep(int t_milliseconds) {
svcSleepThread(1000000 * t_milliseconds);
}
// private methods
void Thread::threadFunction(void* arg) {
RenderD7::Thread::ThreadData data = *static_cast<RenderD7::Thread::ThreadData*>(arg);
data.m_function(data.m_parameter);
*data.m_running = false;
}
}

119
internal/thread.hpp Normal file
View File

@ -0,0 +1,119 @@
#pragma once
#include <3ds.h>
#include <atomic>
#include <functional>
#include <string>
#include "parameter.hpp"
using CTRU_Thread = Thread;
#define THREAD_STACK_SIZE 0x1000
namespace RenderD7 {
namespace Threads
{
inline bool threadrunning = false;
struct Thread
{
Handle handle;
void (*ep)(void);
bool finished;
void* stacktop;
};
bool Create();
bool Join();
void Exit();
}
class Thread {
public:
/**
* @brief Default constructor
* @note This should only be called when calling m3d::Thread::initialize() before calling m3d::Thread::start()
*/
Thread();
/**
* @brief Constructs the thread
* @param t_function The thread function
* @param t_parameter The parameter to pass to the function
* @param t_autostart Whether the thread should start instantly
* @param t_detached Whether the thread starts detached or not
* @param t_stackSize The stacksize allocated for the thread in bytes (rounded to multiples of 8 bytes)
* @note t_function needs to be of type `void` and take one (and only one) parameter of type m3d::Parameter
* @warning If the thread priority is lower than the priority of the calling thread, the thread will never get executed. Use m3d::Thread::getCurrentPriority() to get the priority of the current thread
*/
Thread(std::function<void(RenderD7::Parameter)> t_function, RenderD7::Parameter t_parameter = nullptr, bool t_autostart = false, bool t_detached = false, unsigned long long int t_stackSize = 4 * 1024);
/**
* @brief Destructs the thread
*/
virtual ~Thread();
/**
* @brief Initializes the thread
* @param t_function The thread function
* @param t_parameter The parameter to pass to the function
* @param t_autostart Whether the thread should start instantly
* @param t_detached Whether the thread starts detached or not
* @param t_stackSize The stacksize allocated for the thread in bytes (rounded to multiples of 8 bytes)
* @note t_function needs to be of type `void` and take one (and only one) parameter of type m3d::Parameter
* @warning If the thread priority is lower than the priority of the calling thread, the thread will never get executed. Use m3d::Thread::getCurrentPriority() to get the priority of the current thread
*/
void initialize(std::function<void(RenderD7::Parameter)> t_function, RenderD7::Parameter t_parameter = nullptr, bool t_autostart = false, bool t_detached = false, unsigned long long int t_stackSize = 4 * 1024);
/**
* @brief Sets the size of the stack that gets allocated for the next thread that get's started
* @param t_stackSize The allocated space in bytes (rounded to multiples of 8 bytes)
*/
void setStackSize(unsigned long long int t_stackSize);
/**
* @brief Starts the thread. To restart it, call Thread::join() before
* @param t_detached Whether the thread should start detached or not
*/
void start(bool t_detached = false);
/**
* @brief Detaches the thread
*/
void kill();
/**
* @brief Waits for the thread to finish
* @param t_timeout The timeout in nanoseconds. Leave it for no timeout
*/
void join(long long unsigned int t_timeout = U64_MAX);
bool isRunning();
/**
* @brief Puts the thread to sleep
*
* This is needed if you have multiple threads running at the same time. It doesn't affect the execution-time of the thread, it just makes it possible for the other threads to get their chance to shine.
*/
static void sleep();
/**
* @brief Sleeps for the given time
* @param t_milliseconds The time to sleep in milliseconds
*/
static void sleep(int t_milliseconds);
private:
struct ThreadData {
RenderD7::Parameter m_parameter;
std::function<void(RenderD7::Parameter)> m_function;
std::atomic<bool>* m_running;
};
static void threadFunction(void* t_arg);
/* data */
int m_priority, m_stackSize;
bool m_started;
std::atomic<bool> m_running;
RenderD7::Thread::ThreadData m_data;
CTRU_Thread m_thread;
};
}

17
internal/tween.hpp Normal file
View File

@ -0,0 +1,17 @@
#include "Clock.hpp"
namespace rnd7{
enum class TweenType : int {Position = 1, Color, Alpha};
enum class TweenLoop : int {None = 1, Loop = 2,};
enum class TweenDirection : int {Current, Forward, Backward};
enum class TweenState : int {Playing = 1, Stopped};
class Tween
{
public:
Tween(float from, float to, float duration, TweenLoop loop, TweenState state);
};
}

View File

@ -30,14 +30,15 @@ Log::Log()
void Log::Init(const char *filename) void Log::Init(const char *filename)
{ {
this->filename = filename; std::string name = "logs/Log_" + Log::logDate() + filename + ".txt";
if ((access(filename, F_OK) == 0)) this->filename = name.c_str();
if ((access(name.c_str(), F_OK) == 0))
{ {
} }
else else
{ {
FILE* logfile = fopen((filename), "w"); FILE* logfile = fopen((name.c_str()), "w");
fclose(logfile); fclose(logfile);
} }
} }
@ -56,4 +57,4 @@ void Log::Write(std::string debug_text)
Log::~Log() Log::~Log()
{ {
} }

15
log.hpp
View File

@ -1,19 +1,30 @@
#pragma once
#include <fstream> #include <fstream>
#include <stdarg.h> #include <stdarg.h>
#include <string> #include <string>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
/** Log Class */
class Log class Log
{ {
public: public:
/** Construct */
Log(); Log();
/** Deconstruct */
~Log(); ~Log();
/// Init the log file
/// \param filename name for the file
void Init(const char *filename); void Init(const char *filename);
/// Write Text to logfile
/// \param debug_text your text
void Write(std::string debug_text); void Write(std::string debug_text);
/// Get the date
std::string logDate(void); std::string logDate(void);
/// Format to logstyle
/// \param fmt_str the formatted style
std::string format(const std::string& fmt_str, ...); std::string format(const std::string& fmt_str, ...);
private: private:
/// param filename the name of the logfile
std::string filename; std::string filename;
}; };

View File

@ -4,11 +4,24 @@
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 0) | (((g) & 0xFF) << 8) | (((b) & 0xFF) << 16) | (((a) & 0xFF) << 24)) #define RGBA8(r, g, b, a) ((((r) & 0xFF) << 0) | (((g) & 0xFF) << 8) | (((b) & 0xFF) << 16) | (((a) & 0xFF) << 24))
#define D7_NOTHING C2D_Color32(0, 0, 0, 0) #define D7_NOTHING C2D_Color32(0, 0, 0, 0)
#define CFGVER "0"
Log renderd7log; Log renderd7log;
float animtime; float animtime;
bool isndspinit = false; bool isndspinit = false;
bool running = true; bool running = true;
std::stack<std::unique_ptr<RenderD7::Scene>> RenderD7::Scene::scenes; std::stack<std::unique_ptr<RenderD7::Scene>> RenderD7::Scene::scenes;
//std::vector<RenderD7::Ovl> overlays;
bool usedbgmsg = false;
std::string dspststus = "Not Initialisized!";
int cobj___;
int maxobj__;
//INI::INIFile cfgfile;
std::unique_ptr<INI::INIFile> cfgfile = nullptr;
INI::INIStructure cfgstruct;
std::string D_app_name;
u32 d7_hDown; u32 d7_hDown;
u32 d7_hHeld; u32 d7_hHeld;
@ -25,6 +38,16 @@ static u64 last_time = 0;
float d11framerate = 0; float d11framerate = 0;
//----------------- //-----------------
//Metrik-------------------------------------
u32 mt_color;
u32 mt_txtcolor;
int mt_screen;
//int mt_width = mt_screen ? 320 : 400;
float mt_txtSize;
bool metrikd = false;
double mt_fpsgraph[320];
//-------------------------------------------
bool currentScreen = false; bool currentScreen = false;
C3D_RenderTarget* Top; C3D_RenderTarget* Top;
@ -39,7 +62,7 @@ RenderD7::SpriteSheetAnimation::SpriteSheetAnimation()
} }
RenderD7::SpriteSheetAnimation::~SpriteSheetAnimation() RenderD7::SpriteSheetAnimation::~SpriteSheetAnimation()
{ {
//
} }
bool RenderD7::DrawImageFromSheet(RenderD7::Sheet* sheet, size_t index, float x, float y, float scaleX, float scaleY) bool RenderD7::DrawImageFromSheet(RenderD7::Sheet* sheet, size_t index, float x, float y, float scaleX, float scaleY)
{ {
@ -60,9 +83,11 @@ void RenderD7::Init::NdspFirm(bool useit)
{ {
ndspInit(); ndspInit();
isndspinit = true; isndspinit = true;
dspststus = "Initialisized success!";
} }
else else
{ {
dspststus = "Not found: dspfirm.cdc";
renderd7log.Write("RenderD7: SoundEngine Error! ndspfirm not found!"); renderd7log.Write("RenderD7: SoundEngine Error! ndspfirm not found!");
} }
} }
@ -74,7 +99,7 @@ void RenderD7::Exit::NdspFirm()
ndspExit(); ndspExit();
} }
} }
void RenderD7::Msg::Display(std::string titletxt, std::string txt, C3D_RenderTarget *target) void RenderD7::Msg::Display(std::string titletxt, std::string subtext, C3D_RenderTarget *target)
{ {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, DSEVENBLACK); C2D_TargetClear(Top, DSEVENBLACK);
@ -87,17 +112,37 @@ void RenderD7::Msg::Display(std::string titletxt, std::string txt, C3D_RenderTar
RenderD7::OnScreen(target); RenderD7::OnScreen(target);
RenderD7::DrawRect(0, 0, 400, 26, RenderD7::Color::Hex("#333333", 200)); RenderD7::DrawRect(0, 0, 400, 26, RenderD7::Color::Hex("#333333", 200));
RenderD7::DrawText(5, 2, 0.7f, DSEVENWHITE, titletxt); RenderD7::DrawText(5, 2, 0.7f, DSEVENWHITE, titletxt);
RenderD7::DrawText(5, 30, 0.6f, DSEVENWHITE, txt); RenderD7::DrawText(5, 30, 0.6f, DSEVENWHITE, subtext);
C3D_FrameEnd(0); C3D_FrameEnd(0);
} }
void RenderD7::Msg::DisplayWithProgress(std::string titletext, std::string subtext, float current, float total, u32 prgbarcolor)
{
RenderD7::ClearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, DSEVENBLACK);
C2D_TargetClear(Bottom, DSEVENBLACK);
char str[256];
snprintf(str, sizeof(str), "(%.2f%%)", ((float)current/(float)total) * 100.0f);
RenderD7::OnScreen(Top);
RenderD7::DrawRect(0, 0, 400, 240, RenderD7::Color::Hex("#111111"));
RenderD7::DrawRect(0, 0, 400, 26, RenderD7::Color::Hex("#333333", 200));
RenderD7::DrawText(5, 2, 0.7f, DSEVENWHITE, titletext);
RenderD7::DrawText(5, 30, 0.6f, DSEVENWHITE, subtext);
RenderD7::DrawRect(30, 120, 342, 30, RenderD7::Color::Hex("#333333"));
RenderD7::DrawRect(31, 121, (int)(((float)current / (float)total) * 338.0f), 28, prgbarcolor);
RenderD7::DrawTextCentered(5, 124, 0.7f, RenderD7::Color::Hex("#111111"), str, 390);
RenderD7::OnScreen(Bottom);
RenderD7::DrawRect(0, 0, 320, 240, RenderD7::Color::Hex("#111111"));
C3D_FrameEnd(0);
}
void RenderD7::SetupLog() void RenderD7::SetupLog()
{ {
renderd7log.Init("sdmc:/Flappy-Bird-RenderD7.log"); renderd7log.Init("sdmc:/RenderD7.log");
} }
void RenderD7::SpriteSheetAnimation::Setup(RenderD7::Sheet *sheet, size_t imagecount, size_t startimage, float frame_begin, float frame_finish) void RenderD7::SpriteSheetAnimation::Setup(RenderD7::Sheet *sheet, size_t imagecount, size_t startimage, float frame_begin, float frame_finish)
{ {
D_totaltime = frame_begin; D_totaltime = frame_begin;
renderd7log.Write("frame_begin success"); renderd7log.Write("frame_begin success");
this->images = imagecount; this->images = imagecount;
@ -122,23 +167,44 @@ void RenderD7::SpriteSheetAnimation::Play(float timespeed)
} }
RenderD7::SpriteSheetAnimation::FromSheet(sheet, imgs); RenderD7::SpriteSheetAnimation::FromSheet(sheet, imgs);
//RenderD7::SpriteSheetAnimation::Draw(); //RenderD7::SpriteSheetAnimation::Draw();
} }
void RenderD7::Error::DisplayError(std::string toptext, std::string errortext) void RenderD7::Error::DisplayError(std::string toptext, std::string errortext, int timesec)
{ {
RenderD7::ClearTextBufs(); RenderD7::ClearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, DSEVENBLACK); C2D_TargetClear(Top, DSEVENBLACK);
C2D_TargetClear(Bottom, DSEVENBLACK); C2D_TargetClear(Bottom, DSEVENBLACK);
RenderD7::DrawTextCentered(0, 0, 0.7f, DSEVENWHITE, toptext, 400); RenderD7::OnScreen(Top);
RenderD7::DrawTextCentered(0, 100, 0.6f, DSEVENWHITE, errortext, 400); RenderD7::DrawText(0, 0, 0.7f, DSEVENWHITE, toptext);
RenderD7::DrawText(0, 30, 0.6f, DSEVENWHITE, errortext);
C3D_FrameEnd(0); C3D_FrameEnd(0);
for (int i = 0; i < 60*20; i++) { int time = 60*timesec;
for (int i = 0; i < 60*timesec; i++) {
RenderD7::DrawRect(0, 236, (int)(((float)i / (float)60*timesec) * 400.0f), 4, RenderD7::Color::Hex("#00ff00"));
gspWaitForVBlank(); gspWaitForVBlank();
} }
} }
void RenderD7::Error::DisplayFatalError(std::string toptext, std::string errortext)
{
bool error___ = true;
RenderD7::ClearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, DSEVENBLACK);
C2D_TargetClear(Bottom, DSEVENBLACK);
RenderD7::OnScreen(Top);
RenderD7::DrawTextCentered(0, 0, 0.7f, DSEVENWHITE, toptext, 400);
RenderD7::DrawTextCentered(0, 100, 0.6f, DSEVENWHITE, errortext, 400);
RenderD7::DrawTextCentered(0, 200, 0.6f, DSEVENWHITE, "Press Start to Exit!", 400);
C3D_FrameEnd(0);
while (error___)
{
if(d7_hDown & KEY_START)
{
RenderD7::ExitApp();
}
}
}
u32 RenderD7::Color::Hex(const std::string color, u8 a) u32 RenderD7::Color::Hex(const std::string color, u8 a)
{ {
if (color.length() < 7 || std::regex_search(color.substr(1), std::regex("[^0-9A-Fa-f]"))) { // invalid color. if (color.length() < 7 || std::regex_search(color.substr(1), std::regex("[^0-9A-Fa-f]"))) { // invalid color.
@ -175,6 +241,28 @@ void RenderD7::OnScreen(C3D_RenderTarget *target)
C2D_SceneBegin(target); C2D_SceneBegin(target);
} }
void frameloop()
{
frames++;
u64 delta_time = osGetTime() - last_time;
if (delta_time >= 1000) {
current_fps = frames/(delta_time/1000.0f)+1;
frames = 0;
last_time = osGetTime();
}
d11framerate = current_fps;
mt_fpsgraph[320] = current_fps;
}
float getframerate()
{
return d11framerate;
}
std::string RenderD7::GetFramerate()
{
return (std::to_string((int)d11framerate).substr(0, 2));
}
bool RenderD7::MainLoop() bool RenderD7::MainLoop()
{ {
if (!aptMainLoop()) return false; if (!aptMainLoop()) return false;
@ -186,20 +274,25 @@ bool RenderD7::MainLoop()
RenderD7::ClearTextBufs(); RenderD7::ClearTextBufs();
C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, C2D_Color32(0, 0, 0, 0)); C2D_TargetClear(Top, C2D_Color32(0, 0, 0, 0));
C2D_TargetClear(Bottom, C2D_Color32(0, 0, 0, 0)); C2D_TargetClear(Bottom, C2D_Color32(0, 0, 0, 0));
frameloop();
RenderD7::Scene::doDraw();
RenderD7::Scene::doLogic(d7_hDown, d7_hHeld, d7_hUp, d7_touch);
//if (metrikd)RenderD7::DrawMetrikOvl();
return running; return running;
} }
RenderD7::Sheet::Sheet() RenderD7::Sheet::Sheet()
{ {
//
} }
RenderD7::Sheet::~Sheet() RenderD7::Sheet::~Sheet()
{ {
//
} }
Result RenderD7::Sheet::Load(const char *path) Result RenderD7::Sheet::Load(const char *path)
@ -215,11 +308,11 @@ void RenderD7::Sheet::Free()
RenderD7::Sprite::Sprite() RenderD7::Sprite::Sprite()
{ {
//
} }
RenderD7::Sprite::~Sprite() RenderD7::Sprite::~Sprite()
{ {
//
} }
void RenderD7::Sprite::FromSheet(RenderD7::Sheet *sheet, size_t index) void RenderD7::Sprite::FromSheet(RenderD7::Sheet *sheet, size_t index)
{ {
@ -262,33 +355,31 @@ float RenderD7::Sprite::getPosY()
return this->sprite.params.pos.y; return this->sprite.params.pos.y;
} }
void RenderD7::Sprite::FromImage(RenderD7::Image *img)
{
C2D_SpriteFromImage(&this->sprite, img->img);
}
void RenderD7::Sprite::SetScale(float x, float y)
{
C2D_SpriteScale(&this->sprite, x, y);
}
void RenderD7::ClearTextBufs(void) void RenderD7::ClearTextBufs(void)
{ {
C2D_TextBufClear(TextBuf); C2D_TextBufClear(TextBuf);
} }
void frameloop()
{
frames++;
u64 delta_time = osGetTime() - last_time;
if (delta_time >= 1000) {
current_fps = frames/(delta_time/1000.0f)+1;
frames = 0;
last_time = osGetTime();
}
d11framerate = current_fps;
}
float getframerate()
{
frameloop();
return d11framerate;
}
bool RenderD7::DrawRect(float x, float y, float w, float h, u32 color) bool RenderD7::DrawRect(float x, float y, float w, float h, u32 color)
{ {
return C2D_DrawRectSolid(x, y, 0.5f, w, h, color); return C2D_DrawRectSolid(x, y, 0.5f, w, h, color);
} }
bool RenderD7::DrawPx(float x, float y, u32 color)
{
return C2D_DrawRectSolid(x, y, 0.5f, 1, 1, color);
}
void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt) { void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt) {
float lineHeight, widthScale; float lineHeight, widthScale;
@ -308,7 +399,6 @@ void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::st
} else { } else {
widthScale = RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n'))); widthScale = RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n')));
} }
} else { } else {
// Do the widthScale 2. // Do the widthScale 2.
if (fnt != nullptr) { if (fnt != nullptr) {
@ -316,9 +406,7 @@ void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::st
} else { } else {
widthScale = std::min((float)maxWidth, RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n')))); widthScale = std::min((float)maxWidth, RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n'))));
} }
} }
if (fnt != nullptr) { if (fnt != nullptr) {
RenderD7::DrawText((currentScreen ? 200 : 160)+x-(widthScale/2), y+(lineHeight*line), size, color, Text.substr(0, Text.find('\n')), maxWidth, maxHeight, fnt); RenderD7::DrawText((currentScreen ? 200 : 160)+x-(widthScale/2), y+(lineHeight*line), size, color, Text.substr(0, Text.find('\n')), maxWidth, maxHeight, fnt);
} else { } else {
@ -336,7 +424,6 @@ void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::st
} else { } else {
widthScale = RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n'))); widthScale = RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n')));
} }
} else { } else {
// And again. // And again.
if (fnt != nullptr) { if (fnt != nullptr) {
@ -344,7 +431,6 @@ void RenderD7::DrawTextCentered(float x, float y, float size, u32 color, std::st
} else { } else {
widthScale = std::min((float)maxWidth, RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n')))); widthScale = std::min((float)maxWidth, RenderD7::GetTextWidth(size, Text.substr(0, Text.find('\n'))));
} }
} }
if (fnt != nullptr) { if (fnt != nullptr) {
RenderD7::DrawText((currentScreen ? 200 : 160)+x-(widthScale/2), y+(lineHeight*line), size, color, Text.substr(0, Text.find('\n')), maxWidth, maxHeight, fnt); RenderD7::DrawText((currentScreen ? 200 : 160)+x-(widthScale/2), y+(lineHeight*line), size, color, Text.substr(0, Text.find('\n')), maxWidth, maxHeight, fnt);
@ -369,7 +455,6 @@ void RenderD7::DrawText(float x, float y, float size, u32 color, std::string Tex
if (maxHeight == 0) { if (maxHeight == 0) {
heightScale = size; heightScale = size;
} else { } else {
if (fnt != nullptr) { if (fnt != nullptr) {
heightScale = std::min(size, size*(maxHeight/RenderD7::GetTextHeight(size, Text, fnt))); heightScale = std::min(size, size*(maxHeight/RenderD7::GetTextHeight(size, Text, fnt)));
} else { } else {
@ -387,7 +472,10 @@ void RenderD7::DrawText(float x, float y, float size, u32 color, std::string Tex
} }
} }
} }
void RenderD7::DrawTextLeft(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt)
{
RenderD7::DrawText(x - RenderD7::GetTextWidth(size, Text, fnt), y, size, color, Text, maxWidth, maxHeight, fnt);
}
// Get String or Text Width. // Get String or Text Width.
float RenderD7::GetTextWidth(float size, std::string Text, C2D_Font fnt) { float RenderD7::GetTextWidth(float size, std::string Text, C2D_Font fnt) {
float width = 0; float width = 0;
@ -440,38 +528,88 @@ bool RenderD7::DrawCircle(float x, float y, float radius, u32 color)
return C2D_DrawCircleSolid(x, y, 0.5f, radius, color); return C2D_DrawCircleSolid(x, y, 0.5f, radius, color);
} }
Result RenderD7::Init::Main() void MetrikThread(RenderD7::Parameter param) {
while (true) {
RenderD7::DrawMetrikOvl();
RenderD7::Thread::sleep(1000 * 1); // wait; also, this is needed to allow for concurrency (refer to the documentation for m3d::Thread::sleep())
}
}
Result RenderD7::Init::Main(std::string app_name)
{ {
gfxInitDefault(); gfxInitDefault();
aptInit(); aptInit();
romfsInit(); romfsInit();
cfguInit(); cfguInit();
osSetSpeedupEnable(true); if (cobj___){maxobj__ = cobj___;}
if (!cobj___){maxobj__ = C2D_DEFAULT_MAX_OBJECTS;}
D_app_name = app_name;
std::string cfgpath = "sdmc:/RenderD7/Apps/";
cfgpath += D_app_name;
mkdir("sdmc:/RenderD7/", 0777);
mkdir("sdmc:/RenderD7/Apps", 0777);
mkdir(cfgpath.c_str(), 0777);
bool renew = false;
if (FS::FileExist(cfgpath + "/config.ini"))
{
cfgfile = std::make_unique<INI::INIFile>(cfgpath + "/config.ini");
cfgfile->read(cfgstruct);
std::string version = cfgstruct["info"]["version"];
if (version != CFGVER) renew = true;
}
if (!FS::FileExist(cfgpath + "/config.ini") || renew)
{
cfgfile = std::make_unique<INI::INIFile>(cfgpath+ "/config.ini");
cfgfile->read(cfgstruct);
cfgstruct["info"]["version"] = CFGVER;
cfgstruct["info"]["renderd7ver"] = RENDERD7VSTRING;
cfgstruct["settings"]["doscreentimeout"] = "0";
cfgstruct["settings"]["forcetimeoutLB"] = "1";
cfgstruct["settings"]["forceFrameRate"] = "60";
cfgstruct["settings"]["super-reselution"] = "0";
cfgstruct["metrik-settings"]["enableoverlay"] = "0";
cfgstruct["metrik-settings"]["Screen"] = "0";
cfgstruct["metrik-settings"]["txtColor"] = "#ffffff";
cfgstruct["metrik-settings"]["txtColorA"] = "255";
cfgstruct["metrik-settings"]["ColorA"] = "255";
cfgstruct["metrik-settings"]["Color"] = "#000000";
cfgstruct["metrik-settings"]["txtSize"] = "0.7f";
cfgfile->write(cfgstruct);
}
cfgfile = std::make_unique<INI::INIFile>(cfgpath+ "/config.ini");
cfgfile->read(cfgstruct);
std::string Fps = cfgstruct["settings"]["forceFrameRate"];
C3D_FrameRate(RenderD7::Convert::StringtoFloat(Fps));
metrikd = RenderD7::Convert::FloatToBool(RenderD7::Convert::StringtoFloat(cfgstruct["metrik-settings"]["enableoverlay"]));
mt_txtcolor = RenderD7::Color::Hex(cfgstruct["metrik-settings"]["txtColor"], (u8)RenderD7::Convert::StringtoFloat(cfgstruct["metrik-settings"]["txtColorA"]));
mt_color = RenderD7::Color::Hex(cfgstruct["metrik-settings"]["Color"], (u8)RenderD7::Convert::StringtoFloat(cfgstruct["metrik-settings"]["ColorA"]));
mt_txtSize = RenderD7::Convert::StringtoFloat(cfgstruct["metrik-settings"]["txtSize"]);
mt_screen = RenderD7::Convert::StringtoInt(cfgstruct["metrik-settings"]["Screen"]);
osSetSpeedupEnable(true);
C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); C3D_Init(C3D_DEFAULT_CMDBUF_SIZE);
C2D_Init(C2D_DEFAULT_MAX_OBJECTS); C2D_Init(size_t(maxobj__));
C2D_Prepare(); C2D_Prepare();
Top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT); Top = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT);
TopRight = C2D_CreateScreenTarget(GFX_TOP, GFX_RIGHT); TopRight = C2D_CreateScreenTarget(GFX_TOP, GFX_RIGHT);
Bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT); Bottom = C2D_CreateScreenTarget(GFX_BOTTOM, GFX_LEFT);
TextBuf = C2D_TextBufNew(4096); TextBuf = C2D_TextBufNew(4096);
Font = C2D_FontLoadSystem(CFG_REGION_USA); Font = C2D_FontLoadSystem(CFG_REGION_USA);
//RenderD7::Msg::Display("RenderD7", "RenderD7 init success!\nWaiting for MainLoop!", Top);
return 0; return 0;
} }
void RenderD7::Exit::Main() void RenderD7::Exit::Main()
{ {
cfgfile->write(cfgstruct);
if (RenderD7::Threads::threadrunning) RenderD7::Threads::Exit();
C2D_TextBufDelete(TextBuf); C2D_TextBufDelete(TextBuf);
C2D_Fini(); C2D_Fini();
C3D_Fini(); C3D_Fini();
aptExit(); aptExit();
gfxExit();
romfsExit(); romfsExit();
cfguExit(); cfguExit();
} romfsExit();
std::string RenderD7::GetFramerate()
{
frameloop();
return (std::to_string(d11framerate).substr(0, 2));
} }
void RenderD7::DrawTObjects(std::vector<RenderD7::TObject> tobjects, u32 color, u32 txtcolor, int selection, u32 selbgcolor, u32 selcolor) void RenderD7::DrawTObjects(std::vector<RenderD7::TObject> tobjects, u32 color, u32 txtcolor, int selection, u32 selbgcolor, u32 selcolor)
@ -490,9 +628,26 @@ void RenderD7::DrawTObjects(std::vector<RenderD7::TObject> tobjects, u32 color,
RenderD7::DrawRect(tobjects[i].x, tobjects[i].y - 1, tobjects[i].w, tobjects[i].h, color); RenderD7::DrawRect(tobjects[i].x, tobjects[i].y - 1, tobjects[i].w, tobjects[i].h, color);
RenderD7::DrawText(tobjects[i].x + (tobjects[i].w/2) - RenderD7::GetTextHeight(tobjects[i].txtsize , tobjects[i].text) + tobjects[i].correctx, tobjects[i].y + (tobjects[i].h/2) - RenderD7::GetTextHeight(tobjects[i].txtsize, tobjects[i].text) + tobjects[i].correcty, tobjects[i].txtsize, txtcolor, tobjects[i].text); RenderD7::DrawText(tobjects[i].x + (tobjects[i].w/2) - RenderD7::GetTextHeight(tobjects[i].txtsize , tobjects[i].text) + tobjects[i].correctx, tobjects[i].y + (tobjects[i].h/2) - RenderD7::GetTextHeight(tobjects[i].txtsize, tobjects[i].text) + tobjects[i].correcty, tobjects[i].txtsize, txtcolor, tobjects[i].text);
} }
} }
} }
void RenderD7::DrawTLBtns(std::vector<RenderD7::TLBtn> btns, u32 color, int selection, u32 selbgcolor, u32 selcolor)
{
for(int i = 0; i < (int)btns.size(); i++)
{
if (selection == i)
{
RenderD7::DrawRect(btns[i].x - 2, btns[i].y - 2, btns[i].w + 4, btns[i].h + 4, selbgcolor);
RenderD7::DrawRect(btns[i].x, btns[i].y, btns[i].w, btns[i].h, color);
RenderD7::DrawRect(btns[i].x, btns[i].y, btns[i].w, btns[i].h, selcolor);
}
else
{
RenderD7::DrawRect(btns[i].x, btns[i].y - 1, btns[i].w, btns[i].h, color);
}
}
}
void RenderD7::ExitApp() void RenderD7::ExitApp()
{ {
running = false; running = false;
@ -504,6 +659,14 @@ bool RenderD7::touchTObj(touchPosition touch, RenderD7::TObject button)
else return false; else return false;
} }
int RenderD7::GetRandomInt(int b, int e)
{
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(b, e);
int r = distribution(generator);
return r;
}
void RenderD7::DrawSTObject(std::vector<RenderD7::TObject> tobject, int tobjectindex, u32 color, u32 txtcolor) void RenderD7::DrawSTObject(std::vector<RenderD7::TObject> tobject, int tobjectindex, u32 color, u32 txtcolor)
{ {
RenderD7::DrawRect(tobject[tobjectindex].x, tobject[tobjectindex].y, tobject[tobjectindex].w, tobject[tobjectindex].h, color); RenderD7::DrawRect(tobject[tobjectindex].x, tobject[tobjectindex].y, tobject[tobjectindex].w, tobject[tobjectindex].h, color);
@ -557,10 +720,259 @@ void RenderD7::GetDirContentsExt(std::vector<RenderD7::DirContent> &dircontent,
closedir(pdir); closedir(pdir);
} }
sort(dircontent.begin(), dircontent.end(), dirEntryPredicate); sort(dircontent.begin(), dircontent.end(), dirEntryPredicate);
} }
void RenderD7::GetDirContents(std::vector<RenderD7::DirContent> &dircontent) { void RenderD7::GetDirContents(std::vector<RenderD7::DirContent> &dircontent) {
RenderD7::GetDirContentsExt(dircontent, {}); RenderD7::GetDirContentsExt(dircontent, {});
} }
void RenderD7::Image::LoadPng(const std::string path)
{
if (usedbgmsg)
{
RenderD7::Msg::Display("RenderD7", "Loading Png:" + path, Top);
}
std::vector<u8> ImageBuffer;
unsigned width, height;
if (loadet)
{
C3D_TexDelete(this->img.tex);
}
lodepng::decode(ImageBuffer, width, height, path);
this->img.tex = new C3D_Tex;
this->img.subtex = new Tex3DS_SubTexture({(u16)width, (u16)height, 0.0f, 1.0f, width / 1024.0f, 1.0f - (height / 1024.0f)});
C3D_TexInit(this->img.tex, 1024, 1024, GPU_RGBA8);
C3D_TexSetFilter(this->img.tex, GPU_LINEAR, GPU_LINEAR);
this->img.tex->border = 0xFFFFFFFF;
C3D_TexSetWrap(this->img.tex, GPU_CLAMP_TO_BORDER, GPU_CLAMP_TO_BORDER);
for (u32 x = 0; x < width && x < 1024; x++) {
for (u32 y = 0; y < height && y < 1024; y++) {
const u32 dstPos = ((((y >> 3) * (1024 >> 3) + (x >> 3)) << 6) +
((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) | ((y & 2) << 2) |
((x & 4) << 2) | ((y & 4) << 3))) * 4;
const u32 srcPos = (y * width + x) * 4;
((uint8_t *)this->img.tex->data)[dstPos + 0] = ImageBuffer.data()[srcPos + 3];
((uint8_t *)this->img.tex->data)[dstPos + 1] = ImageBuffer.data()[srcPos + 2];
((uint8_t *)this->img.tex->data)[dstPos + 2] = ImageBuffer.data()[srcPos + 1];
((uint8_t *)this->img.tex->data)[dstPos + 3] = ImageBuffer.data()[srcPos + 0];
}
}
loadet = true;
}
void RenderD7::Image::LoadPFromBuffer(const std::vector<u8> &buffer)
{
std::vector<u8> ImageBuffer;
if (loadet)
{
C3D_TexDelete(this->img.tex);
}
unsigned width, height;
lodepng::decode(ImageBuffer, width, height, buffer);
img.tex = new C3D_Tex;
img.subtex = new Tex3DS_SubTexture({(u16)width, (u16)height, 0.0f, 1.0f, width / 512.0f, 1.0f - (height / 512.0f)});
C3D_TexInit(img.tex, 512, 512, GPU_RGBA8);
C3D_TexSetFilter(img.tex, GPU_LINEAR, GPU_LINEAR);
img.tex->border = 0xFFFFFFFF;
C3D_TexSetWrap(img.tex, GPU_CLAMP_TO_BORDER, GPU_CLAMP_TO_BORDER);
for (u32 x = 0; x < width && x < 512; x++) {
for (u32 y = 0; y < height && y < 512; y++) {
const u32 dstPos = ((((y >> 3) * (512 >> 3) + (x >> 3)) << 6) +
((x & 1) | ((y & 1) << 1) | ((x & 2) << 1) | ((y & 2) << 2) |
((x & 4) << 2) | ((y & 4) << 3))) * 4;
const u32 srcPos = (y * width + x) * 4;
((uint8_t *)img.tex->data)[dstPos + 0] = ImageBuffer.data()[srcPos + 3];
((uint8_t *)img.tex->data)[dstPos + 1] = ImageBuffer.data()[srcPos + 2];
((uint8_t *)img.tex->data)[dstPos + 2] = ImageBuffer.data()[srcPos + 1];
((uint8_t *)img.tex->data)[dstPos + 3] = ImageBuffer.data()[srcPos + 0];
}
}
}
bool RenderD7::DrawImage(C2D_Image img, float x, float y, float scaleX, float scaleY)
{
return C2D_DrawImageAt(img, x, y, 0.5f, nullptr, scaleX, scaleY);
}
bool RenderD7::Image::Draw(float x, float y, float scaleX, float scaleY)
{
return C2D_DrawImageAt(this->img, x, y, 0.5f, nullptr, scaleX, scaleY);
}
bool RenderD7::FS::FileExist(const std::string& path)
{
FILE *test = fopen(path.c_str(), "r");
if(test != NULL)
{
fclose(test);
return true;
}
return false;
}
bool RenderD7::IsNdspInit()
{
if (isndspinit)
{
return true;
}
else
{
return false;
}
}
void RenderD7::DrawList1(RenderD7::ScrollList1 &l, float txtsize, C3D_RenderTarget *t)
{
RenderD7::OnScreen(t);
RenderD7::DrawRect(0, 0, 400, 240, RenderD7::Color::Hex("#dddddd"));
RenderD7::DrawText(0, 0, 0.8f, RenderD7::Color::Hex("#ffffff"), l.Text);
}
void RenderD7::DrawMetrikOvl()
{
switch (mt_screen)
{
case 0:
RenderD7::OnScreen(Top);
break;
case 1:
RenderD7::OnScreen(Bottom);
break;
default:
RenderD7::OnScreen(Bottom);
break;
}
RenderD7::DrawText(0, 0, mt_txtSize, mt_txtcolor, "FPS: " + RenderD7::GetFramerate());
RenderD7::DrawText(0, 50, mt_txtSize, mt_txtcolor, "CPU: " + std::to_string(C3D_GetProcessingTime()*6.0f) + "%/" + std::to_string(C3D_GetProcessingTime()));
RenderD7::DrawText(0, 70, mt_txtSize, mt_txtcolor, "GPU: " + std::to_string(C3D_GetDrawingTime()*6.0f) + "%/" + std::to_string(C3D_GetDrawingTime()));
RenderD7::DrawText(0, 90, mt_txtSize, mt_txtcolor, "CMD: " + std::to_string(C3D_GetCmdBufUsage()*100.0f) + "%/" + std::to_string(C3D_GetCmdBufUsage()));
for (int z = 0; z < 320; z++)
{
C2D_DrawLine(z, 239 - mt_fpsgraph[z], mt_txtcolor, z + 1, 239 - mt_fpsgraph[z + 1], mt_txtcolor, 1, 1);
}
}
bool RenderD7::DrawNFRect(float p1x, float p1y, float w, float h, u32 color, float scale)
{
C2D_DrawLine(p1x, p1y, color,w, p1y, color, scale, 1);
C2D_DrawLine(w, p1y, color,w, h, color, scale, 1);
C2D_DrawLine(w, h, color,p1x, h, color, scale, 1);
C2D_DrawLine(p1x, h, color,p1x, p1y, color, scale, 1);
return true;
}
void RenderD7::FrameEnd()
{
if (metrikd)RenderD7::DrawMetrikOvl();
/*for (int i = 0; i < (int)overlays.size(); i++)
{
overlays[i].Draw();
}*/
if (d7_hHeld & KEY_L && d7_hHeld & KEY_R && d7_hDown & KEY_Y)
{
RenderD7::LoadSettings();
}
C3D_FrameEnd(0);
}
RenderD7::RSettings::RSettings()
{
}
RenderD7::RSettings::~RSettings()
{
}
void RenderD7::RSettings::Draw(void) const
{
std::string metkkkkk = "Metrik: " + metrikd ? "true" : "false";
RenderD7::OnScreen(Top);
RenderD7::DrawRect(0, 0, 400, 20, RenderD7::Color::Hex("#111111"));
RenderD7::DrawRect(0, 20, 400, 220, RenderD7::Color::Hex("#eeeeee"));
RenderD7::DrawText(0, 0, 0.7f, DSEVENWHITE, "RenderD7->Settings");
RenderD7::DrawText(0, 22, 0.7f, DSEVENBLACK, metkkkkk);
}
void RenderD7::RSettings::Logic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch)
{
if (d7_hDown & KEY_B)
{
RenderD7::Scene::Back();
}
}
void RenderD7::LoadSettings(){
RenderD7::Scene::Load(std::make_unique<RenderD7::RSettings>());
}
/*void RenderD7::AddOvl(RenderD7::Ovl overlay)
{
overlays.push_back(overlay);
}*/
/*RenderD7::Console::Console()
{
this->x = 0;
this->y = 0;
this->w = 320;
this->h = 240;
this->color = {0, 0, 0, 255};
}
RenderD7::Console::Console(int x, int y, int w, int h, u8 a)
{
this->x = x;
this->y = y;
this->w = w;
this->h = h;
this->color = {0, 0, 0, a};
}
RenderD7::Console::Console(int x, int y, int w, int h, RenderD7::Color::rgba col)
{
this->x = x;
this->y = y;
this->w = w;
this->h = h;
this->color = col;
}
RenderD7::Console::Console(int x, int y, int w, int h, std::string name, RenderD7::Color::rgba col, RenderD7::Color::rgba barcol, RenderD7::Color::rgba outlinecol)
{
this->x = x;
this->y = y;
this->w = w;
this->h = h;
this->color = col;
this->outlinecol = outlinecol;
this->barcolor = barcol;
this->m_name = name;
}
RenderD7::Console::~Console()
{
}
void RenderD7::Console::On(C3D_RenderTarget *t_cscreen)
{
this->cscreen = t_cscreen;
}
bool RenderD7::Console::Update()
{
bool dr_sc = true;
return dr_sc;
}
*/

View File

@ -1,3 +1,4 @@
#pragma once
#include <3ds.h> #include <3ds.h>
#include <citro2d.h> #include <citro2d.h>
#include <citro3d.h> #include <citro3d.h>
@ -5,13 +6,28 @@
#include <stack> #include <stack>
#include <string> #include <string>
#include <functional> #include <functional>
#include <map>
#include <vector> #include <vector>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <cstring> #include <cstring>
#include <random>
#include <sys/stat.h> #include <sys/stat.h>
#include <algorithm>
#include <iostream>
#include "external/lodepng.h"
#include "external/fs.h"
#include <codecvt>
#include "lang.hpp"
#include "parameter.hpp"
#include "thread.hpp"
#include "ini.hpp"
#include "stringtool.hpp"
#include "Clock.hpp"
#define RENDERD7VSTRING "0.6.2"
#define CHANGELOG "0.6.2: \n0.6.10: rewrite Threadsystem, Improve framerate\n0.6.02: Fix Code in lang.hpp\nadd Draw Text Left Function.\nadd changelog\n0.6.01: add Threading system."
#define DEFAULT_CENTER 0.5f #define DEFAULT_CENTER 0.5f
extern C3D_RenderTarget* Top; extern C3D_RenderTarget* Top;
@ -23,28 +39,76 @@ extern u32 d7_hHeld;
extern u32 d7_hUp; extern u32 d7_hUp;
extern touchPosition d7_touch; extern touchPosition d7_touch;
extern std::string dspststus;
/// RenderD7
namespace RenderD7 namespace RenderD7
{ {
enum kbd{
SWKBD,
BKBD
};
enum kbd_type
{
NUMPAD,
STANDARD
};
/// Set current RenderScreen
/// \param target The RenderTarget Top, Bottom
void OnScreen(C3D_RenderTarget *target); void OnScreen(C3D_RenderTarget *target);
/** The Spritesheet Class */
class Sheet class Sheet
{ {
public: public:
/// Construct sheet
Sheet(); Sheet();
// Deconstruct sheet
~Sheet(); ~Sheet();
/// Load a Sritesheet
/// path: Path to the Spritesheet (.t3x)
Result Load(const char *path); Result Load(const char *path);
/// Unload the Spritesheet
void Free(); void Free();
// The Spritesheet
C2D_SpriteSheet spritesheet; C2D_SpriteSheet spritesheet;
}; };
/// Image Class
class Image
{
public:
/// Load Image from Png
/// path: path to png file
void LoadPng(const std::string path);
/// Load the Image from buffer
/// buffer: the frame buffer
void LoadPFromBuffer(const std::vector<u8> &buffer);
/// Draw the Image directly
/// \param x The x position
/// \param y the y position
/// \param scaleX x scale from 0.0 to 1.0
/// \param scaleY y scale from 0.0 to 1.0
bool Draw(float x, float y, float scaleX = 1.0f, float scaleY = 1.0f);
/// \brief Get The Image
/// \return C2D_Image
C2D_Image Get(){return this->img;}
/// \img this is the C2D_Image
C2D_Image img;
/// \loadet whether the image is loadet or not
bool loadet = false;
};
/// Sprite Class
class Sprite class Sprite
{ {
public: public:
/// \brief Construct Sprite
Sprite(); Sprite();
~Sprite(); ~Sprite();
void FromSheet(RenderD7::Sheet *sheet, size_t index); void FromSheet(RenderD7::Sheet *sheet, size_t index);
void FromImage(RenderD7::Image *img);
bool Draw(); bool Draw();
void SetCenter(float x, float y); void SetCenter(float x, float y);
void SetPos(float x, float y); void SetPos(float x, float y);
void SetScale(float x, float y);
void SetRotation(float rotation); void SetRotation(float rotation);
void Rotate(float speed); void Rotate(float speed);
float getWidth(); float getWidth();
@ -55,31 +119,66 @@ namespace RenderD7
C2D_ImageTint tint; C2D_ImageTint tint;
C2D_Sprite sprite; C2D_Sprite sprite;
}; };
class Scene { class Scene {
public: public:
static std::stack<std::unique_ptr<Scene>> scenes; static std::stack<std::unique_ptr<Scene>> scenes;
virtual ~Scene() {} virtual ~Scene() {}
virtual void Logic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch) = 0; virtual void Logic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch) = 0;
virtual void Draw() const = 0; virtual void Draw() const = 0;
//virtual void Ovl() const = 0;
static void Load(std::unique_ptr<Scene> scene); static void Load(std::unique_ptr<Scene> scene);
static void Back(); static void Back();
static void doDraw(); static void doDraw();
static void doLogic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch); static void doLogic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch);
//static void HandleOvl();
}; };
class RSettings : public RenderD7::Scene
{
private:
/* data */
public:
RSettings();
void Draw(void) const override;
~RSettings();
void Logic(u32 hDown, u32 hHeld, u32 hUp, touchPosition touch) override;
};
void LoadSettings();
/*class Ovl {
public:
virtual ~Ovl(){}
virtual void Draw() const = 0;
};
void AddOvl(RenderD7::Ovl overlay);*/
namespace Color namespace Color
{ {
struct rgba
{
u8 r, g, b, a;
};
class RGBA{
public:
RGBA(u8 r, u8 g, u8 b, u8 a) : m_r(r),m_g(g),m_b(b),m_a(a){}
u32 toRGBA() const {return (m_r << 24) | (m_g << 16) | (m_b << 8) | m_a;}
u8 m_r, m_g ,m_b, m_a;
};
u32 Hex(const std::string color, u8 a = 255); u32 Hex(const std::string color, u8 a = 255);
} }
int GetRandomInt(int b, int e);
void DrawMetrikOvl();
bool DrawImageFromSheet(RenderD7::Sheet* sheet, size_t index, float x, float y, float scaleX = 1.0, float scaleY = 1.0); bool DrawImageFromSheet(RenderD7::Sheet* sheet, size_t index, float x, float y, float scaleX = 1.0, float scaleY = 1.0);
namespace Error namespace Error
{ {
void DisplayError(std::string toptext, std::string errortext); void DisplayError(std::string toptext, std::string errortext, int timesec);
void DisplayFatalError(std::string toptext, std::string errortext); void DisplayFatalError(std::string toptext, std::string errortext);
} }
namespace Init namespace Init
{ {
Result Main(); Result Main(std::string app_name = "RD7Game");
void NdspFirm(bool useit = false); void NdspFirm(bool useit = false);
} }
namespace Exit namespace Exit
@ -89,10 +188,21 @@ namespace RenderD7
} }
namespace Msg namespace Msg
{ {
void Display(std::string titletxt, std::string, C3D_RenderTarget *target); void Display(std::string titletxt, std::string subtext, C3D_RenderTarget *target);
void DisplayWithProgress(std::string titletext, std::string subtext, float current, float total, u32 prgbarcolor);
} }
namespace Convert
{
inline float StringtoFloat(std::string inp){return std::atof(inp.c_str());}
inline int StringtoInt(std::string inp){return std::atoi(inp.c_str());}
inline bool FloatToBool(float inp){if(inp == 1)return true; else return false;}
}
namespace FS
{
bool FileExist(const std::string& path);
}
bool IsNdspInit();
void SetupLog(void); void SetupLog(void);
std::string GetFramerate(); std::string GetFramerate();
bool MainLoop(); bool MainLoop();
@ -101,19 +211,22 @@ namespace RenderD7
void ClearTextBufs(void); void ClearTextBufs(void);
bool DrawRect(float x, float y, float w, float h, u32 color); bool DrawRect(float x, float y, float w, float h, u32 color);
bool DrawNFRect(float p1x, float p1y, float w, float h, u32 color, float scale = 1);
bool DrawPx(float x, float y, u32 color);
void DrawTextCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr); void DrawTextCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr);
void DrawText(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr); void DrawText(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr);
void DrawTextLeft(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr);
float GetTextWidth(float size, std::string Text, C2D_Font fnt = nullptr); float GetTextWidth(float size, std::string Text, C2D_Font fnt = nullptr);
void GetTextSize(float size, float *width, float *height, std::string Text, C2D_Font fnt = nullptr); void GetTextSize(float size, float *width, float *height, std::string Text, C2D_Font fnt = nullptr);
float GetTextHeight(float size, std::string Text, C2D_Font fnt = nullptr); float GetTextHeight(float size, std::string Text, C2D_Font fnt = nullptr);
Result loadFont(C2D_Font &fnt, const char * Path = ""); Result loadFont(C2D_Font &fnt, const char * Path = "");
Result unloadFont(C2D_Font &fnt); Result unloadFont(C2D_Font &fnt);
bool DrawCircle(float x, float y, float radius, u32 color); bool DrawCircle(float x, float y, float radius, u32 color);
bool DrawImage(C2D_Image img, float x, float y, float scaleX = 1.0f, float scaleY = 1.0f);
void FrameEnd();
class SpriteSheetAnimation : public RenderD7::Sprite class SpriteSheetAnimation : public RenderD7::Sprite
{ {
public: public:
SpriteSheetAnimation(); SpriteSheetAnimation();
~SpriteSheetAnimation(); ~SpriteSheetAnimation();
@ -125,34 +238,87 @@ namespace RenderD7
float D_totaltime; float D_totaltime;
RenderD7::Sheet *sheet; RenderD7::Sheet *sheet;
float time; float time;
}; };
struct TObject struct TObject
{ {
int x; int x; //Position X
int y; int y; //Position Y
int w; int w; //Button Width
int h; int h; //Button Height
std::string text = ""; std::string text = ""; //Text
float correctx = 0; float correctx = 0; //Correct X Position
float correcty = 0; float correcty = 0; //Correct Y Position
float txtsize = 0.7f; float txtsize = 0.7f; //Set Text Size
}; };
struct TLBtn
{
int x; //Position X
int y; //Position Y
int w; //Button Width
int h; //Button Height
};
struct ScrollList1
{
std::string Text = "";
};
struct ScrollList2
{
float x;
float y;
float w;
float h;
std::string Text = "";
};
/*enum ListType
{
ONE,
TWO
};*/
void DrawList1(RenderD7::ScrollList1 &l, float txtsize, C3D_RenderTarget *t);
void DrawTObjects(std::vector<RenderD7::TObject> tobjects, u32 color, u32 txtcolor, int selection = -1, u32 selbgcolor = RenderD7::Color::Hex("#2D98AF"), u32 selcolor = RenderD7::Color::Hex("#000000")); void DrawTObjects(std::vector<RenderD7::TObject> tobjects, u32 color, u32 txtcolor, int selection = -1, u32 selbgcolor = RenderD7::Color::Hex("#2D98AF"), u32 selcolor = RenderD7::Color::Hex("#000000"));
void DrawSTObject(std::vector<RenderD7::TObject> tobject, int tobjectindex, u32 color, u32 txtcolor); void DrawSTObject(std::vector<RenderD7::TObject> tobject, int tobjectindex, u32 color, u32 txtcolor);
bool touchTObj(touchPosition touch, RenderD7::TObject button); bool touchTObj(touchPosition touch, RenderD7::TObject button);
void DrawTLBtns(std::vector<RenderD7::TLBtn> btns, u32 color, int selection = -1, u32 selbgcolor = RenderD7::Color::Hex("#2D98AF"), u32 selcolor = RenderD7::Color::Hex("#000000"));
struct DirContent struct DirContent
{ {
std::string name; std::string name;
std::string path; std::string path;
bool isDir; bool isDir;
}; };
struct Checkbox
{
float x, y, s;
bool is_chexked = false;
u32 outcol, incol, chcol;
};
void DrawCheckbox(Checkbox box);
/*class Console
{
public:
Console();
Console(int x, int y, int w, int h, int a = 255);
Console(int x, int y, int w, int h, RenderD7::Color::rgba col);
Console(int x, int y, int w, int h, std::string name, RenderD7::Color::rgba col = {255, 255, 255, 255}, RenderD7::Color::rgba barcol = {0, 0, 0, 255}, RenderD7::Color::rgba outlinecol = {222, 222, 222, 255});
void On(C3D_RenderTarget *t_cscreen);
bool Update();
~Console();
private:
std::vector<std::string> m_lines;
int x, y, w, h;
std::string m_name = "";
C3D_RenderTarget *cscreen;
bool m_nconsole = false;
bool m_mconsole = false;
RenderD7::Color::rgba color = {255, 255, 255, 255};
RenderD7::Color::rgba outlinecol = {222, 222, 222, 255};
RenderD7::Color::rgba barcolor = {0, 0, 0, 255};
};*/
bool NameIsEndingWith(const std::string &name, const std::vector<std::string> &extensions); bool NameIsEndingWith(const std::string &name, const std::vector<std::string> &extensions);
void GetDirContentsExt(std::vector<RenderD7::DirContent> &dircontent, const std::vector<std::string> &extensions); void GetDirContentsExt(std::vector<RenderD7::DirContent> &dircontent, const std::vector<std::string> &extensions);
void GetDirContents(std::vector<RenderD7::DirContent> &dircontent); void GetDirContents(std::vector<RenderD7::DirContent> &dircontent);
} /// RenderD7
}

View File

@ -5,6 +5,7 @@
#include <cstring> #include <cstring>
#include <string> #include <string>
extern bool isndspinit;
using std::string; using std::string;
// Reference: http://yannesposito.com/Scratch/en/blog/2010-10-14-Fun-with-wav/ // Reference: http://yannesposito.com/Scratch/en/blog/2010-10-14-Fun-with-wav/
@ -25,6 +26,7 @@ typedef struct _WavHeader {
static_assert(sizeof(WavHeader) == 44, "WavHeader size is not 44 bytes."); static_assert(sizeof(WavHeader) == 44, "WavHeader size is not 44 bytes.");
sound::sound(const string& path, int channel, bool toloop) { sound::sound(const string& path, int channel, bool toloop) {
if (isndspinit){
ndspSetOutputMode(NDSP_OUTPUT_STEREO); ndspSetOutputMode(NDSP_OUTPUT_STEREO);
ndspSetOutputCount(2); // Num of buffers ndspSetOutputCount(2); // Num of buffers
@ -98,10 +100,11 @@ sound::sound(const string& path, int channel, bool toloop) {
waveBuf.nsamples = dataSize / (wavHeader.bits_per_sample >> 3); waveBuf.nsamples = dataSize / (wavHeader.bits_per_sample >> 3);
waveBuf.looping = toloop; waveBuf.looping = toloop;
waveBuf.status = NDSP_WBUF_FREE; waveBuf.status = NDSP_WBUF_FREE;
chnl = channel; chnl = channel;}
} }
sound::~sound() { sound::~sound() {
if (isndspinit){
waveBuf.data_vaddr = 0; waveBuf.data_vaddr = 0;
waveBuf.nsamples = 0; waveBuf.nsamples = 0;
waveBuf.looping = false; waveBuf.looping = false;
@ -110,16 +113,18 @@ sound::~sound() {
if (data) { if (data) {
linearFree(data); linearFree(data);
} }}
} }
void sound::play() { void sound::play() {
if (isndspinit){
if (!data) return; if (!data) return;
DSP_FlushDataCache(data, dataSize); DSP_FlushDataCache(data, dataSize);
ndspChnWaveBufAdd(chnl, &waveBuf); ndspChnWaveBufAdd(chnl, &waveBuf);}
} }
void sound::stop() { void sound::stop() {
if (isndspinit){
if (!data) return; if (!data) return;
ndspChnWaveBufClear(chnl); ndspChnWaveBufClear(chnl);}
} }

View File

@ -1,14 +1,21 @@
#ifndef _UNIVERSAL_UPDATER_SOUND_H #pragma once
#define _UNIVERSAL_UPDATER_SOUND_H
#include <3ds.h> #include <3ds.h>
#include <string> #include <string>
/** Sound Class */
class sound { class sound {
public: public:
/// \brief Construct new Soundeffect
/// \param path Path to the .wav file
/// \param channel the channel 1-23
/// \param toloop true:loop the sound, false: don't loop
sound(const std::string& path, int channel = 1, bool toloop = false); sound(const std::string& path, int channel = 1, bool toloop = false);
/** deconstruct the sound */
~sound(); ~sound();
/** play the sound */
void play(); void play();
/** stop the sound */
void stop(); void stop();
private: private:
@ -18,4 +25,3 @@ private:
int chnl; int chnl;
}; };
#endif

View File

@ -0,0 +1,11 @@
//rd7cc
#include <iostream>
#include <fstream>
int main(int argc, char* argv[])
{
std::ofstream result ("result.hpp");
result << "//Result" << std::endl;
result.close();
}