Beispiel #1
0
void LoadMainBmpImage(Window *window, int id)
{
	DEBUG_LOG("Loading Main resourceId %d.", id);
	int resourceId = id;
	
	Layer *window_layer = window_get_root_layer(window);
       
	if(!window)
	{
		DEBUG_LOG("Skipping image load due to window not yet available.");
		return;
	}

		
	if(mainImageLayerLoaded)
	{
		if(mainImageLayerResourceLoaded == resourceId)
		{
			layer_add_child(window_layer, bitmap_layer_get_layer(mainImageLayer));
			DEBUG_LOG("Already Loaded correct image");
			return; // already loaded the correct one.
		}
		UnloadMainBmpImage();
	}
	mainImage = gbitmap_create_with_resource(resourceId);
	mainImageLayer = bitmap_layer_create(mainFrame);
	bitmap_layer_set_bitmap(mainImageLayer, mainImage);
	bitmap_layer_set_alignment(mainImageLayer, GAlignCenter);
	layer_add_child(window_layer, bitmap_layer_get_layer(mainImageLayer));
	mainImageLayerLoaded = true;
	mainImageLayerResourceLoaded = resourceId;
	DEBUG_LOG("LOADED Main resourceId %d.", resourceId);
}
Beispiel #2
0
void LoadMainBmpImage(Window *window, int id, int floorId)
{
	int resourceId = id;
	
	Layer *window_layer = window_get_root_layer(window);
	
#if DISABLE_MENU_BMPS
	return;
#endif
	
	if(!window)
	{
		DEBUG_LOG("Skipping image load due to window not yet available.");
		return;
	}
		
	if(mainImageLoaded)
	{
		if(mainImageResourceLoaded == resourceId)
		{
			DEBUG_LOG("Resource %d already loaded.", resourceId);
			if(floorImageLoaded)
				layer_add_child(window_layer, bitmap_layer_get_layer(floorImage));
			layer_add_child(window_layer, bitmap_layer_get_layer(mainImage));
			return; // already loaded the correct one.
		}
		DEBUG_LOG("Unloading resourceId %d.", mainImageResourceLoaded);
		UnloadMainBmpImage();
	}
	
	DEBUG_LOG("Loading resourceId %d.", resourceId);

#if defined(PBL_COLOR)
	if(floorId >= 0)
	{
		floorImageBitmap = gbitmap_create_with_resource(floorId);
		floorImage = bitmap_layer_create(mainFrame);
		bitmap_layer_set_bitmap(floorImage, floorImageBitmap);
		bitmap_layer_set_alignment(floorImage, GAlignCenter);
		layer_add_child(window_layer, bitmap_layer_get_layer(floorImage));
		floorImageLoaded = true;
	}
#endif

	ProfileLogStart("LoadMainBmpImage");
	mainImageBitmap = gbitmap_create_with_resource(resourceId);
	mainImage = bitmap_layer_create(mainFrame);
	bitmap_layer_set_bitmap(mainImage, mainImageBitmap);
	bitmap_layer_set_alignment(mainImage, GAlignCenter);
#if defined(PBL_COLOR)
	bitmap_layer_set_compositing_mode(mainImage, GCompOpSet);
#endif
	layer_add_child(window_layer, bitmap_layer_get_layer(mainImage));
	mainImageLoaded = true;
	mainImageResourceLoaded = resourceId;
	ProfileLogStop("LoadMainBmpImage");
}
Beispiel #3
0
void handle_deinit() 
{
	INFO_LOG("Cleaning up on exit.");
	SavePersistedData();
	UnloadBackgroundImage();
	UnloadMainBmpImage();
	UnloadTextLayers();
	tick_timer_service_unsubscribe();
	app_focus_service_unsubscribe();
#if ALLOW_WORKER_APP
	AppDying(ClosingWhileInBattle());
	app_worker_message_unsubscribe();
#endif
}
Beispiel #4
0
void LoadMainBmpImage(Window *window, int id)
{
	int resourceId = id;
	
	if(!window)
		return;
		
	if(mainImageLoaded)
	{
		if(mainImageResourceLoaded == resourceId)
		{
			layer_add_child(&window->layer, &mainImage.layer.layer);
			return; // already loaded the correct one.
		}
		UnloadMainBmpImage();
	}
	bmp_init_container(resourceId, &mainImage);
	layer_set_frame(&mainImage.layer.layer, mainFrame);
	layer_add_child(&window->layer, &mainImage.layer.layer);
	mainImageLoaded = true;
	mainImageResourceLoaded = resourceId;
}
Beispiel #5
0
void LoadMainBmpImage(Window *window, int id)
{
	int resourceId = id;
	
	Layer *window_layer = window_get_root_layer(window);
	
#if DISABLE_MENU_BMPS
	return;
#endif
	
	if(!window)
	{
		DEBUG_LOG("Skipping image load due to window not yet available.");
		return;
	}
		
	if(mainImageLoaded)
	{
		if(mainImageResourceLoaded == resourceId)
		{
			DEBUG_LOG("Resource %d already loaded.", resourceId);
			layer_add_child(window_layer, bitmap_layer_get_layer(mainImage));
			return; // already loaded the correct one.
		}
		DEBUG_LOG("Unloading resourceId %d.", mainImageResourceLoaded);
		UnloadMainBmpImage();
	}
	
	DEBUG_LOG("Loading resourceId %d.", resourceId);

	mainImageBitmap = gbitmap_create_with_resource(resourceId);
	mainImage = bitmap_layer_create(mainFrame);
	bitmap_layer_set_bitmap(mainImage, mainImageBitmap);
	bitmap_layer_set_alignment(mainImage, GAlignCenter);
	layer_add_child(window_layer, bitmap_layer_get_layer(mainImage));
	mainImageLoaded = true;
	mainImageResourceLoaded = resourceId;
}
Beispiel #6
0
void handle_deinit(AppContextRef ctx) {
	(void)ctx;

	UnloadBackgroundImage();
	UnloadMainBmpImage();
}