Browse Source

Tween level selection screen

master
C. J. Howard 7 years ago
parent
commit
fa09653171
4 changed files with 12 additions and 7 deletions
  1. +1
    -1
      data
  2. +7
    -5
      src/application.cpp
  3. +3
    -0
      src/configuration.hpp.in
  4. +1
    -1
      src/states/level-select-state.cpp

+ 1
- 1
data

@ -1 +1 @@
Subproject commit 698ccda0e290629d871cdc92eb701789ac7d0f9c
Subproject commit 3335c35bc91dedb10a91f1528913354a7b7657e7

+ 7
- 5
src/application.cpp View File

@ -1587,7 +1587,7 @@ void Application::selectLevel(std::size_t index)
// Perform tweening
for (int i = 0; i < 5; ++i)
{
levelPlaceholderModelInstances[i].setTranslation(Vector3(4.0f, 0.0f, 0.0f) * static_cast<float>(previewLevelIndices[i]));
levelPlaceholderModelInstances[i].setTranslation(Vector3(ANTKEEPER_LEVEL_SPACING, 0.0f, 0.0f) * static_cast<float>(previewLevelIndices[i]));
}
}
@ -1598,10 +1598,11 @@ void Application::selectNextLevel()
selectLevel(currentLevelIndex + 1);
// Setup camera tween
Vector3 difference = Vector3(ANTKEEPER_LEVEL_SPACING * currentLevelIndex, camera.getTranslation().y, camera.getTranslation().z) - camera.getTranslation();
cameraTranslationTween->setTime(0.0f);
cameraTranslationTween->setDuration(0.125f);
cameraTranslationTween->setDuration(0.5f);
cameraTranslationTween->setStartValue(camera.getTranslation());
cameraTranslationTween->setDeltaValue(Vector3(4.0f, 0.0f, 0.0f));
cameraTranslationTween->setDeltaValue(difference);
cameraTranslationTween->setUpdateCallback(std::bind(&SceneObject::setTranslation, &camera, std::placeholders::_1));
cameraTranslationTween->start();
}
@ -1614,10 +1615,11 @@ void Application::selectPreviousLevel()
selectLevel(currentLevelIndex - 1);
// Setup camera tween
Vector3 difference = Vector3(ANTKEEPER_LEVEL_SPACING * currentLevelIndex, camera.getTranslation().y, camera.getTranslation().z) - camera.getTranslation();
cameraTranslationTween->setTime(0.0f);
cameraTranslationTween->setDuration(0.125f);
cameraTranslationTween->setDuration(0.5f);
cameraTranslationTween->setStartValue(camera.getTranslation());
cameraTranslationTween->setDeltaValue(Vector3(-4.0f, 0.0f, 0.0f));
cameraTranslationTween->setDeltaValue(difference);
cameraTranslationTween->setUpdateCallback(std::bind(&SceneObject::setTranslation, &camera, std::placeholders::_1));
cameraTranslationTween->start();
}

+ 3
- 0
src/configuration.hpp.in View File

@ -31,4 +31,7 @@ const float ANTKEEPER_TERRAIN_WIDTH = 50.0f;
const float ANTKEEPER_TERRAIN_BASE_HEIGHT = 35.7f;
const float ANTKEEPER_TERRAIN_DEPTH = 50.0f;
// Level selection
const float ANTKEEPER_LEVEL_SPACING = 4.5f;
#endif // CONFIGURATION_HPP

+ 1
- 1
src/states/level-select-state.cpp View File

@ -34,7 +34,7 @@ void LevelSelectState::enter()
ModelInstance* instance = &application->levelPlaceholderModelInstances[i];
application->defaultLayer->addObject(instance);
}
application->camera.lookAt(Vector3(0, 10, 20), Vector3(0, 1, 0), Vector3(0, 1, 0));
application->camera.lookAt(Vector3(0, 8, 12), Vector3(0, 1, 0), Vector3(0, 1, 0));
application->selectLevel(0);

Loading…
Cancel
Save