Skip to content

Commit

Permalink
Merge fixes from develop (#7)
Browse files Browse the repository at this point in the history
Minor QOL and bug fixes
  • Loading branch information
unwieldycat authored Oct 29, 2023
2 parents 22c4415 + f8b74dd commit 6e873c6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/robodash/views/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ImageView : public rd::View {
* performance. CF_INDEXED_4_BIT or CF_INDEXED_8_BIT is reccomended for
* color images.
*/
ImageView(std::string name, std::string path);
ImageView(std::string path, std::string name = "Image");

void initialize();
void refresh();
Expand Down
2 changes: 1 addition & 1 deletion src/robodash/styles/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void _init_style_misc() {
lv_style_init(&style_bg);
lv_style_set_border_width(&style_bg, 0);
lv_style_set_radius(&style_bg, 0);
lv_style_set_bg_color(&style_bg, color_bg);
lv_style_set_bg_color(&style_bg, lv_color_black());
lv_style_set_text_color(&style_bg, color_text);
lv_style_set_pad_all(&style_bg, 0);

Expand Down
4 changes: 3 additions & 1 deletion src/robodash/views/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ rd::ConsoleView::ConsoleView(std::string name) : View(name) {}
void rd::ConsoleView::refresh() {}

void rd::ConsoleView::initialize() {
lv_obj_set_style_bg_color(this->get_obj(), color_bg, 0);

output = lv_label_create(this->get_obj());
lv_obj_set_size(output, 464, 224);
lv_obj_align(output, LV_ALIGN_CENTER, 0, 0);
Expand All @@ -29,7 +31,7 @@ void rd::ConsoleView::clear() {

void rd::ConsoleView::print(std::string str) {
stream << str;
lv_label_set_text(output, stream.str().c_str());
if (output) lv_label_set_text(output, stream.str().c_str());
}

void rd::ConsoleView::println(std::string str) { this->print(str + "\n"); }
3 changes: 2 additions & 1 deletion src/robodash/views/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

// ============================= Core Functions ============================= //

rd::ImageView::ImageView(std::string name, std::string path) : View(name) {
rd::ImageView::ImageView(std::string path, std::string name) : View(name) {
this->path = "S:" + path;
}

void rd::ImageView::initialize() {
if (!pros::usd::is_installed()) return;
lv_obj_t *image = lv_img_create(this->get_obj());
lv_img_set_src(image, path.c_str());
lv_obj_align(image, LV_ALIGN_CENTER, 0, 0);
Expand Down
4 changes: 3 additions & 1 deletion src/robodash/views/selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void r_select_act(lv_event_t *event) {
lv_obj_align(selected_label, LV_ALIGN_CENTER, 120, 0);
}

routine = selected_routine;
selected_routine = routine;
}

void done_act(lv_event_t *event) { selection_done = true; }
Expand All @@ -134,6 +134,8 @@ rd::SelectorView::SelectorView() : View("Auton Selector"){};
void rd::SelectorView::refresh() {}

void rd::SelectorView::initialize() {
lv_obj_set_style_bg_color(this->get_obj(), color_bg, 0);

routine_list = lv_list_create(this->get_obj());
lv_obj_set_size(routine_list, 228, 192);
lv_obj_align(routine_list, LV_ALIGN_BOTTOM_LEFT, 8, -8);
Expand Down

0 comments on commit 6e873c6

Please sign in to comment.