diff --git a/GameEngine/src/main/java/org/example/ColorController.java b/GameEngine/src/main/java/org/example/ColorController.java new file mode 100644 index 0000000..d4d0a0c --- /dev/null +++ b/GameEngine/src/main/java/org/example/ColorController.java @@ -0,0 +1,63 @@ +package org.example; +import static org.lwjgl.glfw.GLFW.*; + + + +public class ColorController { + + private float red = 1.0f; + private float green = 0.0f; + private float blue = 0.0f; + + public void setRed(float red) { + this.red = red; + } + + public void setGreen(float green) { + this.green = green; + } + + public void setBlue(float blue) { + this.blue = blue; + } + + + public float getRed() { + return red; + } + + public float getGreen() { + return green; + } + + public float getBlue() { + return blue; + } + + + + public void handleInput(int key) { + switch (key) { + case GLFW_KEY_R: // Rキーで赤に変更 + setRed(1.0f); + setGreen(0.0f); + setBlue(0.0f); + break; + case GLFW_KEY_G: // Gキーで緑に変更 + setRed(0.0f); + setGreen(1.0f); + setBlue(0.0f); + break; + case GLFW_KEY_B: // Bキーで青に変更 + setRed(0.0f); + setGreen(0.0f); + setBlue(1.0f); + break; + case GLFW_KEY_Y: // Yキーで黄色に変更 + setRed(1.0f); + setGreen(1.0f); + setBlue(0.0f); + break; + } + } +} \ No newline at end of file