Java Code Examples for org.newdawn.slick.opengl.Texture#getTextureHeight()
The following examples show how to use
org.newdawn.slick.opengl.Texture#getTextureHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaletteSwapper.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 6 votes |
/** * Setup. * * @param u the u * @return the shader args */ public static ShaderArgs setup(FightUnit u) { Unit unit = u.getUnit(); ShaderArgs args = new ShaderArgs(); if(unit.getTheClass().name.equals("Lord")) return args; String c = unit.functionalClassName(); Texture t = palettes.get(c); if(t == null) return args; if(lookup.get(c) == null) return args; int offset = lookup.get(c).indexOf(unit.name); if(offset < 0) return args; args.programName = "paletteSwap"; args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()}; GL13.glActiveTexture(GL13.GL_TEXTURE8); t.bind(); GL13.glActiveTexture(GL13.GL_TEXTURE0); return args; }
Example 2
Source File: PaletteSwapper.java From FEMultiplayer with GNU General Public License v3.0 | 6 votes |
public static ShaderArgs setup(FightUnit u) { Unit unit = u.getUnit(); ShaderArgs args = new ShaderArgs(); if(unit.getTheClass().name.equals("Lord")) return args; String c = unit.functionalClassName(); Texture t = palettes.get(c); if(t == null) return args; if(lookup.get(c) == null) return args; int offset = lookup.get(c).indexOf(unit.name); if(offset < 0) return args; args.programName = "paletteSwap"; args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()}; GL13.glActiveTexture(GL13.GL_TEXTURE8); t.bind(); GL13.glActiveTexture(GL13.GL_TEXTURE0); return args; }
Example 3
Source File: PaletteSwapper.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 5 votes |
/** * Setup. * * @param u the u * @return the shader args */ public static ShaderArgs setup(Unit u) { ShaderArgs args = new ShaderArgs(); int offset = u.getPartyColor().equals(Party.TEAM_BLUE) ? 0 : 1; if(offset == 0) return args; Texture t = palettes.get("overworld"); args.programName = "paletteSwap"; args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()}; GL13.glActiveTexture(GL13.GL_TEXTURE8); t.bind(); GL13.glActiveTexture(GL13.GL_TEXTURE0); return args; }
Example 4
Source File: PaletteSwapper.java From FEMultiplayer with GNU General Public License v3.0 | 5 votes |
public static ShaderArgs setup(Unit u) { ShaderArgs args = new ShaderArgs(); int offset = u.getPartyColor().equals(Party.TEAM_BLUE) ? 0 : 1; if(offset == 0) return args; Texture t = palettes.get("overworld"); args.programName = "paletteSwap"; args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()}; GL13.glActiveTexture(GL13.GL_TEXTURE8); t.bind(); GL13.glActiveTexture(GL13.GL_TEXTURE0); return args; }
Example 5
Source File: BeatmapNode.java From opsu-dance with GNU General Public License v3.0 | 4 votes |
static void calcStarDimensions() { // inefficient way to get star dimensions minus transparency final Texture t = GameImage.STAR.getImage().getTexture(); if (!t.hasAlpha()) { return; } final byte[] d = t.getTextureData(); final int w = t.getImageWidth(); final int h = t.getImageHeight(); final int _w = t.getTextureHeight(); final int _h = t.getTextureWidth(); int minheight = h, maxheight = 0, left = w; for (int i = 0, x = 3; i < _h; i++) { for (int j = 0; j < _w; j++, x += 4) { if (i > h || j > w) { continue; } int v = d[x]; if (v < 0) { v += 256; } if (v > 30) { minheight = minheight < i ? minheight : i; maxheight = maxheight > i ? maxheight : i; left = left < j ? left : j; } } } if (minheight > h / 2) minheight = 0; if (maxheight < h / 2) maxheight = h; if (left > w / 2) left = 0; starTexture.width = w; starTexture.height = h; final float desiredSize = hitboxHeight * 0.26f; final float visibleHeight = (maxheight - minheight); final float yo = .5f - visibleHeight / starTexture.height / 2f; final float xo = left / starTexture.width; final float scale = starTexture.height / visibleHeight; final float ratio = starTexture.width / starTexture.height; starTexture.height = desiredSize * scale; starTexture.width = starTexture.height * ratio; starTexture.height2 = starTexture.height / 2f; starTexture.width2 = starTexture.width / 2f; starYoffset += yo * starTexture.height; starXoffset -= xo * starTexture.width; }
Example 6
Source File: Node.java From opsu-dance with GNU General Public License v3.0 | 4 votes |
static void revalidate() { button = new TextureData(MENU_BUTTON_BG.getImage()); final Texture t = button.image.getTexture(); final int w = t.getImageWidth(); final int h = t.getImageHeight(); hitboxYtop = 0; hitboxYbot = h; hitboxXleft = 0; float hitboxXright = w; if (t.hasAlpha()) { final byte[] d = t.getTextureData(); int minheight = h, maxheight = 0, left = w, right = 0; hitboxXright = w - left; int _w = t.getTextureWidth(); int _h = t.getTextureHeight(); for (int i = 0, x = 3; i < _h; i++) { for (int j = 0; j < _w; j++, x += 4) { if (i > h || j > w) { continue; } int v = d[x]; if (v < 0) { v += 256; } if (v > 100) { minheight = minheight < i ? minheight : i; maxheight = maxheight > i ? maxheight : i; left = left < j ? left : j; right = right > j ? right : j; } } } if (minheight > h / 2) minheight = 0; if (maxheight < h / 2) maxheight = h; if (left > w / 2) left = 0; if (right < w / 2) right = w; hitboxYtop = minheight; hitboxYbot = maxheight; hitboxXleft = left; hitboxXright = right; } hitboxXright = hitboxXright / w; final float hbtop = (float) hitboxYtop / h; final float hbbot = (float) hitboxYbot / h; final float scaleup = (float) h / (hitboxYbot - hitboxYtop); final float ratio = button.width / button.height; final float desiredButtonHeight = InstanceContainer.height * 0.117f; button.width = ratio * (button.height = desiredButtonHeight * scaleup); button.height2 = button.height / 2f; button.width2 = button.width / 2f; buttonWidth = (int) button.width; buttonHeight = (int) button.height; hitboxYtop = (int) (hbtop * button.height); hitboxYbot = (int) (hbbot * button.height); hitboxHeight = hitboxYbot - hitboxYtop; buttonIndent = width * (isWidescreen ? 0.00875f : 0.0125f); buttonHoverIndent = buttonIndent * 6.6666f; buttonOffset = buttonHeight * 0.65f; buttonOffset2 = buttonOffset / 2f; buttonInternalOffset = (buttonHeight * .935f - buttonOffset) / 2f; indentPerOffset = buttonOffset / buttonIndent; buttonOffsetX = -(hitboxXright * buttonWidth) + buttonHoverIndent * 2; buttonOffsetX += 20; // padding because they're usually rounded cx = buttonWidth * 0.043f; }