Skip to content

Commit 0024491

Browse files
clang format
1 parent 1431e7d commit 0024491

File tree

14 files changed

+332
-338
lines changed

14 files changed

+332
-338
lines changed

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
21
build/
3-
42
*.ovl
5-
63
*.elf
7-
84
*.nacp
9-
105
*.nro
6+
.vscode

.vscode/c_cpp_properties.json

100644100755
Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
11
{
22
"configurations": [
33
{
4-
"name": "DKP Aarch64 Windows",
5-
"includePath": [
6-
"C:/devkitPro/devkitA64/aarch64-none-elf/include/**",
7-
"C:/devkitPro/devkitA64/lib/gcc/aarch64-none-elf/8.3.0/include/**",
8-
"C:/devkitPro/libnx/include/**",
9-
"C:/devkitPro/portlibs/switch/include/**",
10-
"C:/devkitPro/portlibs/switch/include/freetype2/**",
11-
"${workspaceFolder}/include/**",
12-
"${workspaceFolder}/libtesla/include/**"
13-
],
14-
"defines": [
15-
"SWITCH",
16-
"__SWITCH__",
17-
"__aarch64__"
18-
],
19-
"compilerPath": "C:/devkitPro/devkitA64/bin/aarch64-none-elf-g++",
20-
"cStandard": "c11",
21-
"cppStandard": "c++17",
22-
"intelliSenseMode": "gcc-x64"
23-
},
24-
{
25-
"name": "DKP Aarch64 Linux",
4+
"name": "DKP aarch64",
265
"includePath": [
276
"/opt/devkitpro/devkitA64/aarch64-none-elf/include/**",
287
"/opt/devkitpro/devkitA64/lib/gcc/aarch64-none-elf/8.3.0/include/**",
298
"/opt/devkitpro/libnx/include/**",
309
"/opt/devkitpro/portlibs/switch/include/**",
31-
"/opt/devkitpro/portlibs/switch/include/**",
32-
"/opt/devkitpro/portlibs/switch/include/freetype2/**",
33-
"${workspaceFolder}/include/**",
34-
"${workspaceFolder}/libs/libtesla/include/**"
10+
"libs/libtesla/**"
3511
],
3612
"defines": [
3713
"SWITCH",
3814
"__SWITCH__",
39-
"__aarch64__"
15+
"DEBUG"
4016
],
4117
"compilerPath": "/opt/devkitpro/devkitA64/bin/aarch64-none-elf-g++",
4218
"cStandard": "c11",
@@ -45,4 +21,4 @@
4521
}
4622
],
4723
"version": 4
48-
}
24+
}

.vscode/settings.json

100644100755
Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,88 @@
11
{
22
"files.associations": {
3-
"chrono": "cpp",
4-
"string_view": "cpp",
53
"array": "cpp",
6-
"atomic": "cpp",
7-
"bit": "cpp",
84
"*.tcc": "cpp",
95
"cctype": "cpp",
106
"clocale": "cpp",
117
"cmath": "cpp",
128
"cstdarg": "cpp",
13-
"cstddef": "cpp",
149
"cstdint": "cpp",
1510
"cstdio": "cpp",
1611
"cstdlib": "cpp",
17-
"cstring": "cpp",
18-
"ctime": "cpp",
1912
"cwchar": "cpp",
2013
"cwctype": "cpp",
21-
"deque": "cpp",
14+
"list": "cpp",
2215
"unordered_map": "cpp",
2316
"vector": "cpp",
2417
"exception": "cpp",
25-
"algorithm": "cpp",
26-
"functional": "cpp",
27-
"iterator": "cpp",
28-
"memory": "cpp",
29-
"memory_resource": "cpp",
30-
"numeric": "cpp",
31-
"optional": "cpp",
32-
"random": "cpp",
33-
"ratio": "cpp",
34-
"string": "cpp",
35-
"system_error": "cpp",
36-
"tuple": "cpp",
37-
"type_traits": "cpp",
38-
"utility": "cpp",
3918
"fstream": "cpp",
4019
"initializer_list": "cpp",
4120
"iosfwd": "cpp",
4221
"istream": "cpp",
4322
"limits": "cpp",
4423
"new": "cpp",
24+
"optional": "cpp",
4525
"ostream": "cpp",
4626
"sstream": "cpp",
4727
"stdexcept": "cpp",
4828
"streambuf": "cpp",
49-
"thread": "cpp",
50-
"cinttypes": "cpp",
29+
"string_view": "cpp",
30+
"system_error": "cpp",
31+
"type_traits": "cpp",
32+
"tuple": "cpp",
5133
"typeinfo": "cpp",
34+
"utility": "cpp",
35+
"filesystem": "cpp",
36+
"chrono": "cpp",
5237
"codecvt": "cpp",
38+
"cstring": "cpp",
39+
"ctime": "cpp",
40+
"deque": "cpp",
41+
"iostream": "cpp",
42+
"ratio": "cpp",
43+
"atomic": "cpp",
44+
"bitset": "cpp",
45+
"cfenv": "cpp",
46+
"charconv": "cpp",
47+
"cinttypes": "cpp",
48+
"complex": "cpp",
5349
"condition_variable": "cpp",
50+
"csetjmp": "cpp",
51+
"csignal": "cpp",
52+
"cstddef": "cpp",
53+
"cuchar": "cpp",
54+
"forward_list": "cpp",
55+
"unordered_set": "cpp",
56+
"functional": "cpp",
57+
"future": "cpp",
5458
"iomanip": "cpp",
55-
"mutex": "cpp"
59+
"memory": "cpp",
60+
"mutex": "cpp",
61+
"numeric": "cpp",
62+
"scoped_allocator": "cpp",
63+
"shared_mutex": "cpp",
64+
"thread": "cpp",
65+
"typeindex": "cpp",
66+
"valarray": "cpp",
67+
"plutonium": "cpp",
68+
"algorithm": "cpp",
69+
"iterator": "cpp",
70+
"memory_resource": "cpp",
71+
"random": "cpp",
72+
"string": "cpp",
73+
"map": "cpp",
74+
"regex": "cpp",
75+
"set": "cpp",
76+
"variant": "cpp",
77+
"bit": "cpp"
78+
},
79+
"files.exclude": {
80+
"**/.git": true,
81+
"**/.svn": true,
82+
"**/.hg": true,
83+
"**/CVS": true,
84+
"**/.DS_Store": true,
85+
"**/build": true,
86+
"**/out": true
5687
}
57-
}
88+
}

source/elm_button.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,32 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with libtesla. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
#include "elm_button.hpp"
2120

2221
Button::Button(u16 x, u16 y, u16 w, u16 h, const std::string &txt, std::function<bool(s64)> cb) : m_text(txt), m_onClick(cb) {
23-
this->setPosition(x, y);
24-
this->setSize(w, h);
22+
this->setPosition(x, y);
23+
this->setSize(w, h);
2524
}
2625

27-
Button::~Button() { }
26+
Button::~Button() {}
2827

29-
tsl::Element* Button::requestFocus(tsl::Element *oldFocus, FocusDirection direction) {
30-
return this;
28+
tsl::Element *Button::requestFocus(tsl::Element *oldFocus, FocusDirection direction) {
29+
return this;
3130
}
3231

3332
void Button::draw(tsl::Screen *screen, u16 x1, u16 y1) {
34-
const auto [x, y] = this->getPosition();
35-
const auto [w, h] = this->getSize();
33+
const auto [x, y] = this->getPosition();
34+
const auto [w, h] = this->getSize();
3635

37-
screen->drawRect(x, y, w, 1, a({ 0x5, 0x5, 0x5, 0xF }));
38-
screen->drawRect(x, y + h - 1, w, 1, a({ 0x5, 0x5, 0x5, 0xF }));
36+
screen->drawRect(x, y, w, 1, a({0x5, 0x5, 0x5, 0xF}));
37+
screen->drawRect(x, y + h - 1, w, 1, a({0x5, 0x5, 0x5, 0xF}));
3938

40-
screen->drawString(this->m_text.c_str(), false, x + 20, y + 45, 23, a({ 0xF, 0xF, 0xF, 0xF }));
39+
screen->drawString(this->m_text.c_str(), false, x + 20, y + 45, 23, a({0xF, 0xF, 0xF, 0xF}));
4140
}
4241

4342
void Button::layout() {
44-
4543
}
4644

4745
bool Button::onClick(s64 key) {
48-
return m_onClick(key);
46+
return m_onClick(key);
4947
}

source/elm_button.hpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with libtesla. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
#pragma once
2120
#include <tesla.hpp>
2221

2322
class Button : public tsl::Element {
2423
public:
25-
Button(u16 x, u16 y, u16 w, u16 h, const std::string &txt, std::function<bool(s64)> cb);
26-
~Button();
24+
Button(u16 x, u16 y, u16 w, u16 h, const std::string &txt, std::function<bool(s64)> cb);
25+
~Button();
2726

28-
tsl::Element* requestFocus(tsl::Element *oldFocus, FocusDirection direction) override;
27+
tsl::Element *requestFocus(tsl::Element *oldFocus, FocusDirection direction) override;
2928

30-
void draw(tsl::Screen *screen, u16 x, u16 y) override;
31-
void layout() override;
32-
bool onClick(s64 key) override;
29+
void draw(tsl::Screen *screen, u16 x, u16 y) override;
30+
void layout() override;
31+
bool onClick(s64 key) override;
3332

3433
private:
35-
std::string m_text;
36-
std::function<bool(s64)> m_onClick;
34+
std::string m_text;
35+
std::function<bool(s64)> m_onClick;
3736
};

source/elm_text.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,24 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with libtesla. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
#include "elm_text.hpp"
2120

2221
Text::Text(u16 x, u16 y, u16 w, u16 h, const std::string &txt) : m_text(txt) {
23-
this->setPosition(x, y);
24-
this->setSize(w, h);
22+
this->setPosition(x, y);
23+
this->setSize(w, h);
2524
}
2625

27-
Text::~Text() { }
26+
Text::~Text() {}
2827

2928
void Text::draw(tsl::Screen *screen, u16 x1, u16 y1) {
30-
const auto [x, y] = this->getPosition();
29+
const auto [x, y] = this->getPosition();
3130

32-
screen->drawString(this->m_text.c_str(), false, x + 20, y + 45, 23, a({ 0xF, 0xF, 0xF, 0xF }));
31+
screen->drawString(this->m_text.c_str(), false, x + 20, y + 45, 23, a({0xF, 0xF, 0xF, 0xF}));
3332
}
3433

3534
void Text::layout() {
36-
3735
}
3836

3937
void Text::setText(const std::string &txt) {
40-
this->m_text = txt;
38+
this->m_text = txt;
4139
}

source/elm_text.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@
1616
* You should have received a copy of the GNU General Public License
1717
* along with libtesla. If not, see <http://www.gnu.org/licenses/>.
1818
*/
19-
2019
#pragma once
2120
#include <tesla.hpp>
2221

2322
class Text : public tsl::Element {
2423
public:
25-
Text(u16 x, u16 y, u16 w, u16 h, const std::string &txt);
26-
~Text();
24+
Text(u16 x, u16 y, u16 w, u16 h, const std::string &txt);
25+
~Text();
2726

28-
tsl::Element* requestFocus(Element *oldFocus, FocusDirection direction) {
29-
return nullptr;
30-
}
27+
tsl::Element *requestFocus(Element *oldFocus, FocusDirection direction) {
28+
return nullptr;
29+
}
3130

32-
void draw(tsl::Screen *screen, u16 x, u16 y) override;
33-
void layout() override;
31+
void draw(tsl::Screen *screen, u16 x, u16 y) override;
32+
void layout() override;
3433

35-
void setText(const std::string &txt);
34+
void setText(const std::string &txt);
3635

3736
private:
38-
std::string m_text;
37+
std::string m_text;
3938
};

source/gui_error.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@
1818
#include "gui_error.hpp"
1919

2020
class LastFrame : public tsl::element::Frame {
21-
public:
22-
virtual bool onClick(s64 key) {
23-
if (key == KEY_B) {
24-
tsl::Gui::closeGui();
25-
return true;
26-
}
21+
public:
22+
virtual bool onClick(s64 key) {
23+
if (key == KEY_B) {
24+
tsl::Gui::closeGui();
25+
return true;
26+
}
2727

28-
return false;
29-
}
28+
return false;
29+
}
3030
};
3131

32-
ErrorGui::ErrorGui(Result result, const std::string &message) : rc(result), msg(message) { }
33-
ErrorGui::~ErrorGui() { }
32+
ErrorGui::ErrorGui(Result result, const std::string &message) : rc(result), msg(message) {}
33+
ErrorGui::~ErrorGui() {}
3434

35-
tsl::Element* ErrorGui::createUI() {
36-
this->setTitle("ShareNX");
37-
this->setSubtitle("Behemoth, v1.0.0");
35+
tsl::Element *ErrorGui::createUI() {
36+
this->setTitle("ShareNX");
37+
this->setSubtitle("Behemoth, v1.0.0");
3838

39-
auto root = new LastFrame();
40-
auto error = new tsl::element::CustomDrawer(0, 0, 100, FB_WIDTH, [&](u16 x, u16 y, tsl::Screen *screen) {
41-
screen->drawString("\uE150", false, (FB_WIDTH - 90) / 2, 300, 90, tsl::a(0xFFFF));
42-
screen->drawString(msg.c_str(), false, 105, 380, 25, tsl::a(0xFFFF));
43-
if (rc != 0) {
44-
char errorCode[10];
45-
snprintf(errorCode, 10, "%04d-%04d", 2000 + R_MODULE(rc), R_DESCRIPTION(rc));
46-
screen->drawString(errorCode, false, 120, 430, 25, tsl::a(0xFFFF));
47-
}
48-
});
49-
root->addElement(error);
50-
return root;
39+
auto root = new LastFrame();
40+
auto error = new tsl::element::CustomDrawer(0, 0, 100, FB_WIDTH, [&](u16 x, u16 y, tsl::Screen *screen) {
41+
screen->drawString("\uE150", false, (FB_WIDTH - 90) / 2, 300, 90, tsl::a(0xFFFF));
42+
screen->drawString(msg.c_str(), false, 105, 380, 25, tsl::a(0xFFFF));
43+
if (rc != 0) {
44+
char errorCode[10];
45+
snprintf(errorCode, 10, "%04d-%04d", 2000 + R_MODULE(rc), R_DESCRIPTION(rc));
46+
screen->drawString(errorCode, false, 120, 430, 25, tsl::a(0xFFFF));
47+
}
48+
});
49+
root->addElement(error);
50+
return root;
5151
}

0 commit comments

Comments
 (0)