Skip to content

Commit

Permalink
Continuation of #1
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjglgamedev committed Aug 9, 2024
1 parent b46216a commit b4796a5
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 202 deletions.
12 changes: 2 additions & 10 deletions bookcontents/chapter-01/chapter-01.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,8 @@ public class MouseInput {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
public class MouseInput {

private final Vector2f currentPos;
private final Vector2f displVec;
private final Vector2f previousPos;
private Vector2f displVec;
private boolean inWindow;
private boolean leftButtonPressed;
private boolean rightButtonPressed;
Expand Down Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class MouseInput {

private final Vector2f currentPos;
private final Vector2f displVec;
private final Vector2f previousPos;
private boolean inWindow;
private boolean leftButtonPressed;
private final Vector2f previousPos;
private boolean rightButtonPressed;

public MouseInput(long windowHandle) {
Expand Down Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,8 @@ public void input() {
displVec.x = 0;
displVec.y = 0;
if (previousPos.x >= 0 && previousPos.y >= 0 && inWindow) {
double deltax = currentPos.x - previousPos.x;
double deltay = currentPos.y - previousPos.y;
boolean rotateX = deltax != 0;
boolean rotateY = deltay != 0;
if (rotateX) {
displVec.y = (float) deltax;
}
if (rotateY) {
displVec.x = (float) deltay;
}
displVec.x = currentPos.y - previousPos.y;
displVec.y = currentPos.x - previousPos.x;
}
previousPos.x = currentPos.x;
previousPos.y = currentPos.y;
Expand Down
Loading

0 comments on commit b4796a5

Please sign in to comment.