List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:io.flob.blackheart.StateTitleHelp.java
License:Open Source License
private void render_buttons() { _core._texture.game_atlas.bind(); GL11.glBegin(GL11.GL_QUADS); button_ok.tick(); GL11.glEnd(); }
From source file:io.flob.clicker.StateGame.java
License:Open Source License
@Override public void tick() throws Exception { if (time() <= 0) { _core.state(_core._game_over);//from ww w .ja v a2 s. c o m } else { _core._texture.atlas.bind(); GL11.glBegin(GL11.GL_QUADS); for (int x = 0; x < buttons.size(); x++) { buttons.get(x).tick(); if (level % 5 == 0) { int _x = Misc.random_int(-5, 5); int _y = Misc.random_int(-5, 5); if (buttons.get(x).position.getX() + _x < Display.getWidth() - button_size) { if (buttons.get(x).position.getX() + _x > button_size / 2) { buttons.get(x).position.x += _x; } if (buttons.get(x).position.getY() + _y < Display.getHeight() - button_size) { if (buttons.get(x).position.getY() + _y > button_size / 2) { buttons.get(x).position.y += _y; } } } } } GL11.glEnd(); for (int x = 0; x < buttons.size(); x++) { if (buttons.get(x).clicked()) { buttons.remove(x); continue; } } } if (buttons.isEmpty()) { create(); } if (!_core.DEBUG) { _core._font.title.render(15, 0, "LEVEL " + level); _core._font.title.render( Display.getWidth() - _core._font.title.font().getWidth(String.valueOf(time())) - 15, 0, time()); } }
From source file:io.flob.clicker.StateGameOver.java
License:Open Source License
@Override public void tick() throws Exception { _core._texture.atlas.bind();/* w ww .j a va 2s . c om*/ GL11.glBegin(GL11.GL_QUADS); button_play.tick(); GL11.glEnd(); _core._font.button.render_centred((int) button_play.getCenterX(), (int) button_play.getCenterY(), button_play_text); _core._font.button.render_centred(Display.getWidth() / 2, 100, "clicking over!"); _core._font.copyrite.render_centred(Display.getWidth() / 2, 190, "You got to level " + _core._game.level); _core._font.copyrite.render_centred(Display.getWidth() / 2, 210, "With " + _core._game.over_time + " seconds over time!"); _core._font.copyrite.render_centred(Display.getWidth() / 2, 250, "This gives you a score of " + _core._game.over_time + " x " + _core._game.level + " = " + _core._game.over_time * _core._game.level); if (button_play.clicked()) { _core._title.new_game(); } }
From source file:io.flob.clicker.StateSplash.java
License:Open Source License
@Override public void tick() throws Exception { _core._display.prepare();/*from w w w . ja v a 2 s . c om*/ Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash.png")); texture.bind(); int x1 = (Display.getWidth() / 2) - (texture.getTextureWidth() / 2); int y1 = (Display.getHeight() / 2) - (texture.getTextureHeight() / 2); int x2 = (Display.getWidth() / 2) + (texture.getTextureWidth() / 2); int y2 = (Display.getHeight() / 2) + (texture.getTextureHeight() / 2); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(x1, y1); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(x2, y1); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(x2, y2); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(x1, y2); GL11.glEnd(); _core._display.update(); }
From source file:io.flob.clicker.StateTitle.java
License:Open Source License
@Override public void tick() throws Exception { if (button_play.clicked()) { new_game(); return;/*from w ww . ja va2 s . c o m*/ } _core._texture.atlas.bind(); GL11.glBegin(GL11.GL_QUADS); button_play.tick(); GL11.glEnd(); _core._font.button.render_centred((int) button_play.getCenterX(), (int) button_play.getCenterY(), button_play_text); _core._font.copyrite.render(Display.getWidth() - _core._font.copyrite.font().getWidth(About.copyrite) - 5, Display.getHeight() - _core._font.copyrite.font().getHeight(), About.copyrite); String version_text = "Version " + About.version; _core._font.copyrite.render(5, 0, version_text); _core._font.button.render_centred(Display.getWidth() / 2, 100, About.title); _core._font.copyrite.render_centred(Display.getWidth() / 2, 190, "Each level is randomly generated"); _core._font.copyrite.render_centred(Display.getWidth() / 2, 210, "You have 10 seconds to click all of the buttons!"); _core._font.copyrite.render_centred(Display.getWidth() / 2, 230, "The buttons will increase by 1 per level"); _core._font.copyrite.render_centred(Display.getWidth() / 2, 250, "Time leftover will be calculated as bonus points!"); }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawOval(int x, int y, int width, int height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//w ww . j a v a 2 s .c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POINTS); { for (double angle = 0; angle <= 90; angle += .5) { double xLoc = x + width * Math.cos(angle * (Math.PI / 180)); double yLoc = y + height * Math.sin(angle * (Math.PI / 180)); double distanceY = yLoc - y; double distanceX = xLoc - x; GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2); GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2 + distanceY * 2); GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2 + distanceY * 2); GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2); } } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillOval(double x0, double y0, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from ww w . j av a 2 s .c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POLYGON); { for (int i = 360; 0 <= i; i -= 2) GL11.glVertex2d(x0 + width * Math.cos(i * (Math.PI / 180)), y0 + height * Math.sin(i * (Math.PI / 180))); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawCustomPolygon(int[] x, int[] y, Color color) { if (color.getAlpha() != 0 && x.length == y.length) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from ww w .jav a 2 s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { for (int i = 0; i < x.length; i++) { if (i < x.length - 1) { GL11.glVertex2f(x[i], y[i]); GL11.glVertex2f(x[i + 1], y[i + 1]); } else { GL11.glVertex2f(x[i], y[i]); GL11.glVertex2f(x[0], y[0]); } } } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillCustomPolygon(double x, double y, double[][] positions, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from w w w.j a v a 2 s. co m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POLYGON); { for (int i = 0; i < positions.length; i++) GL11.glVertex2d(x + positions[i][0], y + positions[i][1]); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawLine(int x0, int y0, int x1, int y1, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from ww w.j av a 2 s.c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { GL11.glVertex2f(x0, y0); GL11.glVertex2f(x1, y1); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }