// // Created by Wouter Groeneveld on 02/08/18. // #include #include #include #include #include #include "sample_start_scene.h" #include "flying_stuff_scene.h" #include "lama.h" #include "sample_sound.h" std::vector SampleStartScene::backgrounds() { return {}; } std::vector SampleStartScene::sprites() { return { animation.get() }; } void SampleStartScene::load() { foregroundPalette = std::unique_ptr(new ForegroundPaletteManager(lama_palette, sizeof(lama_palette))); backgroundPalette = std::unique_ptr(new BackgroundPaletteManager()); SpriteBuilder builder; animation = builder .withData(lama_data, sizeof(lama_data)) .withSize(SIZE_32_32) .withAnimated(6, 3) .withLocation(50, 50) .buildPtr(); TextStream::instance().setText("PRESS START", 3, 8); engine->enqueueMusic(zelda_music_16K_mono, zelda_music_16K_mono_bytes); } void SampleStartScene::tick(u16 keys) { if(keys & KEY_START) { if(!engine->isTransitioning()) { engine->enqueueSound(zelda_secret_16K_mono, zelda_secret_16K_mono_bytes); TextStream::instance() << "entered: starting next scene"; engine->transitionIntoScene(new FlyingStuffScene(engine), new FadeOutScene(2)); } } else if(keys & KEY_LEFT) { animation->flipHorizontally(true); } else if(keys & KEY_RIGHT) { animation->flipHorizontally(false); } else if(keys & KEY_UP) { animation->flipVertically(true); } else if(keys & KEY_DOWN) { animation->flipVertically(false); } }