| | package org.example; |
---|
| | |
---|
| | import org.lwjgl.opengl.GL11; |
---|
| | import static org.lwjgl.glfw.GLFW.*; |
---|
| | import static org.lwjgl.opengl.GL11.*; |
---|
| | |
---|
| | public class ColorController implements IGameComponent { |
---|
| | private float red; |
---|
| | private float green; |
---|
| |
---|
| | this.setColor(0.0F, 0.0F, 0.0F); |
---|
| | } |
---|
| | |
---|
| | public void update() { |
---|
| | if (KeyInput.KeyDown(82)) { |
---|
| | if (KeyInput.KeyDown(GLFW_KEY_R)) { |
---|
| | this.setColor(1.0F, 0.0F, 0.0F); |
---|
| | System.out.println("R"); |
---|
| | } |
---|
| | |
---|
| | if (KeyInput.KeyPress(71)) { |
---|
| | if (KeyInput.KeyPress(GLFW_KEY_G)) { |
---|
| | this.setColor(0.0F, 1.0F, 0.0F); |
---|
| | System.out.println("G"); |
---|
| | } |
---|
| | |
---|
| | if (KeyInput.KeyUp(66)) { |
---|
| | if (KeyInput.KeyUp(GLFW_KEY_B)) { |
---|
| | this.setColor(0.0F, 0.0F, 1.0F); |
---|
| | System.out.println("B"); |
---|
| | } |
---|
| | |
---|
| | if (KeyInput.KeyUp(89)) { |
---|
| | if (KeyInput.KeyUp(GLFW_KEY_Y)) { |
---|
| | this.setColor(1.0F, 1.0F, 0.0F); |
---|
| | System.out.println("Y"); |
---|
| | } |
---|
| | |
---|
| |
---|
| | this.setColor(0.0F, 1.0F, 1.0F); |
---|
| | System.out.println("Custom"); |
---|
| | } |
---|
| | |
---|
| | GL11.glClearColor(this.getRed(), this.getGreen(), this.getBlue(), 0.0F); |
---|
| | glClearColor(this.getRed(), this.getGreen(), this.getBlue(), 0.0F); |
---|
| | } |
---|
| | |
---|
| | public float getRed() { |
---|
| | return this.red; |
---|
| |
---|
| | |