chore(tools) Вспомогательный класс OGL_Tools (OpenGL Tools)
This commit is contained in:
64
src/ru/dmitriymx/game/OGL_Tools.java
Normal file
64
src/ru/dmitriymx/game/OGL_Tools.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package ru.dmitriymx.game;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class OGL_Tools {
|
||||||
|
public static void draw_target(int x, int y, float angle){
|
||||||
|
final int size = 100;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(x,y,0);
|
||||||
|
GL11.glRotatef(angle, 0, 0, 1);
|
||||||
|
|
||||||
|
GL11.glBegin(GL11.GL_LINES);
|
||||||
|
GL11.glColor3f(1,0,0);
|
||||||
|
GL11.glVertex2f(0,0);
|
||||||
|
GL11.glVertex2f(size,0);
|
||||||
|
GL11.glColor3f(0,1,0);
|
||||||
|
GL11.glVertex2f(0,0);
|
||||||
|
GL11.glVertex2f(0,size);
|
||||||
|
GL11.glColor3f(0,0,1);
|
||||||
|
GL11.glVertex2f(0,0);
|
||||||
|
GL11.glVertex2f(-size,0);
|
||||||
|
GL11.glColor3f(1,1,1);
|
||||||
|
GL11.glVertex2f(0,0);
|
||||||
|
GL11.glVertex2f(0,-size);
|
||||||
|
GL11.glEnd();
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void draw_quad(int x, int y, float angle){
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
GL11.glTranslatef(x,y,0);
|
||||||
|
GL11.glRotatef(angle, 0, 0, 1);
|
||||||
|
|
||||||
|
GL11.glColor4f(1, 1, 1, 0.5f);
|
||||||
|
GL11.glBegin(GL11.GL_QUADS);
|
||||||
|
GL11.glVertex2f(0,0);
|
||||||
|
GL11.glVertex2f(100,0);
|
||||||
|
GL11.glVertex2f(100,50);
|
||||||
|
GL11.glVertex2f(0,50);
|
||||||
|
GL11.glEnd();
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void draw_line(int x1, int y1, int x2, int y2){
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
GL11.glColor3f(1,1,0);
|
||||||
|
GL11.glBegin(GL11.GL_LINES);
|
||||||
|
GL11.glVertex2f(x1,y1);
|
||||||
|
GL11.glVertex2f(x2,y2);
|
||||||
|
GL11.glEnd();
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user