Esempio n. 1
0
static void window_load(Window *window) {
  Layer *root_layer = window_get_root_layer(window);

  if (persist_exists(PERSIST_KEY_ID_POMODORO)) {
    persist_read_data(PERSIST_KEY_ID_POMODORO, &pomodoro, sizeof(pomodoro));

  }
  if (persist_exists(PERSIST_KEY_ID_POMODORO_CYCLE)) {
    persist_read_data(PERSIST_KEY_ID_POMODORO_CYCLE, &pomodoro.cycle, sizeof(pomodoro.cycle));
  }
  if (persist_exists(PERSIST_KEY_ID_POMODORO_CYCLE_NOW)) {
    persist_read_data(PERSIST_KEY_ID_POMODORO_CYCLE_NOW, &pomodoro.timer, sizeof(pomodoro.timer));

    if (pomodoro.cycle <= pomodoro.timer) pomodoro.timer = -1;
  }

  tick_timer_service_subscribe(HOUR_UNIT | MINUTE_UNIT, tick_handler);

  // LOAD RESOURCE
  uint8_t resource_id = (uint8_t)RESOURCE_ID_HANNA_B;

  for (uint8_t i = 0; i < bitmaps_length; ++i) {
    bitmaps[i] = gbitmap_create_with_resource((uint8_t)(resource_id + i));
  }

  load_layers(root_layer);
}
Esempio n. 2
0
void Editor::load_sector(const std::string& name) {
  currentsector = level->get_sector(name);
  if(!currentsector) {
    size_t i = 0;
    currentsector = level->get_sector(i);
  }
  currentsector->activate("main");
  load_layers();
}
Esempio n. 3
0
///
/// See: https://github.com/bjorn/tiled/wiki/TMX-Map-Format
///      https://code.google.com/p/tmx-parser
///
/// NOTE
/// We don't support the TMX file format fully. The TmxParser library
/// can fully parse the files but we don't make use of all of these
/// attributes and have only parsed them if we need them.
///
bool MapLoader::load_map(const std::string source) {

	LOG(INFO) << "Loading map";
	map.ParseFile(source);

	if (map.HasError()) {
		LOG(ERROR) << map.GetErrorCode() << " " << map.GetErrorText();
		return false;
	}

	map_width = map.GetWidth();
	map_height = map.GetHeight();

	load_tileset();
	load_layers();

	return true;
}
Esempio n. 4
0
void Editor::load_sector(int id) {
  size_t i = id;
  currentsector = level->get_sector(i);
  currentsector->activate("main");
  load_layers();
}