Audio fix
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
#include <game/agame/player.hpp>
|
||||
#include <window/window.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace Game::AGame {
|
||||
void Player::start() {
|
||||
mSound = Object::Sound("../resources/example.wav", Object::Format::WAV);
|
||||
mSound.play();
|
||||
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(Window::Window::getSDLWindowBackend(), &w, &h);
|
||||
|
||||
mTransform.x = 640.f - (mTex->getWidth() / 2.f * mTransform.scaleX); // Start in the middle of the screen
|
||||
mTransform.y = 360.f - (mTex->getHeight() / 2.f * mTransform.scaleY);
|
||||
mTransform.x = w / 2.f - (mTex->getWidth() / 2.f * mTransform.scaleX * 0.25f); // Start in the middle of the screen
|
||||
mTransform.y = h / 2.f - (mTex->getHeight() / 2.f * mTransform.scaleY * 0.25f);
|
||||
mTransform.rotation = 0.f;
|
||||
|
||||
LOG("W: " << w << " H: " << h);
|
||||
}
|
||||
|
||||
void Player::update(float deltaTime) {
|
||||
@@ -18,6 +25,6 @@ namespace Game::AGame {
|
||||
//LOG(mName << " position: " << mTransform.x << ' ' << mTransform.y);
|
||||
//LOG("DeltaTime: " << deltaTime);
|
||||
mTransform.scaleX = 1.f + 1.f * std::sin(RUNNING_TIME() / 0.5f); // Pulsate scale for testing
|
||||
//mTransform.scaleY = 1.f + 1.f * std::sin(SDL_GetTicks() / 500.f);
|
||||
mTransform.scaleY = 1.f + 0.5f * std::cos(RUNNING_TIME() / 0.5f); // Pulsate scale for testing
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user