Skip to content

Conversation

@mateolafalce
Copy link

draw_value_box could be render before loops. Others TODOs needs more logic

@jackpot51
Copy link
Member

Have you tested this?

@mateolafalce
Copy link
Author

Yes, it almost works in QEMU.

You could try moving the line of code deleted before the loop (right after let ui = Ui::new()?).

let draw_value_box = |display: &mut Display,
    x: i32,
    y: i32,
    value: &IfrTypeValueEnum,
    highlighted: bool|
   -> i32 {
   //TODO: Do not format in drawing loop
    let value_string = match value {
    IfrTypeValueEnum::U8(value) => format!("{value}"),
    IfrTypeValueEnum::U16(value) => format!("{value}"),
    IfrTypeValueEnum::U32(value) => format!("{value}"),
    IfrTypeValueEnum::U64(value) => format!("{value}"),
    IfrTypeValueEnum::Bool(value) => {
            return ui.draw_check_box(display, x, y, *value)
        }
        other => format!("{other:?}"),
    };

    // TODO: Do not render in drawing loop
    let rendered = ui.font.render(&value_string, font_size);
    ui.draw_text_box(display, x, y, &rendered, true, highlighted);
    rendered.height() as i32
};

The new line is the same but without //TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants