basic movement
This commit is contained in:
31
src/game/agame/background.cpp
Normal file
31
src/game/agame/background.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <game/agame/background.hpp>
|
||||
#include <window/window.hpp>
|
||||
|
||||
namespace Game::AGame {
|
||||
void Background::start() {
|
||||
mZIndex = -1; // Ensure background renders behind other entities
|
||||
mTex->setTiled(true); // Set the background texture to be tiled
|
||||
mTiledScale = 0.5f;
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(Window::Window::getSDLWindowBackend(), &w, &h);
|
||||
|
||||
mTransform.scaleX *= 10.f;
|
||||
mTransform.scaleY *= 10.f;
|
||||
|
||||
mTransform.x -= mTex->getWidth() * mTransform.adjustedScaleX() / 2.f;
|
||||
mTransform.y -= mTex->getHeight() * mTransform.adjustedScaleY() / 2.f;
|
||||
|
||||
LOG("W: " << w << " H: " << h);
|
||||
|
||||
mSound.~Sound();
|
||||
}
|
||||
|
||||
void Background::update(float deltaTime) {
|
||||
if (!mIsActive) return;
|
||||
//mTransform.rotation += 1.f; // Rotate clockwise for testing
|
||||
//mTransform.scaleX = 1.f + 1.f * std::sin(RUNNING_TIME() / 0.5f); // Pulsate scale for testing
|
||||
//mTransform.scaleY = 1.f + 0.5f * std::cos(RUNNING_TIME() / 0.5f); // Pulsate scale for testing
|
||||
|
||||
//Object::Camera::getInstance().move(1.f, 0.f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user