package AI_Stage2;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import static org.lwjgl.opengl.GL11.*;
public class AI {
private static Texture texture = null;
public static Texture wood;
public static void main(String args[]) {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Simple Artificial Servant- By Richard Ninness");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
try {
// Load the wood texture from "res/images/wood.png"
wood = TextureLoader.getTexture("PNG", new FileInputStream(new File("C:\\Users\\DerpyLlama\\Desktop\\lwjgl-2.8.5\\res\\Capturecmd.png")));
} catch (IOException e) {
e.printStackTrace();
Display.destroy();
System.exit(1);
}
glMatrixMode(GL_PROJECTION);
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
while (!Display.isCloseRequested()) {
glClear(GL_COLOR_BUFFER_BIT);
wood.bind();
glBegin(GL_TRIANGLES);
glTexCoord2f(1, 0);
glVertex2i(900, 20);
glTexCoord2f(0, 0);
glVertex2i(20, 20);
glTexCoord2f(0, 1);
glVertex2i(20, 900);
glTexCoord2f(0, 1);
glVertex2i(20, 900);
glTexCoord2f(1, 1);
glVertex2i(900, 900);
glTexCoord2f(1, 0);
glVertex2i(900, 20);
glEnd();
// glBegin(GL_QUADS);
// glTexCoord2f(0, 0);
// glVertex2i(400, 400); // Upper-left
// glTexCoord2f(1, 0);
// glVertex2i(450, 400); // Upper-right
// glTexCoord2f(1, 1);
// glVertex2i(450, 450); // Bottom-right
// glTexCoord2f(0, 1);
// glVertex2i(400, 450); // Bottom-left
// glEnd();
Display.update();
Display.sync(60);
}
// Release the resources of the wood texture
wood.release();
Display.destroy();
System.exit(0);
}
public void pollInput() {
if (Mouse.isButtonDown(0)) {
int x = Mouse.getX();
int y = Mouse.getY();
System.out.println("MOUSE DOWN @ X: " + x + " Y: " + y);
}
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
System.out.println("SPACE KEY IS DOWN");
}
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_T) {
}
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
Display.destroy();
System.out.println("Goodbye, master.");
}
}
if (Keyboard.getEventKey() == Keyboard.KEY_S) {
System.out.println("S Key Pressed");
}
if (Keyboard.getEventKey() == Keyboard.KEY_D) {
System.out.println("D Key Pressed");
}
} else {
if (Keyboard.getEventKey() == Keyboard.KEY_A) {
System.out.println("A Key Released");
}
if (Keyboard.getEventKey() == Keyboard.KEY_S) {
System.out.println("S Key Released");
}
if (Keyboard.getEventKey() == Keyboard.KEY_D) {
System.out.println("D Key Released");
}
}
}
}
final String Example = "This is an example";
public static void main11(String[] argv) {
AI inputExample = new AI();
inputExample.start();
}
protected void start() {
// TODO Auto-generated method stub
}