From 2d640cae21e56507e9542dc5707c2f6b1223407f Mon Sep 17 00:00:00 2001 From: Joakim Hunskaar <joakim.borge.hunskar@gmail.com> Date: Tue, 11 Jun 2024 18:24:59 +0200 Subject: [PATCH] edited testproject --- dependencies/testproject_featuredemo.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dependencies/testproject_featuredemo.cpp b/dependencies/testproject_featuredemo.cpp index 7c6eb88..74219b2 100644 --- a/dependencies/testproject_featuredemo.cpp +++ b/dependencies/testproject_featuredemo.cpp @@ -65,8 +65,8 @@ int main(int argc, char* argv[]) { std::vector<Ball> circles; circles.resize(5000); for (unsigned int i = 0; i < circles.size(); i++) { - circles.at(i).x = randint(0, window.width()); - circles.at(i).y = randint(0, window.height()); + circles.at(i).x = randint(0, window.get_width()); + circles.at(i).y = randint(0, window.get_height()); circles.at(i).radius = randint(5, 10); circles.at(i).xSpeed = float(randint(-400, 400)) / 100.0f; circles.at(i).ySpeed = float(randint(-400, 400)) / 100.0f; @@ -94,8 +94,8 @@ int main(int argc, char* argv[]) { window.draw_image(mousePosition, image); bool allAtCenter = true; for (Ball& ball : circles) { - float gravityX = (float(window.width()) / 2.0f) - ball.x; - float gravityY = (float(window.height()) / 2.0f) - ball.y; + float gravityX = (float(window.get_width()) / 2.0f) - ball.x; + float gravityY = (float(window.get_height()) / 2.0f) - ball.y; float absoluteSpeed = std::max(std::sqrt(gravityX * gravityX + gravityY * gravityY), 3.0f); const float gravity = 0.07f; ball.xSpeed += (gravityX / absoluteSpeed) * gravity; @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) { } else if(ball.y + ball.radius < 0) { ball.y = window.h() + ball.radius; }*/ - if ((std::abs(ball.x - float(window.width()) / 2.0f) > 1.0f) && (std::abs(ball.y - float(window.height()) / 2.0f) > 1.0f)) { + if ((std::abs(ball.x - float(window.get_width()) / 2.0f) > 1.0f) && (std::abs(ball.y - float(window.get_height()) / 2.0f) > 1.0f)) { allAtCenter = false; } window.draw_circle({int(ball.x), int(ball.y)}, ball.radius, ball.colour, TDT4102::Color::black); -- GitLab