예제 #1
0
파일: image.cpp 프로젝트: mattl/anaconda
void preload_images()
{
    double start_time = platform_get_time();
#if !defined(CHOWDREN_IS_DESKTOP) && !defined(CHOWDREN_IS_ANDROID)
#if defined(CHOWDREN_PRELOAD_IMAGES) || defined(CHOWDREN_PRELOAD_ALL)
    AssetFile fp;
    fp.open();
    FileStream stream(fp);

#ifdef CHOWDREN_IS_3DS
    Render::set_storage(true);
#endif
    for (int i = 0; i < IMAGE_COUNT; i++) {
        unsigned short handle = stream.read_uint16();
        Image * image = get_internal_image(handle);
        image->upload_texture();
#if !defined(CHOWDREN_PRELOAD_ALL) && defined(CHOWDREN_IS_3DS)
        if (Render::is_vram_full())
            break;
#endif
        image->set_static();
    }

#ifdef CHOWDREN_IS_3DS
    Render::set_storage(false);
#endif

#endif
#endif
    double dt = platform_get_time() - start_time;
    std::cout << "Image preload took " << dt << std::endl;
}
예제 #2
0
파일: media.cpp 프로젝트: mattl/anaconda
void Media::init()
{
    ChowdrenAudio::open_audio();

    double start_time = platform_get_time();

    AssetFile fp;
    fp.open();

#ifdef CHOWDREN_IS_WIIU
    // experimental code to load faster
    unsigned int start = AssetFile::get_offset(0, AssetFile::SOUND_DATA);
    unsigned int size = AssetFile::get_size(AssetFile::SOUND_DATA);
    startup_data = new unsigned char[size];
    startup_size = size;
    fp.seek(start);
	fp.read(startup_data, size);

    for (int i = 0; i < SOUND_COUNT; i++) {
        add_cache(i);
    }

	delete[] startup_data;
#else
    for (int i = 0; i < SOUND_COUNT; i++) {
        fp.set_item(i, AssetFile::SOUND_DATA);
        add_cache(i, fp);
    }
#endif

    std::cout << "Sound bank took " << (platform_get_time() - start_time)
        << std::endl;
}
예제 #3
0
bool load_fonts(FontList & fonts)
{
    AssetFile fp;
    fp.open();
    FileStream stream(fp);

    for (int i = 0; i < FONT_COUNT; i++) {
        fp.set_item(i, AssetFile::FONT_DATA);
        unsigned int count = stream.read_uint32();
        for (unsigned int i = 0; i < count; i++) {
            FTTextureFont * font = new FTTextureFont(stream);
            fonts.push_back(font);
        }
    }
    return fonts.size() > 0;
}
예제 #4
0
void preload_images()
{
#ifndef CHOWDREN_IS_DESKTOP
#if defined(CHOWDREN_PRELOAD_IMAGES) || defined(CHOWDREN_PRELOAD_ALL)
    AssetFile fp;
    fp.open();
    FileStream stream(fp);

    glc_set_storage(true);
    for (int i = 0; i < IMAGE_COUNT; i++) {
        unsigned short handle = stream.read_uint16();
        Image * image = get_internal_image(handle);
        image->upload_texture();
#ifndef CHOWDREN_PRELOAD_ALL
        if (glc_is_vram_full())
            break;
#endif
        image->set_static();
    }
    glc_set_storage(false);
#endif
#endif
}
예제 #5
0
void open_image_file()
{
    if (image_file.is_open())
        return;
    image_file.open();
}