Audio Abstrakcija - WIP
This commit is contained in:
@@ -2,26 +2,22 @@
|
||||
|
||||
namespace Game::AGame {
|
||||
void Player::start() {
|
||||
LOG("Created the Player");
|
||||
mSound = Object::Sound("../resources/example.wav", Object::Format::WAV);
|
||||
mSound.play();
|
||||
|
||||
if (mTex && mTex->getId() == "Roboto") {
|
||||
LOG("Player texture is a font");
|
||||
// Treat as Font and build it
|
||||
std::shared_ptr<Renderer::Font> font = std::dynamic_pointer_cast<Renderer::Font>(mTex);
|
||||
if (font) {
|
||||
font->build({255, 255, 255, 255}, "Hello, World!");
|
||||
} else {
|
||||
ERROR("Failed to cast texture to font");
|
||||
}
|
||||
}
|
||||
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.rotation = 0.f;
|
||||
}
|
||||
|
||||
void Player::update(float deltaTime) {
|
||||
if (!mIsActive) return;
|
||||
//LOG("Updated Player");
|
||||
mTransform.x += 1.f; // Move right at a constant speed for testing
|
||||
//mTransform.x += 1.f; // Move right at a constant speed for testing
|
||||
mTransform.rotation += 1.f; // Rotate clockwise for testing
|
||||
//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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user