Browse Source

Fixed bug: angle converted to int radians

master v1.0.4
Kenneth Bruen 3 years ago
parent
commit
0897cb3b3f
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 11
      examples/maze4.txt
  2. 8
      src/maze.cpp
  3. 2
      y3s2-gui-project.spec

11
examples/maze4.txt

@ -0,0 +1,11 @@
XXXXXXXXX
X X
XXX XX X
X X
X X XX X
X X X
X XXX XXX
X X
XXXXXX X
X X
XXXXXXXXX

8
src/maze.cpp

@ -25,9 +25,9 @@ void MazeScreen::display() {
posX,
0,
posZ,
posX + cos(Utils::toRad(angleX)) * 3,
posX + cos(Utils::toRad<float>(angleX)) * 3,
0,
posZ - sin(Utils::toRad(angleX)) * 3,
posZ - sin(Utils::toRad<float>(angleX)) * 3,
0,
1,
0
@ -115,8 +115,8 @@ void MazeScreen::idle() {
auto deltaTime = (newTime - gameTime) / 1000.0;
gameTime = newTime;
posX += forceX * deltaTime * cos(Utils::toRad(angleX)) + forceZ * deltaTime * sin(Utils::toRad(angleX));
posZ += forceZ * deltaTime * cos(Utils::toRad(angleX)) - forceX * deltaTime * sin(Utils::toRad(angleX));
posX += forceX * deltaTime * cos(Utils::toRad<float>(angleX)) + forceZ * deltaTime * sin(Utils::toRad<float>(angleX));
posZ += forceZ * deltaTime * cos(Utils::toRad<float>(angleX)) - forceX * deltaTime * sin(Utils::toRad<float>(angleX));
glutPostRedisplay();
}

2
y3s2-gui-project.spec

@ -1,5 +1,5 @@
Name: y3s2-gui-project
Version: 1.0.3
Version: 1.0.4
Release: 1%{?dist}
Summary: Maze project in OpenGL for Graphics and User Interfaces lecture in year 3, semester 2

Loading…
Cancel
Save