@@ -75,9 +75,9 @@ namespace menu {
7575 data (args)
7676 {}
7777
78- template <typename Font, typename FrameBuffer, uint32_t BufferSize >
79- void draw (FrameBuffer& fb, const klib::vector2u& offset, const uint32_t selected, char option[Count][BufferSize] ,
80- const klib::graphics::color foreground, const klib::graphics::color background, const bool hidden[Count] = {} )
78+ template <typename Font, typename FrameBuffer>
79+ void draw (FrameBuffer& fb, const klib::vector2u& offset, const uint32_t selected, const char ** option,
80+ const klib::graphics::color foreground, const klib::graphics::color background, const bool * hidden)
8181 {
8282 uint32_t onscreen_index = 0 ;
8383 uint32_t hidden_by_scroll = 0 ;
@@ -127,29 +127,32 @@ namespace menu {
127127 // move the onscreen index
128128 onscreen_index++;
129129
130- // // check if we need to show a option for the current item
131- // if (option == nullptr || option[i] == nullptr) {
132- // // skip if we dont have one
133- // continue;
134- // }
135-
136- // // get the length of the option string
137- // const uint32_t len = klib::string::strlen(option[i]);
138-
139- // // check if the string has any length
140- // if (!len) {
141- // continue;
142- // }
143-
144- // // write the value to the display
145- // writer.draw(
146- // fb, option[i],
147- // klib::vector2i{
148- // static_cast<int32_t>(Width - line_boarder_pixels + (len * 8)),
149- // static_cast<int32_t>(3 + position_index * line_boarder_pixels)
150- // } - offset.cast<int32_t>(),
151- // col_foreground, klib::graphics::transparent
152- // );
130+ // check if we need to show a option for the current item
131+ if (option == nullptr || option[i] == nullptr ) {
132+ // skip if we dont have one
133+ continue ;
134+ }
135+
136+ // get the length of the option string
137+ const uint32_t len = klib::string::strnlen (option[i], sizeof (string));
138+
139+ // check if the string has any length
140+ if (!len || (len == sizeof (string))) {
141+ continue ;
142+ }
143+
144+ // write the value to the display
145+ Font::template draw (
146+ fb, option[i],
147+ klib::vector2i{
148+ static_cast <int32_t >(Width - (line_boarder_pixels + (Font::font::width * len))),
149+ static_cast <int32_t >(
150+ boarder_pixels + (boarder_pixels / 2 ) +
151+ (position_index * line_pixels)
152+ )
153+ } - offset.cast <int32_t >(),
154+ col_foreground, klib::graphics::transparent
155+ );
153156 }
154157
155158 // check if we need to clear parts of the screen
0 commit comments