Only provide 2 options for side lengths (force the use of a specific trig function)

This commit is contained in:
2026-08-07 00:38:38 -04:00
parent 9c81f1a640
commit 685f2b5aaf
+26 -23
View File
@@ -378,7 +378,13 @@ static void alarm_highlight_layer_update_proc(Layer *layer, GContext *ctx) {
}
static uint16_t menu_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *context) {
return 3;
switch (s_highlight_pos) {
case 0:
case 1:
return 3;
default:
return 2;
}
}
static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
@@ -440,28 +446,6 @@ static void alarm_window_load() {
// change highlight color to avoid changing color of bottom bar
s_setter_highlight_color = s_primary_color;
// determine trigonometric function options
s_sin = s_sin_arr[rand() % 2];
s_cos = s_cos_arr[rand() % 2];
s_tan = s_tan_arr[rand() % 2];
// set up menu options
s_options_function[0] = s_sin;
s_options_function[1] = s_cos;
s_options_function[2] = s_tan;
s_options_over[0] = "1"; // TODO
s_options_over[1] = "2"; // TODO
s_options_over[2] = "3"; // TODO
s_options_under[0] = "1"; // TODO
s_options_under[1] = "2"; // TODO
s_options_under[2] = "3"; // TODO
// drop window
s_drop_window = window_create(); // TODO destroy on window unload?
window_set_window_handlers(
s_drop_window,
(WindowHandlers){.unload = drop_menu_window_unload});
// top&bottom bars
add_bar_layers_to_window(window_layer);
@@ -551,6 +535,25 @@ static void alarm_window_load() {
s_triangle_layer = triangle_layer_create(GRect(0, s_top_bar_grect.size.h + 1, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT - (s_top_bar_grect.size.h * 2)), GColorBlack);
layer_add_child(window_layer, s_triangle_layer->layer);
// drop menus
//// determine trigonometric function options
s_sin = s_sin_arr[rand() % 2];
s_cos = s_cos_arr[rand() % 2];
s_tan = s_tan_arr[rand() % 2];
//// set up menu options
s_options_function[0] = s_sin;
s_options_function[1] = s_cos;
s_options_function[2] = s_tan;
s_options_over[0] = "1";
s_options_over[1] = "2";
s_options_under[0] = "1";
s_options_under[1] = "2";
//// create drop window
s_drop_window = window_create(); // TODO destroy on window unload?
window_set_window_handlers(
s_drop_window,
(WindowHandlers){.unload = drop_menu_window_unload});
schedule_fallback_alarm();
tick_timer_service_subscribe(SECOND_UNIT, alarm_seconds_handler);
}