Ejemplo n.º 1
0
static void in_received_handler(DictionaryIterator *iter, void *context) {
  Tuple *tuple = dict_read_first(iter);
  while (tuple) {   
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Pebble received message with key %u", (unsigned)tuple->key);
    switch (tuple->key) {
      case 3:
        APP_LOG(APP_LOG_LEVEL_DEBUG, "Pebble received message requesting value update");
        sendDefaultsToJS();
        return; // don't save values on request  
      case 0:
        APP_LOG(APP_LOG_LEVEL_DEBUG, "Pebble received message with new background value");
        backgroundBlack = tuple->value->int8;
        break;
      case 1:
        APP_LOG(APP_LOG_LEVEL_DEBUG, "Pebble received message with new show day value");
        showDay = tuple->value->int8;
        break;
    }
    tuple = dict_read_next(iter);
  }
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Pebble received message: background=%d, showDay=%d", backgroundBlack, showDay);
  
  // If not MSG_KEY_REQ_VALUES, then really expect both other keys to be present
  setupBackground();
  drawCurrentTime();
  savePersistentValues();
}                
Ejemplo n.º 2
0
void StateLevel::setupLevel() {
    LevelData data = GAME_MANAGER.getLevelData();

    setupBackground( data );
    setupGrid( data );
    setupTHolder();
}
Ejemplo n.º 3
0
GameOverLayer::GameOverLayer(int score){
	CCLayer::init();	
	this->setTouchEnabled(true);
	setupBackground();
	setupScore(score);
	setupButtons();
}
Ejemplo n.º 4
0
void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petControl) {
	if (petControl) {
		CString numStr = "3";
		int mode = petControl->getPassengerClass();
		if (mode <= 3) {
			numStr = CString(mode);
		} else if (mode == 4) {
			mode = petControl->getPriorClass();
			if (mode == 1) {
				numStr = CString(mode);
			}
		}

		CString fullName = numStr + name;
		setupBackground(fullName, petControl);
	}
}
Ejemplo n.º 5
0
static void init() {
  window = window_create();
  window_set_background_color(window, GColorBlack);   
  app_message_open(64, 64);

  window_stack_push(window, true);
                                       
  loadPersistentValues();     

  app_message_register_inbox_received(in_received_handler);
  app_message_register_outbox_failed(out_failed_handler);
  sendDefaultsToJS();
                                         
  // initialize layer for day text
  GFont font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_NEVIS_20));
  Layer *root_layer = window_get_root_layer(window);
  GRect frame = layer_get_frame(root_layer); 
  firstLayer = layer_create(frame);
  layer_add_child(root_layer, firstLayer);
  
  setupBackground();
  
  //todo - make text layer conditional on show date
  dayLayer = text_layer_create((GRect) { .origin = { 0, frame.size.h-20 -DATE_OFFSET}, .size = { frame.size.w-DATE_OFFSET, 20 } });