id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
1,400
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.findCenter
protected void findCenter() { center = new float[]{0, 0}; int length = points.length; for(int i=0;i<length;i+=2) { center[0] += points[i]; center[1] += points[i + 1]; } center[0] /= (length / 2); center[1] /= (length / 2); }
java
protected void findCenter() { center = new float[]{0, 0}; int length = points.length; for(int i=0;i<length;i+=2) { center[0] += points[i]; center[1] += points[i + 1]; } center[0] /= (length / 2); center[1] /= (length / 2); }
[ "protected", "void", "findCenter", "(", ")", "{", "center", "=", "new", "float", "[", "]", "{", "0", ",", "0", "}", ";", "int", "length", "=", "points", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", ...
Get the center of this polygon.
[ "Get", "the", "center", "of", "this", "polygon", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L575-L584
1,401
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.calculateRadius
protected void calculateRadius() { boundingCircleRadius = 0; for(int i=0;i<points.length;i+=2) { float temp = ((points[i] - center[0]) * (points[i] - center[0])) + ((points[i + 1] - center[1]) * (points[i + 1] - center[1])); boundingCircleRadiu...
java
protected void calculateRadius() { boundingCircleRadius = 0; for(int i=0;i<points.length;i+=2) { float temp = ((points[i] - center[0]) * (points[i] - center[0])) + ((points[i + 1] - center[1]) * (points[i + 1] - center[1])); boundingCircleRadiu...
[ "protected", "void", "calculateRadius", "(", ")", "{", "boundingCircleRadius", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "float", "temp", "=", "(", "(", "points", "[", ...
Calculate the radius of a circle that can completely enclose this shape.
[ "Calculate", "the", "radius", "of", "a", "circle", "that", "can", "completely", "enclose", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L590-L599
1,402
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.calculateTriangles
protected void calculateTriangles() { if ((!trianglesDirty) && (tris != null)) { return; } if (points.length >= 6) { boolean clockwise = true; float area = 0; for (int i=0;i<(points.length/2)-1;i++) { float x1 = points[(i*2)]; float y1 = points[(i*2)+1]; ...
java
protected void calculateTriangles() { if ((!trianglesDirty) && (tris != null)) { return; } if (points.length >= 6) { boolean clockwise = true; float area = 0; for (int i=0;i<(points.length/2)-1;i++) { float x1 = points[(i*2)]; float y1 = points[(i*2)+1]; ...
[ "protected", "void", "calculateTriangles", "(", ")", "{", "if", "(", "(", "!", "trianglesDirty", ")", "&&", "(", "tris", "!=", "null", ")", ")", "{", "return", ";", "}", "if", "(", "points", ".", "length", ">=", "6", ")", "{", "boolean", "clockwise",...
Calculate the triangles that can fill this shape
[ "Calculate", "the", "triangles", "that", "can", "fill", "this", "shape" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L604-L630
1,403
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.checkPoints
protected final void checkPoints() { if (pointsDirty) { createPoints(); findCenter(); calculateRadius(); if (points.length > 0) { maxX = points[0]; maxY = points[1]; minX = points[0]; minY ...
java
protected final void checkPoints() { if (pointsDirty) { createPoints(); findCenter(); calculateRadius(); if (points.length > 0) { maxX = points[0]; maxY = points[1]; minX = points[0]; minY ...
[ "protected", "final", "void", "checkPoints", "(", ")", "{", "if", "(", "pointsDirty", ")", "{", "createPoints", "(", ")", ";", "findCenter", "(", ")", ";", "calculateRadius", "(", ")", ";", "if", "(", "points", ".", "length", ">", "0", ")", "{", "max...
Check the dirty flag and create points as necessary.
[ "Check", "the", "dirty", "flag", "and", "create", "points", "as", "necessary", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L656-L677
1,404
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.prune
public Shape prune() { Polygon result = new Polygon(); for (int i=0;i<getPointCount();i++) { int next = i+1 >= getPointCount() ? 0 : i+1; int prev = i-1 < 0 ? getPointCount() - 1 : i-1; float dx1 = getPoint(i)[0] - getPoint(prev)[0]; float dy1 = getPoint(i)[1] - ge...
java
public Shape prune() { Polygon result = new Polygon(); for (int i=0;i<getPointCount();i++) { int next = i+1 >= getPointCount() ? 0 : i+1; int prev = i-1 < 0 ? getPointCount() - 1 : i-1; float dx1 = getPoint(i)[0] - getPoint(prev)[0]; float dy1 = getPoint(i)[1] - ge...
[ "public", "Shape", "prune", "(", ")", "{", "Polygon", "result", "=", "new", "Polygon", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getPointCount", "(", ")", ";", "i", "++", ")", "{", "int", "next", "=", "i", "+", "1", ">=...
Prune any required points in this shape @return The new shape with points pruned
[ "Prune", "any", "required", "points", "in", "this", "shape" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L701-L726
1,405
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.setImageColor
public void setImageColor(float r, float g, float b) { setColor(TOP_LEFT, r, g, b); setColor(TOP_RIGHT, r, g, b); setColor(BOTTOM_LEFT, r, g, b); setColor(BOTTOM_RIGHT, r, g, b); }
java
public void setImageColor(float r, float g, float b) { setColor(TOP_LEFT, r, g, b); setColor(TOP_RIGHT, r, g, b); setColor(BOTTOM_LEFT, r, g, b); setColor(BOTTOM_RIGHT, r, g, b); }
[ "public", "void", "setImageColor", "(", "float", "r", ",", "float", "g", ",", "float", "b", ")", "{", "setColor", "(", "TOP_LEFT", ",", "r", ",", "g", ",", "b", ")", ";", "setColor", "(", "TOP_RIGHT", ",", "r", ",", "g", ",", "b", ")", ";", "se...
Set the filter to apply when drawing this image @param r The red component of the filter colour @param g The green component of the filter colour @param b The blue component of the filter colour
[ "Set", "the", "filter", "to", "apply", "when", "drawing", "this", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L358-L363
1,406
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.setColor
public void setColor(int corner, float r, float g, float b, float a) { if (corners == null) { corners = new Color[] {new Color(1,1,1,1f),new Color(1,1,1,1f), new Color(1,1,1,1f), new Color(1,1,1,1f)}; } corners[corner].r = r; corners[corner].g = g; corners[corner].b = b; corners[corner].a = a;...
java
public void setColor(int corner, float r, float g, float b, float a) { if (corners == null) { corners = new Color[] {new Color(1,1,1,1f),new Color(1,1,1,1f), new Color(1,1,1,1f), new Color(1,1,1,1f)}; } corners[corner].r = r; corners[corner].g = g; corners[corner].b = b; corners[corner].a = a;...
[ "public", "void", "setColor", "(", "int", "corner", ",", "float", "r", ",", "float", "g", ",", "float", "b", ",", "float", "a", ")", "{", "if", "(", "corners", "==", "null", ")", "{", "corners", "=", "new", "Color", "[", "]", "{", "new", "Color",...
Set the color of the given corner when this image is rendered. This is useful lots of visual effect but especially light maps @param corner The corner identifier for the corner to be set @param r The red component value to set (between 0 and 1) @param g The green component value to set (between 0 and 1) @param b The b...
[ "Set", "the", "color", "of", "the", "given", "corner", "when", "this", "image", "is", "rendered", ".", "This", "is", "useful", "lots", "of", "visual", "effect", "but", "especially", "light", "maps" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L375-L384
1,407
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.clampTexture
public void clampTexture() { if (GL.canTextureMirrorClamp()) { GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT); } else { GL.glTexPa...
java
public void clampTexture() { if (GL.canTextureMirrorClamp()) { GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT); GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT); } else { GL.glTexPa...
[ "public", "void", "clampTexture", "(", ")", "{", "if", "(", "GL", ".", "canTextureMirrorClamp", "(", ")", ")", "{", "GL", ".", "glTexParameteri", "(", "SGL", ".", "GL_TEXTURE_2D", ",", "SGL", ".", "GL_TEXTURE_WRAP_S", ",", "SGL", ".", "GL_MIRROR_CLAMP_TO_EDG...
Clamp the loaded texture to it's edges
[ "Clamp", "the", "loaded", "texture", "to", "it", "s", "edges" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L408-L416
1,408
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.load
private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (t...
java
private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException { this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST; try { this.ref = ref; int[] trans = null; if (transparent != null) { trans = new int[3]; trans[0] = (int) (t...
[ "private", "void", "load", "(", "InputStream", "in", ",", "String", "ref", ",", "boolean", "flipped", ",", "int", "f", ",", "Color", "transparent", ")", "throws", "SlickException", "{", "this", ".", "filter", "=", "f", "==", "FILTER_LINEAR", "?", "SGL", ...
Load the image @param in The input stream to read the image from @param ref The name that should be assigned to the image @param flipped True if the image should be flipped on the y-axis on load @param f The filter to use when scaling this image @param transparent The color to treat as transparent @throws SlickExcept...
[ "Load", "the", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L457-L474
1,409
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.init
protected final void init() { if (inited) { return; } inited = true; if (texture != null) { width = texture.getImageWidth(); height = texture.getImageHeight(); textureOffsetX = 0; textureOffsetY = 0; textureWidth = texture.getWidth(); textureHeight = texture.getHeight(); }...
java
protected final void init() { if (inited) { return; } inited = true; if (texture != null) { width = texture.getImageWidth(); height = texture.getImageHeight(); textureOffsetX = 0; textureOffsetY = 0; textureWidth = texture.getWidth(); textureHeight = texture.getHeight(); }...
[ "protected", "final", "void", "init", "(", ")", "{", "if", "(", "inited", ")", "{", "return", ";", "}", "inited", "=", "true", ";", "if", "(", "texture", "!=", "null", ")", "{", "width", "=", "texture", ".", "getImageWidth", "(", ")", ";", "height"...
Initialise internal data
[ "Initialise", "internal", "data" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L494-L513
1,410
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.draw
@Override public void draw(float x, float y) { init(); draw(x,y,width,height); }
java
@Override public void draw(float x, float y) { init(); draw(x,y,width,height); }
[ "@", "Override", "public", "void", "draw", "(", "float", "x", ",", "float", "y", ")", "{", "init", "(", ")", ";", "draw", "(", "x", ",", "y", ",", "width", ",", "height", ")", ";", "}" ]
Draw this image at the specified location @param x The x location to draw the image at @param y The y location to draw the image at
[ "Draw", "this", "image", "at", "the", "specified", "location" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L545-L549
1,411
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawEmbedded
public void drawEmbedded(float x,float y,float width,float height) { init(); if (corners == null) { GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(x, y, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x, y + height, 0); GL.glTexCoord2f(...
java
public void drawEmbedded(float x,float y,float width,float height) { init(); if (corners == null) { GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(x, y, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x, y + height, 0); GL.glTexCoord2f(...
[ "public", "void", "drawEmbedded", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ")", "{", "init", "(", ")", ";", "if", "(", "corners", "==", "null", ")", "{", "GL", ".", "glTexCoord2f", "(", "textureOffsetX", ",...
Draw this image as part of a collection of images @param x The x location to draw the image at @param y The y location to draw the image at @param width The width to render the image at @param height The height to render the image at
[ "Draw", "this", "image", "as", "part", "of", "a", "collection", "of", "images" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L572-L600
1,412
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.draw
public void draw(float x,float y,float scale) { init(); draw(x,y,width*scale,height*scale,Color.white); }
java
public void draw(float x,float y,float scale) { init(); draw(x,y,width*scale,height*scale,Color.white); }
[ "public", "void", "draw", "(", "float", "x", ",", "float", "y", ",", "float", "scale", ")", "{", "init", "(", ")", ";", "draw", "(", "x", ",", "y", ",", "width", "*", "scale", ",", "height", "*", "scale", ",", "Color", ".", "white", ")", ";", ...
Draw the image with a given scale @param x The x position to draw the image at @param y The y position to draw the image at @param scale The scaling to apply
[ "Draw", "the", "image", "with", "a", "given", "scale" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L653-L656
1,413
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getSubImage
public Image getSubImage(int x,int y,int width,int height) { init(); float newTextureOffsetX = ((x / (float) this.width) * textureWidth) + textureOffsetX; float newTextureOffsetY = ((y / (float) this.height) * textureHeight) + textureOffsetY; float newTextureWidth = ((width / (float) this.width) * textu...
java
public Image getSubImage(int x,int y,int width,int height) { init(); float newTextureOffsetX = ((x / (float) this.width) * textureWidth) + textureOffsetX; float newTextureOffsetY = ((y / (float) this.height) * textureHeight) + textureOffsetY; float newTextureWidth = ((width / (float) this.width) * textu...
[ "public", "Image", "getSubImage", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "init", "(", ")", ";", "float", "newTextureOffsetX", "=", "(", "(", "x", "/", "(", "float", ")", "this", ".", "width", ")", "...
Get a sub-part of this image. Note that the create image retains a reference to the image data so should anything change it will affect sub-images too. @param x The x coordinate of the sub-image @param y The y coordinate of the sub-image @param width The width of the sub-image @param height The height of the sub-image...
[ "Get", "a", "sub", "-", "part", "of", "this", "image", ".", "Note", "that", "the", "create", "image", "retains", "a", "reference", "to", "the", "image", "data", "so", "should", "anything", "change", "it", "will", "affect", "sub", "-", "images", "too", ...
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L958-L981
1,414
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawWarped
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0....
java
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0....
[ "public", "void", "drawWarped", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ",", "float", "x3", ",", "float", "y3", ",", "float", "x4", ",", "float", "y4", ")", "{", "Color", ".", "white", ".", "bind", "(", ")"...
Draw the image in a warper rectangle. The effects this can have are many and varied, might be interesting though. @param x1 The top left corner x coordinate @param y1 The top left corner y coordinate @param x2 The top right corner x coordinate @param y2 The top right corner y coordinate @param x3 The bottom right corn...
[ "Draw", "the", "image", "in", "a", "warper", "rectangle", ".", "The", "effects", "this", "can", "have", "are", "many", "and", "varied", "might", "be", "interesting", "though", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1139-L1170
1,415
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getFlippedCopy
public Image getFlippedCopy(boolean flipHorizontal, boolean flipVertical) { init(); Image image = copy(); if (flipHorizontal) { image.textureOffsetX = textureOffsetX + textureWidth; image.textureWidth = -textureWidth; } if (flipVertical) { image.textureOffsetY = textureOffsetY + textureHe...
java
public Image getFlippedCopy(boolean flipHorizontal, boolean flipVertical) { init(); Image image = copy(); if (flipHorizontal) { image.textureOffsetX = textureOffsetX + textureWidth; image.textureWidth = -textureWidth; } if (flipVertical) { image.textureOffsetY = textureOffsetY + textureHe...
[ "public", "Image", "getFlippedCopy", "(", "boolean", "flipHorizontal", ",", "boolean", "flipVertical", ")", "{", "init", "(", ")", ";", "Image", "image", "=", "copy", "(", ")", ";", "if", "(", "flipHorizontal", ")", "{", "image", ".", "textureOffsetX", "="...
Get a copy image flipped on potentially two axis @param flipHorizontal True if we want to flip the image horizontally @param flipVertical True if we want to flip the image vertically @return The flipped image instance @see {{@link #getScaledCopy(int, int)} for caveats on scaled images
[ "Get", "a", "copy", "image", "flipped", "on", "potentially", "two", "axis" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1270-L1284
1,416
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getColor
public Color getColor(int x, int y) { if (pixelData == null) { pixelData = texture.getTextureData(); } int xo = (int) (textureOffsetX * texture.getTextureWidth()); int yo = (int) (textureOffsetY * texture.getTextureHeight()); if (textureWidth < 0) { x = xo - x; } else { ...
java
public Color getColor(int x, int y) { if (pixelData == null) { pixelData = texture.getTextureData(); } int xo = (int) (textureOffsetX * texture.getTextureWidth()); int yo = (int) (textureOffsetY * texture.getTextureHeight()); if (textureWidth < 0) { x = xo - x; } else { ...
[ "public", "Color", "getColor", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "pixelData", "==", "null", ")", "{", "pixelData", "=", "texture", ".", "getTextureData", "(", ")", ";", "}", "int", "xo", "=", "(", "int", ")", "(", "textureOffse...
Get the colour of a pixel at a specified location in this image @param x The x coordinate of the pixel @param y The y coordinate of the pixel @return The Color of the pixel at the specified location
[ "Get", "the", "colour", "of", "a", "pixel", "at", "a", "specified", "location", "in", "this", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1366-L1402
1,417
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java
FontUtils.drawLeft
public static void drawLeft(Font font, String s, int x, int y) { drawString(font, s, Alignment.LEFT, x, y, 0, Color.white); }
java
public static void drawLeft(Font font, String s, int x, int y) { drawString(font, s, Alignment.LEFT, x, y, 0, Color.white); }
[ "public", "static", "void", "drawLeft", "(", "Font", "font", ",", "String", "s", ",", "int", "x", ",", "int", "y", ")", "{", "drawString", "(", "font", ",", "s", ",", "Alignment", ".", "LEFT", ",", "x", ",", "y", ",", "0", ",", "Color", ".", "w...
Draw text left justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at
[ "Draw", "text", "left", "justified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L38-L40
1,418
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java
FontUtils.drawCenter
public static void drawCenter(Font font, String s, int x, int y, int width) { drawString(font, s, Alignment.CENTER, x, y, width, Color.white); }
java
public static void drawCenter(Font font, String s, int x, int y, int width) { drawString(font, s, Alignment.CENTER, x, y, width, Color.white); }
[ "public", "static", "void", "drawCenter", "(", "Font", "font", ",", "String", "s", ",", "int", "x", ",", "int", "y", ",", "int", "width", ")", "{", "drawString", "(", "font", ",", "s", ",", "Alignment", ".", "CENTER", ",", "x", ",", "y", ",", "wi...
Draw text center justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at @param width The width to fill with the text
[ "Draw", "text", "center", "justified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L51-L53
1,419
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java
FontUtils.drawRight
public static void drawRight(Font font, String s, int x, int y, int width) { drawString(font, s, Alignment.RIGHT, x, y, width, Color.white); }
java
public static void drawRight(Font font, String s, int x, int y, int width) { drawString(font, s, Alignment.RIGHT, x, y, width, Color.white); }
[ "public", "static", "void", "drawRight", "(", "Font", "font", ",", "String", "s", ",", "int", "x", ",", "int", "y", ",", "int", "width", ")", "{", "drawString", "(", "font", ",", "s", ",", "Alignment", ".", "RIGHT", ",", "x", ",", "y", ",", "widt...
Draw text right justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at @param width The width to fill with the text
[ "Draw", "text", "right", "justified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L79-L81
1,420
nguillaumin/slick2d-maven
slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/Scalar.java
Scalar.load
public void load() { int resp = loadChooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { lastSelected = loadChooser.getSelectedFile(); saveChooser.setCurrentDirectory(loadChooser.getCurrentDirectory()); try { BufferedImage image = ImageIO.read(lastSelected); imagePanel.se...
java
public void load() { int resp = loadChooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { lastSelected = loadChooser.getSelectedFile(); saveChooser.setCurrentDirectory(loadChooser.getCurrentDirectory()); try { BufferedImage image = ImageIO.read(lastSelected); imagePanel.se...
[ "public", "void", "load", "(", ")", "{", "int", "resp", "=", "loadChooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "lastSelected", "=", "loadChooser", ".", "getSelectedFile", ...
Load the current image
[ "Load", "the", "current", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/Scalar.java#L157-L170
1,421
nguillaumin/slick2d-maven
slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/Scalar.java
Scalar.save
public void save() { int resp = saveChooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = saveChooser.getSelectedFile(); String type = null; if (file.getName().endsWith(".png")) { type = "PNG"; } if (file.getName().endsWith(".gif")) { type = "GIF"; ...
java
public void save() { int resp = saveChooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = saveChooser.getSelectedFile(); String type = null; if (file.getName().endsWith(".png")) { type = "PNG"; } if (file.getName().endsWith(".gif")) { type = "GIF"; ...
[ "public", "void", "save", "(", ")", "{", "int", "resp", "=", "saveChooser", ".", "showSaveDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "file", "=", "saveChooser", ".", "getSelectedFile", ...
Save the current image
[ "Save", "the", "current", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/Scalar.java#L175-L201
1,422
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getAttributeNames
public String[] getAttributeNames() { NamedNodeMap map = dom.getAttributes(); String[] names = new String[map.getLength()]; for (int i=0;i<names.length;i++) { names[i] = map.item(i).getNodeName(); } return names; }
java
public String[] getAttributeNames() { NamedNodeMap map = dom.getAttributes(); String[] names = new String[map.getLength()]; for (int i=0;i<names.length;i++) { names[i] = map.item(i).getNodeName(); } return names; }
[ "public", "String", "[", "]", "getAttributeNames", "(", ")", "{", "NamedNodeMap", "map", "=", "dom", ".", "getAttributes", "(", ")", ";", "String", "[", "]", "names", "=", "new", "String", "[", "map", ".", "getLength", "(", ")", "]", ";", "for", "(",...
Get the names of the attributes specified on this element @return The names of the elements specified
[ "Get", "the", "names", "of", "the", "attributes", "specified", "on", "this", "element" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L38-L47
1,423
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getAttribute
public String getAttribute(String name, String def) { String value = dom.getAttribute(name); if ((value == null) || (value.length() == 0)) { return def; } return value; }
java
public String getAttribute(String name, String def) { String value = dom.getAttribute(name); if ((value == null) || (value.length() == 0)) { return def; } return value; }
[ "public", "String", "getAttribute", "(", "String", "name", ",", "String", "def", ")", "{", "String", "value", "=", "dom", ".", "getAttribute", "(", "name", ")", ";", "if", "(", "(", "value", "==", "null", ")", "||", "(", "value", ".", "length", "(", ...
Get the value specified for a given attribute on this element @param name The name of the attribute whose value should be retrieved @param def The default value to return if the attribute is specified @return The value given for the attribute
[ "Get", "the", "value", "specified", "for", "a", "given", "attribute", "on", "this", "element" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L75-L82
1,424
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getIntAttribute
public int getIntAttribute(String name) throws SlickXMLException { try { return Integer.parseInt(getAttribute(name)); } catch (NumberFormatException e) { throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not an integer",e); } }
java
public int getIntAttribute(String name) throws SlickXMLException { try { return Integer.parseInt(getAttribute(name)); } catch (NumberFormatException e) { throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not an integer",e); } }
[ "public", "int", "getIntAttribute", "(", "String", "name", ")", "throws", "SlickXMLException", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "getAttribute", "(", "name", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", ...
Get the value specified for a given attribute on this element as an integer. @param name The name of the attribute whose value should be retrieved @return The value given for the attribute @throws SlickXMLException Indicates a failure to convert the value into an integer
[ "Get", "the", "value", "specified", "for", "a", "given", "attribute", "on", "this", "element", "as", "an", "integer", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L91-L97
1,425
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getDoubleAttribute
public double getDoubleAttribute(String name) throws SlickXMLException { try { return Double.parseDouble(getAttribute(name)); } catch (NumberFormatException e) { throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not a double",e); } }
java
public double getDoubleAttribute(String name) throws SlickXMLException { try { return Double.parseDouble(getAttribute(name)); } catch (NumberFormatException e) { throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not a double",e); } }
[ "public", "double", "getDoubleAttribute", "(", "String", "name", ")", "throws", "SlickXMLException", "{", "try", "{", "return", "Double", ".", "parseDouble", "(", "getAttribute", "(", "name", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")",...
Get the value specified for a given attribute on this element as an double. @param name The name of the attribute whose value should be retrieved @return The value given for the attribute @throws SlickXMLException Indicates a failure to convert the value into an double
[ "Get", "the", "value", "specified", "for", "a", "given", "attribute", "on", "this", "element", "as", "an", "double", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L122-L128
1,426
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getBooleanAttribute
public boolean getBooleanAttribute(String name) throws SlickXMLException { String value = getAttribute(name); if (value.equalsIgnoreCase("true")) { return true; } if (value.equalsIgnoreCase("false")) { return false; } throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not...
java
public boolean getBooleanAttribute(String name) throws SlickXMLException { String value = getAttribute(name); if (value.equalsIgnoreCase("true")) { return true; } if (value.equalsIgnoreCase("false")) { return false; } throw new SlickXMLException("Value read: '"+getAttribute(name)+"' is not...
[ "public", "boolean", "getBooleanAttribute", "(", "String", "name", ")", "throws", "SlickXMLException", "{", "String", "value", "=", "getAttribute", "(", "name", ")", ";", "if", "(", "value", ".", "equalsIgnoreCase", "(", "\"true\"", ")", ")", "{", "return", ...
Get the value specified for a given attribute on this element as a boolean. @param name The name of the attribute whose value should be retrieved @return The value given for the attribute @throws SlickXMLException Indicates a failure to convert the value into an boolean
[ "Get", "the", "value", "specified", "for", "a", "given", "attribute", "on", "this", "element", "as", "a", "boolean", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L153-L163
1,427
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getContent
public String getContent() { String content = ""; NodeList list = dom.getChildNodes(); for (int i=0;i<list.getLength();i++) { if (list.item(i) instanceof Text) { content += (list.item(i).getNodeValue()); } } return content; }
java
public String getContent() { String content = ""; NodeList list = dom.getChildNodes(); for (int i=0;i<list.getLength();i++) { if (list.item(i) instanceof Text) { content += (list.item(i).getNodeValue()); } } return content; }
[ "public", "String", "getContent", "(", ")", "{", "String", "content", "=", "\"\"", ";", "NodeList", "list", "=", "dom", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "getLength", "(", ")", ";", ...
Get the text content of the element, i.e. the bit between the tags @return The text content of the node
[ "Get", "the", "text", "content", "of", "the", "element", "i", ".", "e", ".", "the", "bit", "between", "the", "tags" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L191-L202
1,428
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getChildren
public XMLElementList getChildren() { if (children != null) { return children; } NodeList list = dom.getChildNodes(); children = new XMLElementList(); for (int i=0;i<list.getLength();i++) { if (list.item(i) instanceof Element) { children.add(new XMLElement((Element) list.item(i))); ...
java
public XMLElementList getChildren() { if (children != null) { return children; } NodeList list = dom.getChildNodes(); children = new XMLElementList(); for (int i=0;i<list.getLength();i++) { if (list.item(i) instanceof Element) { children.add(new XMLElement((Element) list.item(i))); ...
[ "public", "XMLElementList", "getChildren", "(", ")", "{", "if", "(", "children", "!=", "null", ")", "{", "return", "children", ";", "}", "NodeList", "list", "=", "dom", ".", "getChildNodes", "(", ")", ";", "children", "=", "new", "XMLElementList", "(", "...
Get the complete list of children for this node @return The list of children for this node
[ "Get", "the", "complete", "list", "of", "children", "for", "this", "node" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L209-L224
1,429
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java
XMLElement.getChildrenByName
public XMLElementList getChildrenByName(String name) { XMLElementList selected = new XMLElementList(); XMLElementList children = getChildren(); for (int i=0;i<children.size();i++) { if (children.get(i).getName().equals(name)) { selected.add(children.get(i)); } } return selected; }
java
public XMLElementList getChildrenByName(String name) { XMLElementList selected = new XMLElementList(); XMLElementList children = getChildren(); for (int i=0;i<children.size();i++) { if (children.get(i).getName().equals(name)) { selected.add(children.get(i)); } } return selected; }
[ "public", "XMLElementList", "getChildrenByName", "(", "String", "name", ")", "{", "XMLElementList", "selected", "=", "new", "XMLElementList", "(", ")", ";", "XMLElementList", "children", "=", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";...
Get a list of children with a given element name @param name The name of the element type that should be retrieved @return A list of elements
[ "Get", "a", "list", "of", "children", "with", "a", "given", "element", "name" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/XMLElement.java#L232-L243
1,430
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Ellipse.java
Ellipse.createPoints
protected void createPoints() { ArrayList tempPoints = new ArrayList(); maxX = -Float.MIN_VALUE; maxY = -Float.MIN_VALUE; minX = Float.MAX_VALUE; minY = Float.MAX_VALUE; float start = 0; float end = 359; float cx = x + radius1; ...
java
protected void createPoints() { ArrayList tempPoints = new ArrayList(); maxX = -Float.MIN_VALUE; maxY = -Float.MIN_VALUE; minX = Float.MAX_VALUE; minY = Float.MAX_VALUE; float start = 0; float end = 359; float cx = x + radius1; ...
[ "protected", "void", "createPoints", "(", ")", "{", "ArrayList", "tempPoints", "=", "new", "ArrayList", "(", ")", ";", "maxX", "=", "-", "Float", ".", "MIN_VALUE", ";", "maxY", "=", "-", "Float", ".", "MIN_VALUE", ";", "minX", "=", "Float", ".", "MAX_V...
Generate the points to outline this ellipse.
[ "Generate", "the", "points", "to", "outline", "this", "ellipse", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Ellipse.java#L119-L163
1,431
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java
NavMesh.findSpace
public Space findSpace(float x, float y) { for (int i=0;i<spaces.size();i++) { Space space = getSpace(i); if (space.contains(x,y)) { return space; } } return null; }
java
public Space findSpace(float x, float y) { for (int i=0;i<spaces.size();i++) { Space space = getSpace(i); if (space.contains(x,y)) { return space; } } return null; }
[ "public", "Space", "findSpace", "(", "float", "x", ",", "float", "y", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "spaces", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Space", "space", "=", "getSpace", "(", "i", ")", ";",...
Find the space at a given location @param x The x coordinate at which to find the space @param y The y coordinate at which to find the space @return The space at the given location
[ "Find", "the", "space", "at", "a", "given", "location" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java#L69-L78
1,432
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java
NavMesh.findPath
public NavPath findPath(float sx, float sy, float tx, float ty, boolean optimize) { Space source = findSpace(sx,sy); Space target = findSpace(tx,ty); if ((source == null) || (target == null)) { return null; } for (int i=0;i<spaces.size();i++) { ((Space) spaces.get(i)).clearCost(); } target.fil...
java
public NavPath findPath(float sx, float sy, float tx, float ty, boolean optimize) { Space source = findSpace(sx,sy); Space target = findSpace(tx,ty); if ((source == null) || (target == null)) { return null; } for (int i=0;i<spaces.size();i++) { ((Space) spaces.get(i)).clearCost(); } target.fil...
[ "public", "NavPath", "findPath", "(", "float", "sx", ",", "float", "sy", ",", "float", "tx", ",", "float", "ty", ",", "boolean", "optimize", ")", "{", "Space", "source", "=", "findSpace", "(", "sx", ",", "sy", ")", ";", "Space", "target", "=", "findS...
Find a path from the source to the target coordinates @param sx The x coordinate of the source location @param sy The y coordinate of the source location @param tx The x coordinate of the target location @param ty The y coordinate of the target location @param optimize True if paths should be optimized @return The pat...
[ "Find", "a", "path", "from", "the", "source", "to", "the", "target", "coordinates" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java#L90-L120
1,433
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java
NavMesh.isClear
private boolean isClear(float x1, float y1, float x2, float y2, float step) { float dx = (x2 - x1); float dy = (y2 - y1); float len = (float) Math.sqrt((dx*dx)+(dy*dy)); dx *= step; dx /= len; dy *= step; dy /= len; int steps = (int) (len / step); for (int i=0;i<steps;i++) { float x = x1 + (dx*i...
java
private boolean isClear(float x1, float y1, float x2, float y2, float step) { float dx = (x2 - x1); float dy = (y2 - y1); float len = (float) Math.sqrt((dx*dx)+(dy*dy)); dx *= step; dx /= len; dy *= step; dy /= len; int steps = (int) (len / step); for (int i=0;i<steps;i++) { float x = x1 + (dx*i...
[ "private", "boolean", "isClear", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ",", "float", "step", ")", "{", "float", "dx", "=", "(", "x2", "-", "x1", ")", ";", "float", "dy", "=", "(", "y2", "-", "y1", ")", ...
Check if a particular path is clear @param x1 The x coordinate of the starting point @param y1 The y coordinate of the starting point @param x2 The x coordinate of the ending point @param y2 The y coordinate of the ending point @param step The size of the step between points @return True if there are no blockages alon...
[ "Check", "if", "a", "particular", "path", "is", "clear" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java#L132-L152
1,434
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java
NavMesh.optimize
private void optimize(NavPath path) { int pt = 0; while (pt < path.length()-2) { float sx = path.getX(pt); float sy = path.getY(pt); float nx = path.getX(pt+2); float ny = path.getY(pt+2); if (isClear(sx,sy,nx,ny,0.1f)) { path.remove(pt+1); } else { pt++; } } }
java
private void optimize(NavPath path) { int pt = 0; while (pt < path.length()-2) { float sx = path.getX(pt); float sy = path.getY(pt); float nx = path.getX(pt+2); float ny = path.getY(pt+2); if (isClear(sx,sy,nx,ny,0.1f)) { path.remove(pt+1); } else { pt++; } } }
[ "private", "void", "optimize", "(", "NavPath", "path", ")", "{", "int", "pt", "=", "0", ";", "while", "(", "pt", "<", "path", ".", "length", "(", ")", "-", "2", ")", "{", "float", "sx", "=", "path", ".", "getX", "(", "pt", ")", ";", "float", ...
Optimize a path by removing segments that arn't required to reach the end point @param path The path to optimize. Redundant segments will be removed
[ "Optimize", "a", "path", "by", "removing", "segments", "that", "arn", "t", "required", "to", "reach", "the", "end", "point" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java#L160-L175
1,435
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FastTrig.java
FastTrig.sin
public static double sin(double radians) { radians = reduceSinAngle(radians); // limits angle to between -PI/2 and +PI/2 if (Math.abs(radians) <= Math.PI / 4) { return Math.sin(radians); } else { return Math.cos(Math.PI / 2 - radians); } }
java
public static double sin(double radians) { radians = reduceSinAngle(radians); // limits angle to between -PI/2 and +PI/2 if (Math.abs(radians) <= Math.PI / 4) { return Math.sin(radians); } else { return Math.cos(Math.PI / 2 - radians); } }
[ "public", "static", "double", "sin", "(", "double", "radians", ")", "{", "radians", "=", "reduceSinAngle", "(", "radians", ")", ";", "// limits angle to between -PI/2 and +PI/2\r", "if", "(", "Math", ".", "abs", "(", "radians", ")", "<=", "Math", ".", "PI", ...
Get the sine of an angle @param radians The angle @return The sine of the angle
[ "Get", "the", "sine", "of", "an", "angle" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FastTrig.java#L37-L44
1,436
nguillaumin/slick2d-maven
slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java
Scroller.tryMove
private boolean tryMove(float x, float y) { float newx = playerX + x; float newy = playerY + y; // first we try the real move, if that doesn't work // we try moving on just one of the axis (X and then Y) // this allows us to slide against edges if (blocked(newx,newy)) { if (blocked(newx, play...
java
private boolean tryMove(float x, float y) { float newx = playerX + x; float newy = playerY + y; // first we try the real move, if that doesn't work // we try moving on just one of the axis (X and then Y) // this allows us to slide against edges if (blocked(newx,newy)) { if (blocked(newx, play...
[ "private", "boolean", "tryMove", "(", "float", "x", ",", "float", "y", ")", "{", "float", "newx", "=", "playerX", "+", "x", ";", "float", "newy", "=", "playerY", "+", "y", ";", "// first we try the real move, if that doesn't work\r", "// we try moving on just one ...
Try to move in the direction specified. If it's blocked, try sliding. If that doesn't work just don't bother @param x The amount on the X axis to move @param y The amount on the Y axis to move @return True if we managed to move
[ "Try", "to", "move", "in", "the", "direction", "specified", ".", "If", "it", "s", "blocked", "try", "sliding", ".", "If", "that", "doesn", "t", "work", "just", "don", "t", "bother" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java#L160-L185
1,437
nguillaumin/slick2d-maven
slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java
Scroller.updateMovementVector
private void updateMovementVector() { dirX = (float) Math.sin(Math.toRadians(ang)); dirY = (float) -Math.cos(Math.toRadians(ang)); }
java
private void updateMovementVector() { dirX = (float) Math.sin(Math.toRadians(ang)); dirY = (float) -Math.cos(Math.toRadians(ang)); }
[ "private", "void", "updateMovementVector", "(", ")", "{", "dirX", "=", "(", "float", ")", "Math", ".", "sin", "(", "Math", ".", "toRadians", "(", "ang", ")", ")", ";", "dirY", "=", "(", "float", ")", "-", "Math", ".", "cos", "(", "Math", ".", "to...
Update the direction that will be moved in based on the current angle of rotation
[ "Update", "the", "direction", "that", "will", "be", "moved", "in", "based", "on", "the", "current", "angle", "of", "rotation" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java#L191-L194
1,438
nguillaumin/slick2d-maven
slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java
Scroller.drawTank
public void drawTank(Graphics g, float xpos, float ypos, float rot) { // work out the centre of the tank in rendering coordinates and then // spit onto the screen int cx = (int) (xpos * 32); int cy = (int) (ypos * 32); g.rotate(cx,cy,rot); player.draw(cx-16,cy-16); g.rotate(cx,cy,-rot); }
java
public void drawTank(Graphics g, float xpos, float ypos, float rot) { // work out the centre of the tank in rendering coordinates and then // spit onto the screen int cx = (int) (xpos * 32); int cy = (int) (ypos * 32); g.rotate(cx,cy,rot); player.draw(cx-16,cy-16); g.rotate(cx,cy,-rot); }
[ "public", "void", "drawTank", "(", "Graphics", "g", ",", "float", "xpos", ",", "float", "ypos", ",", "float", "rot", ")", "{", "// work out the centre of the tank in rendering coordinates and then\r", "// spit onto the screen\r", "int", "cx", "=", "(", "int", ")", "...
Draw a single tank to the game @param g The graphics context on which we're drawing @param xpos The x coordinate in tiles the tank is at @param ypos The y coordinate in tiles the tank is at @param rot The rotation of the tank
[ "Draw", "a", "single", "tank", "to", "the", "game" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java#L236-L244
1,439
nguillaumin/slick2d-maven
slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java
Scroller.main
public static void main(String[] argv) { try { // create a new container for our example game. This container // just creates a normal native window for rendering OpenGL accelerated // elements to AppGameContainer container = new AppGameContainer(new Scroller(), 800, 600, false); container.start(...
java
public static void main(String[] argv) { try { // create a new container for our example game. This container // just creates a normal native window for rendering OpenGL accelerated // elements to AppGameContainer container = new AppGameContainer(new Scroller(), 800, 600, false); container.start(...
[ "public", "static", "void", "main", "(", "String", "[", "]", "argv", ")", "{", "try", "{", "// create a new container for our example game. This container\r", "// just creates a normal native window for rendering OpenGL accelerated\r", "// elements to\r", "AppGameContainer", "conta...
Entry point to the scroller example @param argv The argument passed on the command line (if any)
[ "Entry", "point", "to", "the", "scroller", "example" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/scroller/Scroller.java#L251-L261
1,440
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/SettingsPanel.java
SettingsPanel.browseForImage
private void browseForImage() { if (emitter != null) { int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); String path = file.getParentFile().getAbsolutePath(); String name = file.getName(); ConfigurableEmitter.s...
java
private void browseForImage() { if (emitter != null) { int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); String path = file.getParentFile().getAbsolutePath(); String name = file.getName(); ConfigurableEmitter.s...
[ "private", "void", "browseForImage", "(", ")", "{", "if", "(", "emitter", "!=", "null", ")", "{", "int", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "Fi...
Browse for a particle image and set the value into both the emitter and text field on successful completion
[ "Browse", "for", "a", "particle", "image", "and", "set", "the", "value", "into", "both", "the", "emitter", "and", "text", "field", "on", "successful", "completion" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/SettingsPanel.java#L88-L102
1,441
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/BigImage.java
BigImage.getMaxSingleImageSize
public static final int getMaxSingleImageSize() { IntBuffer buffer = BufferUtils.createIntBuffer(16); GL.glGetInteger(SGL.GL_MAX_TEXTURE_SIZE, buffer); return buffer.get(0); }
java
public static final int getMaxSingleImageSize() { IntBuffer buffer = BufferUtils.createIntBuffer(16); GL.glGetInteger(SGL.GL_MAX_TEXTURE_SIZE, buffer); return buffer.get(0); }
[ "public", "static", "final", "int", "getMaxSingleImageSize", "(", ")", "{", "IntBuffer", "buffer", "=", "BufferUtils", ".", "createIntBuffer", "(", "16", ")", ";", "GL", ".", "glGetInteger", "(", "SGL", ".", "GL_MAX_TEXTURE_SIZE", ",", "buffer", ")", ";", "r...
Get the maximum size of an image supported by the underlying hardware. @return The maximum size of the textures supported by the underlying hardware.
[ "Get", "the", "maximum", "size", "of", "an", "image", "supported", "by", "the", "underlying", "hardware", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/BigImage.java#L43-L48
1,442
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/BigImage.java
BigImage.build
private void build(String ref, int filter, int tileSize) throws SlickException { try { final LoadableImageData data = ImageDataFactory.getImageDataFor(ref); final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null); build(data, imageBuffer, filter, tileSize); ...
java
private void build(String ref, int filter, int tileSize) throws SlickException { try { final LoadableImageData data = ImageDataFactory.getImageDataFor(ref); final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null); build(data, imageBuffer, filter, tileSize); ...
[ "private", "void", "build", "(", "String", "ref", ",", "int", "filter", ",", "int", "tileSize", ")", "throws", "SlickException", "{", "try", "{", "final", "LoadableImageData", "data", "=", "ImageDataFactory", ".", "getImageDataFor", "(", "ref", ")", ";", "fi...
Create a new big image by loading it from the specified reference @param ref The reference to the image to load @param filter The image filter to apply (@see #Image.FILTER_NEAREST) @param tileSize The maximum size of the tiles to use to build the bigger image @throws SlickException Indicates we were unable to locate t...
[ "Create", "a", "new", "big", "image", "by", "loading", "it", "from", "the", "specified", "reference" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/BigImage.java#L147-L155
1,443
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/BigImage.java
BigImage.destroy
public void destroy() throws SlickException { for (int tx=0;tx<xcount;tx++) { for (int ty=0;ty<ycount;ty++) { Image image = images[tx][ty]; image.destroy(); } } }
java
public void destroy() throws SlickException { for (int tx=0;tx<xcount;tx++) { for (int ty=0;ty<ycount;ty++) { Image image = images[tx][ty]; image.destroy(); } } }
[ "public", "void", "destroy", "(", ")", "throws", "SlickException", "{", "for", "(", "int", "tx", "=", "0", ";", "tx", "<", "xcount", ";", "tx", "++", ")", "{", "for", "(", "int", "ty", "=", "0", ";", "ty", "<", "ycount", ";", "ty", "++", ")", ...
Destroy the image and release any native resources. Calls on a destroyed image have undefined results
[ "Destroy", "the", "image", "and", "release", "any", "native", "resources", ".", "Calls", "on", "a", "destroyed", "image", "have", "undefined", "results" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/BigImage.java#L711-L718
1,444
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/ImageIOImageData.java
ImageIOImageData.copyArea
private void copyArea(BufferedImage image, int x, int y, int width, int height, int dx, int dy) { Graphics2D g = (Graphics2D) image.getGraphics(); g.drawImage(image.getSubimage(x, y, width, height),x+dx,y+dy,null); }
java
private void copyArea(BufferedImage image, int x, int y, int width, int height, int dx, int dy) { Graphics2D g = (Graphics2D) image.getGraphics(); g.drawImage(image.getSubimage(x, y, width, height),x+dx,y+dy,null); }
[ "private", "void", "copyArea", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "int", "dx", ",", "int", "dy", ")", "{", "Graphics2D", "g", "=", "(", "Graphics2D", ")", "image", ".", "...
Implement of transform copy area for 1.4 @param image The image to copy @param x The x position to copy to @param y The y position to copy to @param width The width of the image @param height The height of the image @param dx The transform on the x axis @param dy The transform on the y axis
[ "Implement", "of", "transform", "copy", "area", "for", "1", ".", "4" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/ImageIOImageData.java#L232-L236
1,445
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/BufferedImageUtil.java
BufferedImageUtil.getTexture
public static Texture getTexture(String resourceName, BufferedImage resourceImage) throws IOException { Texture tex = getTexture(resourceName, resourceImage, SGL.GL_TEXTURE_2D, // target SGL.GL_RGBA8, // dest pixel format SGL.GL_LINEAR, // min filter (unused) SGL.GL_LINEAR); return tex; ...
java
public static Texture getTexture(String resourceName, BufferedImage resourceImage) throws IOException { Texture tex = getTexture(resourceName, resourceImage, SGL.GL_TEXTURE_2D, // target SGL.GL_RGBA8, // dest pixel format SGL.GL_LINEAR, // min filter (unused) SGL.GL_LINEAR); return tex; ...
[ "public", "static", "Texture", "getTexture", "(", "String", "resourceName", ",", "BufferedImage", "resourceImage", ")", "throws", "IOException", "{", "Texture", "tex", "=", "getTexture", "(", "resourceName", ",", "resourceImage", ",", "SGL", ".", "GL_TEXTURE_2D", ...
Load a texture @param resourceName The location of the resource to load @param resourceImage The BufferedImage we are converting @return The loaded texture @throws IOException Indicates a failure to access the resource
[ "Load", "a", "texture" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/BufferedImageUtil.java#L37-L46
1,446
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/BufferedImageUtil.java
BufferedImageUtil.getTexture
public static Texture getTexture(String resourceName, BufferedImage resourceimage, int target, int dstPixelFormat, int minFilter, int magFilter) throws IOException { ImageIOImageData data = new ImageIOImageData();int srcPixelFormat = 0; // create the texture ID for this texture int textureID = Intern...
java
public static Texture getTexture(String resourceName, BufferedImage resourceimage, int target, int dstPixelFormat, int minFilter, int magFilter) throws IOException { ImageIOImageData data = new ImageIOImageData();int srcPixelFormat = 0; // create the texture ID for this texture int textureID = Intern...
[ "public", "static", "Texture", "getTexture", "(", "String", "resourceName", ",", "BufferedImage", "resourceimage", ",", "int", "target", ",", "int", "dstPixelFormat", ",", "int", "minFilter", ",", "int", "magFilter", ")", "throws", "IOException", "{", "ImageIOImag...
Load a texture into OpenGL from a BufferedImage @param resourceName The location of the resource to load @param resourceimage The BufferedImage we are converting @param target The GL target to load the texture against @param dstPixelFormat The pixel format of the screen @param minFilter The minimising filter @param ma...
[ "Load", "a", "texture", "into", "OpenGL", "from", "a", "BufferedImage" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/BufferedImageUtil.java#L89-L144
1,447
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.getScratchImage
static public BufferedImage getScratchImage() { Graphics2D g = (Graphics2D)scratchImage.getGraphics(); g.setComposite(AlphaComposite.Clear); g.fillRect(0, 0, GlyphPage.MAX_GLYPH_SIZE, GlyphPage.MAX_GLYPH_SIZE); g.setComposite(AlphaComposite.SrcOver); g.setColor(java.awt.Color.white); return scratchIma...
java
static public BufferedImage getScratchImage() { Graphics2D g = (Graphics2D)scratchImage.getGraphics(); g.setComposite(AlphaComposite.Clear); g.fillRect(0, 0, GlyphPage.MAX_GLYPH_SIZE, GlyphPage.MAX_GLYPH_SIZE); g.setComposite(AlphaComposite.SrcOver); g.setColor(java.awt.Color.white); return scratchIma...
[ "static", "public", "BufferedImage", "getScratchImage", "(", ")", "{", "Graphics2D", "g", "=", "(", "Graphics2D", ")", "scratchImage", ".", "getGraphics", "(", ")", ";", "g", ".", "setComposite", "(", "AlphaComposite", ".", "Clear", ")", ";", "g", ".", "fi...
Returns an image that can be used by effects as a temp image. @return The scratch image used for temporary operations
[ "Returns", "an", "image", "that", "can", "be", "used", "by", "effects", "as", "a", "temp", "image", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L48-L55
1,448
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.colorValue
static public Value colorValue(String name, Color currentValue) { return new DefaultValue(name, EffectUtil.toString(currentValue)) { public void showDialog () { Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value)); if (newColor != null) value = EffectUtil.toSt...
java
static public Value colorValue(String name, Color currentValue) { return new DefaultValue(name, EffectUtil.toString(currentValue)) { public void showDialog () { Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value)); if (newColor != null) value = EffectUtil.toSt...
[ "static", "public", "Value", "colorValue", "(", "String", "name", ",", "Color", "currentValue", ")", "{", "return", "new", "DefaultValue", "(", "name", ",", "EffectUtil", ".", "toString", "(", "currentValue", ")", ")", "{", "public", "void", "showDialog", "(...
Prompts the user for a colour value @param name Thename of the value being configured @param currentValue The default value that should be selected @return The value selected
[ "Prompts", "the", "user", "for", "a", "colour", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L64-L75
1,449
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.intValue
static public Value intValue (String name, final int currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1)); if (showVa...
java
static public Value intValue (String name, final int currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1)); if (showVa...
[ "static", "public", "Value", "intValue", "(", "String", "name", ",", "final", "int", "currentValue", ",", "final", "String", "description", ")", "{", "return", "new", "DefaultValue", "(", "name", ",", "String", ".", "valueOf", "(", "currentValue", ")", ")", ...
Prompts the user for int value @param name The name of the dialog to show @param currentValue The current value to be displayed @param description The help text to provide @return The value selected by the user
[ "Prompts", "the", "user", "for", "int", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L85-L96
1,450
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.floatValue
static public Value floatValue (String name, final float currentValue, final float min, final float max, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1...
java
static public Value floatValue (String name, final float currentValue, final float min, final float max, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1...
[ "static", "public", "Value", "floatValue", "(", "String", "name", ",", "final", "float", "currentValue", ",", "final", "float", "min", ",", "final", "float", "max", ",", "final", "String", "description", ")", "{", "return", "new", "DefaultValue", "(", "name"...
Prompts the user for float value @param name The name of the dialog to show @param currentValue The current value to be displayed @param description The help text to provide @param min The minimum value to allow @param max The maximum value to allow @return The value selected by the user
[ "Prompts", "the", "user", "for", "float", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L108-L120
1,451
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.booleanValue
static public Value booleanValue (String name, final boolean currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); if (showValueDialog(checkBox, d...
java
static public Value booleanValue (String name, final boolean currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); if (showValueDialog(checkBox, d...
[ "static", "public", "Value", "booleanValue", "(", "String", "name", ",", "final", "boolean", "currentValue", ",", "final", "String", "description", ")", "{", "return", "new", "DefaultValue", "(", "name", ",", "String", ".", "valueOf", "(", "currentValue", ")",...
Prompts the user for boolean value @param name The name of the dialog to show @param currentValue The current value to be displayed @param description The help text to provide @return The value selected by the user
[ "Prompts", "the", "user", "for", "boolean", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L130-L142
1,452
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.optionValue
static public Value optionValue (String name, final String currentValue, final String[][] options, final String description) { return new DefaultValue(name, currentValue.toString()) { public void showDialog () { int selectedIndex = -1; DefaultComboBoxModel model = new DefaultComboBoxModel(); for (...
java
static public Value optionValue (String name, final String currentValue, final String[][] options, final String description) { return new DefaultValue(name, currentValue.toString()) { public void showDialog () { int selectedIndex = -1; DefaultComboBoxModel model = new DefaultComboBoxModel(); for (...
[ "static", "public", "Value", "optionValue", "(", "String", "name", ",", "final", "String", "currentValue", ",", "final", "String", "[", "]", "[", "]", "options", ",", "final", "String", "description", ")", "{", "return", "new", "DefaultValue", "(", "name", ...
Prompts the user for a value that represents a fixed number of options. All options are strings. @param options The first array has an entry for each option. Each entry is either a String[1] that is both the display value and actual value, or a String[2] whose first element is the display value and second element is t...
[ "Prompts", "the", "user", "for", "a", "value", "that", "represents", "a", "fixed", "number", "of", "options", ".", "All", "options", "are", "strings", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L157-L186
1,453
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.fromString
static public Color fromString (String rgb) { if (rgb == null || rgb.length() != 6) return Color.white; return new Color(Integer.parseInt(rgb.substring(0, 2), 16), Integer.parseInt(rgb.substring(2, 4), 16), Integer.parseInt(rgb .substring(4, 6), 16)); }
java
static public Color fromString (String rgb) { if (rgb == null || rgb.length() != 6) return Color.white; return new Color(Integer.parseInt(rgb.substring(0, 2), 16), Integer.parseInt(rgb.substring(2, 4), 16), Integer.parseInt(rgb .substring(4, 6), 16)); }
[ "static", "public", "Color", "fromString", "(", "String", "rgb", ")", "{", "if", "(", "rgb", "==", "null", "||", "rgb", ".", "length", "(", ")", "!=", "6", ")", "return", "Color", ".", "white", ";", "return", "new", "Color", "(", "Integer", ".", "p...
Converts a string to a color. @param rgb The string encoding the colour @return The colour represented by the given encoded string
[ "Converts", "a", "string", "to", "a", "color", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L211-L215
1,454
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.addKeyListenerImpl
private void addKeyListenerImpl(KeyListener listener) { if (keyListeners.contains(listener)) { return; } keyListeners.add(listener); allListeners.add(listener); }
java
private void addKeyListenerImpl(KeyListener listener) { if (keyListeners.contains(listener)) { return; } keyListeners.add(listener); allListeners.add(listener); }
[ "private", "void", "addKeyListenerImpl", "(", "KeyListener", "listener", ")", "{", "if", "(", "keyListeners", ".", "contains", "(", "listener", ")", ")", "{", "return", ";", "}", "keyListeners", ".", "add", "(", "listener", ")", ";", "allListeners", ".", "...
Add a key listener to be notified of key input events @param listener The listener to be notified
[ "Add", "a", "key", "listener", "to", "be", "notified", "of", "key", "input", "events" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L497-L503
1,455
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.addMouseListenerImpl
private void addMouseListenerImpl(MouseListener listener) { if (mouseListeners.contains(listener)) { return; } mouseListeners.add(listener); allListeners.add(listener); }
java
private void addMouseListenerImpl(MouseListener listener) { if (mouseListeners.contains(listener)) { return; } mouseListeners.add(listener); allListeners.add(listener); }
[ "private", "void", "addMouseListenerImpl", "(", "MouseListener", "listener", ")", "{", "if", "(", "mouseListeners", ".", "contains", "(", "listener", ")", ")", "{", "return", ";", "}", "mouseListeners", ".", "add", "(", "listener", ")", ";", "allListeners", ...
Add a mouse listener to be notified of mouse input events @param listener The listener to be notified
[ "Add", "a", "mouse", "listener", "to", "be", "notified", "of", "mouse", "input", "events" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L519-L525
1,456
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.addControllerListener
public void addControllerListener(ControllerListener listener) { if (controllerListeners.contains(listener)) { return; } controllerListeners.add(listener); allListeners.add(listener); }
java
public void addControllerListener(ControllerListener listener) { if (controllerListeners.contains(listener)) { return; } controllerListeners.add(listener); allListeners.add(listener); }
[ "public", "void", "addControllerListener", "(", "ControllerListener", "listener", ")", "{", "if", "(", "controllerListeners", ".", "contains", "(", "listener", ")", ")", "{", "return", ";", "}", "controllerListeners", ".", "add", "(", "listener", ")", ";", "al...
Add a controller listener to be notified of controller input events @param listener The listener to be notified
[ "Add", "a", "controller", "listener", "to", "be", "notified", "of", "controller", "input", "events" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L532-L538
1,457
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.addPrimaryListener
public void addPrimaryListener(InputListener listener) { removeListener(listener); keyListeners.add(0, listener); mouseListeners.add(0, listener); controllerListeners.add(0, listener); allListeners.add(listener); }
java
public void addPrimaryListener(InputListener listener) { removeListener(listener); keyListeners.add(0, listener); mouseListeners.add(0, listener); controllerListeners.add(0, listener); allListeners.add(listener); }
[ "public", "void", "addPrimaryListener", "(", "InputListener", "listener", ")", "{", "removeListener", "(", "listener", ")", ";", "keyListeners", ".", "add", "(", "0", ",", "listener", ")", ";", "mouseListeners", ".", "add", "(", "0", ",", "listener", ")", ...
Add a listener to be notified of input events. This listener will get events before others that are currently registered @param listener The listener to be notified
[ "Add", "a", "listener", "to", "be", "notified", "of", "input", "events", ".", "This", "listener", "will", "get", "events", "before", "others", "that", "are", "currently", "registered" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L579-L587
1,458
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.removeKeyListener
public void removeKeyListener(KeyListener listener) { keyListeners.remove(listener); keyListenersToAdd.remove(listener); if (!mouseListeners.contains(listener) && !controllerListeners.contains(listener)) { allListeners.remove(listener); } }
java
public void removeKeyListener(KeyListener listener) { keyListeners.remove(listener); keyListenersToAdd.remove(listener); if (!mouseListeners.contains(listener) && !controllerListeners.contains(listener)) { allListeners.remove(listener); } }
[ "public", "void", "removeKeyListener", "(", "KeyListener", "listener", ")", "{", "keyListeners", ".", "remove", "(", "listener", ")", ";", "keyListenersToAdd", ".", "remove", "(", "listener", ")", ";", "if", "(", "!", "mouseListeners", ".", "contains", "(", ...
Remove a key listener that will no longer be notified @param listener The listen to be removed
[ "Remove", "a", "key", "listener", "that", "will", "no", "longer", "be", "notified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L605-L612
1,459
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.removeControllerListener
public void removeControllerListener(ControllerListener listener) { controllerListeners.remove(listener); if (!mouseListeners.contains(listener) && !keyListeners.contains(listener)) { allListeners.remove(listener); } }
java
public void removeControllerListener(ControllerListener listener) { controllerListeners.remove(listener); if (!mouseListeners.contains(listener) && !keyListeners.contains(listener)) { allListeners.remove(listener); } }
[ "public", "void", "removeControllerListener", "(", "ControllerListener", "listener", ")", "{", "controllerListeners", ".", "remove", "(", "listener", ")", ";", "if", "(", "!", "mouseListeners", ".", "contains", "(", "listener", ")", "&&", "!", "keyListeners", "....
Remove a controller listener that will no longer be notified @param listener The listen to be removed
[ "Remove", "a", "controller", "listener", "that", "will", "no", "longer", "be", "notified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L619-L625
1,460
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.removeMouseListener
public void removeMouseListener(MouseListener listener) { mouseListeners.remove(listener); mouseListenersToAdd.remove(listener); if (!controllerListeners.contains(listener) && !keyListeners.contains(listener)) { allListeners.remove(listener); } }
java
public void removeMouseListener(MouseListener listener) { mouseListeners.remove(listener); mouseListenersToAdd.remove(listener); if (!controllerListeners.contains(listener) && !keyListeners.contains(listener)) { allListeners.remove(listener); } }
[ "public", "void", "removeMouseListener", "(", "MouseListener", "listener", ")", "{", "mouseListeners", ".", "remove", "(", "listener", ")", ";", "mouseListenersToAdd", ".", "remove", "(", "listener", ")", ";", "if", "(", "!", "controllerListeners", ".", "contain...
Remove a mouse listener that will no longer be notified @param listener The listen to be removed
[ "Remove", "a", "mouse", "listener", "that", "will", "no", "longer", "be", "notified" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L632-L639
1,461
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isControlPressed
public boolean isControlPressed(int button, int controller) { if (controllerPressed[controller][button]) { controllerPressed[controller][button] = false; return true; } return false; }
java
public boolean isControlPressed(int button, int controller) { if (controllerPressed[controller][button]) { controllerPressed[controller][button] = false; return true; } return false; }
[ "public", "boolean", "isControlPressed", "(", "int", "button", ",", "int", "controller", ")", "{", "if", "(", "controllerPressed", "[", "controller", "]", "[", "button", "]", ")", "{", "controllerPressed", "[", "controller", "]", "[", "button", "]", "=", "...
Check if a controller button has been pressed since last time @param controller The index of the controller to check @param button The button to check for (note that this includes directional controls first) @return True if the button has been pressed since last time
[ "Check", "if", "a", "controller", "button", "has", "been", "pressed", "since", "last", "time" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L712-L719
1,462
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.clearControlPressedRecord
public void clearControlPressedRecord() { for (int i=0;i<controllers.size();i++) { Arrays.fill(controllerPressed[i], false); } }
java
public void clearControlPressedRecord() { for (int i=0;i<controllers.size();i++) { Arrays.fill(controllerPressed[i], false); } }
[ "public", "void", "clearControlPressedRecord", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "controllers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Arrays", ".", "fill", "(", "controllerPressed", "[", "i", "]", ",", "fal...
Clear the state for isControlPressed method. This will reset all controls to not pressed
[ "Clear", "the", "state", "for", "isControlPressed", "method", ".", "This", "will", "reset", "all", "controls", "to", "not", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L725-L729
1,463
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.getAxisName
public String getAxisName(int controller, int axis) { return ((Controller) controllers.get(controller)).getAxisName(axis); }
java
public String getAxisName(int controller, int axis) { return ((Controller) controllers.get(controller)).getAxisName(axis); }
[ "public", "String", "getAxisName", "(", "int", "controller", ",", "int", "axis", ")", "{", "return", "(", "(", "Controller", ")", "controllers", ".", "get", "(", "controller", ")", ")", ".", "getAxisName", "(", "axis", ")", ";", "}" ]
Get the name of the axis with the given index @param controller The index of the controller to check @param axis The index of the axis to read @return The name of the specified axis
[ "Get", "the", "name", "of", "the", "axis", "with", "the", "given", "index" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L863-L865
1,464
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isControllerLeft
public boolean isControllerLeft(int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isControllerLeft(i)) { return true; } } return false; } return ((Contro...
java
public boolean isControllerLeft(int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isControllerLeft(i)) { return true; } } return false; } return ((Contro...
[ "public", "boolean", "isControllerLeft", "(", "int", "controller", ")", "{", "if", "(", "controller", ">=", "getControllerCount", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "controller", "==", "ANY_CONTROLLER", ")", "{", "for", "(", "int",...
Check if the controller has the left direction pressed @param controller The index of the controller to check @return True if the controller is pressed to the left
[ "Check", "if", "the", "controller", "has", "the", "left", "direction", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L873-L890
1,465
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isControllerUp
public boolean isControllerUp(int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isControllerUp(i)) { return true; } } return false; } return ((Controller) cont...
java
public boolean isControllerUp(int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isControllerUp(i)) { return true; } } return false; } return ((Controller) cont...
[ "public", "boolean", "isControllerUp", "(", "int", "controller", ")", "{", "if", "(", "controller", ">=", "getControllerCount", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "controller", "==", "ANY_CONTROLLER", ")", "{", "for", "(", "int", ...
Check if the controller has the up direction pressed @param controller The index of the controller to check @return True if the controller is pressed to the up
[ "Check", "if", "the", "controller", "has", "the", "up", "direction", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L923-L939
1,466
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isButtonPressed
public boolean isButtonPressed(int index, int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isButtonPressed(index, i)) { return true; } } return false; } r...
java
public boolean isButtonPressed(int index, int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isButtonPressed(index, i)) { return true; } } return false; } r...
[ "public", "boolean", "isButtonPressed", "(", "int", "index", ",", "int", "controller", ")", "{", "if", "(", "controller", ">=", "getControllerCount", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "controller", "==", "ANY_CONTROLLER", ")", "{"...
Check if controller button is pressed @param controller The index of the controller to check @param index The index of the button to check @return True if the button is pressed
[ "Check", "if", "controller", "button", "is", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L974-L990
1,467
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.initControllers
public void initControllers() throws SlickException { if (controllersInited) { return; } controllersInited = true; try { Controllers.create(); int count = Controllers.getControllerCount(); for (int i = 0; i < count; i++) { Controller controller = Controllers.getController(i); ...
java
public void initControllers() throws SlickException { if (controllersInited) { return; } controllersInited = true; try { Controllers.create(); int count = Controllers.getControllerCount(); for (int i = 0; i < count; i++) { Controller controller = Controllers.getController(i); ...
[ "public", "void", "initControllers", "(", ")", "throws", "SlickException", "{", "if", "(", "controllersInited", ")", "{", "return", ";", "}", "controllersInited", "=", "true", ";", "try", "{", "Controllers", ".", "create", "(", ")", ";", "int", "count", "=...
Initialise the controllers system @throws SlickException Indicates a failure to use the hardware
[ "Initialise", "the", "controllers", "system" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1027-L1057
1,468
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.considerDoubleClick
public void considerDoubleClick(int button, int x, int y) { if (doubleClickTimeout == 0) { clickX = x; clickY = y; clickButton = button; doubleClickTimeout = System.currentTimeMillis() + doubleClickDelay; fireMouseClicked(button, x, y, 1); } else { if (clickButton == button) { if ((Sy...
java
public void considerDoubleClick(int button, int x, int y) { if (doubleClickTimeout == 0) { clickX = x; clickY = y; clickButton = button; doubleClickTimeout = System.currentTimeMillis() + doubleClickDelay; fireMouseClicked(button, x, y, 1); } else { if (clickButton == button) { if ((Sy...
[ "public", "void", "considerDoubleClick", "(", "int", "button", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "doubleClickTimeout", "==", "0", ")", "{", "clickX", "=", "x", ";", "clickY", "=", "y", ";", "clickButton", "=", "button", ";", "dou...
Notification that the mouse has been pressed and hence we should consider what we're doing with double clicking @param button The button pressed/released @param x The location of the mouse @param y The location of the mouse
[ "Notification", "that", "the", "mouse", "has", "been", "pressed", "and", "hence", "we", "should", "consider", "what", "we", "re", "doing", "with", "double", "clicking" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1107-L1122
1,469
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.fireControlPress
private void fireControlPress(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.controll...
java
private void fireControlPress(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.controll...
[ "private", "void", "fireControlPress", "(", "int", "index", ",", "int", "controllerIndex", ")", "{", "consumed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "controllerListeners", ".", "size", "(", ")", ";", "i", "++", ")", "{...
Fire an event indicating that a control has been pressed @param index The index of the control pressed @param controllerIndex The index of the controller on which the control was pressed
[ "Fire", "an", "event", "indicating", "that", "a", "control", "has", "been", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1403-L1431
1,470
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.fireControlRelease
private void fireControlRelease(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.contro...
java
private void fireControlRelease(int index, int controllerIndex) { consumed = false; for (int i=0;i<controllerListeners.size();i++) { ControllerListener listener = (ControllerListener) controllerListeners.get(i); if (listener.isAcceptingInput()) { switch (index) { case LEFT: listener.contro...
[ "private", "void", "fireControlRelease", "(", "int", "index", ",", "int", "controllerIndex", ")", "{", "consumed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "controllerListeners", ".", "size", "(", ")", ";", "i", "++", ")", ...
Fire an event indicating that a control has been released @param index The index of the control released @param controllerIndex The index of the controller on which the control was released
[ "Fire", "an", "event", "indicating", "that", "a", "control", "has", "been", "released" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1439-L1467
1,471
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isControlDwn
private boolean isControlDwn(int index, int controllerIndex) { switch (index) { case LEFT: return isControllerLeft(controllerIndex); case RIGHT: return isControllerRight(controllerIndex); case UP: return isControllerUp(controllerIndex); case DOWN: return isControllerDown(controllerIndex);...
java
private boolean isControlDwn(int index, int controllerIndex) { switch (index) { case LEFT: return isControllerLeft(controllerIndex); case RIGHT: return isControllerRight(controllerIndex); case UP: return isControllerUp(controllerIndex); case DOWN: return isControllerDown(controllerIndex);...
[ "private", "boolean", "isControlDwn", "(", "int", "index", ",", "int", "controllerIndex", ")", "{", "switch", "(", "index", ")", "{", "case", "LEFT", ":", "return", "isControllerLeft", "(", "controllerIndex", ")", ";", "case", "RIGHT", ":", "return", "isCont...
Check if a particular control is currently pressed @param index The index of the control @param controllerIndex The index of the control to which the control belongs @return True if the control is pressed
[ "Check", "if", "a", "particular", "control", "is", "currently", "pressed" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1476-L1493
1,472
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.fireMouseClicked
private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); if (consumed...
java
private void fireMouseClicked(int button, int x, int y, int clickCount) { consumed = false; for (int i=0;i<mouseListeners.size();i++) { MouseListener listener = (MouseListener) mouseListeners.get(i); if (listener.isAcceptingInput()) { listener.mouseClicked(button, x, y, clickCount); if (consumed...
[ "private", "void", "fireMouseClicked", "(", "int", "button", ",", "int", "x", ",", "int", "y", ",", "int", "clickCount", ")", "{", "consumed", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mouseListeners", ".", "size", "(", "...
Notify listeners that the mouse button has been clicked @param button The button that has been clicked @param x The location at which the button was clicked @param y The location at which the button was clicked @param clickCount The number of times the button was clicked (single or double click)
[ "Notify", "listeners", "that", "the", "mouse", "button", "has", "been", "clicked" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L1523-L1534
1,473
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureImpl.java
TextureImpl.createIntBuffer
protected IntBuffer createIntBuffer(int size) { ByteBuffer temp = ByteBuffer.allocateDirect(4 * size); temp.order(ByteOrder.nativeOrder()); return temp.asIntBuffer(); }
java
protected IntBuffer createIntBuffer(int size) { ByteBuffer temp = ByteBuffer.allocateDirect(4 * size); temp.order(ByteOrder.nativeOrder()); return temp.asIntBuffer(); }
[ "protected", "IntBuffer", "createIntBuffer", "(", "int", "size", ")", "{", "ByteBuffer", "temp", "=", "ByteBuffer", ".", "allocateDirect", "(", "4", "*", "size", ")", ";", "temp", ".", "order", "(", "ByteOrder", ".", "nativeOrder", "(", ")", ")", ";", "r...
Creates an integer buffer to hold specified ints - strictly a utility method @param size how many int to contain @return created IntBuffer
[ "Creates", "an", "integer", "buffer", "to", "hold", "specified", "ints", "-", "strictly", "a", "utility", "method" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureImpl.java#L293-L298
1,474
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureImpl.java
TextureImpl.setTextureData
public void setTextureData(int srcPixelFormat, int componentCount, int minFilter, int magFilter, ByteBuffer textureBuffer) { reloadData = new ReloadData(); reloadData.srcPixelFormat = srcPixelFormat; reloadData.componentCount = componentCount; reloadData.minFilter = minFilter; reloadData.magFilter = ...
java
public void setTextureData(int srcPixelFormat, int componentCount, int minFilter, int magFilter, ByteBuffer textureBuffer) { reloadData = new ReloadData(); reloadData.srcPixelFormat = srcPixelFormat; reloadData.componentCount = componentCount; reloadData.minFilter = minFilter; reloadData.magFilter = ...
[ "public", "void", "setTextureData", "(", "int", "srcPixelFormat", ",", "int", "componentCount", ",", "int", "minFilter", ",", "int", "magFilter", ",", "ByteBuffer", "textureBuffer", ")", "{", "reloadData", "=", "new", "ReloadData", "(", ")", ";", "reloadData", ...
Set the texture data that this texture can be reloaded from @param srcPixelFormat The pixel format @param componentCount The component count @param minFilter The OpenGL minification filter @param magFilter The OpenGL magnification filter @param textureBuffer The texture buffer containing the data for the texture
[ "Set", "the", "texture", "data", "that", "this", "texture", "can", "be", "reloaded", "from" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureImpl.java#L333-L341
1,475
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/imageout/ImageOut.java
ImageOut.write
public static void write(Image image, String format, String dest, boolean writeAlpha) throws SlickException { try { write(image, format, new FileOutputStream(dest), writeAlpha); } catch (IOException e) { throw new SlickException("Unable to write to the destination: "+dest, e); } }
java
public static void write(Image image, String format, String dest, boolean writeAlpha) throws SlickException { try { write(image, format, new FileOutputStream(dest), writeAlpha); } catch (IOException e) { throw new SlickException("Unable to write to the destination: "+dest, e); } }
[ "public", "static", "void", "write", "(", "Image", "image", ",", "String", "format", ",", "String", "dest", ",", "boolean", "writeAlpha", ")", "throws", "SlickException", "{", "try", "{", "write", "(", "image", ",", "format", ",", "new", "FileOutputStream", ...
Write an image out to a file on the local file system. @param image The image to be written out @param format The format to write the image out in @param dest The destination path to write to @param writeAlpha True if we should write the alpha channel out (some formats don't support this, like JPG) @throws SlickExcept...
[ "Write", "an", "image", "out", "to", "a", "file", "on", "the", "local", "file", "system", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/imageout/ImageOut.java#L124-L130
1,476
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Curve.java
Curve.pointAt
public Vector2f pointAt(float t) { float a = 1 - t; float b = t; float f1 = a * a * a; float f2 = 3 * a * a * b; float f3 = 3 * a * b * b; float f4 = b * b * b; float nx = (p1.x * f1) + (c1.x * f2) + (c2.x * f3) + (p2.x * f4); float ny = (p1.y * f1) + (c1.y * f2) + (c2.y * f3) + (p2.y * ...
java
public Vector2f pointAt(float t) { float a = 1 - t; float b = t; float f1 = a * a * a; float f2 = 3 * a * a * b; float f3 = 3 * a * b * b; float f4 = b * b * b; float nx = (p1.x * f1) + (c1.x * f2) + (c2.x * f3) + (p2.x * f4); float ny = (p1.y * f1) + (c1.y * f2) + (c2.y * f3) + (p2.y * ...
[ "public", "Vector2f", "pointAt", "(", "float", "t", ")", "{", "float", "a", "=", "1", "-", "t", ";", "float", "b", "=", "t", ";", "float", "f1", "=", "a", "*", "a", "*", "a", ";", "float", "f2", "=", "3", "*", "a", "*", "a", "*", "b", ";"...
Get the point at a particular location on the curve @param t A value between 0 and 1 defining the location of the curve the point is at @return The point on the curve
[ "Get", "the", "point", "at", "a", "particular", "location", "on", "the", "curve" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Curve.java#L59-L72
1,477
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java
DataSet.toAngelCodeText
public void toAngelCodeText(PrintStream out, String imageName) { out.println("info face=\""+fontName+"\" size="+size+" bold=0 italic=0 charset=\""+setName+"\" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1"); out.println("common lineHeight="+lineHeight+" base=26 scaleW="+width+" scaleH="+height+...
java
public void toAngelCodeText(PrintStream out, String imageName) { out.println("info face=\""+fontName+"\" size="+size+" bold=0 italic=0 charset=\""+setName+"\" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1"); out.println("common lineHeight="+lineHeight+" base=26 scaleW="+width+" scaleH="+height+...
[ "public", "void", "toAngelCodeText", "(", "PrintStream", "out", ",", "String", "imageName", ")", "{", "out", ".", "println", "(", "\"info face=\\\"\"", "+", "fontName", "+", "\"\\\" size=\"", "+", "size", "+", "\" bold=0 italic=0 charset=\\\"\"", "+", "setName", "...
Output this data set as an angel code data file @param imageName The name of the image to reference @param out The output stream to write to
[ "Output", "this", "data", "set", "as", "an", "angel", "code", "data", "file" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java#L93-L108
1,478
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java
DataSet.addCharacter
public void addCharacter(int code, int xadvance, int x, int y, int width, int height,int yoffset) { chars.add(new CharData(code, xadvance, x, y, width, height,size + yoffset)); }
java
public void addCharacter(int code, int xadvance, int x, int y, int width, int height,int yoffset) { chars.add(new CharData(code, xadvance, x, y, width, height,size + yoffset)); }
[ "public", "void", "addCharacter", "(", "int", "code", ",", "int", "xadvance", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "int", "yoffset", ")", "{", "chars", ".", "add", "(", "new", "CharData", "(", "code", ",...
Add a character to the data set @param code The character code @param xadvance The advance on the x axis after writing this character @param x The x position on the sheet of the character @param y The y position on the sheet of the character @param width The width of the character on the sheet @param height The height...
[ "Add", "a", "character", "to", "the", "data", "set" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java#L214-L216
1,479
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java
DataSet.addKerning
public void addKerning(int first, int second, int offset) { kerning.add(new KerningData(first, second, offset)); }
java
public void addKerning(int first, int second, int offset) { kerning.add(new KerningData(first, second, offset)); }
[ "public", "void", "addKerning", "(", "int", "first", ",", "int", "second", ",", "int", "offset", ")", "{", "kerning", ".", "add", "(", "new", "KerningData", "(", "first", ",", "second", ",", "offset", ")", ")", ";", "}" ]
Add some kerning data @param first The first character @param second The second character @param offset The kerning offset to apply
[ "Add", "some", "kerning", "data" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java#L225-L227
1,480
nguillaumin/slick2d-maven
slick2d-examples/src/main/java/org/newdawn/slick/examples/lights/Light.java
Light.getEffectAt
public float[] getEffectAt(float x, float y, boolean colouredLights) { // first work out what propotion of the strength distance the light // is from the point. This is a value from 0-1 where 1 is the centre of the // light (i.e. full brightness) and 0 is the very edge (or outside) the lights // range fl...
java
public float[] getEffectAt(float x, float y, boolean colouredLights) { // first work out what propotion of the strength distance the light // is from the point. This is a value from 0-1 where 1 is the centre of the // light (i.e. full brightness) and 0 is the very edge (or outside) the lights // range fl...
[ "public", "float", "[", "]", "getEffectAt", "(", "float", "x", ",", "float", "y", ",", "boolean", "colouredLights", ")", "{", "// first work out what propotion of the strength distance the light\r", "// is from the point. This is a value from 0-1 where 1 is the centre of the\r", ...
Get the effect the light should apply to a given location @param x The x coordinate of the location being considered for lighting @param y The y coordinate of the location being considered for lighting @param colouredLights True if we're supporting coloured lights @return The effect on a given location of the light i...
[ "Get", "the", "effect", "the", "light", "should", "apply", "to", "a", "given", "location" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-examples/src/main/java/org/newdawn/slick/examples/lights/Light.java#L58-L80
1,481
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java
SpriteSheet.getSubImage
public Image getSubImage(int x, int y) { init(); if ((x < 0) || (x >= subImages.length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } if ((y < 0) || (y >= subImages[0].length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } return...
java
public Image getSubImage(int x, int y) { init(); if ((x < 0) || (x >= subImages.length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } if ((y < 0) || (y >= subImages[0].length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } return...
[ "public", "Image", "getSubImage", "(", "int", "x", ",", "int", "y", ")", "{", "init", "(", ")", ";", "if", "(", "(", "x", "<", "0", ")", "||", "(", "x", ">=", "subImages", ".", "length", ")", ")", "{", "throw", "new", "RuntimeException", "(", "...
Get the sub image cached in this sprite sheet @param x The x position in tiles of the image to get @param y The y position in tiles of the image to get @return The subimage at that location on the sheet
[ "Get", "the", "sub", "image", "cached", "in", "this", "sprite", "sheet" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java#L198-L209
1,482
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java
SpriteSheet.getSprite
public Image getSprite(int x, int y) { target.init(); initImpl(); if ((x < 0) || (x >= subImages.length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } if ((y < 0) || (y >= subImages[0].length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); ...
java
public Image getSprite(int x, int y) { target.init(); initImpl(); if ((x < 0) || (x >= subImages.length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); } if ((y < 0) || (y >= subImages[0].length)) { throw new RuntimeException("SubImage out of sheet bounds: "+x+","+y); ...
[ "public", "Image", "getSprite", "(", "int", "x", ",", "int", "y", ")", "{", "target", ".", "init", "(", ")", ";", "initImpl", "(", ")", ";", "if", "(", "(", "x", "<", "0", ")", "||", "(", "x", ">=", "subImages", ".", "length", ")", ")", "{", ...
Get a sprite at a particular cell on the sprite sheet @param x The x position of the cell on the sprite sheet @param y The y position of the cell on the sprite sheet @return The single image from the sprite sheet
[ "Get", "a", "sprite", "at", "a", "particular", "cell", "on", "the", "sprite", "sheet" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java#L218-L230
1,483
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java
SpriteSheet.renderInUse
public void renderInUse(int x,int y,int sx,int sy) { subImages[sx][sy].drawEmbedded(x, y, tw, th); }
java
public void renderInUse(int x,int y,int sx,int sy) { subImages[sx][sy].drawEmbedded(x, y, tw, th); }
[ "public", "void", "renderInUse", "(", "int", "x", ",", "int", "y", ",", "int", "sx", ",", "int", "sy", ")", "{", "subImages", "[", "sx", "]", "[", "sy", "]", ".", "drawEmbedded", "(", "x", ",", "y", ",", "tw", ",", "th", ")", ";", "}" ]
Render a sprite when this sprite sheet is in use. @see #startUse() @see #endUse() @param x The x position to render the sprite at @param y The y position to render the sprite at @param sx The x location of the cell to render @param sy The y location of the cell to render
[ "Render", "a", "sprite", "when", "this", "sprite", "sheet", "is", "in", "use", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SpriteSheet.java#L267-L269
1,484
nguillaumin/slick2d-maven
slick2d-packulike/src/main/java/org/newdawn/slick/tools/packulike/SheetPanel.java
SheetPanel.setTextureSize
public void setTextureSize(int width, int height) { setPreferredSize(new Dimension(width, height)); setSize(new Dimension(width, height)); this.width = width; this.height = height; }
java
public void setTextureSize(int width, int height) { setPreferredSize(new Dimension(width, height)); setSize(new Dimension(width, height)); this.width = width; this.height = height; }
[ "public", "void", "setTextureSize", "(", "int", "width", ",", "int", "height", ")", "{", "setPreferredSize", "(", "new", "Dimension", "(", "width", ",", "height", ")", ")", ";", "setSize", "(", "new", "Dimension", "(", "width", ",", "height", ")", ")", ...
Set the size of the sprite sheet @param width The width of the sheet @param height The height of the sheet
[ "Set", "the", "size", "of", "the", "sprite", "sheet" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-packulike/src/main/java/org/newdawn/slick/tools/packulike/SheetPanel.java#L94-L99
1,485
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.setRadius
public void setRadius(float radius) { if (radius != this.radius) { pointsDirty = true; this.radius = radius; setRadii(radius, radius); } }
java
public void setRadius(float radius) { if (radius != this.radius) { pointsDirty = true; this.radius = radius; setRadii(radius, radius); } }
[ "public", "void", "setRadius", "(", "float", "radius", ")", "{", "if", "(", "radius", "!=", "this", ".", "radius", ")", "{", "pointsDirty", "=", "true", ";", "this", ".", "radius", "=", "radius", ";", "setRadii", "(", "radius", ",", "radius", ")", ";...
Set the radius of this circle @param radius The radius of this circle
[ "Set", "the", "radius", "of", "this", "circle" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L72-L78
1,486
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.intersects
public boolean intersects(Shape shape) { if(shape instanceof Circle) { Circle other = (Circle)shape; float totalRad2 = getRadius() + other.getRadius(); if (Math.abs(other.getCenterX() - getCenterX()) > totalRad2) { return false; } if (Math.abs(other.getC...
java
public boolean intersects(Shape shape) { if(shape instanceof Circle) { Circle other = (Circle)shape; float totalRad2 = getRadius() + other.getRadius(); if (Math.abs(other.getCenterX() - getCenterX()) > totalRad2) { return false; } if (Math.abs(other.getC...
[ "public", "boolean", "intersects", "(", "Shape", "shape", ")", "{", "if", "(", "shape", "instanceof", "Circle", ")", "{", "Circle", "other", "=", "(", "Circle", ")", "shape", ";", "float", "totalRad2", "=", "getRadius", "(", ")", "+", "other", ".", "ge...
Check if this circle touches another @param shape The other circle @return True if they touch
[ "Check", "if", "this", "circle", "touches", "another" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L95-L120
1,487
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.contains
public boolean contains(float x, float y) { float xDelta = x - getCenterX(), yDelta = y - getCenterY(); return xDelta * xDelta + yDelta * yDelta < getRadius() * getRadius(); }
java
public boolean contains(float x, float y) { float xDelta = x - getCenterX(), yDelta = y - getCenterY(); return xDelta * xDelta + yDelta * yDelta < getRadius() * getRadius(); }
[ "public", "boolean", "contains", "(", "float", "x", ",", "float", "y", ")", "{", "float", "xDelta", "=", "x", "-", "getCenterX", "(", ")", ",", "yDelta", "=", "y", "-", "getCenterY", "(", ")", ";", "return", "xDelta", "*", "xDelta", "+", "yDelta", ...
Check if a point is contained by this circle @param x The x coordinate of the point to check @param y The y coorindate of the point to check @return True if the point is contained by this circle
[ "Check", "if", "a", "point", "is", "contained", "by", "this", "circle" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L129-L133
1,488
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.contains
private boolean contains(Line line) { return contains(line.getX1(), line.getY1()) && contains(line.getX2(), line.getY2()); }
java
private boolean contains(Line line) { return contains(line.getX1(), line.getY1()) && contains(line.getX2(), line.getY2()); }
[ "private", "boolean", "contains", "(", "Line", "line", ")", "{", "return", "contains", "(", "line", ".", "getX1", "(", ")", ",", "line", ".", "getY1", "(", ")", ")", "&&", "contains", "(", "line", ".", "getX2", "(", ")", ",", "line", ".", "getY2", ...
Check if circle contains the line @param line Line to check against @return True if line inside circle
[ "Check", "if", "circle", "contains", "the", "line" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L140-L142
1,489
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.intersects
private boolean intersects(Rectangle other) { Rectangle box = other; Circle circle = this; if (box.contains(x+radius,y+radius)) { return true; } float x1 = box.getX(); float y1 = box.getY(); float x2 = box.getX() + box.getWidth(); float y2 = box.getY() + box.getHeight(); Line[...
java
private boolean intersects(Rectangle other) { Rectangle box = other; Circle circle = this; if (box.contains(x+radius,y+radius)) { return true; } float x1 = box.getX(); float y1 = box.getY(); float x2 = box.getX() + box.getWidth(); float y2 = box.getY() + box.getHeight(); Line[...
[ "private", "boolean", "intersects", "(", "Rectangle", "other", ")", "{", "Rectangle", "box", "=", "other", ";", "Circle", "circle", "=", "this", ";", "if", "(", "box", ".", "contains", "(", "x", "+", "radius", ",", "y", "+", "radius", ")", ")", "{", ...
Check if this circle touches a rectangle @param other The rectangle to check against @return True if they touch
[ "Check", "if", "this", "circle", "touches", "a", "rectangle" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L166-L197
1,490
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.intersects
private boolean intersects(Line other) { // put it nicely into vectors Vector2f lineSegmentStart = new Vector2f(other.getX1(), other.getY1()); Vector2f lineSegmentEnd = new Vector2f(other.getX2(), other.getY2()); Vector2f circleCenter = new Vector2f(getCenterX(), getCenterY()); ...
java
private boolean intersects(Line other) { // put it nicely into vectors Vector2f lineSegmentStart = new Vector2f(other.getX1(), other.getY1()); Vector2f lineSegmentEnd = new Vector2f(other.getX2(), other.getY2()); Vector2f circleCenter = new Vector2f(getCenterX(), getCenterY()); ...
[ "private", "boolean", "intersects", "(", "Line", "other", ")", "{", "// put it nicely into vectors \r", "Vector2f", "lineSegmentStart", "=", "new", "Vector2f", "(", "other", ".", "getX1", "(", ")", ",", "other", ".", "getY1", "(", ")", ")", ";", "Vector2f", ...
Check if circle touches a line. @param other The line to check against @return True if they touch
[ "Check", "if", "circle", "touches", "a", "line", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L204-L233
1,491
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java
AudioLoader.getAudio
public static Audio getAudio(String format, InputStream in) throws IOException { init(); if (format.equals(AIF)) { return SoundStore.get().getAIF(in); } if (format.equals(WAV)) { return SoundStore.get().getWAV(in); } if (format.equals(OGG)) { return SoundStore.get().getOgg(in); } ...
java
public static Audio getAudio(String format, InputStream in) throws IOException { init(); if (format.equals(AIF)) { return SoundStore.get().getAIF(in); } if (format.equals(WAV)) { return SoundStore.get().getWAV(in); } if (format.equals(OGG)) { return SoundStore.get().getOgg(in); } ...
[ "public", "static", "Audio", "getAudio", "(", "String", "format", ",", "InputStream", "in", ")", "throws", "IOException", "{", "init", "(", ")", ";", "if", "(", "format", ".", "equals", "(", "AIF", ")", ")", "{", "return", "SoundStore", ".", "get", "("...
Get audio data in a playable state by loading the complete audio into memory. @param format The format of the audio to be loaded (something like "XM" or "OGG") @param in The input stream from which to load the audio data @return An object representing the audio data @throws IOException Indicates a failure to access th...
[ "Get", "audio", "data", "in", "a", "playable", "state", "by", "loading", "the", "complete", "audio", "into", "memory", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java#L47-L61
1,492
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java
AudioLoader.getStreamingAudio
public static Audio getStreamingAudio(String format, URL url) throws IOException { init(); if (format.equals(OGG)) { return SoundStore.get().getOggStream(url); } if (format.equals(MOD)) { return SoundStore.get().getMOD(url.openStream()); } if (format.equals(XM)) { return SoundStore.get...
java
public static Audio getStreamingAudio(String format, URL url) throws IOException { init(); if (format.equals(OGG)) { return SoundStore.get().getOggStream(url); } if (format.equals(MOD)) { return SoundStore.get().getMOD(url.openStream()); } if (format.equals(XM)) { return SoundStore.get...
[ "public", "static", "Audio", "getStreamingAudio", "(", "String", "format", ",", "URL", "url", ")", "throws", "IOException", "{", "init", "(", ")", ";", "if", "(", "format", ".", "equals", "(", "OGG", ")", ")", "{", "return", "SoundStore", ".", "get", "...
Get audio data in a playable state by setting up a stream that can be piped into OpenAL - i.e. streaming audio @param format The format of the audio to be loaded (something like "XM" or "OGG") @param url The location of the data that should be streamed @return An object representing the audio data @throws IOException ...
[ "Get", "audio", "data", "in", "a", "playable", "state", "by", "setting", "up", "a", "stream", "that", "can", "be", "piped", "into", "OpenAL", "-", "i", ".", "e", ".", "streaming", "audio" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/AudioLoader.java#L72-L86
1,493
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/WaveData.java
WaveData.create
public static WaveData create(AudioInputStream ais) { //get format of data AudioFormat audioformat = ais.getFormat(); // get channels int channels = 0; if (audioformat.getChannels() == 1) { if (audioformat.getSampleSizeInBits() == 8) { channels = AL10.AL_FORMAT_MONO8; } else if (audioforma...
java
public static WaveData create(AudioInputStream ais) { //get format of data AudioFormat audioformat = ais.getFormat(); // get channels int channels = 0; if (audioformat.getChannels() == 1) { if (audioformat.getSampleSizeInBits() == 8) { channels = AL10.AL_FORMAT_MONO8; } else if (audioforma...
[ "public", "static", "WaveData", "create", "(", "AudioInputStream", "ais", ")", "{", "//get format of data\r", "AudioFormat", "audioformat", "=", "ais", ".", "getFormat", "(", ")", ";", "// get channels\r", "int", "channels", "=", "0", ";", "if", "(", "audioforma...
Creates a WaveData container from the specified stream @param ais AudioInputStream to read from @return WaveData containing data, or null if a failure occured
[ "Creates", "a", "WaveData", "container", "from", "the", "specified", "stream" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/WaveData.java#L180-L239
1,494
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java
MaskUtil.defineMask
public static void defineMask() { GL.glDepthMask(true); GL.glClearDepth(1); GL.glClear(SGL.GL_DEPTH_BUFFER_BIT); GL.glDepthFunc(SGL.GL_ALWAYS); GL.glEnable(SGL.GL_DEPTH_TEST); GL.glDepthMask(true); GL.glColorMask(false, false, false, false); }
java
public static void defineMask() { GL.glDepthMask(true); GL.glClearDepth(1); GL.glClear(SGL.GL_DEPTH_BUFFER_BIT); GL.glDepthFunc(SGL.GL_ALWAYS); GL.glEnable(SGL.GL_DEPTH_TEST); GL.glDepthMask(true); GL.glColorMask(false, false, false, false); }
[ "public", "static", "void", "defineMask", "(", ")", "{", "GL", ".", "glDepthMask", "(", "true", ")", ";", "GL", ".", "glClearDepth", "(", "1", ")", ";", "GL", ".", "glClear", "(", "SGL", ".", "GL_DEPTH_BUFFER_BIT", ")", ";", "GL", ".", "glDepthFunc", ...
Start defining the screen mask. After calling this use graphics functions to mask out the area
[ "Start", "defining", "the", "screen", "mask", ".", "After", "calling", "this", "use", "graphics", "functions", "to", "mask", "out", "the", "area" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java#L19-L27
1,495
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java
MaskUtil.finishDefineMask
public static void finishDefineMask() { GL.glDepthMask(false); GL.glColorMask(true, true, true, true); }
java
public static void finishDefineMask() { GL.glDepthMask(false); GL.glColorMask(true, true, true, true); }
[ "public", "static", "void", "finishDefineMask", "(", ")", "{", "GL", ".", "glDepthMask", "(", "false", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", ";", "}" ]
Finish defining the screen mask
[ "Finish", "defining", "the", "screen", "mask" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java#L32-L35
1,496
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java
MaskUtil.resetMask
public static void resetMask() { GL.glDepthMask(true); GL.glClearDepth(0); GL.glClear(SGL.GL_DEPTH_BUFFER_BIT); GL.glDepthMask(false); GL.glDisable(SGL.GL_DEPTH_TEST); }
java
public static void resetMask() { GL.glDepthMask(true); GL.glClearDepth(0); GL.glClear(SGL.GL_DEPTH_BUFFER_BIT); GL.glDepthMask(false); GL.glDisable(SGL.GL_DEPTH_TEST); }
[ "public", "static", "void", "resetMask", "(", ")", "{", "GL", ".", "glDepthMask", "(", "true", ")", ";", "GL", ".", "glClearDepth", "(", "0", ")", ";", "GL", ".", "glClear", "(", "SGL", ".", "GL_DEPTH_BUFFER_BIT", ")", ";", "GL", ".", "glDepthMask", ...
Reset the masked area - should be done after you've finished rendering
[ "Reset", "the", "masked", "area", "-", "should", "be", "done", "after", "you", "ve", "finished", "rendering" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/MaskUtil.java#L54-L61
1,497
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java
UnicodeFont.createFont
private static Font createFont (String ttfFileRef) throws SlickException { try { return Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(ttfFileRef)); } catch (FontFormatException ex) { throw new SlickException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { thr...
java
private static Font createFont (String ttfFileRef) throws SlickException { try { return Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(ttfFileRef)); } catch (FontFormatException ex) { throw new SlickException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { thr...
[ "private", "static", "Font", "createFont", "(", "String", "ttfFileRef", ")", "throws", "SlickException", "{", "try", "{", "return", "Font", ".", "createFont", "(", "Font", ".", "TRUETYPE_FONT", ",", "ResourceLoader", ".", "getResourceAsStream", "(", "ttfFileRef", ...
Utility to create a Java font for a TTF file reference @param ttfFileRef The file system or classpath location of the TrueTypeFont file. @return The font created @throws SlickException Indicates a failure to locate or load the font into Java's font system.
[ "Utility", "to", "create", "a", "Java", "font", "for", "a", "TTF", "file", "reference" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java#L59-L67
1,498
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java
UnicodeFont.initializeFont
private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) { Map attributes = baseFont.getAttributes(); attributes.put(TextAttribute.SIZE, new Float(size)); attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR); attributes.put(TextAttri...
java
private void initializeFont(Font baseFont, int size, boolean bold, boolean italic) { Map attributes = baseFont.getAttributes(); attributes.put(TextAttribute.SIZE, new Float(size)); attributes.put(TextAttribute.WEIGHT, bold ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR); attributes.put(TextAttri...
[ "private", "void", "initializeFont", "(", "Font", "baseFont", ",", "int", "size", ",", "boolean", "bold", ",", "boolean", "italic", ")", "{", "Map", "attributes", "=", "baseFont", ".", "getAttributes", "(", ")", ";", "attributes", ".", "put", "(", "TextAtt...
Initialise the font to be used based on configuration @param baseFont The AWT font to render @param size The point size of the font to generated @param bold True if the font should be rendered in bold typeface @param italic True if the font should be rendered in bold typeface
[ "Initialise", "the", "font", "to", "be", "used", "based", "on", "configuration" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java#L227-L248
1,499
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java
UnicodeFont.loadSettings
private void loadSettings(HieroSettings settings) { paddingTop = settings.getPaddingTop(); paddingLeft = settings.getPaddingLeft(); paddingBottom = settings.getPaddingBottom(); paddingRight = settings.getPaddingRight(); paddingAdvanceX = settings.getPaddingAdvanceX(); paddingAdvanceY = settings.getPad...
java
private void loadSettings(HieroSettings settings) { paddingTop = settings.getPaddingTop(); paddingLeft = settings.getPaddingLeft(); paddingBottom = settings.getPaddingBottom(); paddingRight = settings.getPaddingRight(); paddingAdvanceX = settings.getPaddingAdvanceX(); paddingAdvanceY = settings.getPad...
[ "private", "void", "loadSettings", "(", "HieroSettings", "settings", ")", "{", "paddingTop", "=", "settings", ".", "getPaddingTop", "(", ")", ";", "paddingLeft", "=", "settings", ".", "getPaddingLeft", "(", ")", ";", "paddingBottom", "=", "settings", ".", "get...
Load the hiero setting and configure the unicode font's rendering @param settings The settings to be applied
[ "Load", "the", "hiero", "setting", "and", "configure", "the", "unicode", "font", "s", "rendering" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java#L255-L265