Works even more now
This commit is contained in:
parent
83d02a8861
commit
44a4c2ceba
@ -69,7 +69,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (text.selected && event.event == CLICK_EVENTS::KEYBOARD) {
|
if (text.selected && event.event == CLICK_EVENTS::KEYBOARD) {
|
||||||
|
if ((text.x + text.width) >= (_window->x + _window->width)) {
|
||||||
|
text.text += "\n";
|
||||||
|
Serial.println("Aight");
|
||||||
|
}
|
||||||
text.text += event.character;
|
text.text += event.character;
|
||||||
|
_tft->get_text_bounds(text.text, text.size, text.width, text.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,15 +95,11 @@ public:
|
|||||||
text.selected = false;
|
text.selected = false;
|
||||||
text.text = "asddsa";
|
text.text = "asddsa";
|
||||||
|
|
||||||
|
_tft->get_text_bounds(text.text, text.size, text.width, text.height);
|
||||||
|
|
||||||
_window->window_content_text.push_back(text);
|
_window->window_content_text.push_back(text);
|
||||||
|
|
||||||
while (_running) {
|
while (_running) {
|
||||||
for (WindowContentText text : _window->window_content_text) {
|
|
||||||
if (text.selected) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1));
|
vTaskDelay(pdMS_TO_TICKS(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,4 +58,10 @@ void TFT_Handler::fill_screen(short color) {
|
|||||||
|
|
||||||
void TFT_Handler::push_sprite() {
|
void TFT_Handler::push_sprite() {
|
||||||
sprite.pushSprite(0, 0);
|
sprite.pushSprite(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TFT_Handler::get_text_bounds(const std::string& str, short size, short& width, short& height) {
|
||||||
|
sprite.setTextSize(size);
|
||||||
|
width = sprite.textWidth(str.c_str());
|
||||||
|
height = sprite.fontHeight() * size;
|
||||||
}
|
}
|
||||||
@ -68,4 +68,5 @@ public:
|
|||||||
void draw_button(short x, short y, short size_x, short size_y, short color, bool pressed, std::string str);
|
void draw_button(short x, short y, short size_x, short size_y, short color, bool pressed, std::string str);
|
||||||
void fill_screen(short color);
|
void fill_screen(short color);
|
||||||
void push_sprite();
|
void push_sprite();
|
||||||
|
void get_text_bounds(const std::string& str, short size, short& width, short& height);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user