inline OpenGL functions to lwjgl GLxx
This commit is contained in:
parent
783adb350b
commit
a2ffb2991d
90 changed files with 1008 additions and 1204 deletions
|
@ -4,11 +4,12 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import game.log.Log;
|
||||
import game.renderer.GlState;
|
||||
import game.renderer.texture.TextureUtil;
|
||||
import game.util.FileUtils;
|
||||
import game.window.WCF;
|
||||
|
||||
public class Font {
|
||||
public static final FontChar[] SIZES = new FontChar[256];
|
||||
|
@ -91,14 +92,14 @@ public class Font {
|
|||
int[] data = new int[XGLYPH * 16 * YGLYPH * 16];
|
||||
img.getRGB(0, 0, XGLYPH * 16, YGLYPH * 16, data, 0, XGLYPH * 16);
|
||||
calculate(data, SIZES, XGLYPH, YGLYPH, 0);
|
||||
texture = WCF.glGenTextures();
|
||||
texture = GL11.glGenTextures();
|
||||
TextureUtil.uploadImage(texture, img);
|
||||
Log.RENDER.debug("Font-Textur wurde mit ID #%d geladen", texture);
|
||||
}
|
||||
|
||||
public static void unload() {
|
||||
if(texture != 0) {
|
||||
WCF.glDeleteTextures(texture);
|
||||
GL11.glDeleteTextures(texture);
|
||||
Log.RENDER.debug("Font-Textur mit ID #%d wurde gelöscht", texture);
|
||||
texture = 0;
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@ import game.gui.element.Fill;
|
|||
import game.gui.element.Slider;
|
||||
import game.util.Formatter;
|
||||
import game.window.DisplayMode;
|
||||
import game.window.WCF;
|
||||
import game.window.Window;
|
||||
|
||||
public class GuiDisplay extends GuiOptions {
|
||||
protected GuiDisplay() {
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
DisplayMode[] dmodes = WCF.getDisplayModes();
|
||||
DisplayMode[] dmodes = Window.getDisplayModes();
|
||||
if(dmodes != null && dmodes.length > 0) {
|
||||
int offset = 0;
|
||||
int pos = 0;
|
||||
|
|
|
@ -2,9 +2,9 @@ package game.gui;
|
|||
|
||||
import game.color.TextColor;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Label;
|
||||
import game.gui.element.Textbox;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Textbox.Action;
|
||||
import game.gui.world.GuiWorlds;
|
||||
import game.init.Config;
|
||||
|
|
|
@ -3,6 +3,7 @@ package game.gui.container;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -24,7 +25,6 @@ import game.renderer.ItemRenderer;
|
|||
import game.renderer.entity.RenderItem;
|
||||
import game.util.ExtMath;
|
||||
import game.window.Button;
|
||||
import game.window.WCF;
|
||||
|
||||
public abstract class GuiContainer extends Gui
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ public abstract class GuiContainer extends Gui
|
|||
this.theSlot = null;
|
||||
int k = 240;
|
||||
int l = 240;
|
||||
WCF.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)k / 1.0F, (float)l / 1.0F);
|
||||
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)k / 1.0F, (float)l / 1.0F);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.drawSlots(mouseX, mouseY);
|
||||
|
@ -437,7 +437,7 @@ public abstract class GuiContainer extends Gui
|
|||
*/
|
||||
private void drawItemStack(ItemStack stack, int x, int y, String altText)
|
||||
{
|
||||
WCF.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
// this.zLevel = 200.0F;
|
||||
this.itemRender.zLevel = 200.0F;
|
||||
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
|
@ -490,13 +490,13 @@ public abstract class GuiContainer extends Gui
|
|||
}
|
||||
|
||||
public void drawPost() {
|
||||
WCF.glPushMatrix();
|
||||
WCF.glTranslatef((this.gm.fb_x - this.xSize * 2) / 2, (this.gm.fb_y - this.ySize * 2) / 2, 0.0f);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((this.gm.fb_x - this.xSize * 2) / 2), (float)((this.gm.fb_y - this.ySize * 2) / 2), 0.0f);
|
||||
// int k1 = SKC.getMouseX();
|
||||
// int l1 = this.gm.fb_y - SKC.getMouseY() - 1;
|
||||
WCF.glScalef(2.0f, 2.0f, 2.0f);
|
||||
GL11.glScalef(2.0f, 2.0f, 2.0f);
|
||||
this.drawScreen((this.gm.mouse_x - this.container_x) / 2, (this.gm.mouse_y - this.container_y) / 2);
|
||||
WCF.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
// GlState.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package game.gui.container;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import game.inventory.ContainerMerchant;
|
||||
import game.inventory.InventoryPlayer;
|
||||
import game.item.ItemStack;
|
||||
|
@ -8,7 +10,6 @@ import game.renderer.GlState;
|
|||
import game.renderer.ItemRenderer;
|
||||
import game.village.MerchantRecipe;
|
||||
import game.village.MerchantRecipeList;
|
||||
import game.window.WCF;
|
||||
import game.world.World;
|
||||
|
||||
public class GuiMerchant extends GuiContainer
|
||||
|
@ -182,7 +183,7 @@ public class GuiMerchant extends GuiContainer
|
|||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
||||
ItemStack itemstack2 = merchantrecipe.getItemToSell();
|
||||
WCF.glPushMatrix();
|
||||
GL11.glPushMatrix();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
GlState.disableLighting();
|
||||
GlState.enableRescaleNormal();
|
||||
|
@ -220,7 +221,7 @@ public class GuiMerchant extends GuiContainer
|
|||
// this.drawCreativeTabHoveringText(I18n.format("merchant.deprecated"), mouseX, mouseY);
|
||||
// }
|
||||
|
||||
WCF.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GlState.enableLighting();
|
||||
GlState.enableDepth();
|
||||
ItemRenderer.enableStandardItemLighting();
|
||||
|
|
|
@ -11,7 +11,6 @@ import game.renderer.Drawing.Vec2i;
|
|||
import game.util.Formatter;
|
||||
import game.window.Button;
|
||||
import game.window.Keysym;
|
||||
import game.window.WCF;
|
||||
|
||||
public abstract class Element {
|
||||
protected final Game gm = Game.getGame();
|
||||
|
@ -233,8 +232,8 @@ public abstract class Element {
|
|||
int x2 = this.size_x - (this.margin_x1 + this.margin_x2);
|
||||
int y2 = this.size_y - (this.margin_y1 + this.margin_y2);
|
||||
// if(elem.type == ElemType.FIELD) {
|
||||
WCF.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
WCF.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
// }
|
||||
// if(this.type == ElemType.CUSTOM)
|
||||
// this.func(this, 1);
|
||||
|
@ -242,7 +241,7 @@ public abstract class Element {
|
|||
this.drawForeground(x1, y1, x2, y2);
|
||||
// logd("DBG", "%d @ %d %d -> %d %d", elem.id, x1, y1, elem.pos_x + x2, elem.pos_y + y2);
|
||||
// if(elem.type == ElemType.FIELD) {
|
||||
WCF.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
// glScissor(0, 0, sys.fb_x, sys.fb_y);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import game.util.Timing;
|
|||
import game.util.Util;
|
||||
import game.window.Button;
|
||||
import game.window.Keysym;
|
||||
import game.window.WCF;
|
||||
import game.window.Window;
|
||||
|
||||
public class Textbox extends Element {
|
||||
public static enum Action {
|
||||
|
@ -165,14 +165,14 @@ public class Textbox extends Element {
|
|||
// char end = this.text[this.sel_end];
|
||||
// this.text[this.sel_end] = 0;
|
||||
String str = Util.strip(this.text, this.sel_start, this.sel_end - this.sel_start, '\n', (char)0, '?');
|
||||
WCF.setClipboard(str);
|
||||
Window.setClipboard(str);
|
||||
// this.text[this.sel_end] = end;
|
||||
if(key == Keysym.X)
|
||||
insertText("");
|
||||
}
|
||||
}
|
||||
else if(this.editable && ctrl && key == Keysym.V) {
|
||||
insertText(WCF.getClipboard());
|
||||
insertText(Window.getClipboard());
|
||||
}
|
||||
else if(this.editable && !ctrl && key == Keysym.RETURN) {
|
||||
if(this.xbreak) {
|
||||
|
@ -431,10 +431,10 @@ public class Textbox extends Element {
|
|||
int y1 = this.pos_y + this.margin_y1;
|
||||
int x2 = this.size_x - (this.margin_x1 + this.margin_x2);
|
||||
int y2 = this.size_y - (this.margin_y1 + this.margin_y2);
|
||||
WCF.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
WCF.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glScissor(x1 < 0 ? 0 : x1, (this.gm.fb_y - (y1 + y2)) < 0 ? 0 : (this.gm.fb_y - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
Drawing.drawRectColor(this.cursorX, this.cursorY, 1, Font.YGLYPH, this.gm.style.cursor);
|
||||
WCF.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package game.gui.world;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.dimension.DimType;
|
||||
import game.dimension.Dimension;
|
||||
import game.dimension.Space;
|
||||
import game.gui.Gui;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Label;
|
||||
import game.gui.element.Textbox;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Textbox.Action;
|
||||
import game.gui.element.TransparentBox;
|
||||
import game.init.Config;
|
||||
|
|
|
@ -31,7 +31,7 @@ import game.renderer.Drawing;
|
|||
import game.util.CharValidator;
|
||||
import game.util.FileCallback;
|
||||
import game.util.FileUtils;
|
||||
import game.window.WCF;
|
||||
import game.window.Window;
|
||||
import game.world.Converter;
|
||||
import game.world.Converter.SaveVersion;
|
||||
import game.world.Region;
|
||||
|
@ -394,7 +394,7 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
}
|
||||
else if (button == this.seedButton)
|
||||
{
|
||||
WCF.setClipboard("" + this.getSelected().getSeed());
|
||||
Window.setClipboard("" + this.getSelected().getSeed());
|
||||
this.warningTimer = 40;
|
||||
this.warningMessage = TextColor.DGREEN + "Startwert wurde in die Zwischenablage kopiert";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue