Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Img: http://b.1339.cf/vvllsst.png
- //LoadingScreen.java
- private void renderUnit(Unit u) {
- int a = (int) u.getAngle();
- int x = u.getX();
- int y = u.getY();
- int w = u.getWidth();
- int h = u.getHeight();
- GL11.glTranslated(w / 2, h / 2, 0);
- GL11.glRotated(a, 0, 0, 1);
- GL11.glTranslated(-w / 2, -h / 2, 0);
- GL11.glRotated(-a, 0, 0, 1);
- GL11.glTranslated(x, y, 0);
- GL11.glRotated(a, 0, 0, 1);
- GL11.glTranslated(-x, -y, 0);
- RenderUtil.renderTexture(x, y, w, h, u.getTextures().getAt(0));
- }
- //RenderUtil.java
- public static void renderTexture(int x, int y, int width, int height, Texture texture) {
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glTexCoord2f(0, 0);
- GL11.glVertex2f(x, y);
- GL11.glTexCoord2f(0, 1);
- GL11.glVertex2f(x, y + height);
- GL11.glTexCoord2f(1, 1);
- GL11.glVertex2f(x + width, y + height);
- GL11.glTexCoord2f(1, 0);
- GL11.glVertex2f(x + width, y);
- GL11.glEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment