steps callback test
This commit is contained in:
parent
620c17c150
commit
2de3f0ddc6
@ -80,6 +80,7 @@ void AssetsLoader::addDefaults(AssetsLoader& loader, const Content* content) {
|
||||
loader.add(ASSET_TEXTURE, TEXTURES_FOLDER"/misc/moon.png", "misc/moon");
|
||||
loader.add(ASSET_TEXTURE, TEXTURES_FOLDER"/misc/sun.png", "misc/sun");
|
||||
loader.add(ASSET_TEXTURE, TEXTURES_FOLDER"/gui/crosshair.png", "gui/crosshair");
|
||||
loader.add(ASSET_SOUND, SOUNDS_FOLDER"/steps/grass.ogg", "steps/grass");
|
||||
|
||||
addLayouts(0, "core", loader.getPaths()->getMainRoot()/fs::path("layouts"), loader);
|
||||
for (auto& entry : content->getPacks()) {
|
||||
|
||||
@ -100,6 +100,25 @@ LevelScreen::LevelScreen(Engine* engine, Level* level) : Screen(engine) {
|
||||
worldRenderer = std::make_unique<WorldRenderer>(engine, frontend.get(), controller->getPlayer());
|
||||
hud = std::make_unique<Hud>(engine, frontend.get(), controller->getPlayer());
|
||||
|
||||
controller->getPlayerController()->listenBlockInteraction(
|
||||
[=](Player*, glm::ivec3 pos, const Block* def, BlockInteraction type) {
|
||||
if (type != BlockInteraction::step) {
|
||||
return;
|
||||
}
|
||||
auto sound = assets->getSound("steps/grass");
|
||||
audio::play(
|
||||
sound,
|
||||
glm::vec3(),
|
||||
true,
|
||||
1.0f,
|
||||
1.0f,
|
||||
false,
|
||||
audio::PRIORITY_LOW,
|
||||
audio::get_channel_index("regular")
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
backlight = settings.graphics.backlight;
|
||||
|
||||
animator = std::make_unique<TextureAnimator>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user