static void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); //hostname text layer hostname_text = text_layer_create(GRect(0, 0, 144, 20)); layer_add_child(window_layer, text_layer_get_layer(hostname_text)); text_layer_set_text(hostname_text, DEFAULT_HOST); //cpu layers cpu_usage_text = text_layer_create(GRect(0, 20, 144, 20)); layer_add_child(window_layer, text_layer_get_layer(cpu_usage_text)); text_layer_set_text(cpu_usage_text, "CPU Usage"); progress_bar_cpu = progress_bar_layer_create(40); //function takes y-pos as argument layer_add_child(window_layer, progress_bar_cpu); //mem layers mem_usage_text = text_layer_create(GRect(0, 60, 144, 20)); layer_add_child(window_layer, text_layer_get_layer(mem_usage_text)); text_layer_set_text(mem_usage_text, "Mem Usage"); progress_bar_mem = progress_bar_layer_create(80); layer_add_child(window_layer, progress_bar_mem); //ip text layer ip_text = text_layer_create(GRect(0, 100, 144, 20)); layer_add_child(window_layer, text_layer_get_layer(ip_text)); text_layer_set_text(ip_text, "IP Address"); //port text layer port_text = text_layer_create(GRect(0, 115, 54, 20)); layer_add_child(window_layer, text_layer_get_layer(port_text)); text_layer_set_text(port_text, "Port"); //debug text layer debug_text = text_layer_create(GRect(50, 120, 94, 20)); layer_add_child(window_layer, text_layer_get_layer(debug_text)); text_layer_set_text(debug_text, "DEBUG"); //Inverter layer iLayer = inverter_layer_create(GRect(0, 0, 144, 152)); layer_add_child(window_layer, inverter_layer_get_layer(iLayer)); }
static void main_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); s_instruction_text = text_layer_create(GRect(0, 0, 144, 73)); layer_add_child(window_layer, text_layer_get_layer(s_instruction_text)); text_layer_set_text(s_instruction_text, "[UP] increase speed\n[SEL] reset\n[DN] decrease speed"); s_progress_bar = progress_bar_layer_create(); layer_add_child(window_layer, s_progress_bar); s_done_text = text_layer_create(GRect(50, 74, 94, 20)); layer_add_child(window_layer, text_layer_get_layer(s_done_text)); // Start the progress timer s_progress_timer = app_timer_register(s_current_speed, progress_timer_callback, NULL); }
void init(void) { window = window_create(); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); window_stack_push(window, true /* Animated */); instruction_text = text_layer_create(GRect(0, 0, 144, 73)); layer_add_child(window_get_root_layer(window), text_layer_get_layer(instruction_text)); text_layer_set_text(instruction_text, "[UP] increase speed\n[SEL] reset\n[DN] decrease speed"); progress_bar = progress_bar_layer_create(); layer_add_child(window_get_root_layer(window), progress_bar); done_text = text_layer_create(GRect(50, 74, 94, 20)); layer_add_child(window_get_root_layer(window), text_layer_get_layer(done_text)); // Start the progress timer progress_timer = app_timer_register(s_current_speed /* milliseconds */, progress_timer_callback, NULL); }