This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static org.lwjgl.opengl.GL11.*; | |
| import org.lwjgl.opengl.Display; | |
| public class Camera | |
| { | |
| private float x, y, scale; | |
| public Camera() | |
| { | |
| x = y = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void zoom(float scale) | |
| { | |
| this.scale += scale * this.scale; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void move(float x, float y) | |
| { | |
| x /= scale; | |
| y /= scale; | |
| this.x = x; | |
| this.y = y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void use() | |
| { | |
| glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0); | |
| glScalef(scale, scale, 1); | |
| glTranslatef(x, y, 0); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static org.lwjgl.opengl.GL11.*; | |
| import org.lwjgl.opengl.Display; | |
| public class Camera | |
| { | |
| private float x, y, scale; | |
| public Camera() | |
| { | |
| x = y = 0; |