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
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
1,300
hawkular/hawkular-alerts
engine/src/main/java/org/hawkular/alerts/engine/impl/ispn/IspnActionsServiceImpl.java
IspnActionsServiceImpl.inClause
private String inClause(String field, Set<String> values) { String separator = ""; StringBuffer sb = new StringBuffer(" and ("); for (String v : values) { sb.append(separator); sb.append(String.format("%s = '%s'", field, v)); separator = " or "; } sb.append(")"); return sb.toString(); }
java
private String inClause(String field, Set<String> values) { String separator = ""; StringBuffer sb = new StringBuffer(" and ("); for (String v : values) { sb.append(separator); sb.append(String.format("%s = '%s'", field, v)); separator = " or "; } sb.append(")"); return sb.toString(); }
[ "private", "String", "inClause", "(", "String", "field", ",", "Set", "<", "String", ">", "values", ")", "{", "String", "separator", "=", "\"\"", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\" and (\"", ")", ";", "for", "(", "String", "v", ":", "values", ")", "{", "sb", ".", "append", "(", "separator", ")", ";", "sb", ".", "append", "(", "String", ".", "format", "(", "\"%s = '%s'\"", ",", "field", ",", "v", ")", ")", ";", "separator", "=", "\" or \"", ";", "}", "sb", ".", "append", "(", "\")\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
An exploded "in" clause because the actual one seems not to work
[ "An", "exploded", "in", "clause", "because", "the", "actual", "one", "seems", "not", "to", "work" ]
b4a0c2909b38e03e72cc1828219562ee8fcbf426
https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/engine/src/main/java/org/hawkular/alerts/engine/impl/ispn/IspnActionsServiceImpl.java#L227-L237
1,301
hawkular/hawkular-alerts
rest-handlers/src/main/java/org/hawkular/alerts/handlers/util/Link.java
Link.rfc5988String
public String rfc5988String() { StringBuilder builder = new StringBuilder(); builder.append("<") .append(href) .append(">; rel=\"") .append(rel) .append("\""); return builder.toString(); }
java
public String rfc5988String() { StringBuilder builder = new StringBuilder(); builder.append("<") .append(href) .append(">; rel=\"") .append(rel) .append("\""); return builder.toString(); }
[ "public", "String", "rfc5988String", "(", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"<\"", ")", ".", "append", "(", "href", ")", ".", "append", "(", "\">; rel=\\\"\"", ")", ".", "append", "(", "rel", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Return the link in the format of RFC 5988 Web Linking. See <a href="http://tools.ietf.org/html/rfc5988#page-7">RFC 5988 Web Linking</a> @return String that contains the link with href and rel
[ "Return", "the", "link", "in", "the", "format", "of", "RFC", "5988", "Web", "Linking", "." ]
b4a0c2909b38e03e72cc1828219562ee8fcbf426
https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/rest-handlers/src/main/java/org/hawkular/alerts/handlers/util/Link.java#L69-L77
1,302
Qkyrie/Markdown2Pdf
src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java
HtmlCleaner.cleanWithOutputEncoding
public String cleanWithOutputEncoding(String input, String outputEncoding) throws ConversionException { return clean(input, null, outputEncoding); }
java
public String cleanWithOutputEncoding(String input, String outputEncoding) throws ConversionException { return clean(input, null, outputEncoding); }
[ "public", "String", "cleanWithOutputEncoding", "(", "String", "input", ",", "String", "outputEncoding", ")", "throws", "ConversionException", "{", "return", "clean", "(", "input", ",", "null", ",", "outputEncoding", ")", ";", "}" ]
Clean-up HTML code with specified output encoding, asumes UTF-8 as input encoding. @param input @param outputEncoding @return @throws ConversionException
[ "Clean", "-", "up", "HTML", "code", "with", "specified", "output", "encoding", "asumes", "UTF", "-", "8", "as", "input", "encoding", "." ]
f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a
https://github.com/Qkyrie/Markdown2Pdf/blob/f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a/src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java#L38-L40
1,303
Qkyrie/Markdown2Pdf
src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java
HtmlCleaner.cleanWithInputEncoding
public String cleanWithInputEncoding(String htmlFile, String inputEncoding) throws ConversionException { return clean(htmlFile, inputEncoding, null); }
java
public String cleanWithInputEncoding(String htmlFile, String inputEncoding) throws ConversionException { return clean(htmlFile, inputEncoding, null); }
[ "public", "String", "cleanWithInputEncoding", "(", "String", "htmlFile", ",", "String", "inputEncoding", ")", "throws", "ConversionException", "{", "return", "clean", "(", "htmlFile", ",", "inputEncoding", ",", "null", ")", ";", "}" ]
Clean-up HTML code with specified input encoding, asumes UTF-8 as output encoding. @param htmlFile @param inputEncoding @return @throws ConversionException
[ "Clean", "-", "up", "HTML", "code", "with", "specified", "input", "encoding", "asumes", "UTF", "-", "8", "as", "output", "encoding", "." ]
f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a
https://github.com/Qkyrie/Markdown2Pdf/blob/f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a/src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java#L49-L51
1,304
Qkyrie/Markdown2Pdf
src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java
HtmlCleaner.clean
public String clean(String input, String inputEncoding, String outputEncoding) throws ConversionException { InputStream stringAsStream; try { stringAsStream = new ByteArrayInputStream(input.getBytes(inputEncoding !=null ? inputEncoding : "UTF-8")); } catch (UnsupportedEncodingException e) { throw ConversionException.HTML_TO_PDF_EXCEPTION; } ByteArrayOutputStream outputAsStream = new ByteArrayOutputStream(); Tidy htmlCleaner = new Tidy(); htmlCleaner.setInputEncoding(inputEncoding !=null ? inputEncoding : "UTF-8"); htmlCleaner.setOutputEncoding(outputEncoding != null ? outputEncoding : "UTF-8"); htmlCleaner.setXHTML(true); htmlCleaner.parse(stringAsStream, outputAsStream); try { String result = outputAsStream.toString(outputEncoding != null ? outputEncoding : "UTF-8"); return result.trim(); } catch (UnsupportedEncodingException e) { throw ConversionException.HTML_TO_PDF_EXCEPTION; } }
java
public String clean(String input, String inputEncoding, String outputEncoding) throws ConversionException { InputStream stringAsStream; try { stringAsStream = new ByteArrayInputStream(input.getBytes(inputEncoding !=null ? inputEncoding : "UTF-8")); } catch (UnsupportedEncodingException e) { throw ConversionException.HTML_TO_PDF_EXCEPTION; } ByteArrayOutputStream outputAsStream = new ByteArrayOutputStream(); Tidy htmlCleaner = new Tidy(); htmlCleaner.setInputEncoding(inputEncoding !=null ? inputEncoding : "UTF-8"); htmlCleaner.setOutputEncoding(outputEncoding != null ? outputEncoding : "UTF-8"); htmlCleaner.setXHTML(true); htmlCleaner.parse(stringAsStream, outputAsStream); try { String result = outputAsStream.toString(outputEncoding != null ? outputEncoding : "UTF-8"); return result.trim(); } catch (UnsupportedEncodingException e) { throw ConversionException.HTML_TO_PDF_EXCEPTION; } }
[ "public", "String", "clean", "(", "String", "input", ",", "String", "inputEncoding", ",", "String", "outputEncoding", ")", "throws", "ConversionException", "{", "InputStream", "stringAsStream", ";", "try", "{", "stringAsStream", "=", "new", "ByteArrayInputStream", "(", "input", ".", "getBytes", "(", "inputEncoding", "!=", "null", "?", "inputEncoding", ":", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "ConversionException", ".", "HTML_TO_PDF_EXCEPTION", ";", "}", "ByteArrayOutputStream", "outputAsStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "Tidy", "htmlCleaner", "=", "new", "Tidy", "(", ")", ";", "htmlCleaner", ".", "setInputEncoding", "(", "inputEncoding", "!=", "null", "?", "inputEncoding", ":", "\"UTF-8\"", ")", ";", "htmlCleaner", ".", "setOutputEncoding", "(", "outputEncoding", "!=", "null", "?", "outputEncoding", ":", "\"UTF-8\"", ")", ";", "htmlCleaner", ".", "setXHTML", "(", "true", ")", ";", "htmlCleaner", ".", "parse", "(", "stringAsStream", ",", "outputAsStream", ")", ";", "try", "{", "String", "result", "=", "outputAsStream", ".", "toString", "(", "outputEncoding", "!=", "null", "?", "outputEncoding", ":", "\"UTF-8\"", ")", ";", "return", "result", ".", "trim", "(", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "ConversionException", ".", "HTML_TO_PDF_EXCEPTION", ";", "}", "}" ]
Clean-up HTML code with specified input and output encodings. @param input HTML text @param inputEncoding A valid java encoding name. Uses UTF-8 if null. @param outputEncoding A valid java encoding name. Uses UTF-8 if null. @return @throws ConversionException
[ "Clean", "-", "up", "HTML", "code", "with", "specified", "input", "and", "output", "encodings", "." ]
f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a
https://github.com/Qkyrie/Markdown2Pdf/blob/f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a/src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java#L62-L82
1,305
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setCurrent
public static void setCurrent(Graphics current) { if (currentGraphics != current) { if (currentGraphics != null) { currentGraphics.disable(); } currentGraphics = current; currentGraphics.enable(); } }
java
public static void setCurrent(Graphics current) { if (currentGraphics != current) { if (currentGraphics != null) { currentGraphics.disable(); } currentGraphics = current; currentGraphics.enable(); } }
[ "public", "static", "void", "setCurrent", "(", "Graphics", "current", ")", "{", "if", "(", "currentGraphics", "!=", "current", ")", "{", "if", "(", "currentGraphics", "!=", "null", ")", "{", "currentGraphics", ".", "disable", "(", ")", ";", "}", "currentGraphics", "=", "current", ";", "currentGraphics", ".", "enable", "(", ")", ";", "}", "}" ]
Set the current graphics context in use @param current The graphics context that should be considered current
[ "Set", "the", "current", "graphics", "context", "in", "use" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L70-L78
1,306
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setDrawMode
public void setDrawMode(int mode) { predraw(); currentDrawingMode = mode; if (currentDrawingMode == MODE_NORMAL) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE_MINUS_SRC_ALPHA); } if (currentDrawingMode == MODE_ALPHA_MAP) { GL.glDisable(SGL.GL_BLEND); GL.glColorMask(false, false, false, true); } if (currentDrawingMode == MODE_ALPHA_BLEND) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, false); GL.glBlendFunc(SGL.GL_DST_ALPHA, SGL.GL_ONE_MINUS_DST_ALPHA); } if (currentDrawingMode == MODE_COLOR_MULTIPLY) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE_MINUS_SRC_COLOR, SGL.GL_SRC_COLOR); } if (currentDrawingMode == MODE_ADD) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE, SGL.GL_ONE); } if (currentDrawingMode == MODE_SCREEN) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE, SGL.GL_ONE_MINUS_SRC_COLOR); } postdraw(); }
java
public void setDrawMode(int mode) { predraw(); currentDrawingMode = mode; if (currentDrawingMode == MODE_NORMAL) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE_MINUS_SRC_ALPHA); } if (currentDrawingMode == MODE_ALPHA_MAP) { GL.glDisable(SGL.GL_BLEND); GL.glColorMask(false, false, false, true); } if (currentDrawingMode == MODE_ALPHA_BLEND) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, false); GL.glBlendFunc(SGL.GL_DST_ALPHA, SGL.GL_ONE_MINUS_DST_ALPHA); } if (currentDrawingMode == MODE_COLOR_MULTIPLY) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE_MINUS_SRC_COLOR, SGL.GL_SRC_COLOR); } if (currentDrawingMode == MODE_ADD) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE, SGL.GL_ONE); } if (currentDrawingMode == MODE_SCREEN) { GL.glEnable(SGL.GL_BLEND); GL.glColorMask(true, true, true, true); GL.glBlendFunc(SGL.GL_ONE, SGL.GL_ONE_MINUS_SRC_COLOR); } postdraw(); }
[ "public", "void", "setDrawMode", "(", "int", "mode", ")", "{", "predraw", "(", ")", ";", "currentDrawingMode", "=", "mode", ";", "if", "(", "currentDrawingMode", "==", "MODE_NORMAL", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", ";", "GL", ".", "glBlendFunc", "(", "SGL", ".", "GL_SRC_ALPHA", ",", "SGL", ".", "GL_ONE_MINUS_SRC_ALPHA", ")", ";", "}", "if", "(", "currentDrawingMode", "==", "MODE_ALPHA_MAP", ")", "{", "GL", ".", "glDisable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "false", ",", "false", ",", "false", ",", "true", ")", ";", "}", "if", "(", "currentDrawingMode", "==", "MODE_ALPHA_BLEND", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "false", ")", ";", "GL", ".", "glBlendFunc", "(", "SGL", ".", "GL_DST_ALPHA", ",", "SGL", ".", "GL_ONE_MINUS_DST_ALPHA", ")", ";", "}", "if", "(", "currentDrawingMode", "==", "MODE_COLOR_MULTIPLY", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", ";", "GL", ".", "glBlendFunc", "(", "SGL", ".", "GL_ONE_MINUS_SRC_COLOR", ",", "SGL", ".", "GL_SRC_COLOR", ")", ";", "}", "if", "(", "currentDrawingMode", "==", "MODE_ADD", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", ";", "GL", ".", "glBlendFunc", "(", "SGL", ".", "GL_ONE", ",", "SGL", ".", "GL_ONE", ")", ";", "}", "if", "(", "currentDrawingMode", "==", "MODE_SCREEN", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_BLEND", ")", ";", "GL", ".", "glColorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", ";", "GL", ".", "glBlendFunc", "(", "SGL", ".", "GL_ONE", ",", "SGL", ".", "GL_ONE_MINUS_SRC_COLOR", ")", ";", "}", "postdraw", "(", ")", ";", "}" ]
Set the drawing mode to use. This mode defines how pixels are drawn to the graphics context. It can be used to draw into the alpha map. The mode supplied should be one of {@link Graphics#MODE_NORMAL} or {@link Graphics#MODE_ALPHA_MAP} or {@link Graphics#MODE_ALPHA_BLEND} @param mode The mode to apply.
[ "Set", "the", "drawing", "mode", "to", "use", ".", "This", "mode", "defines", "how", "pixels", "are", "drawn", "to", "the", "graphics", "context", ".", "It", "can", "be", "used", "to", "draw", "into", "the", "alpha", "map", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L178-L211
1,307
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setBackground
public void setBackground(Color color) { predraw(); GL.glClearColor(color.r, color.g, color.b, color.a); postdraw(); }
java
public void setBackground(Color color) { predraw(); GL.glClearColor(color.r, color.g, color.b, color.a); postdraw(); }
[ "public", "void", "setBackground", "(", "Color", "color", ")", "{", "predraw", "(", ")", ";", "GL", ".", "glClearColor", "(", "color", ".", "r", ",", "color", ".", "g", ",", "color", ".", "b", ",", "color", ".", "a", ")", ";", "postdraw", "(", ")", ";", "}" ]
Set the background colour of the graphics context. This colour is used when clearing the context. Note that calling this method alone does not cause the context to be cleared. @param color The background color of the graphics context
[ "Set", "the", "background", "colour", "of", "the", "graphics", "context", ".", "This", "colour", "is", "used", "when", "clearing", "the", "context", ".", "Note", "that", "calling", "this", "method", "alone", "does", "not", "cause", "the", "context", "to", "be", "cleared", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L286-L290
1,308
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.getBackground
public Color getBackground() { predraw(); FloatBuffer buffer = BufferUtils.createFloatBuffer(16); GL.glGetFloat(SGL.GL_COLOR_CLEAR_VALUE, buffer); postdraw(); return new Color(buffer); }
java
public Color getBackground() { predraw(); FloatBuffer buffer = BufferUtils.createFloatBuffer(16); GL.glGetFloat(SGL.GL_COLOR_CLEAR_VALUE, buffer); postdraw(); return new Color(buffer); }
[ "public", "Color", "getBackground", "(", ")", "{", "predraw", "(", ")", ";", "FloatBuffer", "buffer", "=", "BufferUtils", ".", "createFloatBuffer", "(", "16", ")", ";", "GL", ".", "glGetFloat", "(", "SGL", ".", "GL_COLOR_CLEAR_VALUE", ",", "buffer", ")", ";", "postdraw", "(", ")", ";", "return", "new", "Color", "(", "buffer", ")", ";", "}" ]
Get the current graphics context background color @return The background color of this graphics context
[ "Get", "the", "current", "graphics", "context", "background", "color" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L297-L304
1,309
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.resetTransform
public void resetTransform() { sx = 1; sy = 1; if (pushed) { predraw(); GL.glPopMatrix(); pushed = false; postdraw(); } }
java
public void resetTransform() { sx = 1; sy = 1; if (pushed) { predraw(); GL.glPopMatrix(); pushed = false; postdraw(); } }
[ "public", "void", "resetTransform", "(", ")", "{", "sx", "=", "1", ";", "sy", "=", "1", ";", "if", "(", "pushed", ")", "{", "predraw", "(", ")", ";", "GL", ".", "glPopMatrix", "(", ")", ";", "pushed", "=", "false", ";", "postdraw", "(", ")", ";", "}", "}" ]
Reset the transformation on this graphics context
[ "Reset", "the", "transformation", "on", "this", "graphics", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L318-L328
1,310
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.scale
public void scale(float sx, float sy) { this.sx = this.sx * sx; this.sy = this.sy * sy; checkPush(); predraw(); GL.glScalef(sx, sy, 1); postdraw(); }
java
public void scale(float sx, float sy) { this.sx = this.sx * sx; this.sy = this.sy * sy; checkPush(); predraw(); GL.glScalef(sx, sy, 1); postdraw(); }
[ "public", "void", "scale", "(", "float", "sx", ",", "float", "sy", ")", "{", "this", ".", "sx", "=", "this", ".", "sx", "*", "sx", ";", "this", ".", "sy", "=", "this", ".", "sy", "*", "sy", ";", "checkPush", "(", ")", ";", "predraw", "(", ")", ";", "GL", ".", "glScalef", "(", "sx", ",", "sy", ",", "1", ")", ";", "postdraw", "(", ")", ";", "}" ]
Apply a scaling factor to everything drawn on the graphics context @param sx The scaling factor to apply to the x axis @param sy The scaling factor to apply to the y axis
[ "Apply", "a", "scaling", "factor", "to", "everything", "drawn", "on", "the", "graphics", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L350-L359
1,311
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.rotate
public void rotate(float rx, float ry, float ang) { checkPush(); predraw(); translate(rx, ry); GL.glRotatef(ang, 0, 0, 1); translate(-rx, -ry); postdraw(); }
java
public void rotate(float rx, float ry, float ang) { checkPush(); predraw(); translate(rx, ry); GL.glRotatef(ang, 0, 0, 1); translate(-rx, -ry); postdraw(); }
[ "public", "void", "rotate", "(", "float", "rx", ",", "float", "ry", ",", "float", "ang", ")", "{", "checkPush", "(", ")", ";", "predraw", "(", ")", ";", "translate", "(", "rx", ",", "ry", ")", ";", "GL", ".", "glRotatef", "(", "ang", ",", "0", ",", "0", ",", "1", ")", ";", "translate", "(", "-", "rx", ",", "-", "ry", ")", ";", "postdraw", "(", ")", ";", "}" ]
Apply a rotation to everything draw on the graphics context @param rx The x coordinate of the center of rotation @param ry The y coordinate of the center of rotation @param ang The angle (in degrees) to rotate by
[ "Apply", "a", "rotation", "to", "everything", "draw", "on", "the", "graphics", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L371-L379
1,312
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.translate
public void translate(float x, float y) { checkPush(); predraw(); GL.glTranslatef(x, y, 0); postdraw(); }
java
public void translate(float x, float y) { checkPush(); predraw(); GL.glTranslatef(x, y, 0); postdraw(); }
[ "public", "void", "translate", "(", "float", "x", ",", "float", "y", ")", "{", "checkPush", "(", ")", ";", "predraw", "(", ")", ";", "GL", ".", "glTranslatef", "(", "x", ",", "y", ",", "0", ")", ";", "postdraw", "(", ")", ";", "}" ]
Apply a translation to everything drawn to the context @param x The amount to translate on the x-axis @param y The amount of translate on the y-axis
[ "Apply", "a", "translation", "to", "everything", "drawn", "to", "the", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L389-L395
1,313
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setColor
public void setColor(Color color) { if (color == null) { return; } currentColor = new Color(color); predraw(); currentColor.bind(); postdraw(); }
java
public void setColor(Color color) { if (color == null) { return; } currentColor = new Color(color); predraw(); currentColor.bind(); postdraw(); }
[ "public", "void", "setColor", "(", "Color", "color", ")", "{", "if", "(", "color", "==", "null", ")", "{", "return", ";", "}", "currentColor", "=", "new", "Color", "(", "color", ")", ";", "predraw", "(", ")", ";", "currentColor", ".", "bind", "(", ")", ";", "postdraw", "(", ")", ";", "}" ]
Set the color to use when rendering to this context @param color The color to use when rendering to this context
[ "Set", "the", "color", "to", "use", "when", "rendering", "to", "this", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L420-L429
1,314
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.drawLine
public void drawLine(float x1, float y1, float x2, float y2) { float lineWidth = this.lineWidth - 1; if (LSR.applyGLLineFixes()) { if (x1 == x2) { if (y1 > y2) { float temp = y2; y2 = y1; y1 = temp; } float step = 1 / sy; lineWidth = lineWidth / sy; fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),lineWidth+step,(y2-y1)+lineWidth+step); return; } else if (y1 == y2) { if (x1 > x2) { float temp = x2; x2 = x1; x1 = temp; } float step = 1 / sx; lineWidth = lineWidth / sx; fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),(x2-x1)+lineWidth+step,lineWidth+step); return; } } predraw(); currentColor.bind(); TextureImpl.bindNone(); LSR.start(); LSR.vertex(x1,y1); LSR.vertex(x2,y2); LSR.end(); postdraw(); }
java
public void drawLine(float x1, float y1, float x2, float y2) { float lineWidth = this.lineWidth - 1; if (LSR.applyGLLineFixes()) { if (x1 == x2) { if (y1 > y2) { float temp = y2; y2 = y1; y1 = temp; } float step = 1 / sy; lineWidth = lineWidth / sy; fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),lineWidth+step,(y2-y1)+lineWidth+step); return; } else if (y1 == y2) { if (x1 > x2) { float temp = x2; x2 = x1; x1 = temp; } float step = 1 / sx; lineWidth = lineWidth / sx; fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),(x2-x1)+lineWidth+step,lineWidth+step); return; } } predraw(); currentColor.bind(); TextureImpl.bindNone(); LSR.start(); LSR.vertex(x1,y1); LSR.vertex(x2,y2); LSR.end(); postdraw(); }
[ "public", "void", "drawLine", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ")", "{", "float", "lineWidth", "=", "this", ".", "lineWidth", "-", "1", ";", "if", "(", "LSR", ".", "applyGLLineFixes", "(", ")", ")", "{", "if", "(", "x1", "==", "x2", ")", "{", "if", "(", "y1", ">", "y2", ")", "{", "float", "temp", "=", "y2", ";", "y2", "=", "y1", ";", "y1", "=", "temp", ";", "}", "float", "step", "=", "1", "/", "sy", ";", "lineWidth", "=", "lineWidth", "/", "sy", ";", "fillRect", "(", "x1", "-", "(", "lineWidth", "/", "2.0f", ")", ",", "y1", "-", "(", "lineWidth", "/", "2.0f", ")", ",", "lineWidth", "+", "step", ",", "(", "y2", "-", "y1", ")", "+", "lineWidth", "+", "step", ")", ";", "return", ";", "}", "else", "if", "(", "y1", "==", "y2", ")", "{", "if", "(", "x1", ">", "x2", ")", "{", "float", "temp", "=", "x2", ";", "x2", "=", "x1", ";", "x1", "=", "temp", ";", "}", "float", "step", "=", "1", "/", "sx", ";", "lineWidth", "=", "lineWidth", "/", "sx", ";", "fillRect", "(", "x1", "-", "(", "lineWidth", "/", "2.0f", ")", ",", "y1", "-", "(", "lineWidth", "/", "2.0f", ")", ",", "(", "x2", "-", "x1", ")", "+", "lineWidth", "+", "step", ",", "lineWidth", "+", "step", ")", ";", "return", ";", "}", "}", "predraw", "(", ")", ";", "currentColor", ".", "bind", "(", ")", ";", "TextureImpl", ".", "bindNone", "(", ")", ";", "LSR", ".", "start", "(", ")", ";", "LSR", ".", "vertex", "(", "x1", ",", "y1", ")", ";", "LSR", ".", "vertex", "(", "x2", ",", "y2", ")", ";", "LSR", ".", "end", "(", ")", ";", "postdraw", "(", ")", ";", "}" ]
Draw a line on the canvas in the current colour @param x1 The x coordinate of the start point @param y1 The y coordinate of the start point @param x2 The x coordinate of the end point @param y2 The y coordinate of the end point
[ "Draw", "a", "line", "on", "the", "canvas", "in", "the", "current", "colour" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L452-L489
1,315
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.draw
public void draw(Shape shape, ShapeFill fill) { predraw(); TextureImpl.bindNone(); ShapeRenderer.draw(shape, fill); currentColor.bind(); postdraw(); }
java
public void draw(Shape shape, ShapeFill fill) { predraw(); TextureImpl.bindNone(); ShapeRenderer.draw(shape, fill); currentColor.bind(); postdraw(); }
[ "public", "void", "draw", "(", "Shape", "shape", ",", "ShapeFill", "fill", ")", "{", "predraw", "(", ")", ";", "TextureImpl", ".", "bindNone", "(", ")", ";", "ShapeRenderer", ".", "draw", "(", "shape", ",", "fill", ")", ";", "currentColor", ".", "bind", "(", ")", ";", "postdraw", "(", ")", ";", "}" ]
Draw the outline of the given shape. @param shape The shape to draw. @param fill The fill type to apply
[ "Draw", "the", "outline", "of", "the", "given", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L499-L507
1,316
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.drawRect
public void drawRect(float x1, float y1, float width, float height) { float lineWidth = getLineWidth(); drawLine(x1,y1,x1+width,y1); drawLine(x1+width,y1,x1+width,y1+height); drawLine(x1+width,y1+height,x1,y1+height); drawLine(x1,y1+height,x1,y1); }
java
public void drawRect(float x1, float y1, float width, float height) { float lineWidth = getLineWidth(); drawLine(x1,y1,x1+width,y1); drawLine(x1+width,y1,x1+width,y1+height); drawLine(x1+width,y1+height,x1,y1+height); drawLine(x1,y1+height,x1,y1); }
[ "public", "void", "drawRect", "(", "float", "x1", ",", "float", "y1", ",", "float", "width", ",", "float", "height", ")", "{", "float", "lineWidth", "=", "getLineWidth", "(", ")", ";", "drawLine", "(", "x1", ",", "y1", ",", "x1", "+", "width", ",", "y1", ")", ";", "drawLine", "(", "x1", "+", "width", ",", "y1", ",", "x1", "+", "width", ",", "y1", "+", "height", ")", ";", "drawLine", "(", "x1", "+", "width", ",", "y1", "+", "height", ",", "x1", ",", "y1", "+", "height", ")", ";", "drawLine", "(", "x1", ",", "y1", "+", "height", ",", "x1", ",", "y1", ")", ";", "}" ]
Draw a rectangle to the canvas in the current colour @param x1 The x coordinate of the top left corner @param y1 The y coordinate of the top left corner @param width The width of the rectangle to draw @param height The height of the rectangle to draw
[ "Draw", "a", "rectangle", "to", "the", "canvas", "in", "the", "current", "colour" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L685-L692
1,317
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setWorldClip
public void setWorldClip(float x, float y, float width, float height) { predraw(); worldClipRecord = new Rectangle(x, y, width, height); GL.glEnable(SGL.GL_CLIP_PLANE0); worldClip.put(1).put(0).put(0).put(-x).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE0, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE1); worldClip.put(-1).put(0).put(0).put(x + width).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE1, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE2); worldClip.put(0).put(1).put(0).put(-y).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE2, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE3); worldClip.put(0).put(-1).put(0).put(y + height).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE3, worldClip); postdraw(); }
java
public void setWorldClip(float x, float y, float width, float height) { predraw(); worldClipRecord = new Rectangle(x, y, width, height); GL.glEnable(SGL.GL_CLIP_PLANE0); worldClip.put(1).put(0).put(0).put(-x).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE0, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE1); worldClip.put(-1).put(0).put(0).put(x + width).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE1, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE2); worldClip.put(0).put(1).put(0).put(-y).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE2, worldClip); GL.glEnable(SGL.GL_CLIP_PLANE3); worldClip.put(0).put(-1).put(0).put(y + height).flip(); GL.glClipPlane(SGL.GL_CLIP_PLANE3, worldClip); postdraw(); }
[ "public", "void", "setWorldClip", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ")", "{", "predraw", "(", ")", ";", "worldClipRecord", "=", "new", "Rectangle", "(", "x", ",", "y", ",", "width", ",", "height", ")", ";", "GL", ".", "glEnable", "(", "SGL", ".", "GL_CLIP_PLANE0", ")", ";", "worldClip", ".", "put", "(", "1", ")", ".", "put", "(", "0", ")", ".", "put", "(", "0", ")", ".", "put", "(", "-", "x", ")", ".", "flip", "(", ")", ";", "GL", ".", "glClipPlane", "(", "SGL", ".", "GL_CLIP_PLANE0", ",", "worldClip", ")", ";", "GL", ".", "glEnable", "(", "SGL", ".", "GL_CLIP_PLANE1", ")", ";", "worldClip", ".", "put", "(", "-", "1", ")", ".", "put", "(", "0", ")", ".", "put", "(", "0", ")", ".", "put", "(", "x", "+", "width", ")", ".", "flip", "(", ")", ";", "GL", ".", "glClipPlane", "(", "SGL", ".", "GL_CLIP_PLANE1", ",", "worldClip", ")", ";", "GL", ".", "glEnable", "(", "SGL", ".", "GL_CLIP_PLANE2", ")", ";", "worldClip", ".", "put", "(", "0", ")", ".", "put", "(", "1", ")", ".", "put", "(", "0", ")", ".", "put", "(", "-", "y", ")", ".", "flip", "(", ")", ";", "GL", ".", "glClipPlane", "(", "SGL", ".", "GL_CLIP_PLANE2", ",", "worldClip", ")", ";", "GL", ".", "glEnable", "(", "SGL", ".", "GL_CLIP_PLANE3", ")", ";", "worldClip", ".", "put", "(", "0", ")", ".", "put", "(", "-", "1", ")", ".", "put", "(", "0", ")", ".", "put", "(", "y", "+", "height", ")", ".", "flip", "(", ")", ";", "GL", ".", "glClipPlane", "(", "SGL", ".", "GL_CLIP_PLANE3", ",", "worldClip", ")", ";", "postdraw", "(", ")", ";", "}" ]
Set clipping that controls which areas of the world will be drawn to. Note that world clip is different from standard screen clip in that it's defined in the space of the current world coordinate - i.e. it's affected by translate, rotate, scale etc. @param x The x coordinate of the top left corner of the allowed area @param y The y coordinate of the top left corner of the allowed area @param width The width of the allowed area @param height The height of the allowed area
[ "Set", "clipping", "that", "controls", "which", "areas", "of", "the", "world", "will", "be", "drawn", "to", ".", "Note", "that", "world", "clip", "is", "different", "from", "standard", "screen", "clip", "in", "that", "it", "s", "defined", "in", "the", "space", "of", "the", "current", "world", "coordinate", "-", "i", ".", "e", ".", "it", "s", "affected", "by", "translate", "rotate", "scale", "etc", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L720-L738
1,318
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.clearWorldClip
public void clearWorldClip() { predraw(); worldClipRecord = null; GL.glDisable(SGL.GL_CLIP_PLANE0); GL.glDisable(SGL.GL_CLIP_PLANE1); GL.glDisable(SGL.GL_CLIP_PLANE2); GL.glDisable(SGL.GL_CLIP_PLANE3); postdraw(); }
java
public void clearWorldClip() { predraw(); worldClipRecord = null; GL.glDisable(SGL.GL_CLIP_PLANE0); GL.glDisable(SGL.GL_CLIP_PLANE1); GL.glDisable(SGL.GL_CLIP_PLANE2); GL.glDisable(SGL.GL_CLIP_PLANE3); postdraw(); }
[ "public", "void", "clearWorldClip", "(", ")", "{", "predraw", "(", ")", ";", "worldClipRecord", "=", "null", ";", "GL", ".", "glDisable", "(", "SGL", ".", "GL_CLIP_PLANE0", ")", ";", "GL", ".", "glDisable", "(", "SGL", ".", "GL_CLIP_PLANE1", ")", ";", "GL", ".", "glDisable", "(", "SGL", ".", "GL_CLIP_PLANE2", ")", ";", "GL", ".", "glDisable", "(", "SGL", ".", "GL_CLIP_PLANE3", ")", ";", "postdraw", "(", ")", ";", "}" ]
Clear world clipping setup. This does not effect screen clipping
[ "Clear", "world", "clipping", "setup", ".", "This", "does", "not", "effect", "screen", "clipping" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L743-L751
1,319
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setWorldClip
public void setWorldClip(Rectangle clip) { if (clip == null) { clearWorldClip(); } else { setWorldClip(clip.getX(), clip.getY(), clip.getWidth(), clip .getHeight()); } }
java
public void setWorldClip(Rectangle clip) { if (clip == null) { clearWorldClip(); } else { setWorldClip(clip.getX(), clip.getY(), clip.getWidth(), clip .getHeight()); } }
[ "public", "void", "setWorldClip", "(", "Rectangle", "clip", ")", "{", "if", "(", "clip", "==", "null", ")", "{", "clearWorldClip", "(", ")", ";", "}", "else", "{", "setWorldClip", "(", "clip", ".", "getX", "(", ")", ",", "clip", ".", "getY", "(", ")", ",", "clip", ".", "getWidth", "(", ")", ",", "clip", ".", "getHeight", "(", ")", ")", ";", "}", "}" ]
Set the world clip to be applied @see #setWorldClip(float, float, float, float) @param clip The area still visible
[ "Set", "the", "world", "clip", "to", "be", "applied" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L760-L767
1,320
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.fillRect
public void fillRect(float x, float y, float width, float height, Image pattern, float offX, float offY) { int cols = ((int) Math.ceil(width / pattern.getWidth())) + 2; int rows = ((int) Math.ceil(height / pattern.getHeight())) + 2; Rectangle preClip = getWorldClip(); setWorldClip(x, y, width, height); predraw(); // Draw all the quads we need for (int c = 0; c < cols; c++) { for (int r = 0; r < rows; r++) { pattern.draw(c * pattern.getWidth() + x - offX, r * pattern.getHeight() + y - offY); } } postdraw(); setWorldClip(preClip); }
java
public void fillRect(float x, float y, float width, float height, Image pattern, float offX, float offY) { int cols = ((int) Math.ceil(width / pattern.getWidth())) + 2; int rows = ((int) Math.ceil(height / pattern.getHeight())) + 2; Rectangle preClip = getWorldClip(); setWorldClip(x, y, width, height); predraw(); // Draw all the quads we need for (int c = 0; c < cols; c++) { for (int r = 0; r < rows; r++) { pattern.draw(c * pattern.getWidth() + x - offX, r * pattern.getHeight() + y - offY); } } postdraw(); setWorldClip(preClip); }
[ "public", "void", "fillRect", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "Image", "pattern", ",", "float", "offX", ",", "float", "offY", ")", "{", "int", "cols", "=", "(", "(", "int", ")", "Math", ".", "ceil", "(", "width", "/", "pattern", ".", "getWidth", "(", ")", ")", ")", "+", "2", ";", "int", "rows", "=", "(", "(", "int", ")", "Math", ".", "ceil", "(", "height", "/", "pattern", ".", "getHeight", "(", ")", ")", ")", "+", "2", ";", "Rectangle", "preClip", "=", "getWorldClip", "(", ")", ";", "setWorldClip", "(", "x", ",", "y", ",", "width", ",", "height", ")", ";", "predraw", "(", ")", ";", "// Draw all the quads we need\r", "for", "(", "int", "c", "=", "0", ";", "c", "<", "cols", ";", "c", "++", ")", "{", "for", "(", "int", "r", "=", "0", ";", "r", "<", "rows", ";", "r", "++", ")", "{", "pattern", ".", "draw", "(", "c", "*", "pattern", ".", "getWidth", "(", ")", "+", "x", "-", "offX", ",", "r", "*", "pattern", ".", "getHeight", "(", ")", "+", "y", "-", "offY", ")", ";", "}", "}", "postdraw", "(", ")", ";", "setWorldClip", "(", "preClip", ")", ";", "}" ]
Tile a rectangle with a pattern specifing the offset from the top corner that one tile should match @param x The x coordinate of the rectangle @param y The y coordinate of the rectangle @param width The width of the rectangle @param height The height of the rectangle @param pattern The image to tile across the rectangle @param offX The offset on the x axis from the top left corner @param offY The offset on the y axis from the top left corner
[ "Tile", "a", "rectangle", "with", "a", "pattern", "specifing", "the", "offset", "from", "the", "top", "corner", "that", "one", "tile", "should", "match" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L854-L873
1,321
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.fillRect
public void fillRect(float x1, float y1, float width, float height) { predraw(); TextureImpl.bindNone(); currentColor.bind(); GL.glBegin(SGL.GL_QUADS); GL.glVertex2f(x1, y1); GL.glVertex2f(x1 + width, y1); GL.glVertex2f(x1 + width, y1 + height); GL.glVertex2f(x1, y1 + height); GL.glEnd(); postdraw(); }
java
public void fillRect(float x1, float y1, float width, float height) { predraw(); TextureImpl.bindNone(); currentColor.bind(); GL.glBegin(SGL.GL_QUADS); GL.glVertex2f(x1, y1); GL.glVertex2f(x1 + width, y1); GL.glVertex2f(x1 + width, y1 + height); GL.glVertex2f(x1, y1 + height); GL.glEnd(); postdraw(); }
[ "public", "void", "fillRect", "(", "float", "x1", ",", "float", "y1", ",", "float", "width", ",", "float", "height", ")", "{", "predraw", "(", ")", ";", "TextureImpl", ".", "bindNone", "(", ")", ";", "currentColor", ".", "bind", "(", ")", ";", "GL", ".", "glBegin", "(", "SGL", ".", "GL_QUADS", ")", ";", "GL", ".", "glVertex2f", "(", "x1", ",", "y1", ")", ";", "GL", ".", "glVertex2f", "(", "x1", "+", "width", ",", "y1", ")", ";", "GL", ".", "glVertex2f", "(", "x1", "+", "width", ",", "y1", "+", "height", ")", ";", "GL", ".", "glVertex2f", "(", "x1", ",", "y1", "+", "height", ")", ";", "GL", ".", "glEnd", "(", ")", ";", "postdraw", "(", ")", ";", "}" ]
Fill a rectangle on the canvas in the current color @param x1 The x coordinate of the top left corner @param y1 The y coordinate of the top left corner @param width The width of the rectangle to fill @param height The height of the rectangle to fill
[ "Fill", "a", "rectangle", "on", "the", "canvas", "in", "the", "current", "color" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L887-L899
1,322
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setLineWidth
public void setLineWidth(float width) { predraw(); this.lineWidth = width; LSR.setWidth(width); GL.glPointSize(width); postdraw(); }
java
public void setLineWidth(float width) { predraw(); this.lineWidth = width; LSR.setWidth(width); GL.glPointSize(width); postdraw(); }
[ "public", "void", "setLineWidth", "(", "float", "width", ")", "{", "predraw", "(", ")", ";", "this", ".", "lineWidth", "=", "width", ";", "LSR", ".", "setWidth", "(", "width", ")", ";", "GL", ".", "glPointSize", "(", "width", ")", ";", "postdraw", "(", ")", ";", "}" ]
Set the with of the line to be used when drawing line based primitives @param width The width of the line to be used when drawing line based primitives
[ "Set", "the", "with", "of", "the", "line", "to", "be", "used", "when", "drawing", "line", "based", "primitives" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1297-L1303
1,323
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.resetLineWidth
public void resetLineWidth() { predraw(); Renderer.getLineStripRenderer().setWidth(1.0f); GL.glLineWidth(1.0f); GL.glPointSize(1.0f); postdraw(); }
java
public void resetLineWidth() { predraw(); Renderer.getLineStripRenderer().setWidth(1.0f); GL.glLineWidth(1.0f); GL.glPointSize(1.0f); postdraw(); }
[ "public", "void", "resetLineWidth", "(", ")", "{", "predraw", "(", ")", ";", "Renderer", ".", "getLineStripRenderer", "(", ")", ".", "setWidth", "(", "1.0f", ")", ";", "GL", ".", "glLineWidth", "(", "1.0f", ")", ";", "GL", ".", "glPointSize", "(", "1.0f", ")", ";", "postdraw", "(", ")", ";", "}" ]
Reset the line width in use to the default for this graphics context
[ "Reset", "the", "line", "width", "in", "use", "to", "the", "default", "for", "this", "graphics", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1317-L1325
1,324
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.setAntiAlias
public void setAntiAlias(boolean anti) { predraw(); antialias = anti; LSR.setAntiAlias(anti); if (anti) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } else { GL.glDisable(SGL.GL_POLYGON_SMOOTH); } postdraw(); }
java
public void setAntiAlias(boolean anti) { predraw(); antialias = anti; LSR.setAntiAlias(anti); if (anti) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } else { GL.glDisable(SGL.GL_POLYGON_SMOOTH); } postdraw(); }
[ "public", "void", "setAntiAlias", "(", "boolean", "anti", ")", "{", "predraw", "(", ")", ";", "antialias", "=", "anti", ";", "LSR", ".", "setAntiAlias", "(", "anti", ")", ";", "if", "(", "anti", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "}", "else", "{", "GL", ".", "glDisable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "}", "postdraw", "(", ")", ";", "}" ]
Indicate if we should antialias as we draw primitives @param anti True if we should antialias
[ "Indicate", "if", "we", "should", "antialias", "as", "we", "draw", "primitives" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1333-L1343
1,325
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.drawString
public void drawString(String str, float x, float y) { predraw(); font.drawString(x, y, str, currentColor); postdraw(); }
java
public void drawString(String str, float x, float y) { predraw(); font.drawString(x, y, str, currentColor); postdraw(); }
[ "public", "void", "drawString", "(", "String", "str", ",", "float", "x", ",", "float", "y", ")", "{", "predraw", "(", ")", ";", "font", ".", "drawString", "(", "x", ",", "y", ",", "str", ",", "currentColor", ")", ";", "postdraw", "(", ")", ";", "}" ]
Draw a string to the screen using the current font @param str The string to draw @param x The x coordinate to draw the string at @param y The y coordinate to draw the string at
[ "Draw", "a", "string", "to", "the", "screen", "using", "the", "current", "font" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1364-L1368
1,326
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.copyArea
public void copyArea(Image target, int x, int y) { int format = target.getTexture().hasAlpha() ? SGL.GL_RGBA : SGL.GL_RGB; target.bind(); GL.glCopyTexImage2D(SGL.GL_TEXTURE_2D, 0, format, x, screenHeight - (y + target.getHeight()), target.getTexture() .getTextureWidth(), target.getTexture().getTextureHeight(), 0); target.ensureInverted(); }
java
public void copyArea(Image target, int x, int y) { int format = target.getTexture().hasAlpha() ? SGL.GL_RGBA : SGL.GL_RGB; target.bind(); GL.glCopyTexImage2D(SGL.GL_TEXTURE_2D, 0, format, x, screenHeight - (y + target.getHeight()), target.getTexture() .getTextureWidth(), target.getTexture().getTextureHeight(), 0); target.ensureInverted(); }
[ "public", "void", "copyArea", "(", "Image", "target", ",", "int", "x", ",", "int", "y", ")", "{", "int", "format", "=", "target", ".", "getTexture", "(", ")", ".", "hasAlpha", "(", ")", "?", "SGL", ".", "GL_RGBA", ":", "SGL", ".", "GL_RGB", ";", "target", ".", "bind", "(", ")", ";", "GL", ".", "glCopyTexImage2D", "(", "SGL", ".", "GL_TEXTURE_2D", ",", "0", ",", "format", ",", "x", ",", "screenHeight", "-", "(", "y", "+", "target", ".", "getHeight", "(", ")", ")", ",", "target", ".", "getTexture", "(", ")", ".", "getTextureWidth", "(", ")", ",", "target", ".", "getTexture", "(", ")", ".", "getTextureHeight", "(", ")", ",", "0", ")", ";", "target", ".", "ensureInverted", "(", ")", ";", "}" ]
Copy an area of the rendered screen into an image. The width and height of the area are assumed to match that of the image @param target The target image @param x The x position to copy from @param y The y position to copy from
[ "Copy", "an", "area", "of", "the", "rendered", "screen", "into", "an", "image", ".", "The", "width", "and", "height", "of", "the", "area", "are", "assumed", "to", "match", "that", "of", "the", "image" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1511-L1518
1,327
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.getPixel
public Color getPixel(int x, int y) { predraw(); GL.glReadPixels(x, screenHeight - y, 1, 1, SGL.GL_RGBA, SGL.GL_UNSIGNED_BYTE, readBuffer); postdraw(); return new Color(translate(readBuffer.get(0)), translate(readBuffer .get(1)), translate(readBuffer.get(2)), translate(readBuffer .get(3))); }
java
public Color getPixel(int x, int y) { predraw(); GL.glReadPixels(x, screenHeight - y, 1, 1, SGL.GL_RGBA, SGL.GL_UNSIGNED_BYTE, readBuffer); postdraw(); return new Color(translate(readBuffer.get(0)), translate(readBuffer .get(1)), translate(readBuffer.get(2)), translate(readBuffer .get(3))); }
[ "public", "Color", "getPixel", "(", "int", "x", ",", "int", "y", ")", "{", "predraw", "(", ")", ";", "GL", ".", "glReadPixels", "(", "x", ",", "screenHeight", "-", "y", ",", "1", ",", "1", ",", "SGL", ".", "GL_RGBA", ",", "SGL", ".", "GL_UNSIGNED_BYTE", ",", "readBuffer", ")", ";", "postdraw", "(", ")", ";", "return", "new", "Color", "(", "translate", "(", "readBuffer", ".", "get", "(", "0", ")", ")", ",", "translate", "(", "readBuffer", ".", "get", "(", "1", ")", ")", ",", "translate", "(", "readBuffer", ".", "get", "(", "2", ")", ")", ",", "translate", "(", "readBuffer", ".", "get", "(", "3", ")", ")", ")", ";", "}" ]
Get the colour of a single pixel in this graphics context @param x The x coordinate of the pixel to read @param y The y coordinate of the pixel to read @return The colour of the pixel at the specified location
[ "Get", "the", "colour", "of", "a", "single", "pixel", "in", "this", "graphics", "context" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1544-L1553
1,328
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.getArea
public void getArea(int x, int y, int width, int height, ByteBuffer target) { if (target.capacity() < width * height * 4) { throw new IllegalArgumentException("Byte buffer provided to get area is not big enough"); } predraw(); GL.glReadPixels(x, screenHeight - y - height, width, height, SGL.GL_RGBA, SGL.GL_UNSIGNED_BYTE, target); postdraw(); }
java
public void getArea(int x, int y, int width, int height, ByteBuffer target) { if (target.capacity() < width * height * 4) { throw new IllegalArgumentException("Byte buffer provided to get area is not big enough"); } predraw(); GL.glReadPixels(x, screenHeight - y - height, width, height, SGL.GL_RGBA, SGL.GL_UNSIGNED_BYTE, target); postdraw(); }
[ "public", "void", "getArea", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "ByteBuffer", "target", ")", "{", "if", "(", "target", ".", "capacity", "(", ")", "<", "width", "*", "height", "*", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Byte buffer provided to get area is not big enough\"", ")", ";", "}", "predraw", "(", ")", ";", "GL", ".", "glReadPixels", "(", "x", ",", "screenHeight", "-", "y", "-", "height", ",", "width", ",", "height", ",", "SGL", ".", "GL_RGBA", ",", "SGL", ".", "GL_UNSIGNED_BYTE", ",", "target", ")", ";", "postdraw", "(", ")", ";", "}" ]
Get an ara of pixels as RGBA values into a buffer @param x The x position in the context to grab from @param y The y position in the context to grab from @param width The width of the area to grab from @param height The hiehgt of the area to grab from @param target The target buffer to grab into
[ "Get", "an", "ara", "of", "pixels", "as", "RGBA", "values", "into", "a", "buffer" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1564-L1575
1,329
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.popTransform
public void popTransform() { if (stackIndex == 0) { throw new RuntimeException("Attempt to pop a transform that hasn't be pushed"); } predraw(); stackIndex--; FloatBuffer oldBuffer = (FloatBuffer) stack.get(stackIndex); GL.glLoadMatrix(oldBuffer); sx = oldBuffer.get(16); sy = oldBuffer.get(17); postdraw(); }
java
public void popTransform() { if (stackIndex == 0) { throw new RuntimeException("Attempt to pop a transform that hasn't be pushed"); } predraw(); stackIndex--; FloatBuffer oldBuffer = (FloatBuffer) stack.get(stackIndex); GL.glLoadMatrix(oldBuffer); sx = oldBuffer.get(16); sy = oldBuffer.get(17); postdraw(); }
[ "public", "void", "popTransform", "(", ")", "{", "if", "(", "stackIndex", "==", "0", ")", "{", "throw", "new", "RuntimeException", "(", "\"Attempt to pop a transform that hasn't be pushed\"", ")", ";", "}", "predraw", "(", ")", ";", "stackIndex", "--", ";", "FloatBuffer", "oldBuffer", "=", "(", "FloatBuffer", ")", "stack", ".", "get", "(", "stackIndex", ")", ";", "GL", ".", "glLoadMatrix", "(", "oldBuffer", ")", ";", "sx", "=", "oldBuffer", ".", "get", "(", "16", ")", ";", "sy", "=", "oldBuffer", ".", "get", "(", "17", ")", ";", "postdraw", "(", ")", ";", "}" ]
Pop a previously pushed transform from the stack to the current. This should only be called if a transform has been previously pushed.
[ "Pop", "a", "previously", "pushed", "transform", "from", "the", "stack", "to", "the", "current", ".", "This", "should", "only", "be", "called", "if", "a", "transform", "has", "been", "previously", "pushed", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1757-L1771
1,330
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getLayerIndex
public int getLayerIndex(String name) { int idx = 0; for (int i = 0; i < layers.size(); i++) { Layer layer = (Layer) layers.get(i); if (layer.name.equals(name)) { return i; } } return -1; }
java
public int getLayerIndex(String name) { int idx = 0; for (int i = 0; i < layers.size(); i++) { Layer layer = (Layer) layers.get(i); if (layer.name.equals(name)) { return i; } } return -1; }
[ "public", "int", "getLayerIndex", "(", "String", "name", ")", "{", "int", "idx", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "layers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Layer", "layer", "=", "(", "Layer", ")", "layers", ".", "get", "(", "i", ")", ";", "if", "(", "layer", ".", "name", ".", "equals", "(", "name", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Get the index of the layer with given name @param name The name of the tile to search for @return The index of the layer or -1 if there is no layer with given name
[ "Get", "the", "index", "of", "the", "layer", "with", "given", "name" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L169-L181
1,331
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getTileImage
public Image getTileImage(int x, int y, int layerIndex) { Layer layer = (Layer) layers.get(layerIndex); int tileSetIndex = layer.data[x][y][0]; if ((tileSetIndex >= 0) && (tileSetIndex < tileSets.size())) { TileSet tileSet = (TileSet) tileSets.get(tileSetIndex); int sheetX = tileSet.getTileX(layer.data[x][y][1]); int sheetY = tileSet.getTileY(layer.data[x][y][1]); return tileSet.tiles.getSprite(sheetX, sheetY); } return null; }
java
public Image getTileImage(int x, int y, int layerIndex) { Layer layer = (Layer) layers.get(layerIndex); int tileSetIndex = layer.data[x][y][0]; if ((tileSetIndex >= 0) && (tileSetIndex < tileSets.size())) { TileSet tileSet = (TileSet) tileSets.get(tileSetIndex); int sheetX = tileSet.getTileX(layer.data[x][y][1]); int sheetY = tileSet.getTileY(layer.data[x][y][1]); return tileSet.tiles.getSprite(sheetX, sheetY); } return null; }
[ "public", "Image", "getTileImage", "(", "int", "x", ",", "int", "y", ",", "int", "layerIndex", ")", "{", "Layer", "layer", "=", "(", "Layer", ")", "layers", ".", "get", "(", "layerIndex", ")", ";", "int", "tileSetIndex", "=", "layer", ".", "data", "[", "x", "]", "[", "y", "]", "[", "0", "]", ";", "if", "(", "(", "tileSetIndex", ">=", "0", ")", "&&", "(", "tileSetIndex", "<", "tileSets", ".", "size", "(", ")", ")", ")", "{", "TileSet", "tileSet", "=", "(", "TileSet", ")", "tileSets", ".", "get", "(", "tileSetIndex", ")", ";", "int", "sheetX", "=", "tileSet", ".", "getTileX", "(", "layer", ".", "data", "[", "x", "]", "[", "y", "]", "[", "1", "]", ")", ";", "int", "sheetY", "=", "tileSet", ".", "getTileY", "(", "layer", ".", "data", "[", "x", "]", "[", "y", "]", "[", "1", "]", ")", ";", "return", "tileSet", ".", "tiles", ".", "getSprite", "(", "sheetX", ",", "sheetY", ")", ";", "}", "return", "null", ";", "}" ]
Gets the Image used to draw the tile at the given x and y coordinates. @param x The x coordinate of the tile whose image should be retrieved @param y The y coordinate of the tile whose image should be retrieved @param layerIndex The index of the layer on which the tile whose image should be retrieve exists @return The image used to draw the specified tile or null if there is no image for the specified tile.
[ "Gets", "the", "Image", "used", "to", "draw", "the", "tile", "at", "the", "given", "x", "and", "y", "coordinates", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L196-L210
1,332
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getTileId
public int getTileId(int x, int y, int layerIndex) { Layer layer = (Layer) layers.get(layerIndex); return layer.getTileID(x, y); }
java
public int getTileId(int x, int y, int layerIndex) { Layer layer = (Layer) layers.get(layerIndex); return layer.getTileID(x, y); }
[ "public", "int", "getTileId", "(", "int", "x", ",", "int", "y", ",", "int", "layerIndex", ")", "{", "Layer", "layer", "=", "(", "Layer", ")", "layers", ".", "get", "(", "layerIndex", ")", ";", "return", "layer", ".", "getTileID", "(", "x", ",", "y", ")", ";", "}" ]
Get the global ID of a tile at specified location in the map @param x The x location of the tile @param y The y location of the tile @param layerIndex The index of the layer to retireve the tile from @return The global ID of the tile
[ "Get", "the", "global", "ID", "of", "a", "tile", "at", "specified", "location", "in", "the", "map" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L259-L262
1,333
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.setTileId
public void setTileId(int x, int y, int layerIndex, int tileid) { Layer layer = (Layer) layers.get(layerIndex); layer.setTileID(x, y, tileid); }
java
public void setTileId(int x, int y, int layerIndex, int tileid) { Layer layer = (Layer) layers.get(layerIndex); layer.setTileID(x, y, tileid); }
[ "public", "void", "setTileId", "(", "int", "x", ",", "int", "y", ",", "int", "layerIndex", ",", "int", "tileid", ")", "{", "Layer", "layer", "=", "(", "Layer", ")", "layers", ".", "get", "(", "layerIndex", ")", ";", "layer", ".", "setTileID", "(", "x", ",", "y", ",", "tileid", ")", ";", "}" ]
Set the global ID of a tile at specified location in the map @param x The x location of the tile @param y The y location of the tile @param layerIndex The index of the layer to set the new tileid @param tileid The tileid to be set
[ "Set", "the", "global", "ID", "of", "a", "tile", "at", "specified", "location", "in", "the", "map" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L276-L279
1,334
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getMapProperty
public String getMapProperty(String propertyName, String def) { if (props == null) return def; return props.getProperty(propertyName, def); }
java
public String getMapProperty(String propertyName, String def) { if (props == null) return def; return props.getProperty(propertyName, def); }
[ "public", "String", "getMapProperty", "(", "String", "propertyName", ",", "String", "def", ")", "{", "if", "(", "props", "==", "null", ")", "return", "def", ";", "return", "props", ".", "getProperty", "(", "propertyName", ",", "def", ")", ";", "}" ]
Get a property given to the map. Note that this method will not perform well and should not be used as part of the default code path in the game loop. @param propertyName The name of the property of the map to retrieve @param def The default value to return @return The value assigned to the property on the map (or the default value if none is supplied)
[ "Get", "a", "property", "given", "to", "the", "map", ".", "Note", "that", "this", "method", "will", "not", "perform", "well", "and", "should", "not", "be", "used", "as", "part", "of", "the", "default", "code", "path", "in", "the", "game", "loop", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L293-L297
1,335
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getLayerProperty
public String getLayerProperty(int layerIndex, String propertyName, String def) { Layer layer = (Layer) layers.get(layerIndex); if (layer == null || layer.props == null) return def; return layer.props.getProperty(propertyName, def); }
java
public String getLayerProperty(int layerIndex, String propertyName, String def) { Layer layer = (Layer) layers.get(layerIndex); if (layer == null || layer.props == null) return def; return layer.props.getProperty(propertyName, def); }
[ "public", "String", "getLayerProperty", "(", "int", "layerIndex", ",", "String", "propertyName", ",", "String", "def", ")", "{", "Layer", "layer", "=", "(", "Layer", ")", "layers", ".", "get", "(", "layerIndex", ")", ";", "if", "(", "layer", "==", "null", "||", "layer", ".", "props", "==", "null", ")", "return", "def", ";", "return", "layer", ".", "props", ".", "getProperty", "(", "propertyName", ",", "def", ")", ";", "}" ]
Get a property given to a particular layer. Note that this method will not perform well and should not be used as part of the default code path in the game loop. @param layerIndex The index of the layer to retrieve @param propertyName The name of the property of this layer to retrieve @param def The default value to return @return The value assigned to the property on the layer (or the default value if none is supplied)
[ "Get", "a", "property", "given", "to", "a", "particular", "layer", ".", "Note", "that", "this", "method", "will", "not", "perform", "well", "and", "should", "not", "be", "used", "as", "part", "of", "the", "default", "code", "path", "in", "the", "game", "loop", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L313-L319
1,336
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getTileProperty
public String getTileProperty(int tileID, String propertyName, String def) { if (tileID == 0) { return def; } TileSet set = findTileSet(tileID); Properties props = set.getProperties(tileID); if (props == null) { return def; } return props.getProperty(propertyName, def); }
java
public String getTileProperty(int tileID, String propertyName, String def) { if (tileID == 0) { return def; } TileSet set = findTileSet(tileID); Properties props = set.getProperties(tileID); if (props == null) { return def; } return props.getProperty(propertyName, def); }
[ "public", "String", "getTileProperty", "(", "int", "tileID", ",", "String", "propertyName", ",", "String", "def", ")", "{", "if", "(", "tileID", "==", "0", ")", "{", "return", "def", ";", "}", "TileSet", "set", "=", "findTileSet", "(", "tileID", ")", ";", "Properties", "props", "=", "set", ".", "getProperties", "(", "tileID", ")", ";", "if", "(", "props", "==", "null", ")", "{", "return", "def", ";", "}", "return", "props", ".", "getProperty", "(", "propertyName", ",", "def", ")", ";", "}" ]
Get a propety given to a particular tile. Note that this method will not perform well and should not be used as part of the default code path in the game loop. @param tileID The global ID of the tile to retrieve @param propertyName The name of the property to retireve @param def The default value to return @return The value assigned to the property on the tile (or the default value if none is supplied)
[ "Get", "a", "propety", "given", "to", "a", "particular", "tile", ".", "Note", "that", "this", "method", "will", "not", "perform", "well", "and", "should", "not", "be", "used", "as", "part", "of", "the", "default", "code", "path", "in", "the", "game", "loop", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L335-L347
1,337
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.render
public void render(int x, int y, int layer) { render(x, y, 0, 0, getWidth(), getHeight(), layer, false); }
java
public void render(int x, int y, int layer) { render(x, y, 0, 0, getWidth(), getHeight(), layer, false); }
[ "public", "void", "render", "(", "int", "x", ",", "int", "y", ",", "int", "layer", ")", "{", "render", "(", "x", ",", "y", ",", "0", ",", "0", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ",", "layer", ",", "false", ")", ";", "}" ]
Render a single layer from the map @param x The x location to render at @param y The y location to render at @param layer The layer to render
[ "Render", "a", "single", "layer", "from", "the", "map" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L371-L373
1,338
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.renderIsometricMap
protected void renderIsometricMap(int x, int y, int sx, int sy, int width, int height, Layer layer, boolean lineByLine) { ArrayList drawLayers = layers; if (layer != null) { drawLayers = new ArrayList(); drawLayers.add(layer); } int maxCount = width * height; int allCount = 0; boolean allProcessed = false; int initialLineX = x; int initialLineY = y; int startLineTileX = 0; int startLineTileY = 0; while (!allProcessed) { int currentTileX = startLineTileX; int currentTileY = startLineTileY; int currentLineX = initialLineX; int min = 0; if (height > width) min = (startLineTileY < width - 1) ? startLineTileY : (width - currentTileX < height) ? width - currentTileX - 1 : width - 1; else min = (startLineTileY < height - 1) ? startLineTileY : (width - currentTileX < height) ? width - currentTileX - 1 : height - 1; for (int burner = 0; burner <= min; currentTileX++, currentTileY--, burner++) { for (int layerIdx = 0; layerIdx < drawLayers.size(); layerIdx++) { Layer currentLayer = (Layer) drawLayers.get(layerIdx); currentLayer.render(currentLineX, initialLineY, currentTileX, currentTileY, 1, 0, lineByLine, tileWidth, tileHeight); } currentLineX += tileWidth; allCount++; } // System.out.println("Line : " + counter++ + " - " + count + // "allcount : " + allCount); if (startLineTileY < (height - 1)) { startLineTileY += 1; initialLineX -= tileWidth / 2; initialLineY += tileHeight / 2; } else { startLineTileX += 1; initialLineX += tileWidth / 2; initialLineY += tileHeight / 2; } if (allCount >= maxCount) allProcessed = true; } }
java
protected void renderIsometricMap(int x, int y, int sx, int sy, int width, int height, Layer layer, boolean lineByLine) { ArrayList drawLayers = layers; if (layer != null) { drawLayers = new ArrayList(); drawLayers.add(layer); } int maxCount = width * height; int allCount = 0; boolean allProcessed = false; int initialLineX = x; int initialLineY = y; int startLineTileX = 0; int startLineTileY = 0; while (!allProcessed) { int currentTileX = startLineTileX; int currentTileY = startLineTileY; int currentLineX = initialLineX; int min = 0; if (height > width) min = (startLineTileY < width - 1) ? startLineTileY : (width - currentTileX < height) ? width - currentTileX - 1 : width - 1; else min = (startLineTileY < height - 1) ? startLineTileY : (width - currentTileX < height) ? width - currentTileX - 1 : height - 1; for (int burner = 0; burner <= min; currentTileX++, currentTileY--, burner++) { for (int layerIdx = 0; layerIdx < drawLayers.size(); layerIdx++) { Layer currentLayer = (Layer) drawLayers.get(layerIdx); currentLayer.render(currentLineX, initialLineY, currentTileX, currentTileY, 1, 0, lineByLine, tileWidth, tileHeight); } currentLineX += tileWidth; allCount++; } // System.out.println("Line : " + counter++ + " - " + count + // "allcount : " + allCount); if (startLineTileY < (height - 1)) { startLineTileY += 1; initialLineX -= tileWidth / 2; initialLineY += tileHeight / 2; } else { startLineTileX += 1; initialLineX += tileWidth / 2; initialLineY += tileHeight / 2; } if (allCount >= maxCount) allProcessed = true; } }
[ "protected", "void", "renderIsometricMap", "(", "int", "x", ",", "int", "y", ",", "int", "sx", ",", "int", "sy", ",", "int", "width", ",", "int", "height", ",", "Layer", "layer", ",", "boolean", "lineByLine", ")", "{", "ArrayList", "drawLayers", "=", "layers", ";", "if", "(", "layer", "!=", "null", ")", "{", "drawLayers", "=", "new", "ArrayList", "(", ")", ";", "drawLayers", ".", "add", "(", "layer", ")", ";", "}", "int", "maxCount", "=", "width", "*", "height", ";", "int", "allCount", "=", "0", ";", "boolean", "allProcessed", "=", "false", ";", "int", "initialLineX", "=", "x", ";", "int", "initialLineY", "=", "y", ";", "int", "startLineTileX", "=", "0", ";", "int", "startLineTileY", "=", "0", ";", "while", "(", "!", "allProcessed", ")", "{", "int", "currentTileX", "=", "startLineTileX", ";", "int", "currentTileY", "=", "startLineTileY", ";", "int", "currentLineX", "=", "initialLineX", ";", "int", "min", "=", "0", ";", "if", "(", "height", ">", "width", ")", "min", "=", "(", "startLineTileY", "<", "width", "-", "1", ")", "?", "startLineTileY", ":", "(", "width", "-", "currentTileX", "<", "height", ")", "?", "width", "-", "currentTileX", "-", "1", ":", "width", "-", "1", ";", "else", "min", "=", "(", "startLineTileY", "<", "height", "-", "1", ")", "?", "startLineTileY", ":", "(", "width", "-", "currentTileX", "<", "height", ")", "?", "width", "-", "currentTileX", "-", "1", ":", "height", "-", "1", ";", "for", "(", "int", "burner", "=", "0", ";", "burner", "<=", "min", ";", "currentTileX", "++", ",", "currentTileY", "--", ",", "burner", "++", ")", "{", "for", "(", "int", "layerIdx", "=", "0", ";", "layerIdx", "<", "drawLayers", ".", "size", "(", ")", ";", "layerIdx", "++", ")", "{", "Layer", "currentLayer", "=", "(", "Layer", ")", "drawLayers", ".", "get", "(", "layerIdx", ")", ";", "currentLayer", ".", "render", "(", "currentLineX", ",", "initialLineY", ",", "currentTileX", ",", "currentTileY", ",", "1", ",", "0", ",", "lineByLine", ",", "tileWidth", ",", "tileHeight", ")", ";", "}", "currentLineX", "+=", "tileWidth", ";", "allCount", "++", ";", "}", "// System.out.println(\"Line : \" + counter++ + \" - \" + count +\r", "// \"allcount : \" + allCount);\r", "if", "(", "startLineTileY", "<", "(", "height", "-", "1", ")", ")", "{", "startLineTileY", "+=", "1", ";", "initialLineX", "-=", "tileWidth", "/", "2", ";", "initialLineY", "+=", "tileHeight", "/", "2", ";", "}", "else", "{", "startLineTileX", "+=", "1", ";", "initialLineX", "+=", "tileWidth", "/", "2", ";", "initialLineY", "+=", "tileHeight", "/", "2", ";", "}", "if", "(", "allCount", ">=", "maxCount", ")", "allProcessed", "=", "true", ";", "}", "}" ]
Render of isometric map renders. @param x The x location to render at @param y The y location to render at @param sx The x tile location to start rendering @param sy The y tile location to start rendering @param width The width of the section to render (in tiles) @param height The height of the section to render (in tiles) @param layer if this is null all layers are rendered, if not only the selected layer is renderered @param lineByLine True if we should render line by line, i.e. giving us a chance to render something else between lines (@see {@link #renderedLine(int, int, int)} TODO: [Isometric map] Render stuff between lines, concept of line differs from ortho maps
[ "Render", "of", "isometric", "map", "renders", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L502-L564
1,339
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getTileSetByGID
public TileSet getTileSetByGID(int gid) { for (int i = 0; i < tileSets.size(); i++) { TileSet set = (TileSet) tileSets.get(i); if (set.contains(gid)) { return set; } } return null; }
java
public TileSet getTileSetByGID(int gid) { for (int i = 0; i < tileSets.size(); i++) { TileSet set = (TileSet) tileSets.get(i); if (set.contains(gid)) { return set; } } return null; }
[ "public", "TileSet", "getTileSetByGID", "(", "int", "gid", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tileSets", ".", "size", "(", ")", ";", "i", "++", ")", "{", "TileSet", "set", "=", "(", "TileSet", ")", "tileSets", ".", "get", "(", "i", ")", ";", "if", "(", "set", ".", "contains", "(", "gid", ")", ")", "{", "return", "set", ";", "}", "}", "return", "null", ";", "}" ]
Get a tileset by a given global ID @param gid The global ID of the tileset to retrieve @return The tileset requested or null if no tileset matches
[ "Get", "a", "tileset", "by", "a", "given", "global", "ID" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L726-L736
1,340
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectCount
public int getObjectCount(int groupID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); return grp.objects.size(); } return -1; }
java
public int getObjectCount(int groupID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); return grp.objects.size(); } return -1; }
[ "public", "int", "getObjectCount", "(", "int", "groupID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "return", "grp", ".", "objects", ".", "size", "(", ")", ";", "}", "return", "-", "1", ";", "}" ]
Returns the number of objects of a specific object-group. @param groupID The index of this object-group @return Number of the objects in the object-group or -1, when error occurred.
[ "Returns", "the", "number", "of", "objects", "of", "a", "specific", "object", "-", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L789-L795
1,341
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectName
public String getObjectName(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.name; } } return null; }
java
public String getObjectName(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.name; } } return null; }
[ "public", "String", "getObjectName", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "name", ";", "}", "}", "return", "null", ";", "}" ]
Return the name of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The name of an object or null, when error occurred
[ "Return", "the", "name", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L806-L815
1,342
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectType
public String getObjectType(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.type; } } return null; }
java
public String getObjectType(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.type; } } return null; }
[ "public", "String", "getObjectType", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "type", ";", "}", "}", "return", "null", ";", "}" ]
Return the type of an specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The type of an object or null, when error occurred
[ "Return", "the", "type", "of", "an", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L826-L835
1,343
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectX
public int getObjectX(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.x; } } return -1; }
java
public int getObjectX(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.x; } } return -1; }
[ "public", "int", "getObjectX", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "x", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the x-coordinate of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The x-coordinate of an object, or -1, when error occurred
[ "Returns", "the", "x", "-", "coordinate", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L846-L855
1,344
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectY
public int getObjectY(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.y; } } return -1; }
java
public int getObjectY(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.y; } } return -1; }
[ "public", "int", "getObjectY", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "y", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the y-coordinate of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The y-coordinate of an object, or -1, when error occurred
[ "Returns", "the", "y", "-", "coordinate", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L866-L875
1,345
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectWidth
public int getObjectWidth(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.width; } } return -1; }
java
public int getObjectWidth(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.width; } } return -1; }
[ "public", "int", "getObjectWidth", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "width", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the width of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The width of an object, or -1, when error occurred
[ "Returns", "the", "width", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L886-L895
1,346
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectHeight
public int getObjectHeight(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.height; } } return -1; }
java
public int getObjectHeight(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.height; } } return -1; }
[ "public", "int", "getObjectHeight", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "return", "object", ".", "height", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the height of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The height of an object, or -1, when error occurred
[ "Returns", "the", "height", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L906-L915
1,347
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectImage
public String getObjectImage(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); if (object == null) { return null; } return object.image; } } return null; }
java
public String getObjectImage(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); if (object == null) { return null; } return object.image; } } return null; }
[ "public", "String", "getObjectImage", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "if", "(", "object", "==", "null", ")", "{", "return", "null", ";", "}", "return", "object", ".", "image", ";", "}", "}", "return", "null", ";", "}" ]
Retrieve the image source property for a given object @param groupID Index of a group @param objectID Index of an object @return The image source reference or null if one isn't defined
[ "Retrieve", "the", "image", "source", "property", "for", "a", "given", "object" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L926-L941
1,348
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectProperty
public String getObjectProperty(int groupID, int objectID, String propertyName, String def) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); if (object == null) { return def; } if (object.props == null) { return def; } return object.props.getProperty(propertyName, def); } } return def; }
java
public String getObjectProperty(int groupID, int objectID, String propertyName, String def) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); if (object == null) { return def; } if (object.props == null) { return def; } return object.props.getProperty(propertyName, def); } } return def; }
[ "public", "String", "getObjectProperty", "(", "int", "groupID", ",", "int", "objectID", ",", "String", "propertyName", ",", "String", "def", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "objectGroups", ".", "get", "(", "groupID", ")", ";", "if", "(", "objectID", ">=", "0", "&&", "objectID", "<", "grp", ".", "objects", ".", "size", "(", ")", ")", "{", "GroupObject", "object", "=", "(", "GroupObject", ")", "grp", ".", "objects", ".", "get", "(", "objectID", ")", ";", "if", "(", "object", "==", "null", ")", "{", "return", "def", ";", "}", "if", "(", "object", ".", "props", "==", "null", ")", "{", "return", "def", ";", "}", "return", "object", ".", "props", ".", "getProperty", "(", "propertyName", ",", "def", ")", ";", "}", "}", "return", "def", ";", "}" ]
Looks for a property with the given name and returns it's value. If no property is found, def is returned. @param groupID Index of a group @param objectID Index of an object @param propertyName Name of a property @param def default value to return, if no property is found @return The value of the property with the given name or def, if there is no property with that name.
[ "Looks", "for", "a", "property", "with", "the", "given", "name", "and", "returns", "it", "s", "value", ".", "If", "no", "property", "is", "found", "def", "is", "returned", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L958-L976
1,349
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.getFirstNamedElement
private static Element getFirstNamedElement(Element element, String name) { NodeList list = element.getElementsByTagName(name); if (list.getLength() == 0) { return null; } return (Element) list.item(0); }
java
private static Element getFirstNamedElement(Element element, String name) { NodeList list = element.getElementsByTagName(name); if (list.getLength() == 0) { return null; } return (Element) list.item(0); }
[ "private", "static", "Element", "getFirstNamedElement", "(", "Element", "element", ",", "String", "name", ")", "{", "NodeList", "list", "=", "element", ".", "getElementsByTagName", "(", "name", ")", ";", "if", "(", "list", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "return", "(", "Element", ")", "list", ".", "item", "(", "0", ")", ";", "}" ]
Get the first child named as specified from the passed XML element @param element The element whose children are interogated @param name The name of the element to retrieve @return The requested element
[ "Get", "the", "first", "child", "named", "as", "specified", "from", "the", "passed", "XML", "element" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L479-L486
1,350
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.createRangeElement
private static Element createRangeElement(Document document, String name, ConfigurableEmitter.Range range) { Element element = document.createElement(name); element.setAttribute("min", "" + range.getMin()); element.setAttribute("max", "" + range.getMax()); element.setAttribute("enabled", "" + range.isEnabled()); return element; }
java
private static Element createRangeElement(Document document, String name, ConfigurableEmitter.Range range) { Element element = document.createElement(name); element.setAttribute("min", "" + range.getMin()); element.setAttribute("max", "" + range.getMax()); element.setAttribute("enabled", "" + range.isEnabled()); return element; }
[ "private", "static", "Element", "createRangeElement", "(", "Document", "document", ",", "String", "name", ",", "ConfigurableEmitter", ".", "Range", "range", ")", "{", "Element", "element", "=", "document", ".", "createElement", "(", "name", ")", ";", "element", ".", "setAttribute", "(", "\"min\"", ",", "\"\"", "+", "range", ".", "getMin", "(", ")", ")", ";", "element", ".", "setAttribute", "(", "\"max\"", ",", "\"\"", "+", "range", ".", "getMax", "(", ")", ")", ";", "element", ".", "setAttribute", "(", "\"enabled\"", ",", "\"\"", "+", "range", ".", "isEnabled", "(", ")", ")", ";", "return", "element", ";", "}" ]
Create an XML element based on a configured range @param document The document the element will be part of @param name The name to give the new element @param range The configured range @return A configured XML element on the range
[ "Create", "an", "XML", "element", "based", "on", "a", "configured", "range" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L681-L689
1,351
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.createValueElement
private static Element createValueElement(Document document, String name, ConfigurableEmitter.Value value) { Element element = document.createElement(name); // void: now writes the value type if (value instanceof SimpleValue) { element.setAttribute("type", "simple"); element.setAttribute("value", "" + value.getValue(0)); } else if (value instanceof RandomValue) { element.setAttribute("type", "random"); element .setAttribute("value", "" + ((RandomValue) value).getValue()); } else if (value instanceof LinearInterpolator) { element.setAttribute("type", "linear"); element.setAttribute("min", "" + ((LinearInterpolator) value).getMin()); element.setAttribute("max", "" + ((LinearInterpolator) value).getMax()); element.setAttribute("active", "" + ((LinearInterpolator) value).isActive()); ArrayList curve = ((LinearInterpolator) value).getCurve(); for (int i = 0; i < curve.size(); i++) { Vector2f point = (Vector2f) curve.get(i); Element pointElement = document.createElement("point"); pointElement.setAttribute("x", "" + point.x); pointElement.setAttribute("y", "" + point.y); element.appendChild(pointElement); } } else { Log.warn("unkown value type ignored: " + value.getClass()); } return element; }
java
private static Element createValueElement(Document document, String name, ConfigurableEmitter.Value value) { Element element = document.createElement(name); // void: now writes the value type if (value instanceof SimpleValue) { element.setAttribute("type", "simple"); element.setAttribute("value", "" + value.getValue(0)); } else if (value instanceof RandomValue) { element.setAttribute("type", "random"); element .setAttribute("value", "" + ((RandomValue) value).getValue()); } else if (value instanceof LinearInterpolator) { element.setAttribute("type", "linear"); element.setAttribute("min", "" + ((LinearInterpolator) value).getMin()); element.setAttribute("max", "" + ((LinearInterpolator) value).getMax()); element.setAttribute("active", "" + ((LinearInterpolator) value).isActive()); ArrayList curve = ((LinearInterpolator) value).getCurve(); for (int i = 0; i < curve.size(); i++) { Vector2f point = (Vector2f) curve.get(i); Element pointElement = document.createElement("point"); pointElement.setAttribute("x", "" + point.x); pointElement.setAttribute("y", "" + point.y); element.appendChild(pointElement); } } else { Log.warn("unkown value type ignored: " + value.getClass()); } return element; }
[ "private", "static", "Element", "createValueElement", "(", "Document", "document", ",", "String", "name", ",", "ConfigurableEmitter", ".", "Value", "value", ")", "{", "Element", "element", "=", "document", ".", "createElement", "(", "name", ")", ";", "// void: now writes the value type\r", "if", "(", "value", "instanceof", "SimpleValue", ")", "{", "element", ".", "setAttribute", "(", "\"type\"", ",", "\"simple\"", ")", ";", "element", ".", "setAttribute", "(", "\"value\"", ",", "\"\"", "+", "value", ".", "getValue", "(", "0", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "RandomValue", ")", "{", "element", ".", "setAttribute", "(", "\"type\"", ",", "\"random\"", ")", ";", "element", ".", "setAttribute", "(", "\"value\"", ",", "\"\"", "+", "(", "(", "RandomValue", ")", "value", ")", ".", "getValue", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "LinearInterpolator", ")", "{", "element", ".", "setAttribute", "(", "\"type\"", ",", "\"linear\"", ")", ";", "element", ".", "setAttribute", "(", "\"min\"", ",", "\"\"", "+", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "getMin", "(", ")", ")", ";", "element", ".", "setAttribute", "(", "\"max\"", ",", "\"\"", "+", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "getMax", "(", ")", ")", ";", "element", ".", "setAttribute", "(", "\"active\"", ",", "\"\"", "+", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "isActive", "(", ")", ")", ";", "ArrayList", "curve", "=", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "getCurve", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "curve", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Vector2f", "point", "=", "(", "Vector2f", ")", "curve", ".", "get", "(", "i", ")", ";", "Element", "pointElement", "=", "document", ".", "createElement", "(", "\"point\"", ")", ";", "pointElement", ".", "setAttribute", "(", "\"x\"", ",", "\"\"", "+", "point", ".", "x", ")", ";", "pointElement", ".", "setAttribute", "(", "\"y\"", ",", "\"\"", "+", "point", ".", "y", ")", ";", "element", ".", "appendChild", "(", "pointElement", ")", ";", "}", "}", "else", "{", "Log", ".", "warn", "(", "\"unkown value type ignored: \"", "+", "value", ".", "getClass", "(", ")", ")", ";", "}", "return", "element", ";", "}" ]
Create an XML element based on a configured value @param document The document the element will be part of @param name The name to give the new element @param value The configured value @return A configure XML element based on the value
[ "Create", "an", "XML", "element", "based", "on", "a", "configured", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L702-L739
1,352
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.parseRangeElement
private static void parseRangeElement(Element element, ConfigurableEmitter.Range range) { if (element == null) { return; } range.setMin(Float.parseFloat(element.getAttribute("min"))); range.setMax(Float.parseFloat(element.getAttribute("max"))); range.setEnabled("true".equals(element.getAttribute("enabled"))); }
java
private static void parseRangeElement(Element element, ConfigurableEmitter.Range range) { if (element == null) { return; } range.setMin(Float.parseFloat(element.getAttribute("min"))); range.setMax(Float.parseFloat(element.getAttribute("max"))); range.setEnabled("true".equals(element.getAttribute("enabled"))); }
[ "private", "static", "void", "parseRangeElement", "(", "Element", "element", ",", "ConfigurableEmitter", ".", "Range", "range", ")", "{", "if", "(", "element", "==", "null", ")", "{", "return", ";", "}", "range", ".", "setMin", "(", "Float", ".", "parseFloat", "(", "element", ".", "getAttribute", "(", "\"min\"", ")", ")", ")", ";", "range", ".", "setMax", "(", "Float", ".", "parseFloat", "(", "element", ".", "getAttribute", "(", "\"max\"", ")", ")", ")", ";", "range", ".", "setEnabled", "(", "\"true\"", ".", "equals", "(", "element", ".", "getAttribute", "(", "\"enabled\"", ")", ")", ")", ";", "}" ]
Parse an XML element into a configured range @param element The XML element to parse @param range The range to configure based on the XML
[ "Parse", "an", "XML", "element", "into", "a", "configured", "range" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L749-L757
1,353
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.parseValueElement
private static void parseValueElement(Element element, ConfigurableEmitter.Value value) { if (element == null) { return; } String type = element.getAttribute("type"); String v = element.getAttribute("value"); if (type == null || type.length() == 0) { // support for old style which did not write the type if (value instanceof SimpleValue) { ((SimpleValue) value).setValue(Float.parseFloat(v)); } else if (value instanceof RandomValue) { ((RandomValue) value).setValue(Float.parseFloat(v)); } else { Log.warn("problems reading element, skipping: " + element); } } else { // type given: this is the new style if (type.equals("simple")) { ((SimpleValue) value).setValue(Float.parseFloat(v)); } else if (type.equals("random")) { ((RandomValue) value).setValue(Float.parseFloat(v)); } else if (type.equals("linear")) { String min = element.getAttribute("min"); String max = element.getAttribute("max"); String active = element.getAttribute("active"); NodeList points = element.getElementsByTagName("point"); ArrayList curve = new ArrayList(); for (int i = 0; i < points.getLength(); i++) { Element point = (Element) points.item(i); float x = Float.parseFloat(point.getAttribute("x")); float y = Float.parseFloat(point.getAttribute("y")); curve.add(new Vector2f(x, y)); } ((LinearInterpolator) value).setCurve(curve); ((LinearInterpolator) value).setMin(Integer.parseInt(min)); ((LinearInterpolator) value).setMax(Integer.parseInt(max)); ((LinearInterpolator) value).setActive("true".equals(active)); } else { Log.warn("unkown type detected: " + type); } } }
java
private static void parseValueElement(Element element, ConfigurableEmitter.Value value) { if (element == null) { return; } String type = element.getAttribute("type"); String v = element.getAttribute("value"); if (type == null || type.length() == 0) { // support for old style which did not write the type if (value instanceof SimpleValue) { ((SimpleValue) value).setValue(Float.parseFloat(v)); } else if (value instanceof RandomValue) { ((RandomValue) value).setValue(Float.parseFloat(v)); } else { Log.warn("problems reading element, skipping: " + element); } } else { // type given: this is the new style if (type.equals("simple")) { ((SimpleValue) value).setValue(Float.parseFloat(v)); } else if (type.equals("random")) { ((RandomValue) value).setValue(Float.parseFloat(v)); } else if (type.equals("linear")) { String min = element.getAttribute("min"); String max = element.getAttribute("max"); String active = element.getAttribute("active"); NodeList points = element.getElementsByTagName("point"); ArrayList curve = new ArrayList(); for (int i = 0; i < points.getLength(); i++) { Element point = (Element) points.item(i); float x = Float.parseFloat(point.getAttribute("x")); float y = Float.parseFloat(point.getAttribute("y")); curve.add(new Vector2f(x, y)); } ((LinearInterpolator) value).setCurve(curve); ((LinearInterpolator) value).setMin(Integer.parseInt(min)); ((LinearInterpolator) value).setMax(Integer.parseInt(max)); ((LinearInterpolator) value).setActive("true".equals(active)); } else { Log.warn("unkown type detected: " + type); } } }
[ "private", "static", "void", "parseValueElement", "(", "Element", "element", ",", "ConfigurableEmitter", ".", "Value", "value", ")", "{", "if", "(", "element", "==", "null", ")", "{", "return", ";", "}", "String", "type", "=", "element", ".", "getAttribute", "(", "\"type\"", ")", ";", "String", "v", "=", "element", ".", "getAttribute", "(", "\"value\"", ")", ";", "if", "(", "type", "==", "null", "||", "type", ".", "length", "(", ")", "==", "0", ")", "{", "// support for old style which did not write the type\r", "if", "(", "value", "instanceof", "SimpleValue", ")", "{", "(", "(", "SimpleValue", ")", "value", ")", ".", "setValue", "(", "Float", ".", "parseFloat", "(", "v", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "RandomValue", ")", "{", "(", "(", "RandomValue", ")", "value", ")", ".", "setValue", "(", "Float", ".", "parseFloat", "(", "v", ")", ")", ";", "}", "else", "{", "Log", ".", "warn", "(", "\"problems reading element, skipping: \"", "+", "element", ")", ";", "}", "}", "else", "{", "// type given: this is the new style\r", "if", "(", "type", ".", "equals", "(", "\"simple\"", ")", ")", "{", "(", "(", "SimpleValue", ")", "value", ")", ".", "setValue", "(", "Float", ".", "parseFloat", "(", "v", ")", ")", ";", "}", "else", "if", "(", "type", ".", "equals", "(", "\"random\"", ")", ")", "{", "(", "(", "RandomValue", ")", "value", ")", ".", "setValue", "(", "Float", ".", "parseFloat", "(", "v", ")", ")", ";", "}", "else", "if", "(", "type", ".", "equals", "(", "\"linear\"", ")", ")", "{", "String", "min", "=", "element", ".", "getAttribute", "(", "\"min\"", ")", ";", "String", "max", "=", "element", ".", "getAttribute", "(", "\"max\"", ")", ";", "String", "active", "=", "element", ".", "getAttribute", "(", "\"active\"", ")", ";", "NodeList", "points", "=", "element", ".", "getElementsByTagName", "(", "\"point\"", ")", ";", "ArrayList", "curve", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Element", "point", "=", "(", "Element", ")", "points", ".", "item", "(", "i", ")", ";", "float", "x", "=", "Float", ".", "parseFloat", "(", "point", ".", "getAttribute", "(", "\"x\"", ")", ")", ";", "float", "y", "=", "Float", ".", "parseFloat", "(", "point", ".", "getAttribute", "(", "\"y\"", ")", ")", ";", "curve", ".", "add", "(", "new", "Vector2f", "(", "x", ",", "y", ")", ")", ";", "}", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "setCurve", "(", "curve", ")", ";", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "setMin", "(", "Integer", ".", "parseInt", "(", "min", ")", ")", ";", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "setMax", "(", "Integer", ".", "parseInt", "(", "max", ")", ")", ";", "(", "(", "LinearInterpolator", ")", "value", ")", ".", "setActive", "(", "\"true\"", ".", "equals", "(", "active", ")", ")", ";", "}", "else", "{", "Log", ".", "warn", "(", "\"unkown type detected: \"", "+", "type", ")", ";", "}", "}", "}" ]
Parse an XML element into a configured value @param element The XML element to parse @param value The value to configure based on the XML
[ "Parse", "an", "XML", "element", "into", "a", "configured", "value" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L767-L816
1,354
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java
NavMeshBuilder.build
public NavMesh build(TileBasedMap map, boolean tileBased) { this.tileBased = tileBased; ArrayList spaces = new ArrayList(); if (tileBased) { for (int x=0;x<map.getWidthInTiles();x++) { for (int y=0;y<map.getHeightInTiles();y++) { if (!map.blocked(this, x, y)) { spaces.add(new Space(x,y,1,1)); } } } } else { Space space = new Space(0,0,map.getWidthInTiles(),map.getHeightInTiles()); subsection(map, space, spaces); } while (mergeSpaces(spaces)) {} linkSpaces(spaces); return new NavMesh(spaces); }
java
public NavMesh build(TileBasedMap map, boolean tileBased) { this.tileBased = tileBased; ArrayList spaces = new ArrayList(); if (tileBased) { for (int x=0;x<map.getWidthInTiles();x++) { for (int y=0;y<map.getHeightInTiles();y++) { if (!map.blocked(this, x, y)) { spaces.add(new Space(x,y,1,1)); } } } } else { Space space = new Space(0,0,map.getWidthInTiles(),map.getHeightInTiles()); subsection(map, space, spaces); } while (mergeSpaces(spaces)) {} linkSpaces(spaces); return new NavMesh(spaces); }
[ "public", "NavMesh", "build", "(", "TileBasedMap", "map", ",", "boolean", "tileBased", ")", "{", "this", ".", "tileBased", "=", "tileBased", ";", "ArrayList", "spaces", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "tileBased", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "map", ".", "getWidthInTiles", "(", ")", ";", "x", "++", ")", "{", "for", "(", "int", "y", "=", "0", ";", "y", "<", "map", ".", "getHeightInTiles", "(", ")", ";", "y", "++", ")", "{", "if", "(", "!", "map", ".", "blocked", "(", "this", ",", "x", ",", "y", ")", ")", "{", "spaces", ".", "add", "(", "new", "Space", "(", "x", ",", "y", ",", "1", ",", "1", ")", ")", ";", "}", "}", "}", "}", "else", "{", "Space", "space", "=", "new", "Space", "(", "0", ",", "0", ",", "map", ".", "getWidthInTiles", "(", ")", ",", "map", ".", "getHeightInTiles", "(", ")", ")", ";", "subsection", "(", "map", ",", "space", ",", "spaces", ")", ";", "}", "while", "(", "mergeSpaces", "(", "spaces", ")", ")", "{", "}", "linkSpaces", "(", "spaces", ")", ";", "return", "new", "NavMesh", "(", "spaces", ")", ";", "}" ]
Build a navigation mesh based on a tile map @param map The map to build the navigation mesh from @param tileBased True if we'll use the tiles for the mesh initially rather than quad spacing @return The newly created navigation mesh
[ "Build", "a", "navigation", "mesh", "based", "on", "a", "tile", "map" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java#L44-L67
1,355
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java
NavMeshBuilder.mergeSpaces
private boolean mergeSpaces(ArrayList spaces) { for (int source=0;source<spaces.size();source++) { Space a = (Space) spaces.get(source); for (int target=source+1;target<spaces.size();target++) { Space b = (Space) spaces.get(target); if (a.canMerge(b)) { spaces.remove(a); spaces.remove(b); spaces.add(a.merge(b)); return true; } } } return false; }
java
private boolean mergeSpaces(ArrayList spaces) { for (int source=0;source<spaces.size();source++) { Space a = (Space) spaces.get(source); for (int target=source+1;target<spaces.size();target++) { Space b = (Space) spaces.get(target); if (a.canMerge(b)) { spaces.remove(a); spaces.remove(b); spaces.add(a.merge(b)); return true; } } } return false; }
[ "private", "boolean", "mergeSpaces", "(", "ArrayList", "spaces", ")", "{", "for", "(", "int", "source", "=", "0", ";", "source", "<", "spaces", ".", "size", "(", ")", ";", "source", "++", ")", "{", "Space", "a", "=", "(", "Space", ")", "spaces", ".", "get", "(", "source", ")", ";", "for", "(", "int", "target", "=", "source", "+", "1", ";", "target", "<", "spaces", ".", "size", "(", ")", ";", "target", "++", ")", "{", "Space", "b", "=", "(", "Space", ")", "spaces", ".", "get", "(", "target", ")", ";", "if", "(", "a", ".", "canMerge", "(", "b", ")", ")", "{", "spaces", ".", "remove", "(", "a", ")", ";", "spaces", ".", "remove", "(", "b", ")", ";", "spaces", ".", "add", "(", "a", ".", "merge", "(", "b", ")", ")", ";", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Merge the spaces that have been created to optimize out anywhere we can. @param spaces The list of spaces to be merged @return True if a merge occured and we'll have to start the merge process again
[ "Merge", "the", "spaces", "that", "have", "been", "created", "to", "optimize", "out", "anywhere", "we", "can", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java#L77-L94
1,356
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java
NavMeshBuilder.linkSpaces
private void linkSpaces(ArrayList spaces) { for (int source=0;source<spaces.size();source++) { Space a = (Space) spaces.get(source); for (int target=source+1;target<spaces.size();target++) { Space b = (Space) spaces.get(target); if (a.hasJoinedEdge(b)) { a.link(b); b.link(a); } } } }
java
private void linkSpaces(ArrayList spaces) { for (int source=0;source<spaces.size();source++) { Space a = (Space) spaces.get(source); for (int target=source+1;target<spaces.size();target++) { Space b = (Space) spaces.get(target); if (a.hasJoinedEdge(b)) { a.link(b); b.link(a); } } } }
[ "private", "void", "linkSpaces", "(", "ArrayList", "spaces", ")", "{", "for", "(", "int", "source", "=", "0", ";", "source", "<", "spaces", ".", "size", "(", ")", ";", "source", "++", ")", "{", "Space", "a", "=", "(", "Space", ")", "spaces", ".", "get", "(", "source", ")", ";", "for", "(", "int", "target", "=", "source", "+", "1", ";", "target", "<", "spaces", ".", "size", "(", ")", ";", "target", "++", ")", "{", "Space", "b", "=", "(", "Space", ")", "spaces", ".", "get", "(", "target", ")", ";", "if", "(", "a", ".", "hasJoinedEdge", "(", "b", ")", ")", "{", "a", ".", "link", "(", "b", ")", ";", "b", ".", "link", "(", "a", ")", ";", "}", "}", "}", "}" ]
Determine the links between spaces @param spaces The spaces to link up
[ "Determine", "the", "links", "between", "spaces" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java#L101-L114
1,357
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java
NavMeshBuilder.clear
public boolean clear(TileBasedMap map, Space space) { if (tileBased) { return true; } float x = 0; boolean donex = false; while (x < space.getWidth()) { float y = 0; boolean doney = false; while (y < space.getHeight()) { sx = (int) (space.getX()+x); sy = (int) (space.getY()+y); if (map.blocked(this, sx, sy)) { return false; } y += 0.1f; if ((y > space.getHeight()) && (!doney)) { y = space.getHeight(); doney = true; } } x += 0.1f; if ((x > space.getWidth()) && (!donex)) { x = space.getWidth(); donex = true; } } return true; }
java
public boolean clear(TileBasedMap map, Space space) { if (tileBased) { return true; } float x = 0; boolean donex = false; while (x < space.getWidth()) { float y = 0; boolean doney = false; while (y < space.getHeight()) { sx = (int) (space.getX()+x); sy = (int) (space.getY()+y); if (map.blocked(this, sx, sy)) { return false; } y += 0.1f; if ((y > space.getHeight()) && (!doney)) { y = space.getHeight(); doney = true; } } x += 0.1f; if ((x > space.getWidth()) && (!donex)) { x = space.getWidth(); donex = true; } } return true; }
[ "public", "boolean", "clear", "(", "TileBasedMap", "map", ",", "Space", "space", ")", "{", "if", "(", "tileBased", ")", "{", "return", "true", ";", "}", "float", "x", "=", "0", ";", "boolean", "donex", "=", "false", ";", "while", "(", "x", "<", "space", ".", "getWidth", "(", ")", ")", "{", "float", "y", "=", "0", ";", "boolean", "doney", "=", "false", ";", "while", "(", "y", "<", "space", ".", "getHeight", "(", ")", ")", "{", "sx", "=", "(", "int", ")", "(", "space", ".", "getX", "(", ")", "+", "x", ")", ";", "sy", "=", "(", "int", ")", "(", "space", ".", "getY", "(", ")", "+", "y", ")", ";", "if", "(", "map", ".", "blocked", "(", "this", ",", "sx", ",", "sy", ")", ")", "{", "return", "false", ";", "}", "y", "+=", "0.1f", ";", "if", "(", "(", "y", ">", "space", ".", "getHeight", "(", ")", ")", "&&", "(", "!", "doney", ")", ")", "{", "y", "=", "space", ".", "getHeight", "(", ")", ";", "doney", "=", "true", ";", "}", "}", "x", "+=", "0.1f", ";", "if", "(", "(", "x", ">", "space", ".", "getWidth", "(", ")", ")", "&&", "(", "!", "donex", ")", ")", "{", "x", "=", "space", ".", "getWidth", "(", ")", ";", "donex", "=", "true", ";", "}", "}", "return", "true", ";", "}" ]
Check if a particular space is clear of blockages @param map The map the spaces are being built from @param space The space to check @return True if there are no blockages in the space
[ "Check", "if", "a", "particular", "space", "is", "clear", "of", "blockages" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java#L123-L159
1,358
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java
NavMeshBuilder.subsection
private void subsection(TileBasedMap map, Space space, ArrayList spaces) { if (!clear(map, space)) { float width2 = space.getWidth()/2; float height2 = space.getHeight()/2; if ((width2 < smallestSpace) && (height2 < smallestSpace)) { return; } subsection(map, new Space(space.getX(), space.getY(), width2, height2), spaces); subsection(map, new Space(space.getX(), space.getY()+height2, width2, height2), spaces); subsection(map, new Space(space.getX()+width2, space.getY(), width2, height2), spaces); subsection(map, new Space(space.getX()+width2, space.getY()+height2, width2, height2), spaces); } else { spaces.add(space); } }
java
private void subsection(TileBasedMap map, Space space, ArrayList spaces) { if (!clear(map, space)) { float width2 = space.getWidth()/2; float height2 = space.getHeight()/2; if ((width2 < smallestSpace) && (height2 < smallestSpace)) { return; } subsection(map, new Space(space.getX(), space.getY(), width2, height2), spaces); subsection(map, new Space(space.getX(), space.getY()+height2, width2, height2), spaces); subsection(map, new Space(space.getX()+width2, space.getY(), width2, height2), spaces); subsection(map, new Space(space.getX()+width2, space.getY()+height2, width2, height2), spaces); } else { spaces.add(space); } }
[ "private", "void", "subsection", "(", "TileBasedMap", "map", ",", "Space", "space", ",", "ArrayList", "spaces", ")", "{", "if", "(", "!", "clear", "(", "map", ",", "space", ")", ")", "{", "float", "width2", "=", "space", ".", "getWidth", "(", ")", "/", "2", ";", "float", "height2", "=", "space", ".", "getHeight", "(", ")", "/", "2", ";", "if", "(", "(", "width2", "<", "smallestSpace", ")", "&&", "(", "height2", "<", "smallestSpace", ")", ")", "{", "return", ";", "}", "subsection", "(", "map", ",", "new", "Space", "(", "space", ".", "getX", "(", ")", ",", "space", ".", "getY", "(", ")", ",", "width2", ",", "height2", ")", ",", "spaces", ")", ";", "subsection", "(", "map", ",", "new", "Space", "(", "space", ".", "getX", "(", ")", ",", "space", ".", "getY", "(", ")", "+", "height2", ",", "width2", ",", "height2", ")", ",", "spaces", ")", ";", "subsection", "(", "map", ",", "new", "Space", "(", "space", ".", "getX", "(", ")", "+", "width2", ",", "space", ".", "getY", "(", ")", ",", "width2", ",", "height2", ")", ",", "spaces", ")", ";", "subsection", "(", "map", ",", "new", "Space", "(", "space", ".", "getX", "(", ")", "+", "width2", ",", "space", ".", "getY", "(", ")", "+", "height2", ",", "width2", ",", "height2", ")", ",", "spaces", ")", ";", "}", "else", "{", "spaces", ".", "add", "(", "space", ")", ";", "}", "}" ]
Subsection a space into smaller spaces if required to find a non-blocked area. @param map The map being processed @param space The space being sections @param spaces The list of spaces that have been created
[ "Subsection", "a", "space", "into", "smaller", "spaces", "if", "required", "to", "find", "a", "non", "-", "blocked", "area", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.java#L169-L185
1,359
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/PositionControls.java
PositionControls.setPosition
public void setPosition(int x,int y) { int cx = (xoffset.getMin() + xoffset.getMax()) / 2; int cy = (yoffset.getMin() + yoffset.getMax()) / 2; int dx = x - cx; int dy = y - cy; xoffset.setMin(xoffset.getMin() + dx); xoffset.setMax(xoffset.getMax() + dx); yoffset.setMin(yoffset.getMin() + dy); yoffset.setMax(yoffset.getMax() + dy); xoffset.fireUpdated(null); yoffset.fireUpdated(null); }
java
public void setPosition(int x,int y) { int cx = (xoffset.getMin() + xoffset.getMax()) / 2; int cy = (yoffset.getMin() + yoffset.getMax()) / 2; int dx = x - cx; int dy = y - cy; xoffset.setMin(xoffset.getMin() + dx); xoffset.setMax(xoffset.getMax() + dx); yoffset.setMin(yoffset.getMin() + dy); yoffset.setMax(yoffset.getMax() + dy); xoffset.fireUpdated(null); yoffset.fireUpdated(null); }
[ "public", "void", "setPosition", "(", "int", "x", ",", "int", "y", ")", "{", "int", "cx", "=", "(", "xoffset", ".", "getMin", "(", ")", "+", "xoffset", ".", "getMax", "(", ")", ")", "/", "2", ";", "int", "cy", "=", "(", "yoffset", ".", "getMin", "(", ")", "+", "yoffset", ".", "getMax", "(", ")", ")", "/", "2", ";", "int", "dx", "=", "x", "-", "cx", ";", "int", "dy", "=", "y", "-", "cy", ";", "xoffset", ".", "setMin", "(", "xoffset", ".", "getMin", "(", ")", "+", "dx", ")", ";", "xoffset", ".", "setMax", "(", "xoffset", ".", "getMax", "(", ")", "+", "dx", ")", ";", "yoffset", ".", "setMin", "(", "yoffset", ".", "getMin", "(", ")", "+", "dy", ")", ";", "yoffset", ".", "setMax", "(", "yoffset", ".", "getMax", "(", ")", "+", "dy", ")", ";", "xoffset", ".", "fireUpdated", "(", "null", ")", ";", "yoffset", ".", "fireUpdated", "(", "null", ")", ";", "}" ]
Set the position of the emitter @param x The x position of the emitter @param y The y position of the emitter
[ "Set", "the", "position", "of", "the", "emitter" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/PositionControls.java#L37-L51
1,360
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/CanvasGameContainer.java
CanvasGameContainer.start
public void start() throws SlickException { SwingUtilities.invokeLater(new Runnable() { public void run() { try { Input.disableControllers(); try { Display.setParent(CanvasGameContainer.this); } catch (LWJGLException e) { throw new SlickException("Failed to setParent of canvas", e); } container.setup(); scheduleUpdate(); } catch (SlickException e) { e.printStackTrace(); System.exit(0); } } }); }
java
public void start() throws SlickException { SwingUtilities.invokeLater(new Runnable() { public void run() { try { Input.disableControllers(); try { Display.setParent(CanvasGameContainer.this); } catch (LWJGLException e) { throw new SlickException("Failed to setParent of canvas", e); } container.setup(); scheduleUpdate(); } catch (SlickException e) { e.printStackTrace(); System.exit(0); } } }); }
[ "public", "void", "start", "(", ")", "throws", "SlickException", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "Input", ".", "disableControllers", "(", ")", ";", "try", "{", "Display", ".", "setParent", "(", "CanvasGameContainer", ".", "this", ")", ";", "}", "catch", "(", "LWJGLException", "e", ")", "{", "throw", "new", "SlickException", "(", "\"Failed to setParent of canvas\"", ",", "e", ")", ";", "}", "container", ".", "setup", "(", ")", ";", "scheduleUpdate", "(", ")", ";", "}", "catch", "(", "SlickException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "}", ")", ";", "}" ]
Start the game container rendering @throws SlickException Indicates a failure during game execution
[ "Start", "the", "game", "container", "rendering" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/CanvasGameContainer.java#L57-L77
1,361
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/CanvasGameContainer.java
CanvasGameContainer.scheduleUpdate
private void scheduleUpdate() { if (!isVisible()) { return; } SwingUtilities.invokeLater(new Runnable() { public void run() { try { container.gameLoop(); } catch (SlickException e) { e.printStackTrace(); } container.checkDimensions(); scheduleUpdate(); } }); }
java
private void scheduleUpdate() { if (!isVisible()) { return; } SwingUtilities.invokeLater(new Runnable() { public void run() { try { container.gameLoop(); } catch (SlickException e) { e.printStackTrace(); } container.checkDimensions(); scheduleUpdate(); } }); }
[ "private", "void", "scheduleUpdate", "(", ")", "{", "if", "(", "!", "isVisible", "(", ")", ")", "{", "return", ";", "}", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "container", ".", "gameLoop", "(", ")", ";", "}", "catch", "(", "SlickException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "container", ".", "checkDimensions", "(", ")", ";", "scheduleUpdate", "(", ")", ";", "}", "}", ")", ";", "}" ]
Schedule an update on the EDT
[ "Schedule", "an", "update", "on", "the", "EDT" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/CanvasGameContainer.java#L82-L98
1,362
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Link.java
Link.distance2
public float distance2(float tx, float ty) { float dx = tx - px; float dy = ty - py; return ((dx*dx) + (dy*dy)); }
java
public float distance2(float tx, float ty) { float dx = tx - px; float dy = ty - py; return ((dx*dx) + (dy*dy)); }
[ "public", "float", "distance2", "(", "float", "tx", ",", "float", "ty", ")", "{", "float", "dx", "=", "tx", "-", "px", ";", "float", "dy", "=", "ty", "-", "py", ";", "return", "(", "(", "dx", "*", "dx", ")", "+", "(", "dy", "*", "dy", ")", ")", ";", "}" ]
Get the distance squared from this link to the given position @param tx The x coordinate of the target location @param ty The y coordinate of the target location @return The distance squared from this link to the target
[ "Get", "the", "distance", "squared", "from", "this", "link", "to", "the", "given", "position" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Link.java#L36-L41
1,363
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java
QuadBasedLineStripRenderer.renderLines
public void renderLines(float[] points, int count) { if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width+1f); } GL.glDisable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width); if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } }
java
public void renderLines(float[] points, int count) { if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width+1f); } GL.glDisable(SGL.GL_POLYGON_SMOOTH); renderLinesImpl(points,count,width); if (antialias) { GL.glEnable(SGL.GL_POLYGON_SMOOTH); } }
[ "public", "void", "renderLines", "(", "float", "[", "]", "points", ",", "int", "count", ")", "{", "if", "(", "antialias", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "renderLinesImpl", "(", "points", ",", "count", ",", "width", "+", "1f", ")", ";", "}", "GL", ".", "glDisable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "renderLinesImpl", "(", "points", ",", "count", ",", "width", ")", ";", "if", "(", "antialias", ")", "{", "GL", ".", "glEnable", "(", "SGL", ".", "GL_POLYGON_SMOOTH", ")", ";", "}", "}" ]
Render the lines applying antialiasing if required @param points The points to be rendered as lines @param count The number of points to render
[ "Render", "the", "lines", "applying", "antialiasing", "if", "required" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java#L119-L131
1,364
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java
QuadBasedLineStripRenderer.bindColor
private void bindColor(int index) { if (index < cpt) { if (renderHalf) { GL.glColor4f(colours[(index*4)]*0.5f, colours[(index*4)+1]*0.5f, colours[(index*4)+2]*0.5f, colours[(index*4)+3]*0.5f); } else { GL.glColor4f(colours[(index*4)], colours[(index*4)+1], colours[(index*4)+2], colours[(index*4)+3]); } } }
java
private void bindColor(int index) { if (index < cpt) { if (renderHalf) { GL.glColor4f(colours[(index*4)]*0.5f, colours[(index*4)+1]*0.5f, colours[(index*4)+2]*0.5f, colours[(index*4)+3]*0.5f); } else { GL.glColor4f(colours[(index*4)], colours[(index*4)+1], colours[(index*4)+2], colours[(index*4)+3]); } } }
[ "private", "void", "bindColor", "(", "int", "index", ")", "{", "if", "(", "index", "<", "cpt", ")", "{", "if", "(", "renderHalf", ")", "{", "GL", ".", "glColor4f", "(", "colours", "[", "(", "index", "*", "4", ")", "]", "*", "0.5f", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "1", "]", "*", "0.5f", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "2", "]", "*", "0.5f", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "3", "]", "*", "0.5f", ")", ";", "}", "else", "{", "GL", ".", "glColor4f", "(", "colours", "[", "(", "index", "*", "4", ")", "]", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "1", "]", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "2", "]", ",", "colours", "[", "(", "index", "*", "4", ")", "+", "3", "]", ")", ";", "}", "}", "}" ]
Bind the colour at a given index in the array @param index The index of the colour to bind
[ "Bind", "the", "colour", "at", "a", "given", "index", "in", "the", "array" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java#L258-L268
1,365
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/SlickCallable.java
SlickCallable.enterSafeBlock
public static void enterSafeBlock() { if (inSafe) { return; } Renderer.get().flush(); lastUsed = TextureImpl.getLastBind(); TextureImpl.bindNone(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushClientAttrib(GL11.GL_ALL_CLIENT_ATTRIB_BITS); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); inSafe = true; }
java
public static void enterSafeBlock() { if (inSafe) { return; } Renderer.get().flush(); lastUsed = TextureImpl.getLastBind(); TextureImpl.bindNone(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushClientAttrib(GL11.GL_ALL_CLIENT_ATTRIB_BITS); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); inSafe = true; }
[ "public", "static", "void", "enterSafeBlock", "(", ")", "{", "if", "(", "inSafe", ")", "{", "return", ";", "}", "Renderer", ".", "get", "(", ")", ".", "flush", "(", ")", ";", "lastUsed", "=", "TextureImpl", ".", "getLastBind", "(", ")", ";", "TextureImpl", ".", "bindNone", "(", ")", ";", "GL11", ".", "glPushAttrib", "(", "GL11", ".", "GL_ALL_ATTRIB_BITS", ")", ";", "GL11", ".", "glPushClientAttrib", "(", "GL11", ".", "GL_ALL_CLIENT_ATTRIB_BITS", ")", ";", "GL11", ".", "glMatrixMode", "(", "GL11", ".", "GL_MODELVIEW", ")", ";", "GL11", ".", "glPushMatrix", "(", ")", ";", "GL11", ".", "glMatrixMode", "(", "GL11", ".", "GL_PROJECTION", ")", ";", "GL11", ".", "glPushMatrix", "(", ")", ";", "GL11", ".", "glMatrixMode", "(", "GL11", ".", "GL_MODELVIEW", ")", ";", "inSafe", "=", "true", ";", "}" ]
Enter a safe block ensuring that all the OpenGL state that slick uses is safe before touching the GL state directly.
[ "Enter", "a", "safe", "block", "ensuring", "that", "all", "the", "OpenGL", "state", "that", "slick", "uses", "is", "safe", "before", "touching", "the", "GL", "state", "directly", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/SlickCallable.java#L54-L72
1,366
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/opengl/SlickCallable.java
SlickCallable.leaveSafeBlock
public static void leaveSafeBlock() { if (!inSafe) { return; } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glPopClientAttrib(); GL11.glPopAttrib(); if (lastUsed != null) { lastUsed.bind(); } else { TextureImpl.bindNone(); } inSafe = false; }
java
public static void leaveSafeBlock() { if (!inSafe) { return; } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glPopClientAttrib(); GL11.glPopAttrib(); if (lastUsed != null) { lastUsed.bind(); } else { TextureImpl.bindNone(); } inSafe = false; }
[ "public", "static", "void", "leaveSafeBlock", "(", ")", "{", "if", "(", "!", "inSafe", ")", "{", "return", ";", "}", "GL11", ".", "glMatrixMode", "(", "GL11", ".", "GL_PROJECTION", ")", ";", "GL11", ".", "glPopMatrix", "(", ")", ";", "GL11", ".", "glMatrixMode", "(", "GL11", ".", "GL_MODELVIEW", ")", ";", "GL11", ".", "glPopMatrix", "(", ")", ";", "GL11", ".", "glPopClientAttrib", "(", ")", ";", "GL11", ".", "glPopAttrib", "(", ")", ";", "if", "(", "lastUsed", "!=", "null", ")", "{", "lastUsed", ".", "bind", "(", ")", ";", "}", "else", "{", "TextureImpl", ".", "bindNone", "(", ")", ";", "}", "inSafe", "=", "false", ";", "}" ]
Leave a safe block ensuring that all of Slick's OpenGL state is restored since the last enter.
[ "Leave", "a", "safe", "block", "ensuring", "that", "all", "of", "Slick", "s", "OpenGL", "state", "is", "restored", "since", "the", "last", "enter", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/SlickCallable.java#L78-L98
1,367
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/RoundedRectangle.java
RoundedRectangle.createPoints
private List createPoints(int numberOfSegments, float radius, float cx, float cy, float start, float end) { ArrayList tempPoints = new ArrayList(); int step = 360 / numberOfSegments; for (float a=start;a<=end+step;a+=step) { float ang = a; if (ang > end) { ang = end; } float x = (float) (cx + (FastTrig.cos(Math.toRadians(ang)) * radius)); float y = (float) (cy + (FastTrig.sin(Math.toRadians(ang)) * radius)); tempPoints.add(new Float(x)); tempPoints.add(new Float(y)); } return tempPoints; }
java
private List createPoints(int numberOfSegments, float radius, float cx, float cy, float start, float end) { ArrayList tempPoints = new ArrayList(); int step = 360 / numberOfSegments; for (float a=start;a<=end+step;a+=step) { float ang = a; if (ang > end) { ang = end; } float x = (float) (cx + (FastTrig.cos(Math.toRadians(ang)) * radius)); float y = (float) (cy + (FastTrig.sin(Math.toRadians(ang)) * radius)); tempPoints.add(new Float(x)); tempPoints.add(new Float(y)); } return tempPoints; }
[ "private", "List", "createPoints", "(", "int", "numberOfSegments", ",", "float", "radius", ",", "float", "cx", ",", "float", "cy", ",", "float", "start", ",", "float", "end", ")", "{", "ArrayList", "tempPoints", "=", "new", "ArrayList", "(", ")", ";", "int", "step", "=", "360", "/", "numberOfSegments", ";", "for", "(", "float", "a", "=", "start", ";", "a", "<=", "end", "+", "step", ";", "a", "+=", "step", ")", "{", "float", "ang", "=", "a", ";", "if", "(", "ang", ">", "end", ")", "{", "ang", "=", "end", ";", "}", "float", "x", "=", "(", "float", ")", "(", "cx", "+", "(", "FastTrig", ".", "cos", "(", "Math", ".", "toRadians", "(", "ang", ")", ")", "*", "radius", ")", ")", ";", "float", "y", "=", "(", "float", ")", "(", "cy", "+", "(", "FastTrig", ".", "sin", "(", "Math", ".", "toRadians", "(", "ang", ")", ")", "*", "radius", ")", ")", ";", "tempPoints", ".", "add", "(", "new", "Float", "(", "x", ")", ")", ";", "tempPoints", ".", "add", "(", "new", "Float", "(", "y", ")", ")", ";", "}", "return", "tempPoints", ";", "}" ]
Generate the points to fill a corner arc. @param numberOfSegments How fine to make the ellipse. @param radius The radius of the arc. @param cx The x center of the arc. @param cy The y center of the arc. @param start The start angle of the arc. @param end The end angle of the arc. @return The points created.
[ "Generate", "the", "points", "to", "fill", "a", "corner", "arc", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/RoundedRectangle.java#L245-L263
1,368
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ValuePanel.java
ValuePanel.fireUpdated
private void fireUpdated(Object source) { for (int i=0;i<listeners.size();i++) { ((InputPanelListener) listeners.get(i)).valueUpdated(this); } }
java
private void fireUpdated(Object source) { for (int i=0;i<listeners.size();i++) { ((InputPanelListener) listeners.get(i)).valueUpdated(this); } }
[ "private", "void", "fireUpdated", "(", "Object", "source", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listeners", ".", "size", "(", ")", ";", "i", "++", ")", "{", "(", "(", "InputPanelListener", ")", "listeners", ".", "get", "(", "i", ")", ")", ".", "valueUpdated", "(", "this", ")", ";", "}", "}" ]
Fire notification of updates to all listeners @param source The source of the update
[ "Fire", "notification", "of", "updates", "to", "all", "listeners" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ValuePanel.java#L129-L133
1,369
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.loadBackground
private void loadBackground() { JFileChooser chooser = new JFileChooser("."); chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { game.setBackgroundImage(chooser.getSelectedFile()); } }
java
private void loadBackground() { JFileChooser chooser = new JFileChooser("."); chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { game.setBackgroundImage(chooser.getSelectedFile()); } }
[ "private", "void", "loadBackground", "(", ")", "{", "JFileChooser", "chooser", "=", "new", "JFileChooser", "(", "\".\"", ")", ";", "chooser", ".", "setDialogTitle", "(", "\"Open\"", ")", ";", "int", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "game", ".", "setBackgroundImage", "(", "chooser", ".", "getSelectedFile", "(", ")", ")", ";", "}", "}" ]
Load a background image to display behind the particle system
[ "Load", "a", "background", "image", "to", "display", "behind", "the", "particle", "system" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L348-L355
1,370
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.initGraphEditorWindow
private void initGraphEditorWindow() { // create the window GraphEditorWindow editor = new GraphEditorWindow(); whiskasPanel.setEditor(editor); graphEditorFrame= new JFrame("Whiskas Gradient Editor"); graphEditorFrame.getContentPane().add(editor); graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); graphEditorFrame.pack(); graphEditorFrame.setSize(600, 300); graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight()); graphEditorFrame.setVisible(true); // try { // InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif"); // // //graphEditorFrame.setIconImage(ImageIO.read(in)); // } catch (IOException e) { // e.printStackTrace(); // } }
java
private void initGraphEditorWindow() { // create the window GraphEditorWindow editor = new GraphEditorWindow(); whiskasPanel.setEditor(editor); graphEditorFrame= new JFrame("Whiskas Gradient Editor"); graphEditorFrame.getContentPane().add(editor); graphEditorFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); graphEditorFrame.pack(); graphEditorFrame.setSize(600, 300); graphEditorFrame.setLocation(this.getX(), this.getY()+this.getHeight()); graphEditorFrame.setVisible(true); // try { // InputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream("org/newdawn/slick/tools/peditor/data/icon.gif"); // // //graphEditorFrame.setIconImage(ImageIO.read(in)); // } catch (IOException e) { // e.printStackTrace(); // } }
[ "private", "void", "initGraphEditorWindow", "(", ")", "{", "// create the window\r", "GraphEditorWindow", "editor", "=", "new", "GraphEditorWindow", "(", ")", ";", "whiskasPanel", ".", "setEditor", "(", "editor", ")", ";", "graphEditorFrame", "=", "new", "JFrame", "(", "\"Whiskas Gradient Editor\"", ")", ";", "graphEditorFrame", ".", "getContentPane", "(", ")", ".", "add", "(", "editor", ")", ";", "graphEditorFrame", ".", "setDefaultCloseOperation", "(", "WindowConstants", ".", "HIDE_ON_CLOSE", ")", ";", "graphEditorFrame", ".", "pack", "(", ")", ";", "graphEditorFrame", ".", "setSize", "(", "600", ",", "300", ")", ";", "graphEditorFrame", ".", "setLocation", "(", "this", ".", "getX", "(", ")", ",", "this", ".", "getY", "(", ")", "+", "this", ".", "getHeight", "(", ")", ")", ";", "graphEditorFrame", ".", "setVisible", "(", "true", ")", ";", "//\t\ttry {\r", "//\t\t\tInputStream in = ParticleEditor.class.getClassLoader().getResourceAsStream(\"org/newdawn/slick/tools/peditor/data/icon.gif\");\r", "//\t\t\t\r", "//\t\t\t//graphEditorFrame.setIconImage(ImageIO.read(in));\r", "//\t\t} catch (IOException e) {\r", "//\t\t\te.printStackTrace();\r", "//\t\t}\r", "}" ]
init the graph editor window
[ "init", "the", "graph", "editor", "window" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L367-L389
1,371
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.importEmitter
public void importEmitter() { chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); File path = file.getParentFile(); try { final ConfigurableEmitter emitter = ParticleIO.loadEmitter(file); if (emitter.getImageName() != null) { File possible = new File(path, emitter.getImageName()); if (possible.exists()) { emitter.setImageName(possible.getAbsolutePath()); } else { chooser.setDialogTitle("Locate the image: "+emitter.getImageName()); resp = chooser.showOpenDialog(this); FileFilter filter = new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) { return true; } return (f.getName().equals(emitter.getImageName())); } public String getDescription() { return emitter.getImageName(); } }; chooser.addChoosableFileFilter(filter); if (resp == JFileChooser.APPROVE_OPTION) { File image = chooser.getSelectedFile(); emitter.setImageName(image.getAbsolutePath()); path = image.getParentFile(); } chooser.resetChoosableFileFilters(); chooser.addChoosableFileFilter(xmlFileFilter); } } addEmitter(emitter); emitters.setSelected(emitter); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
java
public void importEmitter() { chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); File path = file.getParentFile(); try { final ConfigurableEmitter emitter = ParticleIO.loadEmitter(file); if (emitter.getImageName() != null) { File possible = new File(path, emitter.getImageName()); if (possible.exists()) { emitter.setImageName(possible.getAbsolutePath()); } else { chooser.setDialogTitle("Locate the image: "+emitter.getImageName()); resp = chooser.showOpenDialog(this); FileFilter filter = new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) { return true; } return (f.getName().equals(emitter.getImageName())); } public String getDescription() { return emitter.getImageName(); } }; chooser.addChoosableFileFilter(filter); if (resp == JFileChooser.APPROVE_OPTION) { File image = chooser.getSelectedFile(); emitter.setImageName(image.getAbsolutePath()); path = image.getParentFile(); } chooser.resetChoosableFileFilters(); chooser.addChoosableFileFilter(xmlFileFilter); } } addEmitter(emitter); emitters.setSelected(emitter); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
[ "public", "void", "importEmitter", "(", ")", "{", "chooser", ".", "setDialogTitle", "(", "\"Open\"", ")", ";", "int", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "file", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "File", "path", "=", "file", ".", "getParentFile", "(", ")", ";", "try", "{", "final", "ConfigurableEmitter", "emitter", "=", "ParticleIO", ".", "loadEmitter", "(", "file", ")", ";", "if", "(", "emitter", ".", "getImageName", "(", ")", "!=", "null", ")", "{", "File", "possible", "=", "new", "File", "(", "path", ",", "emitter", ".", "getImageName", "(", ")", ")", ";", "if", "(", "possible", ".", "exists", "(", ")", ")", "{", "emitter", ".", "setImageName", "(", "possible", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "else", "{", "chooser", ".", "setDialogTitle", "(", "\"Locate the image: \"", "+", "emitter", ".", "getImageName", "(", ")", ")", ";", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "FileFilter", "filter", "=", "new", "FileFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "f", ")", "{", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "return", "(", "f", ".", "getName", "(", ")", ".", "equals", "(", "emitter", ".", "getImageName", "(", ")", ")", ")", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "emitter", ".", "getImageName", "(", ")", ";", "}", "}", ";", "chooser", ".", "addChoosableFileFilter", "(", "filter", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "image", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "emitter", ".", "setImageName", "(", "image", ".", "getAbsolutePath", "(", ")", ")", ";", "path", "=", "image", ".", "getParentFile", "(", ")", ";", "}", "chooser", ".", "resetChoosableFileFilters", "(", ")", ";", "chooser", ".", "addChoosableFileFilter", "(", "xmlFileFilter", ")", ";", "}", "}", "addEmitter", "(", "emitter", ")", ";", "emitters", ".", "setSelected", "(", "emitter", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Import an emitter XML file
[ "Import", "an", "emitter", "XML", "file" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L403-L453
1,372
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.cloneEmitter
public void cloneEmitter() { if (selected == null) { return; } try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ParticleIO.saveEmitter(bout, selected); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ConfigurableEmitter emitter = ParticleIO.loadEmitter(bin); emitter.name = emitter.name + "_clone"; addEmitter(emitter); emitters.setSelected(emitter); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } }
java
public void cloneEmitter() { if (selected == null) { return; } try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ParticleIO.saveEmitter(bout, selected); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ConfigurableEmitter emitter = ParticleIO.loadEmitter(bin); emitter.name = emitter.name + "_clone"; addEmitter(emitter); emitters.setSelected(emitter); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } }
[ "public", "void", "cloneEmitter", "(", ")", "{", "if", "(", "selected", "==", "null", ")", "{", "return", ";", "}", "try", "{", "ByteArrayOutputStream", "bout", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ParticleIO", ".", "saveEmitter", "(", "bout", ",", "selected", ")", ";", "ByteArrayInputStream", "bin", "=", "new", "ByteArrayInputStream", "(", "bout", ".", "toByteArray", "(", ")", ")", ";", "ConfigurableEmitter", "emitter", "=", "ParticleIO", ".", "loadEmitter", "(", "bin", ")", ";", "emitter", ".", "name", "=", "emitter", ".", "name", "+", "\"_clone\"", ";", "addEmitter", "(", "emitter", ")", ";", "emitters", ".", "setSelected", "(", "emitter", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Clone the selected emitter
[ "Clone", "the", "selected", "emitter" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L458-L476
1,373
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.exportEmitter
public void exportEmitter() { if (selected == null) { return; } chooser.setDialogTitle("Save"); int resp = chooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().endsWith(".xml")) { file = new File(file.getAbsolutePath()+".xml"); } try { ParticleIO.saveEmitter(file, selected); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
java
public void exportEmitter() { if (selected == null) { return; } chooser.setDialogTitle("Save"); int resp = chooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().endsWith(".xml")) { file = new File(file.getAbsolutePath()+".xml"); } try { ParticleIO.saveEmitter(file, selected); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
[ "public", "void", "exportEmitter", "(", ")", "{", "if", "(", "selected", "==", "null", ")", "{", "return", ";", "}", "chooser", ".", "setDialogTitle", "(", "\"Save\"", ")", ";", "int", "resp", "=", "chooser", ".", "showSaveDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "file", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "if", "(", "!", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\".xml\"", ")", ")", "{", "file", "=", "new", "File", "(", "file", ".", "getAbsolutePath", "(", ")", "+", "\".xml\"", ")", ";", "}", "try", "{", "ParticleIO", ".", "saveEmitter", "(", "file", ",", "selected", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Export an emitter XML file
[ "Export", "an", "emitter", "XML", "file" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L481-L501
1,374
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.createNewSystem
public void createNewSystem() { game.clearSystem(additive.isSelected()); pointsEnabled.setSelected(false); emitters.clear(); }
java
public void createNewSystem() { game.clearSystem(additive.isSelected()); pointsEnabled.setSelected(false); emitters.clear(); }
[ "public", "void", "createNewSystem", "(", ")", "{", "game", ".", "clearSystem", "(", "additive", ".", "isSelected", "(", ")", ")", ";", "pointsEnabled", ".", "setSelected", "(", "false", ")", ";", "emitters", ".", "clear", "(", ")", ";", "}" ]
Create a completely new particle system
[ "Create", "a", "completely", "new", "particle", "system" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L506-L510
1,375
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.loadSystem
public void loadSystem() { chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); File path = file.getParentFile(); try { ParticleSystem system = ParticleIO.loadConfiguredSystem(file); game.setSystem(system); emitters.clear(); for (int i=0;i<system.getEmitterCount();i++) { final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i); if (emitter.getImageName() != null) { File possible = new File(path, emitter.getImageName()); if (possible.exists()) { emitter.setImageName(possible.getAbsolutePath()); } else { chooser.setDialogTitle("Locate the image: "+emitter.getImageName()); FileFilter filter = new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) { return true; } return (f.getName().equals(emitter.getImageName())); } public String getDescription() { return emitter.getImageName(); } }; chooser.addChoosableFileFilter(filter); resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File image = chooser.getSelectedFile(); emitter.setImageName(image.getAbsolutePath()); path = image.getParentFile(); } chooser.setDialogTitle("Open"); chooser.resetChoosableFileFilters(); chooser.addChoosableFileFilter(xmlFileFilter); } } emitters.add(emitter); } additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE); pointsEnabled.setSelected(system.usePoints()); emitters.setSelected(0); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
java
public void loadSystem() { chooser.setDialogTitle("Open"); int resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); File path = file.getParentFile(); try { ParticleSystem system = ParticleIO.loadConfiguredSystem(file); game.setSystem(system); emitters.clear(); for (int i=0;i<system.getEmitterCount();i++) { final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i); if (emitter.getImageName() != null) { File possible = new File(path, emitter.getImageName()); if (possible.exists()) { emitter.setImageName(possible.getAbsolutePath()); } else { chooser.setDialogTitle("Locate the image: "+emitter.getImageName()); FileFilter filter = new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) { return true; } return (f.getName().equals(emitter.getImageName())); } public String getDescription() { return emitter.getImageName(); } }; chooser.addChoosableFileFilter(filter); resp = chooser.showOpenDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File image = chooser.getSelectedFile(); emitter.setImageName(image.getAbsolutePath()); path = image.getParentFile(); } chooser.setDialogTitle("Open"); chooser.resetChoosableFileFilters(); chooser.addChoosableFileFilter(xmlFileFilter); } } emitters.add(emitter); } additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE); pointsEnabled.setSelected(system.usePoints()); emitters.setSelected(0); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
[ "public", "void", "loadSystem", "(", ")", "{", "chooser", ".", "setDialogTitle", "(", "\"Open\"", ")", ";", "int", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "file", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "File", "path", "=", "file", ".", "getParentFile", "(", ")", ";", "try", "{", "ParticleSystem", "system", "=", "ParticleIO", ".", "loadConfiguredSystem", "(", "file", ")", ";", "game", ".", "setSystem", "(", "system", ")", ";", "emitters", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "system", ".", "getEmitterCount", "(", ")", ";", "i", "++", ")", "{", "final", "ConfigurableEmitter", "emitter", "=", "(", "ConfigurableEmitter", ")", "system", ".", "getEmitter", "(", "i", ")", ";", "if", "(", "emitter", ".", "getImageName", "(", ")", "!=", "null", ")", "{", "File", "possible", "=", "new", "File", "(", "path", ",", "emitter", ".", "getImageName", "(", ")", ")", ";", "if", "(", "possible", ".", "exists", "(", ")", ")", "{", "emitter", ".", "setImageName", "(", "possible", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "else", "{", "chooser", ".", "setDialogTitle", "(", "\"Locate the image: \"", "+", "emitter", ".", "getImageName", "(", ")", ")", ";", "FileFilter", "filter", "=", "new", "FileFilter", "(", ")", "{", "public", "boolean", "accept", "(", "File", "f", ")", "{", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "{", "return", "true", ";", "}", "return", "(", "f", ".", "getName", "(", ")", ".", "equals", "(", "emitter", ".", "getImageName", "(", ")", ")", ")", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "emitter", ".", "getImageName", "(", ")", ";", "}", "}", ";", "chooser", ".", "addChoosableFileFilter", "(", "filter", ")", ";", "resp", "=", "chooser", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "image", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "emitter", ".", "setImageName", "(", "image", ".", "getAbsolutePath", "(", ")", ")", ";", "path", "=", "image", ".", "getParentFile", "(", ")", ";", "}", "chooser", ".", "setDialogTitle", "(", "\"Open\"", ")", ";", "chooser", ".", "resetChoosableFileFilters", "(", ")", ";", "chooser", ".", "addChoosableFileFilter", "(", "xmlFileFilter", ")", ";", "}", "}", "emitters", ".", "add", "(", "emitter", ")", ";", "}", "additive", ".", "setSelected", "(", "system", ".", "getBlendingMode", "(", ")", "==", "ParticleSystem", ".", "BLEND_ADDITIVE", ")", ";", "pointsEnabled", ".", "setSelected", "(", "system", ".", "usePoints", "(", ")", ")", ";", "emitters", ".", "setSelected", "(", "0", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Load a complete particle system XML description
[ "Load", "a", "complete", "particle", "system", "XML", "description" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L515-L574
1,376
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.saveSystem
public void saveSystem() { int resp = chooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().endsWith(".xml")) { file = new File(file.getAbsolutePath()+".xml"); } try { ParticleIO.saveConfiguredSystem(file, game.getSystem()); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
java
public void saveSystem() { int resp = chooser.showSaveDialog(this); if (resp == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().endsWith(".xml")) { file = new File(file.getAbsolutePath()+".xml"); } try { ParticleIO.saveConfiguredSystem(file, game.getSystem()); } catch (IOException e) { Log.error(e); JOptionPane.showMessageDialog(this, e.getMessage()); } } }
[ "public", "void", "saveSystem", "(", ")", "{", "int", "resp", "=", "chooser", ".", "showSaveDialog", "(", "this", ")", ";", "if", "(", "resp", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "File", "file", "=", "chooser", ".", "getSelectedFile", "(", ")", ";", "if", "(", "!", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\".xml\"", ")", ")", "{", "file", "=", "new", "File", "(", "file", ".", "getAbsolutePath", "(", ")", "+", "\".xml\"", ")", ";", "}", "try", "{", "ParticleIO", ".", "saveConfiguredSystem", "(", "file", ",", "game", ".", "getSystem", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "this", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Save a complete particle system XML description
[ "Save", "a", "complete", "particle", "system", "XML", "description" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L579-L594
1,377
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.setCurrentEmitter
public void setCurrentEmitter(ConfigurableEmitter emitter) { this.selected = emitter; if (emitter == null) { emissionControls.setEnabled(false); settingsPanel.setEnabled(false); positionControls.setEnabled(false); colorPanel.setEnabled(false); limitPanel.setEnabled(false); whiskasPanel.setEnabled(false); } else { emissionControls.setEnabled(true); settingsPanel.setEnabled(true); positionControls.setEnabled(true); colorPanel.setEnabled(true); limitPanel.setEnabled(true); whiskasPanel.setEnabled(true); emissionControls.setTarget(emitter); settingsPanel.setTarget(emitter); positionControls.setTarget(emitter); settingsPanel.setTarget(emitter); colorPanel.setTarget(emitter); limitPanel.setTarget(emitter); whiskasPanel.setTarget(emitter); } }
java
public void setCurrentEmitter(ConfigurableEmitter emitter) { this.selected = emitter; if (emitter == null) { emissionControls.setEnabled(false); settingsPanel.setEnabled(false); positionControls.setEnabled(false); colorPanel.setEnabled(false); limitPanel.setEnabled(false); whiskasPanel.setEnabled(false); } else { emissionControls.setEnabled(true); settingsPanel.setEnabled(true); positionControls.setEnabled(true); colorPanel.setEnabled(true); limitPanel.setEnabled(true); whiskasPanel.setEnabled(true); emissionControls.setTarget(emitter); settingsPanel.setTarget(emitter); positionControls.setTarget(emitter); settingsPanel.setTarget(emitter); colorPanel.setTarget(emitter); limitPanel.setTarget(emitter); whiskasPanel.setTarget(emitter); } }
[ "public", "void", "setCurrentEmitter", "(", "ConfigurableEmitter", "emitter", ")", "{", "this", ".", "selected", "=", "emitter", ";", "if", "(", "emitter", "==", "null", ")", "{", "emissionControls", ".", "setEnabled", "(", "false", ")", ";", "settingsPanel", ".", "setEnabled", "(", "false", ")", ";", "positionControls", ".", "setEnabled", "(", "false", ")", ";", "colorPanel", ".", "setEnabled", "(", "false", ")", ";", "limitPanel", ".", "setEnabled", "(", "false", ")", ";", "whiskasPanel", ".", "setEnabled", "(", "false", ")", ";", "}", "else", "{", "emissionControls", ".", "setEnabled", "(", "true", ")", ";", "settingsPanel", ".", "setEnabled", "(", "true", ")", ";", "positionControls", ".", "setEnabled", "(", "true", ")", ";", "colorPanel", ".", "setEnabled", "(", "true", ")", ";", "limitPanel", ".", "setEnabled", "(", "true", ")", ";", "whiskasPanel", ".", "setEnabled", "(", "true", ")", ";", "emissionControls", ".", "setTarget", "(", "emitter", ")", ";", "settingsPanel", ".", "setTarget", "(", "emitter", ")", ";", "positionControls", ".", "setTarget", "(", "emitter", ")", ";", "settingsPanel", ".", "setTarget", "(", "emitter", ")", ";", "colorPanel", ".", "setTarget", "(", "emitter", ")", ";", "limitPanel", ".", "setTarget", "(", "emitter", ")", ";", "whiskasPanel", ".", "setTarget", "(", "emitter", ")", ";", "}", "}" ]
Set the currently selected and edited particle emitter @param emitter The emitter that should be selected or null for none
[ "Set", "the", "currently", "selected", "and", "edited", "particle", "emitter" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L621-L647
1,378
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.updateBlendMode
public void updateBlendMode() { if (additive.isSelected()) { game.getSystem().setBlendingMode(ParticleSystem.BLEND_ADDITIVE); } else { game.getSystem().setBlendingMode(ParticleSystem.BLEND_COMBINE); } }
java
public void updateBlendMode() { if (additive.isSelected()) { game.getSystem().setBlendingMode(ParticleSystem.BLEND_ADDITIVE); } else { game.getSystem().setBlendingMode(ParticleSystem.BLEND_COMBINE); } }
[ "public", "void", "updateBlendMode", "(", ")", "{", "if", "(", "additive", ".", "isSelected", "(", ")", ")", "{", "game", ".", "getSystem", "(", ")", ".", "setBlendingMode", "(", "ParticleSystem", ".", "BLEND_ADDITIVE", ")", ";", "}", "else", "{", "game", ".", "getSystem", "(", ")", ".", "setBlendingMode", "(", "ParticleSystem", ".", "BLEND_COMBINE", ")", ";", "}", "}" ]
Change the visual indicator for the current particle system blend mode
[ "Change", "the", "visual", "indicator", "for", "the", "current", "particle", "system", "blend", "mode" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L653-L659
1,379
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java
ParticleEditor.main
public static void main(String[] argv) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); new ParticleEditor(); } catch (Exception e) { Log.error(e); } }
java
public static void main(String[] argv) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); new ParticleEditor(); } catch (Exception e) { Log.error(e); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "argv", ")", "{", "try", "{", "UIManager", ".", "setLookAndFeel", "(", "UIManager", ".", "getSystemLookAndFeelClassName", "(", ")", ")", ";", "new", "ParticleEditor", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "error", "(", "e", ")", ";", "}", "}" ]
Entry point in the editor @param argv The arguments passed on the command line
[ "Entry", "point", "in", "the", "editor" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/ParticleEditor.java#L666-L674
1,380
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java
ResourceLoader.getResourceAsStream
public static InputStream getResourceAsStream(String ref) { InputStream in = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); in = location.getResourceAsStream(ref); if (in != null) { break; } } if (in == null) { throw new RuntimeException("Resource not found: "+ref); } return new BufferedInputStream(in); }
java
public static InputStream getResourceAsStream(String ref) { InputStream in = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); in = location.getResourceAsStream(ref); if (in != null) { break; } } if (in == null) { throw new RuntimeException("Resource not found: "+ref); } return new BufferedInputStream(in); }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "String", "ref", ")", "{", "InputStream", "in", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "locations", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ResourceLocation", "location", "=", "(", "ResourceLocation", ")", "locations", ".", "get", "(", "i", ")", ";", "in", "=", "location", ".", "getResourceAsStream", "(", "ref", ")", ";", "if", "(", "in", "!=", "null", ")", "{", "break", ";", "}", "}", "if", "(", "in", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Resource not found: \"", "+", "ref", ")", ";", "}", "return", "new", "BufferedInputStream", "(", "in", ")", ";", "}" ]
Get a resource @param ref The reference to the resource to retrieve @return A stream from which the resource can be read
[ "Get", "a", "resource" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java#L56-L73
1,381
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java
ResourceLoader.resourceExists
public static boolean resourceExists(String ref) { URL url = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); url = location.getResource(ref); if (url != null) { return true; } } return false; }
java
public static boolean resourceExists(String ref) { URL url = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); url = location.getResource(ref); if (url != null) { return true; } } return false; }
[ "public", "static", "boolean", "resourceExists", "(", "String", "ref", ")", "{", "URL", "url", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "locations", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ResourceLocation", "location", "=", "(", "ResourceLocation", ")", "locations", ".", "get", "(", "i", ")", ";", "url", "=", "location", ".", "getResource", "(", "ref", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if a resource is available from any given resource loader @param ref A reference to the resource that should be checked @return True if the resource can be located
[ "Check", "if", "a", "resource", "is", "available", "from", "any", "given", "resource", "loader" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java#L81-L93
1,382
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java
ResourceLoader.getResource
public static URL getResource(String ref) { URL url = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); url = location.getResource(ref); if (url != null) { break; } } if (url == null) { throw new RuntimeException("Resource not found: "+ref); } return url; }
java
public static URL getResource(String ref) { URL url = null; for (int i=0;i<locations.size();i++) { ResourceLocation location = (ResourceLocation) locations.get(i); url = location.getResource(ref); if (url != null) { break; } } if (url == null) { throw new RuntimeException("Resource not found: "+ref); } return url; }
[ "public", "static", "URL", "getResource", "(", "String", "ref", ")", "{", "URL", "url", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "locations", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ResourceLocation", "location", "=", "(", "ResourceLocation", ")", "locations", ".", "get", "(", "i", ")", ";", "url", "=", "location", ".", "getResource", "(", "ref", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "break", ";", "}", "}", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Resource not found: \"", "+", "ref", ")", ";", "}", "return", "url", ";", "}" ]
Get a resource as a URL @param ref The reference to the resource to retrieve @return A URL from which the resource can be read
[ "Get", "a", "resource", "as", "a", "URL" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/ResourceLoader.java#L101-L119
1,383
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java
ConfigurableEmitter.setPosition
public void setPosition(float x, float y, boolean moveParticles) { if (moveParticles) { adjust = true; adjustx -= this.x - x; adjusty -= this.y - y; } this.x = x; this.y = y; }
java
public void setPosition(float x, float y, boolean moveParticles) { if (moveParticles) { adjust = true; adjustx -= this.x - x; adjusty -= this.y - y; } this.x = x; this.y = y; }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "boolean", "moveParticles", ")", "{", "if", "(", "moveParticles", ")", "{", "adjust", "=", "true", ";", "adjustx", "-=", "this", ".", "x", "-", "x", ";", "adjusty", "-=", "this", ".", "y", "-", "y", ";", "}", "this", ".", "x", "=", "x", ";", "this", ".", "y", "=", "y", ";", "}" ]
Set the position of this particle source @param x The x coodinate of that this emitter should spawn at @param y The y coodinate of that this emitter should spawn at @param moveParticles True if particles should be moved with the emitter
[ "Set", "the", "position", "of", "this", "particle", "source" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java#L234-L242
1,384
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java
ConfigurableEmitter.completed
public boolean completed() { if (engine == null) { return false; } if (length.isEnabled()) { if (timeout > 0) { return false; } return completed; } if (emitCount.isEnabled()) { if (leftToEmit > 0) { return false; } return completed; } if (wrapUp) { return completed; } return false; }
java
public boolean completed() { if (engine == null) { return false; } if (length.isEnabled()) { if (timeout > 0) { return false; } return completed; } if (emitCount.isEnabled()) { if (leftToEmit > 0) { return false; } return completed; } if (wrapUp) { return completed; } return false; }
[ "public", "boolean", "completed", "(", ")", "{", "if", "(", "engine", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "length", ".", "isEnabled", "(", ")", ")", "{", "if", "(", "timeout", ">", "0", ")", "{", "return", "false", ";", "}", "return", "completed", ";", "}", "if", "(", "emitCount", ".", "isEnabled", "(", ")", ")", "{", "if", "(", "leftToEmit", ">", "0", ")", "{", "return", "false", ";", "}", "return", "completed", ";", "}", "if", "(", "wrapUp", ")", "{", "return", "completed", ";", "}", "return", "false", ";", "}" ]
Check if this emitter has completed it's cycle @return True if the emitter has completed it's cycle
[ "Check", "if", "this", "emitter", "has", "completed", "it", "s", "cycle" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java#L444-L467
1,385
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java
ConfigurableEmitter.duplicate
public ConfigurableEmitter duplicate() { ConfigurableEmitter theCopy = null; try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ParticleIO.saveEmitter(bout, this); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); theCopy = ParticleIO.loadEmitter(bin); } catch (IOException e) { Log.error("Slick: ConfigurableEmitter.duplicate(): caught exception " + e.toString()); return null; } return theCopy; }
java
public ConfigurableEmitter duplicate() { ConfigurableEmitter theCopy = null; try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ParticleIO.saveEmitter(bout, this); ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); theCopy = ParticleIO.loadEmitter(bin); } catch (IOException e) { Log.error("Slick: ConfigurableEmitter.duplicate(): caught exception " + e.toString()); return null; } return theCopy; }
[ "public", "ConfigurableEmitter", "duplicate", "(", ")", "{", "ConfigurableEmitter", "theCopy", "=", "null", ";", "try", "{", "ByteArrayOutputStream", "bout", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ParticleIO", ".", "saveEmitter", "(", "bout", ",", "this", ")", ";", "ByteArrayInputStream", "bin", "=", "new", "ByteArrayInputStream", "(", "bout", ".", "toByteArray", "(", ")", ")", ";", "theCopy", "=", "ParticleIO", ".", "loadEmitter", "(", "bin", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "error", "(", "\"Slick: ConfigurableEmitter.duplicate(): caught exception \"", "+", "e", ".", "toString", "(", ")", ")", ";", "return", "null", ";", "}", "return", "theCopy", ";", "}" ]
Create a duplicate of this emitter. The duplicate should be added to a ParticleSystem to be used. @return a copy if no IOException occurred, null otherwise
[ "Create", "a", "duplicate", "of", "this", "emitter", ".", "The", "duplicate", "should", "be", "added", "to", "a", "ParticleSystem", "to", "be", "used", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ConfigurableEmitter.java#L507-L519
1,386
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/Bootstrap.java
Bootstrap.runAsApplication
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) { try { AppGameContainer container = new AppGameContainer(game, width, height, fullscreen); container.start(); } catch (Exception e) { e.printStackTrace(); } }
java
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) { try { AppGameContainer container = new AppGameContainer(game, width, height, fullscreen); container.start(); } catch (Exception e) { e.printStackTrace(); } }
[ "public", "static", "void", "runAsApplication", "(", "Game", "game", ",", "int", "width", ",", "int", "height", ",", "boolean", "fullscreen", ")", "{", "try", "{", "AppGameContainer", "container", "=", "new", "AppGameContainer", "(", "game", ",", "width", ",", "height", ",", "fullscreen", ")", ";", "container", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Start the game as an application @param game The game to be started @param width The width of the window @param height The height of the window @param fullscreen True if the window should be fullscreen
[ "Start", "the", "game", "as", "an", "application" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/Bootstrap.java#L21-L28
1,387
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.setX
public void setX(float x) { if (x != this.x) { float dx = x - this.x; this.x = x; if ((points == null) || (center == null)) { checkPoints(); } // update the points in the special case for (int i=0;i<points.length/2;i++) { points[i*2] += dx; } center[0] += dx; x += dx; maxX += dx; minX += dx; trianglesDirty = true; } }
java
public void setX(float x) { if (x != this.x) { float dx = x - this.x; this.x = x; if ((points == null) || (center == null)) { checkPoints(); } // update the points in the special case for (int i=0;i<points.length/2;i++) { points[i*2] += dx; } center[0] += dx; x += dx; maxX += dx; minX += dx; trianglesDirty = true; } }
[ "public", "void", "setX", "(", "float", "x", ")", "{", "if", "(", "x", "!=", "this", ".", "x", ")", "{", "float", "dx", "=", "x", "-", "this", ".", "x", ";", "this", ".", "x", "=", "x", ";", "if", "(", "(", "points", "==", "null", ")", "||", "(", "center", "==", "null", ")", ")", "{", "checkPoints", "(", ")", ";", "}", "// update the points in the special case\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", "/", "2", ";", "i", "++", ")", "{", "points", "[", "i", "*", "2", "]", "+=", "dx", ";", "}", "center", "[", "0", "]", "+=", "dx", ";", "x", "+=", "dx", ";", "maxX", "+=", "dx", ";", "minX", "+=", "dx", ";", "trianglesDirty", "=", "true", ";", "}", "}" ]
Set the x position of the left side this shape. @param x The new x position of the left side this shape.
[ "Set", "the", "x", "position", "of", "the", "left", "side", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L85-L103
1,388
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.setY
public void setY(float y) { if (y != this.y) { float dy = y - this.y; this.y = y; if ((points == null) || (center == null)) { checkPoints(); } // update the points in the special case for (int i=0;i<points.length/2;i++) { points[(i*2)+1] += dy; } center[1] += dy; y += dy; maxY += dy; minY += dy; trianglesDirty = true; } }
java
public void setY(float y) { if (y != this.y) { float dy = y - this.y; this.y = y; if ((points == null) || (center == null)) { checkPoints(); } // update the points in the special case for (int i=0;i<points.length/2;i++) { points[(i*2)+1] += dy; } center[1] += dy; y += dy; maxY += dy; minY += dy; trianglesDirty = true; } }
[ "public", "void", "setY", "(", "float", "y", ")", "{", "if", "(", "y", "!=", "this", ".", "y", ")", "{", "float", "dy", "=", "y", "-", "this", ".", "y", ";", "this", ".", "y", "=", "y", ";", "if", "(", "(", "points", "==", "null", ")", "||", "(", "center", "==", "null", ")", ")", "{", "checkPoints", "(", ")", ";", "}", "// update the points in the special case\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", "/", "2", ";", "i", "++", ")", "{", "points", "[", "(", "i", "*", "2", ")", "+", "1", "]", "+=", "dy", ";", "}", "center", "[", "1", "]", "+=", "dy", ";", "y", "+=", "dy", ";", "maxY", "+=", "dy", ";", "minY", "+=", "dy", ";", "trianglesDirty", "=", "true", ";", "}", "}" ]
Set the y position of the top of this shape. @param y The new y position of the top of this shape.
[ "Set", "the", "y", "position", "of", "the", "top", "of", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L110-L128
1,389
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.setCenterX
public void setCenterX(float centerX) { if ((points == null) || (center == null)) { checkPoints(); } float xDiff = centerX - getCenterX(); setX(x + xDiff); }
java
public void setCenterX(float centerX) { if ((points == null) || (center == null)) { checkPoints(); } float xDiff = centerX - getCenterX(); setX(x + xDiff); }
[ "public", "void", "setCenterX", "(", "float", "centerX", ")", "{", "if", "(", "(", "points", "==", "null", ")", "||", "(", "center", "==", "null", ")", ")", "{", "checkPoints", "(", ")", ";", "}", "float", "xDiff", "=", "centerX", "-", "getCenterX", "(", ")", ";", "setX", "(", "x", "+", "xDiff", ")", ";", "}" ]
Set the x center of this shape. @param centerX The center point to set.
[ "Set", "the", "x", "center", "of", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L174-L181
1,390
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.setCenterY
public void setCenterY(float centerY) { if ((points == null) || (center == null)) { checkPoints(); } float yDiff = centerY - getCenterY(); setY(y + yDiff); }
java
public void setCenterY(float centerY) { if ((points == null) || (center == null)) { checkPoints(); } float yDiff = centerY - getCenterY(); setY(y + yDiff); }
[ "public", "void", "setCenterY", "(", "float", "centerY", ")", "{", "if", "(", "(", "points", "==", "null", ")", "||", "(", "center", "==", "null", ")", ")", "{", "checkPoints", "(", ")", ";", "}", "float", "yDiff", "=", "centerY", "-", "getCenterY", "(", ")", ";", "setY", "(", "y", "+", "yDiff", ")", ";", "}" ]
Set the y center of this shape. @param centerY The center point to set.
[ "Set", "the", "y", "center", "of", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L199-L206
1,391
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.getPoint
public float[] getPoint(int index) { checkPoints(); float result[] = new float[2]; result[0] = points[index * 2]; result[1] = points[index * 2 + 1]; return result; }
java
public float[] getPoint(int index) { checkPoints(); float result[] = new float[2]; result[0] = points[index * 2]; result[1] = points[index * 2 + 1]; return result; }
[ "public", "float", "[", "]", "getPoint", "(", "int", "index", ")", "{", "checkPoints", "(", ")", ";", "float", "result", "[", "]", "=", "new", "float", "[", "2", "]", ";", "result", "[", "0", "]", "=", "points", "[", "index", "*", "2", "]", ";", "result", "[", "1", "]", "=", "points", "[", "index", "*", "2", "+", "1", "]", ";", "return", "result", ";", "}" ]
Get a single point in this polygon @param index The index of the point to retrieve @return The point's coordinates
[ "Get", "a", "single", "point", "in", "this", "polygon" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L293-L302
1,392
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.getNormal
public float[] getNormal(int index) { float[] current = getPoint(index); float[] prev = getPoint(index - 1 < 0 ? getPointCount() - 1 : index - 1); float[] next = getPoint(index + 1 >= getPointCount() ? 0 : index + 1); float[] t1 = getNormal(prev, current); float[] t2 = getNormal(current, next); if ((index == 0) && (!closed())) { return t2; } if ((index == getPointCount()-1) && (!closed())) { return t1; } float tx = (t1[0]+t2[0])/2; float ty = (t1[1]+t2[1])/2; float len = (float) Math.sqrt((tx*tx)+(ty*ty)); return new float[] {tx/len,ty/len}; }
java
public float[] getNormal(int index) { float[] current = getPoint(index); float[] prev = getPoint(index - 1 < 0 ? getPointCount() - 1 : index - 1); float[] next = getPoint(index + 1 >= getPointCount() ? 0 : index + 1); float[] t1 = getNormal(prev, current); float[] t2 = getNormal(current, next); if ((index == 0) && (!closed())) { return t2; } if ((index == getPointCount()-1) && (!closed())) { return t1; } float tx = (t1[0]+t2[0])/2; float ty = (t1[1]+t2[1])/2; float len = (float) Math.sqrt((tx*tx)+(ty*ty)); return new float[] {tx/len,ty/len}; }
[ "public", "float", "[", "]", "getNormal", "(", "int", "index", ")", "{", "float", "[", "]", "current", "=", "getPoint", "(", "index", ")", ";", "float", "[", "]", "prev", "=", "getPoint", "(", "index", "-", "1", "<", "0", "?", "getPointCount", "(", ")", "-", "1", ":", "index", "-", "1", ")", ";", "float", "[", "]", "next", "=", "getPoint", "(", "index", "+", "1", ">=", "getPointCount", "(", ")", "?", "0", ":", "index", "+", "1", ")", ";", "float", "[", "]", "t1", "=", "getNormal", "(", "prev", ",", "current", ")", ";", "float", "[", "]", "t2", "=", "getNormal", "(", "current", ",", "next", ")", ";", "if", "(", "(", "index", "==", "0", ")", "&&", "(", "!", "closed", "(", ")", ")", ")", "{", "return", "t2", ";", "}", "if", "(", "(", "index", "==", "getPointCount", "(", ")", "-", "1", ")", "&&", "(", "!", "closed", "(", ")", ")", ")", "{", "return", "t1", ";", "}", "float", "tx", "=", "(", "t1", "[", "0", "]", "+", "t2", "[", "0", "]", ")", "/", "2", ";", "float", "ty", "=", "(", "t1", "[", "1", "]", "+", "t2", "[", "1", "]", ")", "/", "2", ";", "float", "len", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "(", "tx", "*", "tx", ")", "+", "(", "ty", "*", "ty", ")", ")", ";", "return", "new", "float", "[", "]", "{", "tx", "/", "len", ",", "ty", "/", "len", "}", ";", "}" ]
Get the combine normal of a given point @param index The index of the point whose normal should be retrieved @return The combined normal of a given point
[ "Get", "the", "combine", "normal", "of", "a", "given", "point" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L310-L329
1,393
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.contains
public boolean contains(Shape other) { if (other.intersects(this)) { return false; } for (int i=0;i<other.getPointCount();i++) { float[] pt = other.getPoint(i); if (!contains(pt[0], pt[1])) { return false; } } return true; }
java
public boolean contains(Shape other) { if (other.intersects(this)) { return false; } for (int i=0;i<other.getPointCount();i++) { float[] pt = other.getPoint(i); if (!contains(pt[0], pt[1])) { return false; } } return true; }
[ "public", "boolean", "contains", "(", "Shape", "other", ")", "{", "if", "(", "other", ".", "intersects", "(", "this", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "other", ".", "getPointCount", "(", ")", ";", "i", "++", ")", "{", "float", "[", "]", "pt", "=", "other", ".", "getPoint", "(", "i", ")", ";", "if", "(", "!", "contains", "(", "pt", "[", "0", "]", ",", "pt", "[", "1", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Check if the shape passed is entirely contained within this shape. @param other The other shape to test against this one @return True if the other shape supplied is entirely contained within this one.
[ "Check", "if", "the", "shape", "passed", "is", "entirely", "contained", "within", "this", "shape", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L339-L352
1,394
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.getNormal
private float[] getNormal(float[] start, float[] end) { float dx = start[0] - end[0]; float dy = start[1] - end[1]; float len = (float) Math.sqrt((dx*dx)+(dy*dy)); dx /= len; dy /= len; return new float[] {-dy,dx}; }
java
private float[] getNormal(float[] start, float[] end) { float dx = start[0] - end[0]; float dy = start[1] - end[1]; float len = (float) Math.sqrt((dx*dx)+(dy*dy)); dx /= len; dy /= len; return new float[] {-dy,dx}; }
[ "private", "float", "[", "]", "getNormal", "(", "float", "[", "]", "start", ",", "float", "[", "]", "end", ")", "{", "float", "dx", "=", "start", "[", "0", "]", "-", "end", "[", "0", "]", ";", "float", "dy", "=", "start", "[", "1", "]", "-", "end", "[", "1", "]", ";", "float", "len", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "(", "dx", "*", "dx", ")", "+", "(", "dy", "*", "dy", ")", ")", ";", "dx", "/=", "len", ";", "dy", "/=", "len", ";", "return", "new", "float", "[", "]", "{", "-", "dy", ",", "dx", "}", ";", "}" ]
Get the normal of the line between two points @param start The start point @param end The end point @return The normal of the line between the two points
[ "Get", "the", "normal", "of", "the", "line", "between", "two", "points" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L360-L367
1,395
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.includes
public boolean includes(float x, float y) { if (points.length == 0) { return false; } checkPoints(); Line testLine = new Line(0,0,0,0); Vector2f pt = new Vector2f(x,y); for (int i=0;i<points.length;i+=2) { int n = i+2; if (n >= points.length) { n = 0; } testLine.set(points[i], points[i+1], points[n], points[n+1]); if (testLine.on(pt)) { return true; } } return false; }
java
public boolean includes(float x, float y) { if (points.length == 0) { return false; } checkPoints(); Line testLine = new Line(0,0,0,0); Vector2f pt = new Vector2f(x,y); for (int i=0;i<points.length;i+=2) { int n = i+2; if (n >= points.length) { n = 0; } testLine.set(points[i], points[i+1], points[n], points[n+1]); if (testLine.on(pt)) { return true; } } return false; }
[ "public", "boolean", "includes", "(", "float", "x", ",", "float", "y", ")", "{", "if", "(", "points", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "checkPoints", "(", ")", ";", "Line", "testLine", "=", "new", "Line", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "Vector2f", "pt", "=", "new", "Vector2f", "(", "x", ",", "y", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "int", "n", "=", "i", "+", "2", ";", "if", "(", "n", ">=", "points", ".", "length", ")", "{", "n", "=", "0", ";", "}", "testLine", ".", "set", "(", "points", "[", "i", "]", ",", "points", "[", "i", "+", "1", "]", ",", "points", "[", "n", "]", ",", "points", "[", "n", "+", "1", "]", ")", ";", "if", "(", "testLine", ".", "on", "(", "pt", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if the given point is part of the path that forms this shape @param x The x position of the point to check @param y The y position of the point to check @return True if the point is includes in the path of the polygon
[ "Check", "if", "the", "given", "point", "is", "part", "of", "the", "path", "that", "forms", "this", "shape" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L377-L400
1,396
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.indexOf
public int indexOf(float x, float y) { for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return i / 2; } } return -1; }
java
public int indexOf(float x, float y) { for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return i / 2; } } return -1; }
[ "public", "int", "indexOf", "(", "float", "x", ",", "float", "y", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "if", "(", "(", "points", "[", "i", "]", "==", "x", ")", "&&", "(", "points", "[", "i", "+", "1", "]", "==", "y", ")", ")", "{", "return", "i", "/", "2", ";", "}", "}", "return", "-", "1", ";", "}" ]
Get the index of a given point @param x The x coordinate of the point @param y The y coordinate of the point @return The index of the point or -1 if the point is not part of this shape path
[ "Get", "the", "index", "of", "a", "given", "point" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L409-L417
1,397
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.contains
public boolean contains(float x, float y) { checkPoints(); if (points.length == 0) { return false; } boolean result = false; float xnew,ynew; float xold,yold; float x1,y1; float x2,y2; int npoints = points.length; xold=points[npoints - 2]; yold=points[npoints - 1]; for (int i=0;i < npoints;i+=2) { xnew = points[i]; ynew = points[i + 1]; if (xnew > xold) { x1 = xold; x2 = xnew; y1 = yold; y2 = ynew; } else { x1 = xnew; x2 = xold; y1 = ynew; y2 = yold; } if ((xnew < x) == (x <= xold) /* edge "open" at one end */ && ((double)y - (double)y1) * (x2 - x1) < ((double)y2 - (double)y1) * (x - x1)) { result = !result; } xold = xnew; yold = ynew; } return result; }
java
public boolean contains(float x, float y) { checkPoints(); if (points.length == 0) { return false; } boolean result = false; float xnew,ynew; float xold,yold; float x1,y1; float x2,y2; int npoints = points.length; xold=points[npoints - 2]; yold=points[npoints - 1]; for (int i=0;i < npoints;i+=2) { xnew = points[i]; ynew = points[i + 1]; if (xnew > xold) { x1 = xold; x2 = xnew; y1 = yold; y2 = ynew; } else { x1 = xnew; x2 = xold; y1 = ynew; y2 = yold; } if ((xnew < x) == (x <= xold) /* edge "open" at one end */ && ((double)y - (double)y1) * (x2 - x1) < ((double)y2 - (double)y1) * (x - x1)) { result = !result; } xold = xnew; yold = ynew; } return result; }
[ "public", "boolean", "contains", "(", "float", "x", ",", "float", "y", ")", "{", "checkPoints", "(", ")", ";", "if", "(", "points", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "boolean", "result", "=", "false", ";", "float", "xnew", ",", "ynew", ";", "float", "xold", ",", "yold", ";", "float", "x1", ",", "y1", ";", "float", "x2", ",", "y2", ";", "int", "npoints", "=", "points", ".", "length", ";", "xold", "=", "points", "[", "npoints", "-", "2", "]", ";", "yold", "=", "points", "[", "npoints", "-", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "npoints", ";", "i", "+=", "2", ")", "{", "xnew", "=", "points", "[", "i", "]", ";", "ynew", "=", "points", "[", "i", "+", "1", "]", ";", "if", "(", "xnew", ">", "xold", ")", "{", "x1", "=", "xold", ";", "x2", "=", "xnew", ";", "y1", "=", "yold", ";", "y2", "=", "ynew", ";", "}", "else", "{", "x1", "=", "xnew", ";", "x2", "=", "xold", ";", "y1", "=", "ynew", ";", "y2", "=", "yold", ";", "}", "if", "(", "(", "xnew", "<", "x", ")", "==", "(", "x", "<=", "xold", ")", "/* edge \"open\" at one end */", "&&", "(", "(", "double", ")", "y", "-", "(", "double", ")", "y1", ")", "*", "(", "x2", "-", "x1", ")", "<", "(", "(", "double", ")", "y2", "-", "(", "double", ")", "y1", ")", "*", "(", "x", "-", "x1", ")", ")", "{", "result", "=", "!", "result", ";", "}", "xold", "=", "xnew", ";", "yold", "=", "ynew", ";", "}", "return", "result", ";", "}" ]
Check if this polygon contains the given point @param x The x position of the point to check @param y The y position of the point to check @return True if the point is contained in the polygon
[ "Check", "if", "this", "polygon", "contains", "the", "given", "point" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L426-L466
1,398
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.intersects
public boolean intersects(Shape shape) { /* * Intersection formula used: * (x4 - x3)(y1 - y3) - (y4 - y3)(x1 - x3) * UA = --------------------------------------- * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1) * * (x2 - x1)(y1 - y3) - (y2 - y1)(x1 - x3) * UB = --------------------------------------- * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1) * * if UA and UB are both between 0 and 1 then the lines intersect. * * Source: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ */ checkPoints(); boolean result = false; float points[] = getPoints(); // (x3, y3) and (x4, y4) float thatPoints[] = shape.getPoints(); // (x1, y1) and (x2, y2) int length = points.length; int thatLength = thatPoints.length; double unknownA; double unknownB; if (!closed()) { length -= 2; } if (!shape.closed()) { thatLength -= 2; } // x1 = thatPoints[j] // x2 = thatPoints[j + 2] // y1 = thatPoints[j + 1] // y2 = thatPoints[j + 3] // x3 = points[i] // x4 = points[i + 2] // y3 = points[i + 1] // y4 = points[i + 3] for(int i=0;i<length;i+=2) { int iNext = i+2; if (iNext >= points.length) { iNext = 0; } for(int j=0;j<thatLength;j+=2) { int jNext = j+2; if (jNext >= thatPoints.length) { jNext = 0; } unknownA = (((points[iNext] - points[i]) * (double) (thatPoints[j + 1] - points[i + 1])) - ((points[iNext+1] - points[i + 1]) * (thatPoints[j] - points[i]))) / (((points[iNext+1] - points[i + 1]) * (thatPoints[jNext] - thatPoints[j])) - ((points[iNext] - points[i]) * (thatPoints[jNext+1] - thatPoints[j + 1]))); unknownB = (((thatPoints[jNext] - thatPoints[j]) * (double) (thatPoints[j + 1] - points[i + 1])) - ((thatPoints[jNext+1] - thatPoints[j + 1]) * (thatPoints[j] - points[i]))) / (((points[iNext+1] - points[i + 1]) * (thatPoints[jNext] - thatPoints[j])) - ((points[iNext] - points[i]) * (thatPoints[jNext+1] - thatPoints[j + 1]))); if(unknownA >= 0 && unknownA <= 1 && unknownB >= 0 && unknownB <= 1) { result = true; break; } } if(result) { break; } } return result; }
java
public boolean intersects(Shape shape) { /* * Intersection formula used: * (x4 - x3)(y1 - y3) - (y4 - y3)(x1 - x3) * UA = --------------------------------------- * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1) * * (x2 - x1)(y1 - y3) - (y2 - y1)(x1 - x3) * UB = --------------------------------------- * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1) * * if UA and UB are both between 0 and 1 then the lines intersect. * * Source: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ */ checkPoints(); boolean result = false; float points[] = getPoints(); // (x3, y3) and (x4, y4) float thatPoints[] = shape.getPoints(); // (x1, y1) and (x2, y2) int length = points.length; int thatLength = thatPoints.length; double unknownA; double unknownB; if (!closed()) { length -= 2; } if (!shape.closed()) { thatLength -= 2; } // x1 = thatPoints[j] // x2 = thatPoints[j + 2] // y1 = thatPoints[j + 1] // y2 = thatPoints[j + 3] // x3 = points[i] // x4 = points[i + 2] // y3 = points[i + 1] // y4 = points[i + 3] for(int i=0;i<length;i+=2) { int iNext = i+2; if (iNext >= points.length) { iNext = 0; } for(int j=0;j<thatLength;j+=2) { int jNext = j+2; if (jNext >= thatPoints.length) { jNext = 0; } unknownA = (((points[iNext] - points[i]) * (double) (thatPoints[j + 1] - points[i + 1])) - ((points[iNext+1] - points[i + 1]) * (thatPoints[j] - points[i]))) / (((points[iNext+1] - points[i + 1]) * (thatPoints[jNext] - thatPoints[j])) - ((points[iNext] - points[i]) * (thatPoints[jNext+1] - thatPoints[j + 1]))); unknownB = (((thatPoints[jNext] - thatPoints[j]) * (double) (thatPoints[j + 1] - points[i + 1])) - ((thatPoints[jNext+1] - thatPoints[j + 1]) * (thatPoints[j] - points[i]))) / (((points[iNext+1] - points[i + 1]) * (thatPoints[jNext] - thatPoints[j])) - ((points[iNext] - points[i]) * (thatPoints[jNext+1] - thatPoints[j + 1]))); if(unknownA >= 0 && unknownA <= 1 && unknownB >= 0 && unknownB <= 1) { result = true; break; } } if(result) { break; } } return result; }
[ "public", "boolean", "intersects", "(", "Shape", "shape", ")", "{", "/*\r\n * Intersection formula used:\r\n * (x4 - x3)(y1 - y3) - (y4 - y3)(x1 - x3)\r\n * UA = ---------------------------------------\r\n * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1)\r\n * \r\n * (x2 - x1)(y1 - y3) - (y2 - y1)(x1 - x3)\r\n * UB = ---------------------------------------\r\n * (y4 - y3)(x2 - x1) - (x4 - x3)(y2 - y1)\r\n * \r\n * if UA and UB are both between 0 and 1 then the lines intersect.\r\n * \r\n * Source: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/\r\n */", "checkPoints", "(", ")", ";", "boolean", "result", "=", "false", ";", "float", "points", "[", "]", "=", "getPoints", "(", ")", ";", "// (x3, y3) and (x4, y4)\r", "float", "thatPoints", "[", "]", "=", "shape", ".", "getPoints", "(", ")", ";", "// (x1, y1) and (x2, y2)\r", "int", "length", "=", "points", ".", "length", ";", "int", "thatLength", "=", "thatPoints", ".", "length", ";", "double", "unknownA", ";", "double", "unknownB", ";", "if", "(", "!", "closed", "(", ")", ")", "{", "length", "-=", "2", ";", "}", "if", "(", "!", "shape", ".", "closed", "(", ")", ")", "{", "thatLength", "-=", "2", ";", "}", "// x1 = thatPoints[j]\r", "// x2 = thatPoints[j + 2]\r", "// y1 = thatPoints[j + 1]\r", "// y2 = thatPoints[j + 3]\r", "// x3 = points[i]\r", "// x4 = points[i + 2]\r", "// y3 = points[i + 1]\r", "// y4 = points[i + 3]\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "+=", "2", ")", "{", "int", "iNext", "=", "i", "+", "2", ";", "if", "(", "iNext", ">=", "points", ".", "length", ")", "{", "iNext", "=", "0", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "thatLength", ";", "j", "+=", "2", ")", "{", "int", "jNext", "=", "j", "+", "2", ";", "if", "(", "jNext", ">=", "thatPoints", ".", "length", ")", "{", "jNext", "=", "0", ";", "}", "unknownA", "=", "(", "(", "(", "points", "[", "iNext", "]", "-", "points", "[", "i", "]", ")", "*", "(", "double", ")", "(", "thatPoints", "[", "j", "+", "1", "]", "-", "points", "[", "i", "+", "1", "]", ")", ")", "-", "(", "(", "points", "[", "iNext", "+", "1", "]", "-", "points", "[", "i", "+", "1", "]", ")", "*", "(", "thatPoints", "[", "j", "]", "-", "points", "[", "i", "]", ")", ")", ")", "/", "(", "(", "(", "points", "[", "iNext", "+", "1", "]", "-", "points", "[", "i", "+", "1", "]", ")", "*", "(", "thatPoints", "[", "jNext", "]", "-", "thatPoints", "[", "j", "]", ")", ")", "-", "(", "(", "points", "[", "iNext", "]", "-", "points", "[", "i", "]", ")", "*", "(", "thatPoints", "[", "jNext", "+", "1", "]", "-", "thatPoints", "[", "j", "+", "1", "]", ")", ")", ")", ";", "unknownB", "=", "(", "(", "(", "thatPoints", "[", "jNext", "]", "-", "thatPoints", "[", "j", "]", ")", "*", "(", "double", ")", "(", "thatPoints", "[", "j", "+", "1", "]", "-", "points", "[", "i", "+", "1", "]", ")", ")", "-", "(", "(", "thatPoints", "[", "jNext", "+", "1", "]", "-", "thatPoints", "[", "j", "+", "1", "]", ")", "*", "(", "thatPoints", "[", "j", "]", "-", "points", "[", "i", "]", ")", ")", ")", "/", "(", "(", "(", "points", "[", "iNext", "+", "1", "]", "-", "points", "[", "i", "+", "1", "]", ")", "*", "(", "thatPoints", "[", "jNext", "]", "-", "thatPoints", "[", "j", "]", ")", ")", "-", "(", "(", "points", "[", "iNext", "]", "-", "points", "[", "i", "]", ")", "*", "(", "thatPoints", "[", "jNext", "+", "1", "]", "-", "thatPoints", "[", "j", "+", "1", "]", ")", ")", ")", ";", "if", "(", "unknownA", ">=", "0", "&&", "unknownA", "<=", "1", "&&", "unknownB", ">=", "0", "&&", "unknownB", "<=", "1", ")", "{", "result", "=", "true", ";", "break", ";", "}", "}", "if", "(", "result", ")", "{", "break", ";", "}", "}", "return", "result", ";", "}" ]
Check if this shape intersects with the shape provided. @param shape The shape to check if it intersects with this one. @return True if the shapes do intersect, false otherwise.
[ "Check", "if", "this", "shape", "intersects", "with", "the", "shape", "provided", "." ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L474-L546
1,399
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.hasVertex
public boolean hasVertex(float x, float y) { if (points.length == 0) { return false; } checkPoints(); for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return true; } } return false; }
java
public boolean hasVertex(float x, float y) { if (points.length == 0) { return false; } checkPoints(); for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return true; } } return false; }
[ "public", "boolean", "hasVertex", "(", "float", "x", ",", "float", "y", ")", "{", "if", "(", "points", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "checkPoints", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "if", "(", "(", "points", "[", "i", "]", "==", "x", ")", "&&", "(", "points", "[", "i", "+", "1", "]", "==", "y", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if a particular location is a vertex of this polygon @param x The x coordinate to check @param y The y coordinate to check @return True if the cordinates supplied are a vertex of this polygon
[ "Check", "if", "a", "particular", "location", "is", "a", "vertex", "of", "this", "polygon" ]
8251f88a0ed6a70e726d2468842455cd1f80893f
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L555-L569