Formatted code (#1007)

* Updated style

* Updated files

* fixed new line

* Updated spacing

* File fix WIP

* Updated to clang 13

* updated comment style

* Removed old comment code
This commit is contained in:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -33,32 +33,30 @@
namespace ui {
SpectrumInputTextView::SpectrumInputTextView(NavigationView& nav) {
hidden(true);
hidden(true);
add_children({
&text_message_0,
&text_message_1,
&text_message_2,
&text_message_3,
&text_message_4,
&text_message_5,
&text_message_6,
&text_message_7,
&text_message_8,
&text_message_9,
&button_message
});
add_children({&text_message_0,
&text_message_1,
&text_message_2,
&text_message_3,
&text_message_4,
&text_message_5,
&text_message_6,
&text_message_7,
&text_message_8,
&text_message_9,
&button_message});
button_message.on_select = [this, &nav](Button&) {
this->on_set_text(nav);
};
button_message.on_select = [this, &nav](Button&) {
this->on_set_text(nav);
};
}
SpectrumInputTextView::~SpectrumInputTextView() {
}
void SpectrumInputTextView::on_set_text(NavigationView& nav) {
text_prompt(nav, buffer, 300);
text_prompt(nav, buffer, 300);
}
void SpectrumInputTextView::focus() {
@ -66,46 +64,45 @@ void SpectrumInputTextView::focus() {
}
void SpectrumInputTextView::paint(Painter& painter) {
message = buffer;
for (uint32_t i = 0 ; i < text_message.size(); i++) {
if (message.length() > i * 30)
text_message[i]->set(message.substr(i * 30, 30));
else
text_message[i]->set("");
}
message = buffer;
for (uint32_t i = 0; i < text_message.size(); i++) {
if (message.length() > i * 30)
text_message[i]->set(message.substr(i * 30, 30));
else
text_message[i]->set("");
}
painter.fill_rectangle(
{{0, 40}, {240, 204}},
style().background
);
painter.fill_rectangle(
{{0, 40}, {240, 204}},
style().background);
}
constexpr uint32_t pixel_repeat = 32;
uint16_t SpectrumInputTextView::get_width(){
return 16 * pixel_repeat;
uint16_t SpectrumInputTextView::get_width() {
return 16 * pixel_repeat;
}
uint16_t SpectrumInputTextView::get_height(){
return this->message.length() * 8;
uint16_t SpectrumInputTextView::get_height() {
return this->message.length() * 8;
}
std::vector<uint8_t> SpectrumInputTextView::get_line(uint16_t y) {
auto character_position = y / 8;
auto character = this->message[character_position];
auto glyph_data = ui::font::fixed_8x16.glyph(character).pixels();
auto line_in_character = y % 8;
std::vector<uint8_t> data(16 * pixel_repeat);
auto character_position = y / 8;
auto character = this->message[character_position];
auto glyph_data = ui::font::fixed_8x16.glyph(character).pixels();
for (uint32_t index = 0; index < 16; index++) {
auto glyph_byte = index;
auto glyph_bit = line_in_character;
uint8_t glyph_pixel = (glyph_data[glyph_byte] & (1 << glyph_bit)) >> glyph_bit;
auto line_in_character = y % 8;
std::vector<uint8_t> data(16 * pixel_repeat);
for (uint32_t j = 0; j < pixel_repeat; j++)
data[index*pixel_repeat + j] = glyph_pixel * 255;
}
for (uint32_t index = 0; index < 16; index++) {
auto glyph_byte = index;
auto glyph_bit = line_in_character;
uint8_t glyph_pixel = (glyph_data[glyph_byte] & (1 << glyph_bit)) >> glyph_bit;
return data;
}
for (uint32_t j = 0; j < pixel_repeat; j++)
data[index * pixel_repeat + j] = glyph_pixel * 255;
}
return data;
}
} // namespace ui