void InitializeMenuLayers(Window *window) { Layer *window_layer = window_get_root_layer(window); int i; for(i = 0; i < MAX_MENU_ENTRIES; ++i) { if(!menuLayersInitialized) { GRect menuFrame = baseMenuFrame; menuFrame.origin.y += i * WINDOW_ROW_HEIGHT; menuLayers[i] = InitializeTextLayer(menuFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); } layer_add_child(window_layer, text_layer_get_layer(menuLayers[i])); layer_set_hidden(text_layer_get_layer(menuLayers[i]), true); } if(!menuLayersInitialized) { // Init the text layer used to show the menu description menuDescLayer = InitializeTextLayer(menuDescFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); menuLayersInitialized = true; } layer_add_child(window_layer, text_layer_get_layer(menuDescLayer)); }
void InitializeMenuLayers(Window *window) { int i; for(i = 0; i < MAX_MENU_ENTRIES; ++i) { if(!menuLayersInitialized) { GRect menuFrame = baseMenuFrame; menuFrame.origin.y += i * WINDOW_ROW_HEIGHT; InitializeTextLayer(&menuLayers[i], menuFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); } layer_add_child(&window->layer, &menuLayers[i].layer); layer_set_hidden(&menuLayers[i].layer, true); } if(!menuLayersInitialized) { // Init the text layer used to show the menu description InitializeTextLayer(&menuDescLayer, menuDescFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); menuLayersInitialized = true; } layer_add_child(&window->layer, &menuDescLayer.layer); }
void InitializeHealthLayer(Window *window) { if(!healthLayersInitialized) { InitializeTextLayer(¤tHealthLayer, currentHealthFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); InitializeTextLayer(&maxHealthLayer, maxHealthFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); healthLayersInitialized = true; } layer_add_child(&window->layer, ¤tHealthLayer.layer); layer_add_child(&window->layer, &maxHealthLayer.layer); }
void InitializeHealthLayer(Window *window) { Layer *window_layer = window_get_root_layer(window); if(!healthLayersInitialized) { currentHealthLayer = InitializeTextLayer(currentHealthFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); maxHealthLayer = InitializeTextLayer(maxHealthFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); healthLayersInitialized = true; } layer_add_child(window_layer, text_layer_get_layer(currentHealthLayer)); layer_add_child(window_layer, text_layer_get_layer(maxHealthLayer)); }
void InitializeConfirmationWindow(Window *window, TextLayer *exitText, TextLayer *yesText, TextLayer *noText) { InitializeWindow(window, "Exit", true); InitializeTextLayer(exitText, exitFrame, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text(exitText, "Exit?"); text_layer_set_text_alignment(exitText, GTextAlignmentCenter); layer_add_child(&window->layer, &exitText->layer); InitializeTextLayer(yesText, yesFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); text_layer_set_text(yesText, "Yes"); layer_add_child(&window->layer, &yesText->layer); InitializeTextLayer(noText, noFrame, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); text_layer_set_text(noText, "No"); layer_add_child(&window->layer, &noText->layer); }
void InitializeLevelLayer(Window *window) { if(!levelLayerInitialized) { InitializeTextLayer(&levelLayer, levelFrame, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); levelLayerInitialized = true; } layer_add_child(&window->layer, &levelLayer.layer); }
void InitializeLevelLayer(Window *window) { Layer *window_layer = window_get_root_layer(window); if(!levelLayerInitialized) { levelLayer = InitializeTextLayer(levelFrame, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); levelLayerInitialized = true; } layer_add_child(window_layer, text_layer_get_layer(levelLayer)); }
void InitializeClockLayer(Window *window) { if(!clockLayerInitialized) { // Init the text layer used to show the time InitializeTextLayer(&clockLayer, clockFrame, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); clockLayerInitialized = true; UpdateClock(); } layer_add_child(&window->layer, &clockLayer.layer); }
void InitializeClockLayer(Window *window) { Layer *window_layer = window_get_root_layer(window); if(!clockLayerInitialized) { // Init the text layer used to show the time clockLayer = InitializeTextLayer(clockFrame, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); clockLayerInitialized = true; UpdateClock(); } layer_add_child(window_layer, text_layer_get_layer(clockLayer)); }
void InitializeMainLayers(Window *window) { int i; for(i = 0; i < MAX_MAIN_TEXT_LAYERS; ++i) { if(!mainLayersInitialized) { GRect localFrame = mainTextBaseFrame; localFrame.origin.y += i * WINDOW_ROW_HEIGHT; InitializeTextLayer(&mainTextLayers[i], localFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); localFrame = mainNumberBaseFrame; localFrame.origin.y += i * WINDOW_ROW_HEIGHT; InitializeTextLayer(&mainNumberLayers[i], localFrame, fonts_get_system_font(FONT_KEY_GOTHIC_14)); text_layer_set_text_alignment(&mainNumberLayers[i], GTextAlignmentRight); } layer_add_child(&window->layer, &mainTextLayers[i].layer); layer_set_hidden(&mainTextLayers[i].layer, true); layer_add_child(&window->layer, &mainNumberLayers[i].layer); layer_set_hidden(&mainNumberLayers[i].layer, true); } mainLayersInitialized = true; }