//------------------------------------------------------------------------------------- void Cellapp::handleGameTick() { AUTO_SCOPED_PROFILE("gameTick"); updateLoad(); EntityApp<Entity>::handleGameTick(); updatables_.update(); }
int Menu::update(gdl::Input & input_) { int ret; if (input_.isKeyDown(gdl::Keys::Back) && this->which != 0) this->which = 0; if (this->which == 0) ret = updateMain(input_); else if (this->which == 1) ret = updateNew(input_); else if (this->which == 2) ret = updateLoad(input_); else if (this->which == 3) ret = updatePlayer(input_); return (ret); }
// App Message API static void in_received_handler(DictionaryIterator *iter, void *context){ if (debugMode) APP_LOG(APP_LOG_LEVEL_INFO, "Message received!"); // Get the first pair Tuple *t = dict_read_first(iter); // Long lived buffers static char roadName_buffer[60]; static char roadCode_buffer[6]; static char busService_buffer[5]; static int loadC, loadN; static char arrC_data_buffer[10]; static char arrN_data_buffer[10]; static bool pgLoad = false, pgMaxLoad = false; static int8_t wabC, wabN; // Process all pairs present while(t != NULL) { // Process this pair's key switch (t->key) { case MESSAGE_DATA_EVENT: APP_LOG(APP_LOG_LEVEL_INFO, "Data received for Dictionary %hu", t->value->int16); APP_LOG(APP_LOG_LEVEL_INFO, "Dictionary Size: %lu", dict_size(iter)); break; case MESSAGE_ROAD_NAME: snprintf(roadName_buffer, sizeof(roadName_buffer), "%s", t->value->cstring); text_layer_set_text(textlayer_busstop_name, roadName_buffer); break; case MESSAGE_ROAD_CODE: snprintf(roadCode_buffer, sizeof(roadCode_buffer), "%s", t->value->cstring); text_layer_set_text(textlayer_busstop_code, roadCode_buffer); break; case MESSAGE_BUS_SERVICE: snprintf(busService_buffer, sizeof(busService_buffer), "%s", t->value->cstring); text_layer_set_text(textlayer_bus_no, busService_buffer); break; case ESTIMATE_ARR_CURRENT_DATA: snprintf(arrC_data_buffer, sizeof(arrC_data_buffer), "%s", t->value->cstring); text_layer_set_text(textlayer_arrive_now, arrC_data_buffer); break; case ESTIMATE_ARR_NEXT_DATA: snprintf(arrN_data_buffer, sizeof(arrN_data_buffer), "%s", t->value->cstring); text_layer_set_text(textlayer_arrive_next, arrN_data_buffer); break; case MESSAGE_CURRENT_FAV: current = t->value->int16; pgLoad = true; break; case MESSAGE_MAX_FAV: max = t->value->int16; pgMaxLoad = true; break; case ESTIMATE_LOAD_CURRENT_DATA: loadC = t->value->int16; updateLoad(loadC, 1); break; case ESTIMATE_LOAD_NEXT_DATA: loadN = t->value->int16; updateLoad(loadN, 2); break; //s_res_bus_wheelchair_accessible //bitmap_wab_now //bitmap_wab_next case MESSAGE_WAB_CURRENT: wabC = t->value->int8; if (debugMode) APP_LOG(APP_LOG_LEVEL_INFO, "Current Has WAB: %i", wabC); if (wabC == 1) bitmap_layer_set_bitmap(bitmap_wab_now, bus_wheelchair_accessible); break; case MESSAGE_WAB_NEXT: wabN = t->value->int8; if (debugMode) APP_LOG(APP_LOG_LEVEL_INFO, "Next Has WAB: %i", wabN); if (wabN == 1) bitmap_layer_set_bitmap(bitmap_wab_next, bus_wheelchair_accessible); break; //No Favourites? Tell them too case ERROR_NO_DATA: text_layer_set_text(textlayer_debug, "No Favourites"); break; } //Handle paging static char paging_buffer[10]; if (pgLoad && pgMaxLoad){ snprintf(paging_buffer, sizeof(paging_buffer), "%d/%d", current, max); text_layer_set_text(textlayer_pages, paging_buffer); } // Get next pair, if any t = dict_read_next(iter); } }