repo_name
stringclasses 5
values | pr_number
int64 1.52k
15.5k
| pr_title
stringlengths 8
143
| pr_description
stringlengths 0
10.2k
| author
stringlengths 3
18
| date_created
unknown | date_merged
unknown | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 11
10.2k
| filepath
stringlengths 6
220
| before_content
stringlengths 0
597M
| after_content
stringlengths 0
597M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/uint_key_func.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class uint_key_func extends BulletBase {
private long swigCPtr;
protected uint_key_func (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new uint_key_func, normally you should not need this constructor it's intended for low-level usage. */
public uint_key_func (long cPtr, boolean cMemoryOwn) {
this("uint_key_func", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (uint_key_func obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_uint_key_func(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public uint_key_func () {
this(CollisionJNI.new_uint_key_func(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
public class uint_key_func extends BulletBase {
private long swigCPtr;
protected uint_key_func (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new uint_key_func, normally you should not need this constructor it's intended for low-level usage. */
public uint_key_func (long cPtr, boolean cMemoryOwn) {
this("uint_key_func", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (uint_key_func obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_uint_key_func(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public uint_key_func () {
this(CollisionJNI.new_uint_key_func(), true);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/linearmath/com/badlogic/gdx/physics/bullet/linearmath/btHashPtr.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btHashPtr extends BulletBase {
private long swigCPtr;
protected btHashPtr (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btHashPtr, normally you should not need this constructor it's intended for low-level usage. */
public btHashPtr (long cPtr, boolean cMemoryOwn) {
this("btHashPtr", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btHashPtr obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btHashPtr(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btHashPtr (long ptr) {
this(LinearMathJNI.new_btHashPtr(ptr), true);
}
public long getPointer () {
return LinearMathJNI.btHashPtr_getPointer(swigCPtr, this);
}
public boolean equals (btHashPtr other) {
return LinearMathJNI.btHashPtr_equals(swigCPtr, this, btHashPtr.getCPtr(other), other);
}
public long getHash () {
return LinearMathJNI.btHashPtr_getHash(swigCPtr, this);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.linearmath;
import com.badlogic.gdx.physics.bullet.BulletBase;
public class btHashPtr extends BulletBase {
private long swigCPtr;
protected btHashPtr (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btHashPtr, normally you should not need this constructor it's intended for low-level usage. */
public btHashPtr (long cPtr, boolean cMemoryOwn) {
this("btHashPtr", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btHashPtr obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
LinearMathJNI.delete_btHashPtr(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public btHashPtr (long ptr) {
this(LinearMathJNI.new_btHashPtr(ptr), true);
}
public long getPointer () {
return LinearMathJNI.btHashPtr_getPointer(swigCPtr, this);
}
public boolean equals (btHashPtr other) {
return LinearMathJNI.btHashPtr_equals(swigCPtr, this, btHashPtr.getCPtr(other), other);
}
public long getHash () {
return LinearMathJNI.btHashPtr_getHash(swigCPtr, this);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/graphics/GL32.java | /*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// copied from https://cs.android.com/android/platform/superproject/+/master:frameworks/base/opengl/java/android/opengl/GLES32.java
package com.badlogic.gdx.graphics;
public interface GL32 extends GL31 {
public static final int GL_CONTEXT_FLAG_DEBUG_BIT = 0x00000002;
public static final int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT = 0x00000004;
public static final int GL_GEOMETRY_SHADER_BIT = 0x00000004;
public static final int GL_TESS_CONTROL_SHADER_BIT = 0x00000008;
public static final int GL_TESS_EVALUATION_SHADER_BIT = 0x00000010;
public static final int GL_QUADS = 0x0007;
public static final int GL_LINES_ADJACENCY = 0x000A;
public static final int GL_LINE_STRIP_ADJACENCY = 0x000B;
public static final int GL_TRIANGLES_ADJACENCY = 0x000C;
public static final int GL_TRIANGLE_STRIP_ADJACENCY = 0x000D;
public static final int GL_PATCHES = 0x000E;
public static final int GL_STACK_OVERFLOW = 0x0503;
public static final int GL_STACK_UNDERFLOW = 0x0504;
public static final int GL_CONTEXT_LOST = 0x0507;
public static final int GL_TEXTURE_BORDER_COLOR = 0x1004;
public static final int GL_VERTEX_ARRAY = 0x8074;
public static final int GL_CLAMP_TO_BORDER = 0x812D;
public static final int GL_CONTEXT_FLAGS = 0x821E;
public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 0x8221;
public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS = 0x8242;
public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243;
public static final int GL_DEBUG_CALLBACK_FUNCTION = 0x8244;
public static final int GL_DEBUG_CALLBACK_USER_PARAM = 0x8245;
public static final int GL_DEBUG_SOURCE_API = 0x8246;
public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247;
public static final int GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248;
public static final int GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249;
public static final int GL_DEBUG_SOURCE_APPLICATION = 0x824A;
public static final int GL_DEBUG_SOURCE_OTHER = 0x824B;
public static final int GL_DEBUG_TYPE_ERROR = 0x824C;
public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D;
public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E;
public static final int GL_DEBUG_TYPE_PORTABILITY = 0x824F;
public static final int GL_DEBUG_TYPE_PERFORMANCE = 0x8250;
public static final int GL_DEBUG_TYPE_OTHER = 0x8251;
public static final int GL_LOSE_CONTEXT_ON_RESET = 0x8252;
public static final int GL_GUILTY_CONTEXT_RESET = 0x8253;
public static final int GL_INNOCENT_CONTEXT_RESET = 0x8254;
public static final int GL_UNKNOWN_CONTEXT_RESET = 0x8255;
public static final int GL_RESET_NOTIFICATION_STRATEGY = 0x8256;
public static final int GL_LAYER_PROVOKING_VERTEX = 0x825E;
public static final int GL_UNDEFINED_VERTEX = 0x8260;
public static final int GL_NO_RESET_NOTIFICATION = 0x8261;
public static final int GL_DEBUG_TYPE_MARKER = 0x8268;
public static final int GL_DEBUG_TYPE_PUSH_GROUP = 0x8269;
public static final int GL_DEBUG_TYPE_POP_GROUP = 0x826A;
public static final int GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B;
public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C;
public static final int GL_DEBUG_GROUP_STACK_DEPTH = 0x826D;
public static final int GL_BUFFER = 0x82E0;
public static final int GL_SHADER = 0x82E1;
public static final int GL_PROGRAM = 0x82E2;
public static final int GL_QUERY = 0x82E3;
public static final int GL_PROGRAM_PIPELINE = 0x82E4;
public static final int GL_SAMPLER = 0x82E6;
public static final int GL_MAX_LABEL_LENGTH = 0x82E8;
public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C;
public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D;
public static final int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F;
public static final int GL_GEOMETRY_VERTICES_OUT = 0x8916;
public static final int GL_GEOMETRY_INPUT_TYPE = 0x8917;
public static final int GL_GEOMETRY_OUTPUT_TYPE = 0x8918;
public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C;
public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32;
public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29;
public static final int GL_TEXTURE_BUFFER = 0x8C2A;
public static final int GL_TEXTURE_BUFFER_BINDING = 0x8C2A;
public static final int GL_MAX_TEXTURE_BUFFER_SIZE = 0x8C2B;
public static final int GL_TEXTURE_BINDING_BUFFER = 0x8C2C;
public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D;
public static final int GL_SAMPLE_SHADING = 0x8C36;
public static final int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37;
public static final int GL_PRIMITIVES_GENERATED = 0x8C87;
public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7;
public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8;
public static final int GL_SAMPLER_BUFFER = 0x8DC2;
public static final int GL_INT_SAMPLER_BUFFER = 0x8DD0;
public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8;
public static final int GL_GEOMETRY_SHADER = 0x8DD9;
public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF;
public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0;
public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1;
public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E;
public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F;
public static final int GL_FIRST_VERTEX_CONVENTION = 0x8E4D;
public static final int GL_LAST_VERTEX_CONVENTION = 0x8E4E;
public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A;
public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B;
public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C;
public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D;
public static final int GL_PATCH_VERTICES = 0x8E72;
public static final int GL_TESS_CONTROL_OUTPUT_VERTICES = 0x8E75;
public static final int GL_TESS_GEN_MODE = 0x8E76;
public static final int GL_TESS_GEN_SPACING = 0x8E77;
public static final int GL_TESS_GEN_VERTEX_ORDER = 0x8E78;
public static final int GL_TESS_GEN_POINT_MODE = 0x8E79;
public static final int GL_ISOLINES = 0x8E7A;
public static final int GL_FRACTIONAL_ODD = 0x8E7B;
public static final int GL_FRACTIONAL_EVEN = 0x8E7C;
public static final int GL_MAX_PATCH_VERTICES = 0x8E7D;
public static final int GL_MAX_TESS_GEN_LEVEL = 0x8E7E;
public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F;
public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80;
public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81;
public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82;
public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83;
public static final int GL_MAX_TESS_PATCH_COMPONENTS = 0x8E84;
public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85;
public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86;
public static final int GL_TESS_EVALUATION_SHADER = 0x8E87;
public static final int GL_TESS_CONTROL_SHADER = 0x8E88;
public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89;
public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A;
public static final int GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009;
public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A;
public static final int GL_SAMPLER_CUBE_MAP_ARRAY = 0x900C;
public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D;
public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E;
public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F;
public static final int GL_IMAGE_BUFFER = 0x9051;
public static final int GL_IMAGE_CUBE_MAP_ARRAY = 0x9054;
public static final int GL_INT_IMAGE_BUFFER = 0x905C;
public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY = 0x905F;
public static final int GL_UNSIGNED_INT_IMAGE_BUFFER = 0x9067;
public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A;
public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB;
public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC;
public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD;
public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 0x90D7;
public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 0x90D8;
public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 0x90D9;
public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102;
public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105;
public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B;
public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C;
public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D;
public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123;
public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124;
public static final int GL_MAX_DEBUG_MESSAGE_LENGTH = 0x9143;
public static final int GL_MAX_DEBUG_LOGGED_MESSAGES = 0x9144;
public static final int GL_DEBUG_LOGGED_MESSAGES = 0x9145;
public static final int GL_DEBUG_SEVERITY_HIGH = 0x9146;
public static final int GL_DEBUG_SEVERITY_MEDIUM = 0x9147;
public static final int GL_DEBUG_SEVERITY_LOW = 0x9148;
public static final int GL_TEXTURE_BUFFER_OFFSET = 0x919D;
public static final int GL_TEXTURE_BUFFER_SIZE = 0x919E;
public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 0x919F;
public static final int GL_MULTIPLY = 0x9294;
public static final int GL_SCREEN = 0x9295;
public static final int GL_OVERLAY = 0x9296;
public static final int GL_DARKEN = 0x9297;
public static final int GL_LIGHTEN = 0x9298;
public static final int GL_COLORDODGE = 0x9299;
public static final int GL_COLORBURN = 0x929A;
public static final int GL_HARDLIGHT = 0x929B;
public static final int GL_SOFTLIGHT = 0x929C;
public static final int GL_DIFFERENCE = 0x929E;
public static final int GL_EXCLUSION = 0x92A0;
public static final int GL_HSL_HUE = 0x92AD;
public static final int GL_HSL_SATURATION = 0x92AE;
public static final int GL_HSL_COLOR = 0x92AF;
public static final int GL_HSL_LUMINOSITY = 0x92B0;
public static final int GL_PRIMITIVE_BOUNDING_BOX = 0x92BE;
public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD;
public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE;
public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF;
public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3;
public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4;
public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5;
public static final int GL_DEBUG_OUTPUT = 0x92E0;
public static final int GL_IS_PER_PATCH = 0x92E7;
public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER = 0x9307;
public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x9308;
public static final int GL_REFERENCED_BY_GEOMETRY_SHADER = 0x9309;
public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS = 0x9312;
public static final int GL_MAX_FRAMEBUFFER_LAYERS = 0x9317;
public static final int GL_MULTISAMPLE_LINE_WIDTH_RANGE = 0x9381;
public static final int GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY = 0x9382;
public static final int GL_COMPRESSED_RGBA_ASTC_4x4 = 0x93B0;
public static final int GL_COMPRESSED_RGBA_ASTC_5x4 = 0x93B1;
public static final int GL_COMPRESSED_RGBA_ASTC_5x5 = 0x93B2;
public static final int GL_COMPRESSED_RGBA_ASTC_6x5 = 0x93B3;
public static final int GL_COMPRESSED_RGBA_ASTC_6x6 = 0x93B4;
public static final int GL_COMPRESSED_RGBA_ASTC_8x5 = 0x93B5;
public static final int GL_COMPRESSED_RGBA_ASTC_8x6 = 0x93B6;
public static final int GL_COMPRESSED_RGBA_ASTC_8x8 = 0x93B7;
public static final int GL_COMPRESSED_RGBA_ASTC_10x5 = 0x93B8;
public static final int GL_COMPRESSED_RGBA_ASTC_10x6 = 0x93B9;
public static final int GL_COMPRESSED_RGBA_ASTC_10x8 = 0x93BA;
public static final int GL_COMPRESSED_RGBA_ASTC_10x10 = 0x93BB;
public static final int GL_COMPRESSED_RGBA_ASTC_12x10 = 0x93BC;
public static final int GL_COMPRESSED_RGBA_ASTC_12x12 = 0x93BD;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 = 0x93D0;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 = 0x93D1;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 = 0x93D2;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 = 0x93D3;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 = 0x93D4;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 = 0x93D5;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 = 0x93D6;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 = 0x93D7;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 = 0x93D8;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 = 0x93D9;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 = 0x93DA;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 = 0x93DB;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 = 0x93DC;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 = 0x93DD;
// C function void glBlendBarrier ( void )
void glBlendBarrier ();
// C function void glCopyImageSubData ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ,
// GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight,
// GLsizei srcDepth )
void glCopyImageSubData (int srcName, int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, int dstName, int dstTarget,
int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth);
// C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids,
// GLboolean enabled )
// void glDebugMessageControl(
// int source,
// int type,
// int severity,
// int count,
// int[] ids,
// int offset,
// boolean enabled
// );
// C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids,
// GLboolean enabled )
void glDebugMessageControl (int source, int type, int severity,
// int count,
java.nio.IntBuffer ids, boolean enabled);
// C function void glDebugMessageInsert ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar
// *buf )
void glDebugMessageInsert (int source, int type, int id, int severity,
// int length
String buf);
// C function void glDebugMessageCallback ( GLDEBUGPROC callback, const void *userParam )
public interface DebugProc {
void onMessage (int source, int type, int id, int severity, String message);
}
void glDebugMessageCallback (DebugProc callback);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// int glGetDebugMessageLog(
// int count,
// int bufSize,
// int[] sources,
// int sourcesOffset,
// int[] types,
// int typesOffset,
// int[] ids,
// int idsOffset,
// int[] severities,
// int severitiesOffset,
// int[] lengths,
// int lengthsOffset,
// byte[] messageLog,
// int messageLogOffset);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
int glGetDebugMessageLog (int count, java.nio.IntBuffer sources, java.nio.IntBuffer types, java.nio.IntBuffer ids,
java.nio.IntBuffer severities, java.nio.IntBuffer lengths, java.nio.ByteBuffer messageLog);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// String[] glGetDebugMessageLog(
// int count,
// int[] sources,
// int sourcesOffset,
// int[] types,
// int typesOffset,
// int[] ids,
// int idsOffset,
// int[] severities,
// int severitiesOffset);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// String[] glGetDebugMessageLog(
// int count,
// java.nio.IntBuffer sources,
// java.nio.IntBuffer types,
// java.nio.IntBuffer ids,
// java.nio.IntBuffer severities);
// C function void glPushDebugGroup ( GLenum source, GLuint id, GLsizei length, const GLchar *message )
void glPushDebugGroup (int source, int id,
// int length,
String message);
// C function void glPopDebugGroup ( void )
void glPopDebugGroup ();
// C function void glObjectLabel ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label )
void glObjectLabel (int identifier, int name,
// int length,
String label);
// C function void glGetObjectLabel ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label )
String glGetObjectLabel (int identifier, int name);
// C function void glObjectPtrLabel ( const void *ptr, GLsizei length, const GLchar *label )
// void glObjectPtrLabel (long ptr, String label);
// C function void glGetObjectPtrLabel ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label )
// String glGetObjectPtrLabel (long ptr);
// C function void glGetPointerv ( GLenum pname, void **params )
long glGetPointerv (int pname);
// C function void glEnablei ( GLenum target, GLuint index )
void glEnablei (int target, int index);
// C function void glDisablei ( GLenum target, GLuint index )
void glDisablei (int target, int index);
// C function void glBlendEquationi ( GLuint buf, GLenum mode )
void glBlendEquationi (int buf, int mode);
// C function void glBlendEquationSeparatei ( GLuint buf, GLenum modeRGB, GLenum modeAlpha )
void glBlendEquationSeparatei (int buf, int modeRGB, int modeAlpha);
// C function void glBlendFunci ( GLuint buf, GLenum src, GLenum dst )
void glBlendFunci (int buf, int src, int dst);
// C function void glBlendFuncSeparatei ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
void glBlendFuncSeparatei (int buf, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
// C function void glColorMaski ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a )
void glColorMaski (int index, boolean r, boolean g, boolean b, boolean a);
// C function GLboolean glIsEnabledi ( GLenum target, GLuint index )
boolean glIsEnabledi (int target, int index);
// C function void glDrawElementsBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex )
void glDrawElementsBaseVertex (int mode, int count, int type, java.nio.Buffer indices, int basevertex);
// C function void glDrawRangeElementsBaseVertex ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const
// void *indices, GLint basevertex )
void glDrawRangeElementsBaseVertex (int mode, int start, int end, int count, int type, java.nio.Buffer indices,
int basevertex);
// C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei
// instanceCount, GLint basevertex )
void glDrawElementsInstancedBaseVertex (int mode, int count, int type, java.nio.Buffer indices, int instanceCount,
int basevertex);
// C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei
// instanceCount, GLint basevertex )
void glDrawElementsInstancedBaseVertex (int mode, int count, int type, int indicesOffset, int instanceCount, int basevertex);
// C function void glFramebufferTexture ( GLenum target, GLenum attachment, GLuint texture, GLint level )
void glFramebufferTexture (int target, int attachment, int texture, int level);
// C function void glPrimitiveBoundingBox ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY,
// GLfloat maxZ, GLfloat maxW )
// void glPrimitiveBoundingBox(
// float minX,
// float minY,
// float minZ,
// float minW,
// float maxX,
// float maxY,
// float maxZ,
// float maxW
// );
// C function GLenum glGetGraphicsResetStatus ( void )
int glGetGraphicsResetStatus ();
// C function void glReadnPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei
// bufSize, void *data )
void glReadnPixels (int x, int y, int width, int height, int format, int type, int bufSize, java.nio.Buffer data);
// C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
// void glGetnUniformfv(
// int program,
// int location,
// int bufSize,
// float[] params,
// int offset
// );
// C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
void glGetnUniformfv (int program, int location,
// int bufSize,
java.nio.FloatBuffer params);
// C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
// void glGetnUniformiv(
// int program,
// int location,
// int bufSize,
// int[] params,
// int offset
// );
// C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
void glGetnUniformiv (int program, int location,
// int bufSize,
java.nio.IntBuffer params);
// C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
// void glGetnUniformuiv(
// int program,
// int location,
// int bufSize,
// int[] params,
// int offset
// );
// C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
void glGetnUniformuiv (int program, int location,
// int bufSize,
java.nio.IntBuffer params);
// C function void glMinSampleShading ( GLfloat value )
void glMinSampleShading (float value);
// C function void glPatchParameteri ( GLenum pname, GLint value )
void glPatchParameteri (int pname, int value);
// C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
// void glTexParameterIiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
void glTexParameterIiv (int target, int pname, java.nio.IntBuffer params);
// C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
// void glTexParameterIuiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
void glTexParameterIuiv (int target, int pname, java.nio.IntBuffer params);
// C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
// void glGetTexParameterIiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
void glGetTexParameterIiv (int target, int pname, java.nio.IntBuffer params);
// C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
// void glGetTexParameterIuiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
void glGetTexParameterIuiv (int target, int pname, java.nio.IntBuffer params);
// C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
// void glSamplerParameterIiv(
// int sampler,
// int pname,
// int[] param,
// int offset
// );
// C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
void glSamplerParameterIiv (int sampler, int pname, java.nio.IntBuffer param);
// C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
// void glSamplerParameterIuiv(
// int sampler,
// int pname,
// int[] param,
// int offset
// );
// C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
void glSamplerParameterIuiv (int sampler, int pname, java.nio.IntBuffer param);
// C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
// void glGetSamplerParameterIiv(
// int sampler,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
void glGetSamplerParameterIiv (int sampler, int pname, java.nio.IntBuffer params);
// C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
// void glGetSamplerParameterIuiv(
// int sampler,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
void glGetSamplerParameterIuiv (int sampler, int pname, java.nio.IntBuffer params);
// C function void glTexBuffer ( GLenum target, GLenum internalformat, GLuint buffer )
void glTexBuffer (int target, int internalformat, int buffer);
// C function void glTexBufferRange ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size )
void glTexBufferRange (int target, int internalformat, int buffer, int offset, int size);
// C function void glTexStorage3DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei
// height, GLsizei depth, GLboolean fixedsamplelocations )
void glTexStorage3DMultisample (int target, int samples, int internalformat, int width, int height, int depth,
boolean fixedsamplelocations);
}
| /*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// copied from https://cs.android.com/android/platform/superproject/+/master:frameworks/base/opengl/java/android/opengl/GLES32.java
package com.badlogic.gdx.graphics;
public interface GL32 extends GL31 {
public static final int GL_CONTEXT_FLAG_DEBUG_BIT = 0x00000002;
public static final int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT = 0x00000004;
public static final int GL_GEOMETRY_SHADER_BIT = 0x00000004;
public static final int GL_TESS_CONTROL_SHADER_BIT = 0x00000008;
public static final int GL_TESS_EVALUATION_SHADER_BIT = 0x00000010;
public static final int GL_QUADS = 0x0007;
public static final int GL_LINES_ADJACENCY = 0x000A;
public static final int GL_LINE_STRIP_ADJACENCY = 0x000B;
public static final int GL_TRIANGLES_ADJACENCY = 0x000C;
public static final int GL_TRIANGLE_STRIP_ADJACENCY = 0x000D;
public static final int GL_PATCHES = 0x000E;
public static final int GL_STACK_OVERFLOW = 0x0503;
public static final int GL_STACK_UNDERFLOW = 0x0504;
public static final int GL_CONTEXT_LOST = 0x0507;
public static final int GL_TEXTURE_BORDER_COLOR = 0x1004;
public static final int GL_VERTEX_ARRAY = 0x8074;
public static final int GL_CLAMP_TO_BORDER = 0x812D;
public static final int GL_CONTEXT_FLAGS = 0x821E;
public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 0x8221;
public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS = 0x8242;
public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243;
public static final int GL_DEBUG_CALLBACK_FUNCTION = 0x8244;
public static final int GL_DEBUG_CALLBACK_USER_PARAM = 0x8245;
public static final int GL_DEBUG_SOURCE_API = 0x8246;
public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247;
public static final int GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248;
public static final int GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249;
public static final int GL_DEBUG_SOURCE_APPLICATION = 0x824A;
public static final int GL_DEBUG_SOURCE_OTHER = 0x824B;
public static final int GL_DEBUG_TYPE_ERROR = 0x824C;
public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D;
public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E;
public static final int GL_DEBUG_TYPE_PORTABILITY = 0x824F;
public static final int GL_DEBUG_TYPE_PERFORMANCE = 0x8250;
public static final int GL_DEBUG_TYPE_OTHER = 0x8251;
public static final int GL_LOSE_CONTEXT_ON_RESET = 0x8252;
public static final int GL_GUILTY_CONTEXT_RESET = 0x8253;
public static final int GL_INNOCENT_CONTEXT_RESET = 0x8254;
public static final int GL_UNKNOWN_CONTEXT_RESET = 0x8255;
public static final int GL_RESET_NOTIFICATION_STRATEGY = 0x8256;
public static final int GL_LAYER_PROVOKING_VERTEX = 0x825E;
public static final int GL_UNDEFINED_VERTEX = 0x8260;
public static final int GL_NO_RESET_NOTIFICATION = 0x8261;
public static final int GL_DEBUG_TYPE_MARKER = 0x8268;
public static final int GL_DEBUG_TYPE_PUSH_GROUP = 0x8269;
public static final int GL_DEBUG_TYPE_POP_GROUP = 0x826A;
public static final int GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B;
public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C;
public static final int GL_DEBUG_GROUP_STACK_DEPTH = 0x826D;
public static final int GL_BUFFER = 0x82E0;
public static final int GL_SHADER = 0x82E1;
public static final int GL_PROGRAM = 0x82E2;
public static final int GL_QUERY = 0x82E3;
public static final int GL_PROGRAM_PIPELINE = 0x82E4;
public static final int GL_SAMPLER = 0x82E6;
public static final int GL_MAX_LABEL_LENGTH = 0x82E8;
public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C;
public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D;
public static final int GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F;
public static final int GL_GEOMETRY_VERTICES_OUT = 0x8916;
public static final int GL_GEOMETRY_INPUT_TYPE = 0x8917;
public static final int GL_GEOMETRY_OUTPUT_TYPE = 0x8918;
public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C;
public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32;
public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29;
public static final int GL_TEXTURE_BUFFER = 0x8C2A;
public static final int GL_TEXTURE_BUFFER_BINDING = 0x8C2A;
public static final int GL_MAX_TEXTURE_BUFFER_SIZE = 0x8C2B;
public static final int GL_TEXTURE_BINDING_BUFFER = 0x8C2C;
public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D;
public static final int GL_SAMPLE_SHADING = 0x8C36;
public static final int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37;
public static final int GL_PRIMITIVES_GENERATED = 0x8C87;
public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7;
public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8;
public static final int GL_SAMPLER_BUFFER = 0x8DC2;
public static final int GL_INT_SAMPLER_BUFFER = 0x8DD0;
public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8;
public static final int GL_GEOMETRY_SHADER = 0x8DD9;
public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF;
public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0;
public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1;
public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E;
public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F;
public static final int GL_FIRST_VERTEX_CONVENTION = 0x8E4D;
public static final int GL_LAST_VERTEX_CONVENTION = 0x8E4E;
public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A;
public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B;
public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C;
public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D;
public static final int GL_PATCH_VERTICES = 0x8E72;
public static final int GL_TESS_CONTROL_OUTPUT_VERTICES = 0x8E75;
public static final int GL_TESS_GEN_MODE = 0x8E76;
public static final int GL_TESS_GEN_SPACING = 0x8E77;
public static final int GL_TESS_GEN_VERTEX_ORDER = 0x8E78;
public static final int GL_TESS_GEN_POINT_MODE = 0x8E79;
public static final int GL_ISOLINES = 0x8E7A;
public static final int GL_FRACTIONAL_ODD = 0x8E7B;
public static final int GL_FRACTIONAL_EVEN = 0x8E7C;
public static final int GL_MAX_PATCH_VERTICES = 0x8E7D;
public static final int GL_MAX_TESS_GEN_LEVEL = 0x8E7E;
public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F;
public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80;
public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81;
public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82;
public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83;
public static final int GL_MAX_TESS_PATCH_COMPONENTS = 0x8E84;
public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85;
public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86;
public static final int GL_TESS_EVALUATION_SHADER = 0x8E87;
public static final int GL_TESS_CONTROL_SHADER = 0x8E88;
public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89;
public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A;
public static final int GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009;
public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A;
public static final int GL_SAMPLER_CUBE_MAP_ARRAY = 0x900C;
public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D;
public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E;
public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F;
public static final int GL_IMAGE_BUFFER = 0x9051;
public static final int GL_IMAGE_CUBE_MAP_ARRAY = 0x9054;
public static final int GL_INT_IMAGE_BUFFER = 0x905C;
public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY = 0x905F;
public static final int GL_UNSIGNED_INT_IMAGE_BUFFER = 0x9067;
public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A;
public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB;
public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC;
public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD;
public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 0x90D7;
public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 0x90D8;
public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 0x90D9;
public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102;
public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105;
public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B;
public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C;
public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D;
public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123;
public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124;
public static final int GL_MAX_DEBUG_MESSAGE_LENGTH = 0x9143;
public static final int GL_MAX_DEBUG_LOGGED_MESSAGES = 0x9144;
public static final int GL_DEBUG_LOGGED_MESSAGES = 0x9145;
public static final int GL_DEBUG_SEVERITY_HIGH = 0x9146;
public static final int GL_DEBUG_SEVERITY_MEDIUM = 0x9147;
public static final int GL_DEBUG_SEVERITY_LOW = 0x9148;
public static final int GL_TEXTURE_BUFFER_OFFSET = 0x919D;
public static final int GL_TEXTURE_BUFFER_SIZE = 0x919E;
public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 0x919F;
public static final int GL_MULTIPLY = 0x9294;
public static final int GL_SCREEN = 0x9295;
public static final int GL_OVERLAY = 0x9296;
public static final int GL_DARKEN = 0x9297;
public static final int GL_LIGHTEN = 0x9298;
public static final int GL_COLORDODGE = 0x9299;
public static final int GL_COLORBURN = 0x929A;
public static final int GL_HARDLIGHT = 0x929B;
public static final int GL_SOFTLIGHT = 0x929C;
public static final int GL_DIFFERENCE = 0x929E;
public static final int GL_EXCLUSION = 0x92A0;
public static final int GL_HSL_HUE = 0x92AD;
public static final int GL_HSL_SATURATION = 0x92AE;
public static final int GL_HSL_COLOR = 0x92AF;
public static final int GL_HSL_LUMINOSITY = 0x92B0;
public static final int GL_PRIMITIVE_BOUNDING_BOX = 0x92BE;
public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD;
public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE;
public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF;
public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3;
public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4;
public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5;
public static final int GL_DEBUG_OUTPUT = 0x92E0;
public static final int GL_IS_PER_PATCH = 0x92E7;
public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER = 0x9307;
public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x9308;
public static final int GL_REFERENCED_BY_GEOMETRY_SHADER = 0x9309;
public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS = 0x9312;
public static final int GL_MAX_FRAMEBUFFER_LAYERS = 0x9317;
public static final int GL_MULTISAMPLE_LINE_WIDTH_RANGE = 0x9381;
public static final int GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY = 0x9382;
public static final int GL_COMPRESSED_RGBA_ASTC_4x4 = 0x93B0;
public static final int GL_COMPRESSED_RGBA_ASTC_5x4 = 0x93B1;
public static final int GL_COMPRESSED_RGBA_ASTC_5x5 = 0x93B2;
public static final int GL_COMPRESSED_RGBA_ASTC_6x5 = 0x93B3;
public static final int GL_COMPRESSED_RGBA_ASTC_6x6 = 0x93B4;
public static final int GL_COMPRESSED_RGBA_ASTC_8x5 = 0x93B5;
public static final int GL_COMPRESSED_RGBA_ASTC_8x6 = 0x93B6;
public static final int GL_COMPRESSED_RGBA_ASTC_8x8 = 0x93B7;
public static final int GL_COMPRESSED_RGBA_ASTC_10x5 = 0x93B8;
public static final int GL_COMPRESSED_RGBA_ASTC_10x6 = 0x93B9;
public static final int GL_COMPRESSED_RGBA_ASTC_10x8 = 0x93BA;
public static final int GL_COMPRESSED_RGBA_ASTC_10x10 = 0x93BB;
public static final int GL_COMPRESSED_RGBA_ASTC_12x10 = 0x93BC;
public static final int GL_COMPRESSED_RGBA_ASTC_12x12 = 0x93BD;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 = 0x93D0;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 = 0x93D1;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 = 0x93D2;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 = 0x93D3;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 = 0x93D4;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 = 0x93D5;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 = 0x93D6;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 = 0x93D7;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 = 0x93D8;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 = 0x93D9;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 = 0x93DA;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 = 0x93DB;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 = 0x93DC;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 = 0x93DD;
// C function void glBlendBarrier ( void )
void glBlendBarrier ();
// C function void glCopyImageSubData ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ,
// GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight,
// GLsizei srcDepth )
void glCopyImageSubData (int srcName, int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, int dstName, int dstTarget,
int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth);
// C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids,
// GLboolean enabled )
// void glDebugMessageControl(
// int source,
// int type,
// int severity,
// int count,
// int[] ids,
// int offset,
// boolean enabled
// );
// C function void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids,
// GLboolean enabled )
void glDebugMessageControl (int source, int type, int severity,
// int count,
java.nio.IntBuffer ids, boolean enabled);
// C function void glDebugMessageInsert ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar
// *buf )
void glDebugMessageInsert (int source, int type, int id, int severity,
// int length
String buf);
// C function void glDebugMessageCallback ( GLDEBUGPROC callback, const void *userParam )
public interface DebugProc {
void onMessage (int source, int type, int id, int severity, String message);
}
void glDebugMessageCallback (DebugProc callback);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// int glGetDebugMessageLog(
// int count,
// int bufSize,
// int[] sources,
// int sourcesOffset,
// int[] types,
// int typesOffset,
// int[] ids,
// int idsOffset,
// int[] severities,
// int severitiesOffset,
// int[] lengths,
// int lengthsOffset,
// byte[] messageLog,
// int messageLogOffset);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
int glGetDebugMessageLog (int count, java.nio.IntBuffer sources, java.nio.IntBuffer types, java.nio.IntBuffer ids,
java.nio.IntBuffer severities, java.nio.IntBuffer lengths, java.nio.ByteBuffer messageLog);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// String[] glGetDebugMessageLog(
// int count,
// int[] sources,
// int sourcesOffset,
// int[] types,
// int typesOffset,
// int[] ids,
// int idsOffset,
// int[] severities,
// int severitiesOffset);
// C function GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum
// *severities, GLsizei *lengths, GLchar *messageLog )
// String[] glGetDebugMessageLog(
// int count,
// java.nio.IntBuffer sources,
// java.nio.IntBuffer types,
// java.nio.IntBuffer ids,
// java.nio.IntBuffer severities);
// C function void glPushDebugGroup ( GLenum source, GLuint id, GLsizei length, const GLchar *message )
void glPushDebugGroup (int source, int id,
// int length,
String message);
// C function void glPopDebugGroup ( void )
void glPopDebugGroup ();
// C function void glObjectLabel ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label )
void glObjectLabel (int identifier, int name,
// int length,
String label);
// C function void glGetObjectLabel ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label )
String glGetObjectLabel (int identifier, int name);
// C function void glObjectPtrLabel ( const void *ptr, GLsizei length, const GLchar *label )
// void glObjectPtrLabel (long ptr, String label);
// C function void glGetObjectPtrLabel ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label )
// String glGetObjectPtrLabel (long ptr);
// C function void glGetPointerv ( GLenum pname, void **params )
long glGetPointerv (int pname);
// C function void glEnablei ( GLenum target, GLuint index )
void glEnablei (int target, int index);
// C function void glDisablei ( GLenum target, GLuint index )
void glDisablei (int target, int index);
// C function void glBlendEquationi ( GLuint buf, GLenum mode )
void glBlendEquationi (int buf, int mode);
// C function void glBlendEquationSeparatei ( GLuint buf, GLenum modeRGB, GLenum modeAlpha )
void glBlendEquationSeparatei (int buf, int modeRGB, int modeAlpha);
// C function void glBlendFunci ( GLuint buf, GLenum src, GLenum dst )
void glBlendFunci (int buf, int src, int dst);
// C function void glBlendFuncSeparatei ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
void glBlendFuncSeparatei (int buf, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
// C function void glColorMaski ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a )
void glColorMaski (int index, boolean r, boolean g, boolean b, boolean a);
// C function GLboolean glIsEnabledi ( GLenum target, GLuint index )
boolean glIsEnabledi (int target, int index);
// C function void glDrawElementsBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex )
void glDrawElementsBaseVertex (int mode, int count, int type, java.nio.Buffer indices, int basevertex);
// C function void glDrawRangeElementsBaseVertex ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const
// void *indices, GLint basevertex )
void glDrawRangeElementsBaseVertex (int mode, int start, int end, int count, int type, java.nio.Buffer indices,
int basevertex);
// C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei
// instanceCount, GLint basevertex )
void glDrawElementsInstancedBaseVertex (int mode, int count, int type, java.nio.Buffer indices, int instanceCount,
int basevertex);
// C function void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei
// instanceCount, GLint basevertex )
void glDrawElementsInstancedBaseVertex (int mode, int count, int type, int indicesOffset, int instanceCount, int basevertex);
// C function void glFramebufferTexture ( GLenum target, GLenum attachment, GLuint texture, GLint level )
void glFramebufferTexture (int target, int attachment, int texture, int level);
// C function void glPrimitiveBoundingBox ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY,
// GLfloat maxZ, GLfloat maxW )
// void glPrimitiveBoundingBox(
// float minX,
// float minY,
// float minZ,
// float minW,
// float maxX,
// float maxY,
// float maxZ,
// float maxW
// );
// C function GLenum glGetGraphicsResetStatus ( void )
int glGetGraphicsResetStatus ();
// C function void glReadnPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei
// bufSize, void *data )
void glReadnPixels (int x, int y, int width, int height, int format, int type, int bufSize, java.nio.Buffer data);
// C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
// void glGetnUniformfv(
// int program,
// int location,
// int bufSize,
// float[] params,
// int offset
// );
// C function void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params )
void glGetnUniformfv (int program, int location,
// int bufSize,
java.nio.FloatBuffer params);
// C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
// void glGetnUniformiv(
// int program,
// int location,
// int bufSize,
// int[] params,
// int offset
// );
// C function void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params )
void glGetnUniformiv (int program, int location,
// int bufSize,
java.nio.IntBuffer params);
// C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
// void glGetnUniformuiv(
// int program,
// int location,
// int bufSize,
// int[] params,
// int offset
// );
// C function void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params )
void glGetnUniformuiv (int program, int location,
// int bufSize,
java.nio.IntBuffer params);
// C function void glMinSampleShading ( GLfloat value )
void glMinSampleShading (float value);
// C function void glPatchParameteri ( GLenum pname, GLint value )
void glPatchParameteri (int pname, int value);
// C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
// void glTexParameterIiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params )
void glTexParameterIiv (int target, int pname, java.nio.IntBuffer params);
// C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
// void glTexParameterIuiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params )
void glTexParameterIuiv (int target, int pname, java.nio.IntBuffer params);
// C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
// void glGetTexParameterIiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params )
void glGetTexParameterIiv (int target, int pname, java.nio.IntBuffer params);
// C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
// void glGetTexParameterIuiv(
// int target,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params )
void glGetTexParameterIuiv (int target, int pname, java.nio.IntBuffer params);
// C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
// void glSamplerParameterIiv(
// int sampler,
// int pname,
// int[] param,
// int offset
// );
// C function void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param )
void glSamplerParameterIiv (int sampler, int pname, java.nio.IntBuffer param);
// C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
// void glSamplerParameterIuiv(
// int sampler,
// int pname,
// int[] param,
// int offset
// );
// C function void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param )
void glSamplerParameterIuiv (int sampler, int pname, java.nio.IntBuffer param);
// C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
// void glGetSamplerParameterIiv(
// int sampler,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params )
void glGetSamplerParameterIiv (int sampler, int pname, java.nio.IntBuffer params);
// C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
// void glGetSamplerParameterIuiv(
// int sampler,
// int pname,
// int[] params,
// int offset
// );
// C function void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params )
void glGetSamplerParameterIuiv (int sampler, int pname, java.nio.IntBuffer params);
// C function void glTexBuffer ( GLenum target, GLenum internalformat, GLuint buffer )
void glTexBuffer (int target, int internalformat, int buffer);
// C function void glTexBufferRange ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size )
void glTexBufferRange (int target, int internalformat, int buffer, int offset, int size);
// C function void glTexStorage3DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei
// height, GLsizei depth, GLboolean fixedsamplelocations )
void glTexStorage3DMultisample (int target, int samples, int internalformat, int width, int height, int depth,
boolean fixedsamplelocations);
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-setup/src/com/badlogic/gdx/setup/SettingsDialog.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.setup;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.CENTER;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.NORTH;
import static java.awt.GridBagConstraints.SOUTH;
import static java.awt.GridBagConstraints.SOUTHEAST;
import static java.awt.GridBagConstraints.WEST;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import com.badlogic.gdx.setup.GdxSetupUI.SetupButton;
import com.badlogic.gdx.setup.GdxSetupUI.SetupCheckBox;
public class SettingsDialog extends JDialog {
private JPanel contentPane;
private SetupButton buttonOK;
private SetupButton buttonCancel;
private JLabel linkText;
private JPanel content;
private JPanel bottomPanel;
private JPanel buttonPanel;
private JTextField mavenTextField;
SetupCheckBox offlineBox;
SetupCheckBox kotlinBox;
SetupCheckBox oldAssetsBox;
private String mavenSnapshot;
private boolean offlineSnapshot;
private boolean kotlinSnapshot;
private boolean oldAssetsSnapshot;
public SettingsDialog (final SetupCheckBox gwtCheckBox) {
contentPane = new JPanel(new GridBagLayout());
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
uiLayout(gwtCheckBox);
uiStyle();
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e) {
if (offlineBox.isSelected()) {
int value = JOptionPane.showConfirmDialog(null,
"You have selected offline mode. This requires you to have your dependencies already in your maven/gradle cache.\n\nThe setup will fail if you do not have the correct dependencies already.\n\nDo you want to continue?",
"Warning!", JOptionPane.YES_NO_OPTION);
if (value == 0) {
onOK();
}
} else {
onOK();
}
}
});
buttonCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
onCancel();
}
});
linkText.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
linkText.addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent e) {
if (e.getClickCount() > 0) {
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
try {
URI uri = new URI(
"https://libgdx.com/wiki/articles/improving-workflow-with-gradle#how-to-remove-gradle-ide-integration-from-your-project");
desktop.browse(uri);
} catch (IOException ex) {
ex.printStackTrace();
} catch (URISyntaxException ex) {
ex.printStackTrace();
}
}
}
}
});
setTitle("Advanced Settings");
setSize(600, 300);
setLocationRelativeTo(null);
}
private void uiLayout (final SetupCheckBox gwtCheckBox) {
content = new JPanel(new GridBagLayout());
content.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
bottomPanel = new JPanel(new GridBagLayout());
buttonPanel = new JPanel(new GridBagLayout());
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
buttonOK = new SetupButton("Save");
buttonCancel = new SetupButton("Cancel");
buttonPanel.add(buttonOK, new GridBagConstraints(0, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
buttonPanel.add(buttonCancel, new GridBagConstraints(1, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(content, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
JLabel settings = new JLabel("Settings");
JLabel description = new JLabel("Description");
settings.setForeground(new Color(255, 255, 255));
description.setForeground(new Color(255, 255, 255));
settings.setHorizontalAlignment(JLabel.CENTER);
description.setHorizontalAlignment(JLabel.CENTER);
content.add(settings, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(description, new GridBagConstraints(3, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
JLabel mavenLabel = new JLabel("Maven Mirror URL");
JLabel mavenDesc = new JLabel("Replaces Maven Central with this repository");
mavenTextField = new JTextField(15);
mavenTextField.setMinimumSize(mavenTextField.getPreferredSize());
mavenLabel.setForeground(new Color(170, 170, 170));
mavenDesc.setForeground(new Color(170, 170, 170));
JLabel offlineLabel = new JLabel("Offline Mode");
JLabel offlineDesc = new JLabel("Don't force download dependencies");
offlineBox = new SetupCheckBox();
offlineLabel.setForeground(new Color(170, 170, 170));
offlineDesc.setForeground(new Color(170, 170, 170));
offlineBox.setBackground(new Color(36, 36, 36));
JLabel kotlinLabel = new JLabel("Use Kotlin");
JLabel kotlinDesc = new JLabel("Use Kotlin as the main language");
kotlinBox = new SetupCheckBox();
kotlinBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
final String message = "Using Kotlin with the HTML backend is not supported. Do you want to disable the HTML backend?";
if (kotlinBox.isSelected() && gwtCheckBox.isSelected()
&& JOptionPane.showConfirmDialog(kotlinBox, message, "Warning!", JOptionPane.YES_NO_OPTION) == 0) {
gwtCheckBox.setSelected(false);
} else if (gwtCheckBox.isSelected()) {
kotlinBox.setSelected(false);
}
}
});
kotlinLabel.setForeground(new Color(170, 170, 170));
kotlinDesc.setForeground(new Color(170, 170, 170));
JLabel oldAssetsLabel = new JLabel("Legacy Assets Dir");
JLabel oldAssetsDesc = new JLabel("Store assets in the pre-1.11.0 location");
oldAssetsDesc.setToolTipText("(in android or core folder instead of project root)");
oldAssetsBox = new SetupCheckBox();
oldAssetsLabel.setForeground(new Color(170, 170, 170));
oldAssetsDesc.setForeground(new Color(170, 170, 170));
oldAssetsBox.setBackground(new Color(36, 36, 36));
JSeparator separator = new JSeparator();
separator.setForeground(new Color(85, 85, 85));
separator.setBackground(new Color(85, 85, 85));
content.add(separator, new GridBagConstraints(0, 1, 4, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(mavenLabel, new GridBagConstraints(0, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(mavenTextField, new GridBagConstraints(1, 2, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(mavenDesc, new GridBagConstraints(3, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(offlineLabel, new GridBagConstraints(0, 3, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(offlineBox, new GridBagConstraints(1, 3, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(offlineDesc, new GridBagConstraints(3, 3, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(kotlinLabel, new GridBagConstraints(0, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(kotlinBox, new GridBagConstraints(1, 4, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(kotlinDesc, new GridBagConstraints(3, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(oldAssetsLabel, new GridBagConstraints(0, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(oldAssetsBox, new GridBagConstraints(1, 5, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(oldAssetsDesc, new GridBagConstraints(3, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
String text = "<p style=\"font-size:10\">Click for more info on using Gradle without IDE integration</p>";
linkText = new JLabel("<html>" + text + "</html>");
bottomPanel.add(linkText, new GridBagConstraints(0, 0, 1, 1, 1, 1, WEST, NONE, new Insets(0, 10, 0, 0), 0, 0));
bottomPanel.add(buttonPanel, new GridBagConstraints(3, 0, 1, 1, 1, 1, SOUTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(bottomPanel, new GridBagConstraints(0, 1, 4, 1, 1, 1, SOUTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
}
private void uiStyle () {
content.setBackground(new Color(36, 36, 36));
content.setForeground(new Color(255, 255, 255));
bottomPanel.setBackground(new Color(36, 36, 36));
bottomPanel.setForeground(new Color(255, 255, 255));
buttonPanel.setBackground(new Color(36, 36, 36));
buttonPanel.setForeground(new Color(255, 255, 255));
linkText.setForeground(new Color(20, 150, 20));
contentPane.setBackground(new Color(36, 36, 36));
Border line = BorderFactory.createLineBorder(new Color(80, 80, 80));
Border empty = new EmptyBorder(4, 4, 4, 4);
CompoundBorder border = new CompoundBorder(line, empty);
mavenTextField.setBorder(border);
mavenTextField.setCaretColor(new Color(255, 255, 255));
mavenTextField.setBackground(new Color(46, 46, 46));
mavenTextField.setForeground(new Color(255, 255, 255));
}
public void showDialog (Component parent, SetupCheckBox gwtCheckBox) {
takeSnapshot();
setLocationRelativeTo(parent);
setAlwaysOnTop(true);
setVisible(true);
if (gwtCheckBox.isSelected()) {
kotlinBox.setSelected(false);
kotlinSnapshot = false;
}
}
public List<String> getGradleArgs () {
List<String> list = new ArrayList<String>();
list.add("--no-daemon");
if (offlineBox.isSelected()) {
list.add("--offline");
}
return list;
}
void onOK () {
if (mavenTextField.getText().isEmpty()) {
DependencyBank.mavenCentral = "mavenCentral()";
} else {
DependencyBank.mavenCentral = "maven { url \"" + mavenTextField.getText() + "\" }";
}
setVisible(false);
}
void onCancel () {
setVisible(false);
restore();
}
private void takeSnapshot () {
mavenSnapshot = mavenTextField.getText();
offlineSnapshot = offlineBox.isSelected();
kotlinSnapshot = kotlinBox.isSelected();
oldAssetsSnapshot = oldAssetsBox.isSelected();
}
private void restore () {
mavenTextField.setText(mavenSnapshot);
offlineBox.setSelected(offlineSnapshot);
kotlinBox.setSelected(kotlinSnapshot);
oldAssetsBox.setSelected(oldAssetsSnapshot);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.setup;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.CENTER;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.NORTH;
import static java.awt.GridBagConstraints.SOUTH;
import static java.awt.GridBagConstraints.SOUTHEAST;
import static java.awt.GridBagConstraints.WEST;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import com.badlogic.gdx.setup.GdxSetupUI.SetupButton;
import com.badlogic.gdx.setup.GdxSetupUI.SetupCheckBox;
public class SettingsDialog extends JDialog {
private JPanel contentPane;
private SetupButton buttonOK;
private SetupButton buttonCancel;
private JLabel linkText;
private JPanel content;
private JPanel bottomPanel;
private JPanel buttonPanel;
private JTextField mavenTextField;
SetupCheckBox offlineBox;
SetupCheckBox kotlinBox;
SetupCheckBox oldAssetsBox;
private String mavenSnapshot;
private boolean offlineSnapshot;
private boolean kotlinSnapshot;
private boolean oldAssetsSnapshot;
public SettingsDialog (final SetupCheckBox gwtCheckBox) {
contentPane = new JPanel(new GridBagLayout());
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
uiLayout(gwtCheckBox);
uiStyle();
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e) {
if (offlineBox.isSelected()) {
int value = JOptionPane.showConfirmDialog(null,
"You have selected offline mode. This requires you to have your dependencies already in your maven/gradle cache.\n\nThe setup will fail if you do not have the correct dependencies already.\n\nDo you want to continue?",
"Warning!", JOptionPane.YES_NO_OPTION);
if (value == 0) {
onOK();
}
} else {
onOK();
}
}
});
buttonCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
onCancel();
}
});
linkText.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
linkText.addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent e) {
if (e.getClickCount() > 0) {
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
try {
URI uri = new URI(
"https://libgdx.com/wiki/articles/improving-workflow-with-gradle#how-to-remove-gradle-ide-integration-from-your-project");
desktop.browse(uri);
} catch (IOException ex) {
ex.printStackTrace();
} catch (URISyntaxException ex) {
ex.printStackTrace();
}
}
}
}
});
setTitle("Advanced Settings");
setSize(600, 300);
setLocationRelativeTo(null);
}
private void uiLayout (final SetupCheckBox gwtCheckBox) {
content = new JPanel(new GridBagLayout());
content.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
bottomPanel = new JPanel(new GridBagLayout());
buttonPanel = new JPanel(new GridBagLayout());
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
buttonOK = new SetupButton("Save");
buttonCancel = new SetupButton("Cancel");
buttonPanel.add(buttonOK, new GridBagConstraints(0, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
buttonPanel.add(buttonCancel, new GridBagConstraints(1, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(content, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
JLabel settings = new JLabel("Settings");
JLabel description = new JLabel("Description");
settings.setForeground(new Color(255, 255, 255));
description.setForeground(new Color(255, 255, 255));
settings.setHorizontalAlignment(JLabel.CENTER);
description.setHorizontalAlignment(JLabel.CENTER);
content.add(settings, new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(description, new GridBagConstraints(3, 0, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
JLabel mavenLabel = new JLabel("Maven Mirror URL");
JLabel mavenDesc = new JLabel("Replaces Maven Central with this repository");
mavenTextField = new JTextField(15);
mavenTextField.setMinimumSize(mavenTextField.getPreferredSize());
mavenLabel.setForeground(new Color(170, 170, 170));
mavenDesc.setForeground(new Color(170, 170, 170));
JLabel offlineLabel = new JLabel("Offline Mode");
JLabel offlineDesc = new JLabel("Don't force download dependencies");
offlineBox = new SetupCheckBox();
offlineLabel.setForeground(new Color(170, 170, 170));
offlineDesc.setForeground(new Color(170, 170, 170));
offlineBox.setBackground(new Color(36, 36, 36));
JLabel kotlinLabel = new JLabel("Use Kotlin");
JLabel kotlinDesc = new JLabel("Use Kotlin as the main language");
kotlinBox = new SetupCheckBox();
kotlinBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
final String message = "Using Kotlin with the HTML backend is not supported. Do you want to disable the HTML backend?";
if (kotlinBox.isSelected() && gwtCheckBox.isSelected()
&& JOptionPane.showConfirmDialog(kotlinBox, message, "Warning!", JOptionPane.YES_NO_OPTION) == 0) {
gwtCheckBox.setSelected(false);
} else if (gwtCheckBox.isSelected()) {
kotlinBox.setSelected(false);
}
}
});
kotlinLabel.setForeground(new Color(170, 170, 170));
kotlinDesc.setForeground(new Color(170, 170, 170));
JLabel oldAssetsLabel = new JLabel("Legacy Assets Dir");
JLabel oldAssetsDesc = new JLabel("Store assets in the pre-1.11.0 location");
oldAssetsDesc.setToolTipText("(in android or core folder instead of project root)");
oldAssetsBox = new SetupCheckBox();
oldAssetsLabel.setForeground(new Color(170, 170, 170));
oldAssetsDesc.setForeground(new Color(170, 170, 170));
oldAssetsBox.setBackground(new Color(36, 36, 36));
JSeparator separator = new JSeparator();
separator.setForeground(new Color(85, 85, 85));
separator.setBackground(new Color(85, 85, 85));
content.add(separator, new GridBagConstraints(0, 1, 4, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(mavenLabel, new GridBagConstraints(0, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(mavenTextField, new GridBagConstraints(1, 2, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(mavenDesc, new GridBagConstraints(3, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(offlineLabel, new GridBagConstraints(0, 3, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(offlineBox, new GridBagConstraints(1, 3, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(offlineDesc, new GridBagConstraints(3, 3, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(kotlinLabel, new GridBagConstraints(0, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(kotlinBox, new GridBagConstraints(1, 4, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(kotlinDesc, new GridBagConstraints(3, 4, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(oldAssetsLabel, new GridBagConstraints(0, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
content.add(oldAssetsBox, new GridBagConstraints(1, 5, 2, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
content.add(oldAssetsDesc, new GridBagConstraints(3, 5, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
String text = "<p style=\"font-size:10\">Click for more info on using Gradle without IDE integration</p>";
linkText = new JLabel("<html>" + text + "</html>");
bottomPanel.add(linkText, new GridBagConstraints(0, 0, 1, 1, 1, 1, WEST, NONE, new Insets(0, 10, 0, 0), 0, 0));
bottomPanel.add(buttonPanel, new GridBagConstraints(3, 0, 1, 1, 1, 1, SOUTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(bottomPanel, new GridBagConstraints(0, 1, 4, 1, 1, 1, SOUTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
}
private void uiStyle () {
content.setBackground(new Color(36, 36, 36));
content.setForeground(new Color(255, 255, 255));
bottomPanel.setBackground(new Color(36, 36, 36));
bottomPanel.setForeground(new Color(255, 255, 255));
buttonPanel.setBackground(new Color(36, 36, 36));
buttonPanel.setForeground(new Color(255, 255, 255));
linkText.setForeground(new Color(20, 150, 20));
contentPane.setBackground(new Color(36, 36, 36));
Border line = BorderFactory.createLineBorder(new Color(80, 80, 80));
Border empty = new EmptyBorder(4, 4, 4, 4);
CompoundBorder border = new CompoundBorder(line, empty);
mavenTextField.setBorder(border);
mavenTextField.setCaretColor(new Color(255, 255, 255));
mavenTextField.setBackground(new Color(46, 46, 46));
mavenTextField.setForeground(new Color(255, 255, 255));
}
public void showDialog (Component parent, SetupCheckBox gwtCheckBox) {
takeSnapshot();
setLocationRelativeTo(parent);
setAlwaysOnTop(true);
setVisible(true);
if (gwtCheckBox.isSelected()) {
kotlinBox.setSelected(false);
kotlinSnapshot = false;
}
}
public List<String> getGradleArgs () {
List<String> list = new ArrayList<String>();
list.add("--no-daemon");
if (offlineBox.isSelected()) {
list.add("--offline");
}
return list;
}
void onOK () {
if (mavenTextField.getText().isEmpty()) {
DependencyBank.mavenCentral = "mavenCentral()";
} else {
DependencyBank.mavenCentral = "maven { url \"" + mavenTextField.getText() + "\" }";
}
setVisible(false);
}
void onCancel () {
setVisible(false);
restore();
}
private void takeSnapshot () {
mavenSnapshot = mavenTextField.getText();
offlineSnapshot = offlineBox.isSelected();
kotlinSnapshot = kotlinBox.isSelected();
oldAssetsSnapshot = oldAssetsBox.isSelected();
}
private void restore () {
mavenTextField.setText(mavenSnapshot);
offlineBox.setSelected(offlineSnapshot);
kotlinBox.setSelected(kotlinSnapshot);
oldAssetsBox.setSelected(oldAssetsSnapshot);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/shadows/system/BaseShadowSystem.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system;
import java.util.EnumSet;
import java.util.Set;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Cubemap;
import com.badlogic.gdx.graphics.Cubemap.CubemapSide;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.environment.BaseLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.PointLight;
import com.badlogic.gdx.graphics.g3d.environment.SpotLight;
import com.badlogic.gdx.graphics.g3d.utils.ShaderProvider;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.tests.g3d.shadows.utils.AABBNearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.BoundingSphereDirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.DirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.FixedShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.FrustumLightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.LightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.NearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator.ShadowMapRegion;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entries;
/** BaseShadowSystem allows to easily create custom shadow system.
* @author realitix */
public abstract class BaseShadowSystem implements ShadowSystem, Disposable {
/** This class handles camera and texture region.
* @author realitix */
public static class LightProperties {
public Camera camera;
public TextureRegion region = new TextureRegion();
public LightProperties (Camera camera) {
this.camera = camera;
}
}
/** This class handles LightProperties for each side of PointLight.
* @author realitix */
public static class PointLightProperties {
public ObjectMap<CubemapSide, LightProperties> properties = new ObjectMap<CubemapSide, LightProperties>(6);
}
/** Main camera */
protected Camera camera;
/** Renderable providers */
protected Iterable<RenderableProvider> renderableProviders;
/** Cameras linked with spot lights */
protected ObjectMap<SpotLight, LightProperties> spotCameras = new ObjectMap<SpotLight, LightProperties>();
/** Cameras linked with directional lights */
protected ObjectMap<DirectionalLight, LightProperties> dirCameras = new ObjectMap<DirectionalLight, LightProperties>();
/** Cameras linked with point lights */
protected ObjectMap<PointLight, PointLightProperties> pointCameras = new ObjectMap<PointLight, PointLightProperties>();
/** Analyzer of near and far for spot and point lights */
protected NearFarAnalyzer nearFarAnalyzer;
/** Allocator which choose where to render shadow map in texture */
protected ShadowMapAllocator allocator;
/** Analyzer which compute how to create the camera for directional light */
protected DirectionalAnalyzer directionalAnalyzer;
/** Filter that choose if light must be rendered */
protected LightFilter lightFilter;
/** Framebuffer used to render all the depth maps */
protected FrameBuffer[] frameBuffers;
/** Current pass in the depth process */
protected int currentPass = -1;
/** Iterators for cameras */
protected Entries<SpotLight, LightProperties> spotCameraIterator;
protected Entries<DirectionalLight, LightProperties> dirCameraIterator;
protected Entries<PointLight, PointLightProperties> pointCameraIterator;
/** Current side in the point light cubemap */
protected int currentPointSide;
protected PointLightProperties currentPointProperties;
/** Shader providers used by this system */
protected ShaderProvider[] passShaderProviders;
protected ShaderProvider mainShaderProvider;
/** Current light and properties during shadowmap generation */
protected LightProperties currentLightProperties;
protected BaseLight currentLight;
/** Construct the system with the needed params.
* @param nearFarAnalyzer Analyzer of near and far
* @param allocator Allocator of shadow maps
* @param directionalAnalyzer Analyze directional light to create orthographic camera
* @param lightFilter Filter light to render */
public BaseShadowSystem (NearFarAnalyzer nearFarAnalyzer, ShadowMapAllocator allocator,
DirectionalAnalyzer directionalAnalyzer, LightFilter lightFilter) {
this.nearFarAnalyzer = nearFarAnalyzer;
this.allocator = allocator;
this.directionalAnalyzer = directionalAnalyzer;
this.lightFilter = lightFilter;
}
/** Construct the system with default values */
public BaseShadowSystem () {
this(new AABBNearFarAnalyzer(),
new FixedShadowMapAllocator(FixedShadowMapAllocator.QUALITY_MED, FixedShadowMapAllocator.QUANTITY_MAP_MED),
new BoundingSphereDirectionalAnalyzer(), new FrustumLightFilter());
}
/** Initialize framebuffers and shader providers. You should call super.init() in subclass. */
@Override
public void init () {
frameBuffers = new FrameBuffer[getPassQuantity()];
passShaderProviders = new ShaderProvider[getPassQuantity()];
for (int i = 0; i < getPassQuantity(); i++) {
init(i);
}
};
/** Initialize pass n */
protected abstract void init (int n);
/** getPassQuantity should return at leat one. */
@Override
public abstract int getPassQuantity ();
@Override
public ShaderProvider getPassShaderProvider (int n) {
return passShaderProviders[n];
}
@Override
public ShaderProvider getShaderProvider () {
return mainShaderProvider;
}
@Override
public void addLight (SpotLight spot) {
PerspectiveCamera camera = new PerspectiveCamera(spot.cutoffAngle, 0, 0);
camera.position.set(spot.position);
camera.direction.set(spot.direction);
camera.near = 1;
camera.far = 100;
camera.up.set(camera.direction.y, camera.direction.z, camera.direction.x);
spotCameras.put(spot, new LightProperties(camera));
}
@Override
public void addLight (DirectionalLight dir) {
OrthographicCamera camera = new OrthographicCamera();
camera.direction.set(dir.direction);
camera.near = 1;
camera.far = 100;
dirCameras.put(dir, new LightProperties(camera));
}
@Override
public void addLight (PointLight point) {
addLight(point, EnumSet.of(CubemapSide.PositiveX, CubemapSide.NegativeX, CubemapSide.PositiveY, CubemapSide.NegativeY,
CubemapSide.PositiveZ, CubemapSide.NegativeZ));
}
@Override
public void addLight (PointLight point, Set<CubemapSide> sides) {
PointLightProperties plProperty = new PointLightProperties();
for (int i = 0; i < 6; i++) {
CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i];
if (sides.contains(cubemapSide)) {
PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0);
camera.position.set(point.position);
camera.direction.set(cubemapSide.direction);
camera.up.set(cubemapSide.up);
camera.near = 1;
camera.far = 100;
LightProperties p = new LightProperties(camera);
plProperty.properties.put(cubemapSide, p);
}
}
pointCameras.put(point, plProperty);
}
@Override
public void removeLight (SpotLight spot) {
spotCameras.remove(spot);
}
@Override
public void removeLight (DirectionalLight dir) {
dirCameras.remove(dir);
}
@Override
public void removeLight (PointLight point) {
pointCameras.remove(point);
}
@Override
public boolean hasLight (SpotLight spot) {
if (spotCameras.containsKey(spot)) return true;
return false;
}
@Override
public boolean hasLight (DirectionalLight dir) {
if (dirCameras.containsKey(dir)) return true;
return false;
}
@Override
public boolean hasLight (PointLight point) {
if (pointCameras.containsKey(point)) return true;
return false;
}
@Override
public void update () {
for (ObjectMap.Entry<SpotLight, LightProperties> e : spotCameras) {
e.value.camera.position.set(e.key.position);
e.value.camera.direction.set(e.key.direction);
nearFarAnalyzer.analyze(e.key, e.value.camera, renderableProviders);
}
for (ObjectMap.Entry<DirectionalLight, LightProperties> e : dirCameras) {
directionalAnalyzer.analyze(e.key, e.value.camera, camera).update();
}
for (ObjectMap.Entry<PointLight, PointLightProperties> e : pointCameras) {
for (ObjectMap.Entry<CubemapSide, LightProperties> c : e.value.properties) {
c.value.camera.position.set(e.key.position);
nearFarAnalyzer.analyze(e.key, c.value.camera, renderableProviders);
}
}
}
@Override
public <T extends RenderableProvider> void begin (Camera camera, final Iterable<T> renderableProviders) {
if (this.renderableProviders != null || this.camera != null) throw new GdxRuntimeException("Call end() first.");
this.camera = camera;
this.renderableProviders = (Iterable<RenderableProvider>)renderableProviders;
}
@Override
public void begin (int n) {
if (n >= passShaderProviders.length)
throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName());
currentPass = n;
spotCameraIterator = spotCameras.iterator();
dirCameraIterator = dirCameras.iterator();
pointCameraIterator = pointCameras.iterator();
currentPointSide = 6;
beginPass(n);
}
/** Begin pass n.
* @param n Pass number */
protected void beginPass (int n) {
frameBuffers[n].begin();
};
@Override
public void end () {
this.camera = null;
this.renderableProviders = null;
currentPass = -1;
}
@Override
public void end (int n) {
if (currentPass != n) throw new GdxRuntimeException("Begin " + n + " must be called before end " + n);
endPass(n);
}
/** End pass n.
* @param n Pass number */
protected void endPass (int n) {
frameBuffers[n].end();
}
@Override
public Camera next () {
LightProperties lp = nextDirectional();
if (lp != null) return interceptCamera(lp);
lp = nextSpot();
if (lp != null) return interceptCamera(lp);
lp = nextPoint();
if (lp != null) return interceptCamera(lp);
return null;
}
/** Allows to return custom camera if needed.
* @param lp Returned LightProperties
* @return Camera */
protected Camera interceptCamera (LightProperties lp) {
return lp.camera;
}
protected LightProperties nextDirectional () {
if (!dirCameraIterator.hasNext()) return null;
ObjectMap.Entry<DirectionalLight, LightProperties> e = dirCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
processViewport(lp, false);
return lp;
}
protected LightProperties nextSpot () {
if (!spotCameraIterator.hasNext()) return null;
ObjectMap.Entry<SpotLight, LightProperties> e = spotCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
if (!lightFilter.filter(spotCameras.findKey(lp, true), lp.camera, this.camera)) {
return nextSpot();
}
processViewport(lp, true);
return lp;
}
protected LightProperties nextPoint () {
if (!pointCameraIterator.hasNext() && currentPointSide > 5) return null;
if (currentPointSide > 5) currentPointSide = 0;
if (currentPointSide == 0) {
ObjectMap.Entry<PointLight, PointLightProperties> e = pointCameraIterator.next();
currentLight = e.key;
currentPointProperties = e.value;
}
if (currentPointProperties.properties.containsKey(Cubemap.CubemapSide.values()[currentPointSide])) {
LightProperties lp = currentPointProperties.properties.get(Cubemap.CubemapSide.values()[currentPointSide]);
currentLightProperties = lp;
currentPointSide += 1;
if (!lightFilter.filter(pointCameras.findKey(currentPointProperties, true), lp.camera, this.camera)) {
return nextPoint();
}
processViewport(lp, true);
return lp;
}
currentPointSide += 1;
return nextPoint();
}
/** Set viewport according to allocator.
* @param lp LightProperties to process.
* @param cameraViewport Set camera viewport if true. */
protected void processViewport (LightProperties lp, boolean cameraViewport) {
Camera camera = lp.camera;
ShadowMapRegion r = allocator.nextResult(currentLight);
if (r == null) return;
TextureRegion region = lp.region;
region.setTexture(frameBuffers[currentPass].getColorBufferTexture());
// We don't use HdpiUtils
// gl commands related to shadow map size and not to screen size
Gdx.gl.glViewport(r.x, r.y, r.width, r.height);
Gdx.gl.glScissor(r.x + 1, r.y + 1, r.width - 2, r.height - 2);
region.setRegion(r.x, r.y, r.width, r.height);
if (cameraViewport) {
camera.viewportHeight = r.height;
camera.viewportWidth = r.width;
camera.update();
}
}
public ObjectMap<DirectionalLight, LightProperties> getDirectionalCameras () {
return dirCameras;
}
public ObjectMap<SpotLight, LightProperties> getSpotCameras () {
return spotCameras;
}
public ObjectMap<PointLight, PointLightProperties> getPointCameras () {
return pointCameras;
}
public Texture getTexture (int n) {
if (n >= getPassQuantity()) throw new GdxRuntimeException("Can't get texture " + n);
return frameBuffers[n].getColorBufferTexture();
}
public LightProperties getCurrentLightProperties () {
return currentLightProperties;
}
public BaseLight getCurrentLight () {
return currentLight;
}
public int getCurrentPass () {
return currentPass;
}
@Override
public void dispose () {
for (int i = 0; i < getPassQuantity(); i++) {
frameBuffers[i].dispose();
passShaderProviders[i].dispose();
}
mainShaderProvider.dispose();
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tests.g3d.shadows.system;
import java.util.EnumSet;
import java.util.Set;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Cubemap;
import com.badlogic.gdx.graphics.Cubemap.CubemapSide;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.RenderableProvider;
import com.badlogic.gdx.graphics.g3d.environment.BaseLight;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.environment.PointLight;
import com.badlogic.gdx.graphics.g3d.environment.SpotLight;
import com.badlogic.gdx.graphics.g3d.utils.ShaderProvider;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.tests.g3d.shadows.utils.AABBNearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.BoundingSphereDirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.DirectionalAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.FixedShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.FrustumLightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.LightFilter;
import com.badlogic.gdx.tests.g3d.shadows.utils.NearFarAnalyzer;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator;
import com.badlogic.gdx.tests.g3d.shadows.utils.ShadowMapAllocator.ShadowMapRegion;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entries;
/** BaseShadowSystem allows to easily create custom shadow system.
* @author realitix */
public abstract class BaseShadowSystem implements ShadowSystem, Disposable {
/** This class handles camera and texture region.
* @author realitix */
public static class LightProperties {
public Camera camera;
public TextureRegion region = new TextureRegion();
public LightProperties (Camera camera) {
this.camera = camera;
}
}
/** This class handles LightProperties for each side of PointLight.
* @author realitix */
public static class PointLightProperties {
public ObjectMap<CubemapSide, LightProperties> properties = new ObjectMap<CubemapSide, LightProperties>(6);
}
/** Main camera */
protected Camera camera;
/** Renderable providers */
protected Iterable<RenderableProvider> renderableProviders;
/** Cameras linked with spot lights */
protected ObjectMap<SpotLight, LightProperties> spotCameras = new ObjectMap<SpotLight, LightProperties>();
/** Cameras linked with directional lights */
protected ObjectMap<DirectionalLight, LightProperties> dirCameras = new ObjectMap<DirectionalLight, LightProperties>();
/** Cameras linked with point lights */
protected ObjectMap<PointLight, PointLightProperties> pointCameras = new ObjectMap<PointLight, PointLightProperties>();
/** Analyzer of near and far for spot and point lights */
protected NearFarAnalyzer nearFarAnalyzer;
/** Allocator which choose where to render shadow map in texture */
protected ShadowMapAllocator allocator;
/** Analyzer which compute how to create the camera for directional light */
protected DirectionalAnalyzer directionalAnalyzer;
/** Filter that choose if light must be rendered */
protected LightFilter lightFilter;
/** Framebuffer used to render all the depth maps */
protected FrameBuffer[] frameBuffers;
/** Current pass in the depth process */
protected int currentPass = -1;
/** Iterators for cameras */
protected Entries<SpotLight, LightProperties> spotCameraIterator;
protected Entries<DirectionalLight, LightProperties> dirCameraIterator;
protected Entries<PointLight, PointLightProperties> pointCameraIterator;
/** Current side in the point light cubemap */
protected int currentPointSide;
protected PointLightProperties currentPointProperties;
/** Shader providers used by this system */
protected ShaderProvider[] passShaderProviders;
protected ShaderProvider mainShaderProvider;
/** Current light and properties during shadowmap generation */
protected LightProperties currentLightProperties;
protected BaseLight currentLight;
/** Construct the system with the needed params.
* @param nearFarAnalyzer Analyzer of near and far
* @param allocator Allocator of shadow maps
* @param directionalAnalyzer Analyze directional light to create orthographic camera
* @param lightFilter Filter light to render */
public BaseShadowSystem (NearFarAnalyzer nearFarAnalyzer, ShadowMapAllocator allocator,
DirectionalAnalyzer directionalAnalyzer, LightFilter lightFilter) {
this.nearFarAnalyzer = nearFarAnalyzer;
this.allocator = allocator;
this.directionalAnalyzer = directionalAnalyzer;
this.lightFilter = lightFilter;
}
/** Construct the system with default values */
public BaseShadowSystem () {
this(new AABBNearFarAnalyzer(),
new FixedShadowMapAllocator(FixedShadowMapAllocator.QUALITY_MED, FixedShadowMapAllocator.QUANTITY_MAP_MED),
new BoundingSphereDirectionalAnalyzer(), new FrustumLightFilter());
}
/** Initialize framebuffers and shader providers. You should call super.init() in subclass. */
@Override
public void init () {
frameBuffers = new FrameBuffer[getPassQuantity()];
passShaderProviders = new ShaderProvider[getPassQuantity()];
for (int i = 0; i < getPassQuantity(); i++) {
init(i);
}
};
/** Initialize pass n */
protected abstract void init (int n);
/** getPassQuantity should return at leat one. */
@Override
public abstract int getPassQuantity ();
@Override
public ShaderProvider getPassShaderProvider (int n) {
return passShaderProviders[n];
}
@Override
public ShaderProvider getShaderProvider () {
return mainShaderProvider;
}
@Override
public void addLight (SpotLight spot) {
PerspectiveCamera camera = new PerspectiveCamera(spot.cutoffAngle, 0, 0);
camera.position.set(spot.position);
camera.direction.set(spot.direction);
camera.near = 1;
camera.far = 100;
camera.up.set(camera.direction.y, camera.direction.z, camera.direction.x);
spotCameras.put(spot, new LightProperties(camera));
}
@Override
public void addLight (DirectionalLight dir) {
OrthographicCamera camera = new OrthographicCamera();
camera.direction.set(dir.direction);
camera.near = 1;
camera.far = 100;
dirCameras.put(dir, new LightProperties(camera));
}
@Override
public void addLight (PointLight point) {
addLight(point, EnumSet.of(CubemapSide.PositiveX, CubemapSide.NegativeX, CubemapSide.PositiveY, CubemapSide.NegativeY,
CubemapSide.PositiveZ, CubemapSide.NegativeZ));
}
@Override
public void addLight (PointLight point, Set<CubemapSide> sides) {
PointLightProperties plProperty = new PointLightProperties();
for (int i = 0; i < 6; i++) {
CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i];
if (sides.contains(cubemapSide)) {
PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0);
camera.position.set(point.position);
camera.direction.set(cubemapSide.direction);
camera.up.set(cubemapSide.up);
camera.near = 1;
camera.far = 100;
LightProperties p = new LightProperties(camera);
plProperty.properties.put(cubemapSide, p);
}
}
pointCameras.put(point, plProperty);
}
@Override
public void removeLight (SpotLight spot) {
spotCameras.remove(spot);
}
@Override
public void removeLight (DirectionalLight dir) {
dirCameras.remove(dir);
}
@Override
public void removeLight (PointLight point) {
pointCameras.remove(point);
}
@Override
public boolean hasLight (SpotLight spot) {
if (spotCameras.containsKey(spot)) return true;
return false;
}
@Override
public boolean hasLight (DirectionalLight dir) {
if (dirCameras.containsKey(dir)) return true;
return false;
}
@Override
public boolean hasLight (PointLight point) {
if (pointCameras.containsKey(point)) return true;
return false;
}
@Override
public void update () {
for (ObjectMap.Entry<SpotLight, LightProperties> e : spotCameras) {
e.value.camera.position.set(e.key.position);
e.value.camera.direction.set(e.key.direction);
nearFarAnalyzer.analyze(e.key, e.value.camera, renderableProviders);
}
for (ObjectMap.Entry<DirectionalLight, LightProperties> e : dirCameras) {
directionalAnalyzer.analyze(e.key, e.value.camera, camera).update();
}
for (ObjectMap.Entry<PointLight, PointLightProperties> e : pointCameras) {
for (ObjectMap.Entry<CubemapSide, LightProperties> c : e.value.properties) {
c.value.camera.position.set(e.key.position);
nearFarAnalyzer.analyze(e.key, c.value.camera, renderableProviders);
}
}
}
@Override
public <T extends RenderableProvider> void begin (Camera camera, final Iterable<T> renderableProviders) {
if (this.renderableProviders != null || this.camera != null) throw new GdxRuntimeException("Call end() first.");
this.camera = camera;
this.renderableProviders = (Iterable<RenderableProvider>)renderableProviders;
}
@Override
public void begin (int n) {
if (n >= passShaderProviders.length)
throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName());
currentPass = n;
spotCameraIterator = spotCameras.iterator();
dirCameraIterator = dirCameras.iterator();
pointCameraIterator = pointCameras.iterator();
currentPointSide = 6;
beginPass(n);
}
/** Begin pass n.
* @param n Pass number */
protected void beginPass (int n) {
frameBuffers[n].begin();
};
@Override
public void end () {
this.camera = null;
this.renderableProviders = null;
currentPass = -1;
}
@Override
public void end (int n) {
if (currentPass != n) throw new GdxRuntimeException("Begin " + n + " must be called before end " + n);
endPass(n);
}
/** End pass n.
* @param n Pass number */
protected void endPass (int n) {
frameBuffers[n].end();
}
@Override
public Camera next () {
LightProperties lp = nextDirectional();
if (lp != null) return interceptCamera(lp);
lp = nextSpot();
if (lp != null) return interceptCamera(lp);
lp = nextPoint();
if (lp != null) return interceptCamera(lp);
return null;
}
/** Allows to return custom camera if needed.
* @param lp Returned LightProperties
* @return Camera */
protected Camera interceptCamera (LightProperties lp) {
return lp.camera;
}
protected LightProperties nextDirectional () {
if (!dirCameraIterator.hasNext()) return null;
ObjectMap.Entry<DirectionalLight, LightProperties> e = dirCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
processViewport(lp, false);
return lp;
}
protected LightProperties nextSpot () {
if (!spotCameraIterator.hasNext()) return null;
ObjectMap.Entry<SpotLight, LightProperties> e = spotCameraIterator.next();
currentLight = e.key;
currentLightProperties = e.value;
LightProperties lp = e.value;
if (!lightFilter.filter(spotCameras.findKey(lp, true), lp.camera, this.camera)) {
return nextSpot();
}
processViewport(lp, true);
return lp;
}
protected LightProperties nextPoint () {
if (!pointCameraIterator.hasNext() && currentPointSide > 5) return null;
if (currentPointSide > 5) currentPointSide = 0;
if (currentPointSide == 0) {
ObjectMap.Entry<PointLight, PointLightProperties> e = pointCameraIterator.next();
currentLight = e.key;
currentPointProperties = e.value;
}
if (currentPointProperties.properties.containsKey(Cubemap.CubemapSide.values()[currentPointSide])) {
LightProperties lp = currentPointProperties.properties.get(Cubemap.CubemapSide.values()[currentPointSide]);
currentLightProperties = lp;
currentPointSide += 1;
if (!lightFilter.filter(pointCameras.findKey(currentPointProperties, true), lp.camera, this.camera)) {
return nextPoint();
}
processViewport(lp, true);
return lp;
}
currentPointSide += 1;
return nextPoint();
}
/** Set viewport according to allocator.
* @param lp LightProperties to process.
* @param cameraViewport Set camera viewport if true. */
protected void processViewport (LightProperties lp, boolean cameraViewport) {
Camera camera = lp.camera;
ShadowMapRegion r = allocator.nextResult(currentLight);
if (r == null) return;
TextureRegion region = lp.region;
region.setTexture(frameBuffers[currentPass].getColorBufferTexture());
// We don't use HdpiUtils
// gl commands related to shadow map size and not to screen size
Gdx.gl.glViewport(r.x, r.y, r.width, r.height);
Gdx.gl.glScissor(r.x + 1, r.y + 1, r.width - 2, r.height - 2);
region.setRegion(r.x, r.y, r.width, r.height);
if (cameraViewport) {
camera.viewportHeight = r.height;
camera.viewportWidth = r.width;
camera.update();
}
}
public ObjectMap<DirectionalLight, LightProperties> getDirectionalCameras () {
return dirCameras;
}
public ObjectMap<SpotLight, LightProperties> getSpotCameras () {
return spotCameras;
}
public ObjectMap<PointLight, PointLightProperties> getPointCameras () {
return pointCameras;
}
public Texture getTexture (int n) {
if (n >= getPassQuantity()) throw new GdxRuntimeException("Can't get texture " + n);
return frameBuffers[n].getColorBufferTexture();
}
public LightProperties getCurrentLightProperties () {
return currentLightProperties;
}
public BaseLight getCurrentLight () {
return currentLight;
}
public int getCurrentPass () {
return currentPass;
}
@Override
public void dispose () {
for (int i = 0; i < getPassQuantity(); i++) {
frameBuffers[i].dispose();
passShaderProviders[i].dispose();
}
mainShaderProvider.dispose();
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/ParticleControllerInfluencerSingleTest.java |
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
import com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch;
import com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.TangentialAcceleration;
import com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerFinalizerInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.ParticleControllerControllerRenderer;
import com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue;
import com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
/** @author ryanastout */
public class ParticleControllerInfluencerSingleTest extends BaseG3dTest {
public static final String DEFAULT_PARTICLE = "data/pre_particle.png", DEFAULT_SKIN = "data/uiskin.json";
Quaternion tmpQuaternion = new Quaternion();
Matrix4 tmpMatrix = new Matrix4(), tmpMatrix4 = new Matrix4();
Vector3 tmpVector = new Vector3();
// Simulation
Array<ParticleController> emitters;
// Rendering
Environment environment;
BillboardParticleBatch billboardParticleBatch;
// UI
Stage ui;
Label fpsLabel;
StringBuilder builder;
@Override
public void create () {
super.create();
emitters = new Array<ParticleController>();
assets.load(DEFAULT_PARTICLE, Texture.class);
assets.load(DEFAULT_SKIN, Skin.class);
loading = true;
environment = new Environment();
billboardParticleBatch = new BillboardParticleBatch();
billboardParticleBatch.setCamera(cam);
ui = new Stage();
builder = new StringBuilder();
}
@Override
public void resize (int width, int height) {
super.resize(width, height);
ui.getViewport().setWorldSize(width, height);
ui.getViewport().update(width, height, true);
}
@Override
protected void onLoaded () {
Texture particleTexture = assets.get(DEFAULT_PARTICLE);
billboardParticleBatch.setTexture(assets.get(DEFAULT_PARTICLE, Texture.class));
addEmitter(particleTexture);
setupUI();
}
private void addEmitter (Texture particleTexture) {
ParticleController controller = createBillboardController(particleTexture);
controller.init();
controller.start();
emitters.add(controller);
controller.translate(new Vector3(5, 0, 5));
controller.rotate(Vector3.X, 90);
}
private void setupUI () {
Skin skin = assets.get(DEFAULT_SKIN);
Table table = new Table();
table.setFillParent(true);
table.top().left().add(new Label("FPS ", skin)).left();
table.add(fpsLabel = new Label("", skin)).left().expandX().row();
ui.addActor(table);
}
private ParticleController createBillboardController (Texture particleTexture) {
// Emission
RegularEmitter emitter = new RegularEmitter();
emitter.getDuration().setLow(1000);
emitter.getEmission().setHigh(300);
emitter.getLife().setHigh(4000);
emitter.setMaxParticleCount(20);
// Spawn
CylinderSpawnShapeValue cylinderSpawnShapeValue = new CylinderSpawnShapeValue();
cylinderSpawnShapeValue.spawnWidthValue.setHigh(5);// x
cylinderSpawnShapeValue.spawnHeightValue.setHigh(10);// y
cylinderSpawnShapeValue.spawnDepthValue.setHigh(5);// z
cylinderSpawnShapeValue.setEdges(true);
SpawnInfluencer spawnSource = new SpawnInfluencer(cylinderSpawnShapeValue);
// Dynamics
DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
TangentialAcceleration tangentialAcceleration = new TangentialAcceleration();
tangentialAcceleration.thetaValue.setActive(true);
tangentialAcceleration.thetaValue.setTimeline(new float[] {0});
tangentialAcceleration.thetaValue.setScaling(new float[] {1});
tangentialAcceleration.thetaValue.setHigh(90);
tangentialAcceleration.phiValue.setActive(true);
tangentialAcceleration.phiValue.setTimeline(new float[] {0});
tangentialAcceleration.phiValue.setScaling(new float[] {1});
tangentialAcceleration.phiValue.setHigh(0);
tangentialAcceleration.strengthValue.setActive(true);
tangentialAcceleration.strengthValue.setHigh(10);
tangentialAcceleration.strengthValue.setTimeline(new float[] {0});
tangentialAcceleration.strengthValue.setScaling(new float[] {1});
tangentialAcceleration.isGlobal = false;
dynamicsInfluencer.velocities.add(tangentialAcceleration);
ParticleController ret = new ParticleController("Billboard Controller", emitter,
new BillboardRenderer(billboardParticleBatch), new RegionInfluencer.Single(particleTexture), spawnSource,
dynamicsInfluencer);
ParticleControllerInfluencer pci = new ParticleControllerInfluencer.Single(ret);
SpawnInfluencer si = new SpawnInfluencer(new PointSpawnShapeValue());
Influencer pcfi = new ParticleControllerFinalizerInfluencer();
RegularEmitter emitter2 = new RegularEmitter();
emitter2.getDuration().setLow(3000);
emitter2.getEmission().setHigh(300);
emitter2.getLife().setHigh(4000);
emitter2.setMaxParticleCount(30);
ParticleController ret2 = new ParticleController("Bigger", emitter2, new ParticleControllerControllerRenderer(), pci, si,
pcfi);
return ret2;
}
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
if (emitters.size > 0) {
// Update
float delta = Gdx.graphics.getDeltaTime();
builder.delete(0, builder.length());
builder.append(Gdx.graphics.getFramesPerSecond());
fpsLabel.setText(builder);
ui.act(delta);
billboardParticleBatch.begin();
for (ParticleController controller : emitters) {
controller.update();
controller.draw();
}
billboardParticleBatch.end();
batch.render(billboardParticleBatch, environment);
}
batch.render(instances, environment);
ui.draw();
}
}
|
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
import com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch;
import com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier.TangentialAcceleration;
import com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerFinalizerInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.ParticleControllerInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer;
import com.badlogic.gdx.graphics.g3d.particles.renderers.ParticleControllerControllerRenderer;
import com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue;
import com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
/** @author ryanastout */
public class ParticleControllerInfluencerSingleTest extends BaseG3dTest {
public static final String DEFAULT_PARTICLE = "data/pre_particle.png", DEFAULT_SKIN = "data/uiskin.json";
Quaternion tmpQuaternion = new Quaternion();
Matrix4 tmpMatrix = new Matrix4(), tmpMatrix4 = new Matrix4();
Vector3 tmpVector = new Vector3();
// Simulation
Array<ParticleController> emitters;
// Rendering
Environment environment;
BillboardParticleBatch billboardParticleBatch;
// UI
Stage ui;
Label fpsLabel;
StringBuilder builder;
@Override
public void create () {
super.create();
emitters = new Array<ParticleController>();
assets.load(DEFAULT_PARTICLE, Texture.class);
assets.load(DEFAULT_SKIN, Skin.class);
loading = true;
environment = new Environment();
billboardParticleBatch = new BillboardParticleBatch();
billboardParticleBatch.setCamera(cam);
ui = new Stage();
builder = new StringBuilder();
}
@Override
public void resize (int width, int height) {
super.resize(width, height);
ui.getViewport().setWorldSize(width, height);
ui.getViewport().update(width, height, true);
}
@Override
protected void onLoaded () {
Texture particleTexture = assets.get(DEFAULT_PARTICLE);
billboardParticleBatch.setTexture(assets.get(DEFAULT_PARTICLE, Texture.class));
addEmitter(particleTexture);
setupUI();
}
private void addEmitter (Texture particleTexture) {
ParticleController controller = createBillboardController(particleTexture);
controller.init();
controller.start();
emitters.add(controller);
controller.translate(new Vector3(5, 0, 5));
controller.rotate(Vector3.X, 90);
}
private void setupUI () {
Skin skin = assets.get(DEFAULT_SKIN);
Table table = new Table();
table.setFillParent(true);
table.top().left().add(new Label("FPS ", skin)).left();
table.add(fpsLabel = new Label("", skin)).left().expandX().row();
ui.addActor(table);
}
private ParticleController createBillboardController (Texture particleTexture) {
// Emission
RegularEmitter emitter = new RegularEmitter();
emitter.getDuration().setLow(1000);
emitter.getEmission().setHigh(300);
emitter.getLife().setHigh(4000);
emitter.setMaxParticleCount(20);
// Spawn
CylinderSpawnShapeValue cylinderSpawnShapeValue = new CylinderSpawnShapeValue();
cylinderSpawnShapeValue.spawnWidthValue.setHigh(5);// x
cylinderSpawnShapeValue.spawnHeightValue.setHigh(10);// y
cylinderSpawnShapeValue.spawnDepthValue.setHigh(5);// z
cylinderSpawnShapeValue.setEdges(true);
SpawnInfluencer spawnSource = new SpawnInfluencer(cylinderSpawnShapeValue);
// Dynamics
DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
TangentialAcceleration tangentialAcceleration = new TangentialAcceleration();
tangentialAcceleration.thetaValue.setActive(true);
tangentialAcceleration.thetaValue.setTimeline(new float[] {0});
tangentialAcceleration.thetaValue.setScaling(new float[] {1});
tangentialAcceleration.thetaValue.setHigh(90);
tangentialAcceleration.phiValue.setActive(true);
tangentialAcceleration.phiValue.setTimeline(new float[] {0});
tangentialAcceleration.phiValue.setScaling(new float[] {1});
tangentialAcceleration.phiValue.setHigh(0);
tangentialAcceleration.strengthValue.setActive(true);
tangentialAcceleration.strengthValue.setHigh(10);
tangentialAcceleration.strengthValue.setTimeline(new float[] {0});
tangentialAcceleration.strengthValue.setScaling(new float[] {1});
tangentialAcceleration.isGlobal = false;
dynamicsInfluencer.velocities.add(tangentialAcceleration);
ParticleController ret = new ParticleController("Billboard Controller", emitter,
new BillboardRenderer(billboardParticleBatch), new RegionInfluencer.Single(particleTexture), spawnSource,
dynamicsInfluencer);
ParticleControllerInfluencer pci = new ParticleControllerInfluencer.Single(ret);
SpawnInfluencer si = new SpawnInfluencer(new PointSpawnShapeValue());
Influencer pcfi = new ParticleControllerFinalizerInfluencer();
RegularEmitter emitter2 = new RegularEmitter();
emitter2.getDuration().setLow(3000);
emitter2.getEmission().setHigh(300);
emitter2.getLife().setHigh(4000);
emitter2.setMaxParticleCount(30);
ParticleController ret2 = new ParticleController("Bigger", emitter2, new ParticleControllerControllerRenderer(), pci, si,
pcfi);
return ret2;
}
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
if (emitters.size > 0) {
// Update
float delta = Gdx.graphics.getDeltaTime();
builder.delete(0, builder.length());
builder.append(Gdx.graphics.getFramesPerSecond());
fpsLabel.setText(builder);
ui.act(delta);
billboardParticleBatch.begin();
for (ParticleController controller : emitters) {
controller.update();
controller.draw();
}
billboardParticleBatch.end();
batch.render(billboardParticleBatch, environment);
}
batch.render(instances, environment);
ui.draw();
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/math/Frustum.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.math;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.math.Plane.PlaneSide;
import com.badlogic.gdx.math.collision.BoundingBox;
import com.badlogic.gdx.math.collision.OrientedBoundingBox;
/** A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
* @see Camera#frustum */
public class Frustum {
protected static final Vector3[] clipSpacePlanePoints = {new Vector3(-1, -1, -1), new Vector3(1, -1, -1),
new Vector3(1, 1, -1), new Vector3(-1, 1, -1), // near clip
new Vector3(-1, -1, 1), new Vector3(1, -1, 1), new Vector3(1, 1, 1), new Vector3(-1, 1, 1)}; // far clip
protected static final float[] clipSpacePlanePointsArray = new float[8 * 3];
static {
int j = 0;
for (Vector3 v : clipSpacePlanePoints) {
clipSpacePlanePointsArray[j++] = v.x;
clipSpacePlanePointsArray[j++] = v.y;
clipSpacePlanePointsArray[j++] = v.z;
}
}
private final static Vector3 tmpV = new Vector3();
/** the six clipping planes, near, far, left, right, top, bottom **/
public final Plane[] planes = new Plane[6];
/** eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left **/
public final Vector3[] planePoints = {new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(),
new Vector3(), new Vector3()};
protected final float[] planePointsArray = new float[8 * 3];
public Frustum () {
for (int i = 0; i < 6; i++) {
planes[i] = new Plane(new Vector3(), 0);
}
}
/** Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an
* {@link OrthographicCamera} or {@link PerspectiveCamera}.
* @param inverseProjectionView the combined projection and view matrices. */
public void update (Matrix4 inverseProjectionView) {
System.arraycopy(clipSpacePlanePointsArray, 0, planePointsArray, 0, clipSpacePlanePointsArray.length);
Matrix4.prj(inverseProjectionView.val, planePointsArray, 0, 8, 3);
for (int i = 0, j = 0; i < 8; i++) {
Vector3 v = planePoints[i];
v.x = planePointsArray[j++];
v.y = planePointsArray[j++];
v.z = planePointsArray[j++];
}
planes[0].set(planePoints[1], planePoints[0], planePoints[2]);
planes[1].set(planePoints[4], planePoints[5], planePoints[7]);
planes[2].set(planePoints[0], planePoints[4], planePoints[3]);
planes[3].set(planePoints[5], planePoints[1], planePoints[6]);
planes[4].set(planePoints[2], planePoints[3], planePoints[6]);
planes[5].set(planePoints[4], planePoints[0], planePoints[1]);
}
/** Returns whether the point is in the frustum.
*
* @param point The point
* @return Whether the point is in the frustum. */
public boolean pointInFrustum (Vector3 point) {
for (int i = 0; i < planes.length; i++) {
PlaneSide result = planes[i].testPoint(point);
if (result == PlaneSide.Back) return false;
}
return true;
}
/** Returns whether the point is in the frustum.
*
* @param x The X coordinate of the point
* @param y The Y coordinate of the point
* @param z The Z coordinate of the point
* @return Whether the point is in the frustum. */
public boolean pointInFrustum (float x, float y, float z) {
for (int i = 0; i < planes.length; i++) {
PlaneSide result = planes[i].testPoint(x, y, z);
if (result == PlaneSide.Back) return false;
}
return true;
}
/** Returns whether the given sphere is in the frustum.
*
* @param center The center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustum (Vector3 center, float radius) {
for (int i = 0; i < 6; i++)
if ((planes[i].normal.x * center.x + planes[i].normal.y * center.y + planes[i].normal.z * center.z) < (-radius
- planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum.
*
* @param x The X coordinate of the center of the sphere
* @param y The Y coordinate of the center of the sphere
* @param z The Z coordinate of the center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustum (float x, float y, float z, float radius) {
for (int i = 0; i < 6; i++)
if ((planes[i].normal.x * x + planes[i].normal.y * y + planes[i].normal.z * z) < (-radius - planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.
*
* @param center The center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustumWithoutNearFar (Vector3 center, float radius) {
for (int i = 2; i < 6; i++)
if ((planes[i].normal.x * center.x + planes[i].normal.y * center.y + planes[i].normal.z * center.z) < (-radius
- planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.
*
* @param x The X coordinate of the center of the sphere
* @param y The Y coordinate of the center of the sphere
* @param z The Z coordinate of the center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustumWithoutNearFar (float x, float y, float z, float radius) {
for (int i = 2; i < 6; i++)
if ((planes[i].normal.x * x + planes[i].normal.y * y + planes[i].normal.z * z) < (-radius - planes[i].d)) return false;
return true;
}
/** Returns whether the given {@link BoundingBox} is in the frustum.
*
* @param bounds The bounding box
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (BoundingBox bounds) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(bounds.getCorner000(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner001(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner010(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner011(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner100(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner101(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner110(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner111(tmpV)) != PlaneSide.Back) continue;
return false;
}
return true;
}
/** Returns whether the given bounding box is in the frustum.
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (Vector3 center, Vector3 dimensions) {
return boundsInFrustum(center.x, center.y, center.z, dimensions.x / 2, dimensions.y / 2, dimensions.z / 2);
}
/** Returns whether the given bounding box is in the frustum.
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (float x, float y, float z, float halfWidth, float halfHeight, float halfDepth) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(x + halfWidth, y + halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y + halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y - halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y - halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y + halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y + halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y - halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y - halfHeight, z - halfDepth) != PlaneSide.Back) continue;
return false;
}
return true;
}
/** Returns whether the given {@link OrientedBoundingBox} is in the frustum.
*
* @param obb The oriented bounding box
* @return Whether the oriented bounding box is in the frustum */
public boolean boundsInFrustum (OrientedBoundingBox obb) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(obb.getCorner000(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner001(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner010(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner011(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner100(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner101(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner110(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner111(tmpV)) != PlaneSide.Back) continue;
return false;
}
return true;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.math;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.math.Plane.PlaneSide;
import com.badlogic.gdx.math.collision.BoundingBox;
import com.badlogic.gdx.math.collision.OrientedBoundingBox;
/** A truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.
* @see Camera#frustum */
public class Frustum {
protected static final Vector3[] clipSpacePlanePoints = {new Vector3(-1, -1, -1), new Vector3(1, -1, -1),
new Vector3(1, 1, -1), new Vector3(-1, 1, -1), // near clip
new Vector3(-1, -1, 1), new Vector3(1, -1, 1), new Vector3(1, 1, 1), new Vector3(-1, 1, 1)}; // far clip
protected static final float[] clipSpacePlanePointsArray = new float[8 * 3];
static {
int j = 0;
for (Vector3 v : clipSpacePlanePoints) {
clipSpacePlanePointsArray[j++] = v.x;
clipSpacePlanePointsArray[j++] = v.y;
clipSpacePlanePointsArray[j++] = v.z;
}
}
private final static Vector3 tmpV = new Vector3();
/** the six clipping planes, near, far, left, right, top, bottom **/
public final Plane[] planes = new Plane[6];
/** eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left **/
public final Vector3[] planePoints = {new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(),
new Vector3(), new Vector3()};
protected final float[] planePointsArray = new float[8 * 3];
public Frustum () {
for (int i = 0; i < 6; i++) {
planes[i] = new Plane(new Vector3(), 0);
}
}
/** Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from an
* {@link OrthographicCamera} or {@link PerspectiveCamera}.
* @param inverseProjectionView the combined projection and view matrices. */
public void update (Matrix4 inverseProjectionView) {
System.arraycopy(clipSpacePlanePointsArray, 0, planePointsArray, 0, clipSpacePlanePointsArray.length);
Matrix4.prj(inverseProjectionView.val, planePointsArray, 0, 8, 3);
for (int i = 0, j = 0; i < 8; i++) {
Vector3 v = planePoints[i];
v.x = planePointsArray[j++];
v.y = planePointsArray[j++];
v.z = planePointsArray[j++];
}
planes[0].set(planePoints[1], planePoints[0], planePoints[2]);
planes[1].set(planePoints[4], planePoints[5], planePoints[7]);
planes[2].set(planePoints[0], planePoints[4], planePoints[3]);
planes[3].set(planePoints[5], planePoints[1], planePoints[6]);
planes[4].set(planePoints[2], planePoints[3], planePoints[6]);
planes[5].set(planePoints[4], planePoints[0], planePoints[1]);
}
/** Returns whether the point is in the frustum.
*
* @param point The point
* @return Whether the point is in the frustum. */
public boolean pointInFrustum (Vector3 point) {
for (int i = 0; i < planes.length; i++) {
PlaneSide result = planes[i].testPoint(point);
if (result == PlaneSide.Back) return false;
}
return true;
}
/** Returns whether the point is in the frustum.
*
* @param x The X coordinate of the point
* @param y The Y coordinate of the point
* @param z The Z coordinate of the point
* @return Whether the point is in the frustum. */
public boolean pointInFrustum (float x, float y, float z) {
for (int i = 0; i < planes.length; i++) {
PlaneSide result = planes[i].testPoint(x, y, z);
if (result == PlaneSide.Back) return false;
}
return true;
}
/** Returns whether the given sphere is in the frustum.
*
* @param center The center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustum (Vector3 center, float radius) {
for (int i = 0; i < 6; i++)
if ((planes[i].normal.x * center.x + planes[i].normal.y * center.y + planes[i].normal.z * center.z) < (-radius
- planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum.
*
* @param x The X coordinate of the center of the sphere
* @param y The Y coordinate of the center of the sphere
* @param z The Z coordinate of the center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustum (float x, float y, float z, float radius) {
for (int i = 0; i < 6; i++)
if ((planes[i].normal.x * x + planes[i].normal.y * y + planes[i].normal.z * z) < (-radius - planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.
*
* @param center The center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustumWithoutNearFar (Vector3 center, float radius) {
for (int i = 2; i < 6; i++)
if ((planes[i].normal.x * center.x + planes[i].normal.y * center.y + planes[i].normal.z * center.z) < (-radius
- planes[i].d)) return false;
return true;
}
/** Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.
*
* @param x The X coordinate of the center of the sphere
* @param y The Y coordinate of the center of the sphere
* @param z The Z coordinate of the center of the sphere
* @param radius The radius of the sphere
* @return Whether the sphere is in the frustum */
public boolean sphereInFrustumWithoutNearFar (float x, float y, float z, float radius) {
for (int i = 2; i < 6; i++)
if ((planes[i].normal.x * x + planes[i].normal.y * y + planes[i].normal.z * z) < (-radius - planes[i].d)) return false;
return true;
}
/** Returns whether the given {@link BoundingBox} is in the frustum.
*
* @param bounds The bounding box
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (BoundingBox bounds) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(bounds.getCorner000(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner001(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner010(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner011(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner100(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner101(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner110(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(bounds.getCorner111(tmpV)) != PlaneSide.Back) continue;
return false;
}
return true;
}
/** Returns whether the given bounding box is in the frustum.
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (Vector3 center, Vector3 dimensions) {
return boundsInFrustum(center.x, center.y, center.z, dimensions.x / 2, dimensions.y / 2, dimensions.z / 2);
}
/** Returns whether the given bounding box is in the frustum.
* @return Whether the bounding box is in the frustum */
public boolean boundsInFrustum (float x, float y, float z, float halfWidth, float halfHeight, float halfDepth) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(x + halfWidth, y + halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y + halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y - halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x + halfWidth, y - halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y + halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y + halfHeight, z - halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y - halfHeight, z + halfDepth) != PlaneSide.Back) continue;
if (planes[i].testPoint(x - halfWidth, y - halfHeight, z - halfDepth) != PlaneSide.Back) continue;
return false;
}
return true;
}
/** Returns whether the given {@link OrientedBoundingBox} is in the frustum.
*
* @param obb The oriented bounding box
* @return Whether the oriented bounding box is in the frustum */
public boolean boundsInFrustum (OrientedBoundingBox obb) {
for (int i = 0, len2 = planes.length; i < len2; i++) {
if (planes[i].testPoint(obb.getCorner000(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner001(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner010(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner011(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner100(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner101(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner110(tmpV)) != PlaneSide.Back) continue;
if (planes[i].testPoint(obb.getCorner111(tmpV)) != PlaneSide.Back) continue;
return false;
}
return true;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/scenes/scene2d/Actor.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d;
import static com.badlogic.gdx.utils.Align.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.DelayedRemovalArray;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.reflect.ClassReflection;
/** 2D scene graph node. An actor has a position, rectangular size, origin, scale, rotation, Z index, and color. The position
* corresponds to the unrotated, unscaled bottom left corner of the actor. The position is relative to the actor's parent. The
* origin is relative to the position and is used for scale and rotation.
* <p>
* An actor has a list of in progress {@link Action actions} that are applied to the actor (often over time). These are generally
* used to change the presentation of the actor (moving it, resizing it, etc). See {@link #act(float)}, {@link Action}, and its
* many subclasses.
* <p>
* An actor has two kinds of listeners associated with it: "capture" and regular. The listeners are notified of events the actor
* or its children receive. The regular listeners are designed to allow an actor to respond to events that have been delivered.
* The capture listeners are designed to allow a parent or container actor to handle events before child actors. See {@link #fire}
* for more details.
* <p>
* An {@link InputListener} can receive all the basic input events. More complex listeners (like {@link ClickListener} and
* {@link ActorGestureListener}) can listen for and combine primitive events and recognize complex interactions like multi-touch
* or pinch.
* @author mzechner
* @author Nathan Sweet */
public class Actor {
private @Null Stage stage;
@Null Group parent;
private final DelayedRemovalArray<EventListener> listeners = new DelayedRemovalArray(0);
private final DelayedRemovalArray<EventListener> captureListeners = new DelayedRemovalArray(0);
private final Array<Action> actions = new Array(0);
private @Null String name;
private Touchable touchable = Touchable.enabled;
private boolean visible = true, debug;
float x, y;
float width, height;
float originX, originY;
float scaleX = 1, scaleY = 1;
float rotation;
final Color color = new Color(1, 1, 1, 1);
private @Null Object userObject;
/** Draws the actor. The batch is configured to draw in the parent's coordinate system.
* {@link Batch#draw(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float, float, float, float, float, float)
* This draw method} is convenient to draw a rotated and scaled TextureRegion. {@link Batch#begin()} has already been called on
* the batch. If {@link Batch#end()} is called to draw without the batch then {@link Batch#begin()} must be called before the
* method returns.
* <p>
* The default implementation does nothing.
* @param parentAlpha The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all
* children. */
public void draw (Batch batch, float parentAlpha) {
}
/** Updates the actor based on time. Typically this is called each frame by {@link Stage#act(float)}.
* <p>
* The default implementation calls {@link Action#act(float)} on each action and removes actions that are complete.
* @param delta Time in seconds since the last frame. */
public void act (float delta) {
Array<Action> actions = this.actions;
if (actions.size == 0) return;
if (stage != null && stage.getActionsRequestRendering()) Gdx.graphics.requestRendering();
try {
for (int i = 0; i < actions.size; i++) {
Action action = actions.get(i);
if (action.act(delta) && i < actions.size) {
Action current = actions.get(i);
int actionIndex = current == action ? i : actions.indexOf(action, true);
if (actionIndex != -1) {
actions.removeIndex(actionIndex);
action.setActor(null);
i--;
}
}
}
} catch (RuntimeException ex) {
String context = toString();
throw new RuntimeException("Actor: " + context.substring(0, Math.min(context.length(), 128)), ex);
}
}
/** Sets this actor as the event {@link Event#setTarget(Actor) target} and propagates the event to this actor and ascendants as
* necessary. If this actor is not in the stage, the stage must be set before calling this method.
* <p>
* Events are fired in 2 phases:
* <ol>
* <li>The first phase (the "capture" phase) notifies listeners on each actor starting at the root and propagating down the
* hierarchy to (and including) this actor.</li>
* <li>The second phase notifies listeners on each actor starting at this actor and, if {@link Event#getBubbles()} is true,
* propagating upward to the root.</li>
* </ol>
* If the event is {@link Event#stop() stopped} at any time, it will not propagate to the next actor.
* @return true if the event was {@link Event#cancel() cancelled}. */
public boolean fire (Event event) {
if (event.getStage() == null) event.setStage(getStage());
event.setTarget(this);
// Collect ascendants so event propagation is unaffected by hierarchy changes.
Array<Group> ascendants = Pools.obtain(Array.class);
Group parent = this.parent;
while (parent != null) {
ascendants.add(parent);
parent = parent.parent;
}
try {
// Notify ascendants' capture listeners, starting at the root. Ascendants may stop an event before children receive it.
Object[] ascendantsArray = ascendants.items;
for (int i = ascendants.size - 1; i >= 0; i--) {
Group currentTarget = (Group)ascendantsArray[i];
currentTarget.notify(event, true);
if (event.isStopped()) return event.isCancelled();
}
// Notify the target capture listeners.
notify(event, true);
if (event.isStopped()) return event.isCancelled();
// Notify the target listeners.
notify(event, false);
if (!event.getBubbles()) return event.isCancelled();
if (event.isStopped()) return event.isCancelled();
// Notify ascendants' actor listeners, starting at the target. Children may stop an event before ascendants receive it.
for (int i = 0, n = ascendants.size; i < n; i++) {
((Group)ascendantsArray[i]).notify(event, false);
if (event.isStopped()) return event.isCancelled();
}
return event.isCancelled();
} finally {
ascendants.clear();
Pools.free(ascendants);
}
}
/** Notifies this actor's listeners of the event. The event is not propagated to any ascendants. The event
* {@link Event#setTarget(Actor) target} must be set before calling this method. Before notifying the listeners, this actor is
* set as the {@link Event#getListenerActor() listener actor}. If this actor is not in the stage, the stage must be set before
* calling this method.
* @param capture If true, the capture listeners will be notified instead of the regular listeners.
* @return true if the event was {@link Event#cancel() cancelled}. */
public boolean notify (Event event, boolean capture) {
if (event.getTarget() == null) throw new IllegalArgumentException("The event target cannot be null.");
DelayedRemovalArray<EventListener> listeners = capture ? captureListeners : this.listeners;
if (listeners.size == 0) return event.isCancelled();
event.setListenerActor(this);
event.setCapture(capture);
if (event.getStage() == null) event.setStage(stage);
try {
listeners.begin();
for (int i = 0, n = listeners.size; i < n; i++)
if (listeners.get(i).handle(event)) event.handle();
listeners.end();
} catch (RuntimeException ex) {
String context = toString();
throw new RuntimeException("Actor: " + context.substring(0, Math.min(context.length(), 128)), ex);
}
return event.isCancelled();
}
/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains
* the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the
* bottom left of the actor and width,height is the upper right).
* <p>
* This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not
* occur on this Actor.
* <p>
* The default implementation returns this actor if the point is within this actor's bounds and this actor is visible.
* @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}.
* @see Touchable */
public @Null Actor hit (float x, float y, boolean touchable) {
if (touchable && this.touchable != Touchable.enabled) return null;
if (!isVisible()) return null;
return x >= 0 && x < width && y >= 0 && y < height ? this : null;
}
/** Removes this actor from its parent, if it has a parent.
* @see Group#removeActor(Actor) */
public boolean remove () {
if (parent != null) return parent.removeActor(this, true);
return false;
}
/** Add a listener to receive events that {@link #hit(float, float, boolean) hit} this actor. See {@link #fire(Event)}.
* @see InputListener
* @see ClickListener */
public boolean addListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
if (!listeners.contains(listener, true)) {
listeners.add(listener);
return true;
}
return false;
}
public boolean removeListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
return listeners.removeValue(listener, true);
}
public DelayedRemovalArray<EventListener> getListeners () {
return listeners;
}
/** Adds a listener that is only notified during the capture phase.
* @see #fire(Event) */
public boolean addCaptureListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
if (!captureListeners.contains(listener, true)) captureListeners.add(listener);
return true;
}
public boolean removeCaptureListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
return captureListeners.removeValue(listener, true);
}
public DelayedRemovalArray<EventListener> getCaptureListeners () {
return captureListeners;
}
public void addAction (Action action) {
action.setActor(this);
actions.add(action);
if (stage != null && stage.getActionsRequestRendering()) Gdx.graphics.requestRendering();
}
/** @param action May be null, in which case nothing is done. */
public void removeAction (@Null Action action) {
if (action != null && actions.removeValue(action, true)) action.setActor(null);
}
public Array<Action> getActions () {
return actions;
}
/** Returns true if the actor has one or more actions. */
public boolean hasActions () {
return actions.size > 0;
}
/** Removes all actions on this actor. */
public void clearActions () {
for (int i = actions.size - 1; i >= 0; i--)
actions.get(i).setActor(null);
actions.clear();
}
/** Removes all listeners on this actor. */
public void clearListeners () {
listeners.clear();
captureListeners.clear();
}
/** Removes all actions and listeners on this actor. */
public void clear () {
clearActions();
clearListeners();
}
/** Returns the stage that this actor is currently in, or null if not in a stage. */
public @Null Stage getStage () {
return stage;
}
/** Called by the framework when this actor or any ascendant is added to a group that is in the stage.
* @param stage May be null if the actor or any ascendant is no longer in a stage. */
protected void setStage (Stage stage) {
this.stage = stage;
}
/** Returns true if this actor is the same as or is the descendant of the specified actor. */
public boolean isDescendantOf (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
Actor parent = this;
do {
if (parent == actor) return true;
parent = parent.parent;
} while (parent != null);
return false;
}
/** Returns true if this actor is the same as or is the ascendant of the specified actor. */
public boolean isAscendantOf (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
do {
if (actor == this) return true;
actor = actor.parent;
} while (actor != null);
return false;
}
/** Returns this actor or the first ascendant of this actor that is assignable with the specified type, or null if none were
* found. */
public @Null <T extends Actor> T firstAscendant (Class<T> type) {
if (type == null) throw new IllegalArgumentException("actor cannot be null.");
Actor actor = this;
do {
if (ClassReflection.isInstance(type, actor)) return (T)actor;
actor = actor.parent;
} while (actor != null);
return null;
}
/** Returns true if the actor's parent is not null. */
public boolean hasParent () {
return parent != null;
}
/** Returns the parent actor, or null if not in a group. */
public @Null Group getParent () {
return parent;
}
/** Called by the framework when an actor is added to or removed from a group.
* @param parent May be null if the actor has been removed from the parent. */
protected void setParent (@Null Group parent) {
this.parent = parent;
}
/** Returns true if input events are processed by this actor. */
public boolean isTouchable () {
return touchable == Touchable.enabled;
}
public Touchable getTouchable () {
return touchable;
}
/** Determines how touch events are distributed to this actor. Default is {@link Touchable#enabled}. */
public void setTouchable (Touchable touchable) {
this.touchable = touchable;
}
public boolean isVisible () {
return visible;
}
/** If false, the actor will not be drawn and will not receive touch events. Default is true. */
public void setVisible (boolean visible) {
this.visible = visible;
}
/** Returns true if this actor and all ascendants are visible. */
public boolean ascendantsVisible () {
Actor actor = this;
do {
if (!actor.isVisible()) return false;
actor = actor.parent;
} while (actor != null);
return true;
}
/** @deprecated Use {@link #ascendantsVisible()}. */
@Deprecated
public boolean ancestorsVisible () {
return ascendantsVisible();
}
/** Returns true if this actor is the {@link Stage#getKeyboardFocus() keyboard focus} actor. */
public boolean hasKeyboardFocus () {
Stage stage = getStage();
return stage != null && stage.getKeyboardFocus() == this;
}
/** Returns true if this actor is the {@link Stage#getScrollFocus() scroll focus} actor. */
public boolean hasScrollFocus () {
Stage stage = getStage();
return stage != null && stage.getScrollFocus() == this;
}
/** Returns true if this actor is a target actor for touch focus.
* @see Stage#addTouchFocus(EventListener, Actor, Actor, int, int) */
public boolean isTouchFocusTarget () {
Stage stage = getStage();
if (stage == null) return false;
for (int i = 0, n = stage.touchFocuses.size; i < n; i++)
if (stage.touchFocuses.get(i).target == this) return true;
return false;
}
/** Returns true if this actor is a listener actor for touch focus.
* @see Stage#addTouchFocus(EventListener, Actor, Actor, int, int) */
public boolean isTouchFocusListener () {
Stage stage = getStage();
if (stage == null) return false;
for (int i = 0, n = stage.touchFocuses.size; i < n; i++)
if (stage.touchFocuses.get(i).listenerActor == this) return true;
return false;
}
/** Returns an application specific object for convenience, or null. */
public @Null Object getUserObject () {
return userObject;
}
/** Sets an application specific object for convenience. */
public void setUserObject (@Null Object userObject) {
this.userObject = userObject;
}
/** Returns the X position of the actor's left edge. */
public float getX () {
return x;
}
/** Returns the X position of the specified {@link Align alignment}. */
public float getX (int alignment) {
float x = this.x;
if ((alignment & right) != 0)
x += width;
else if ((alignment & left) == 0) //
x += width / 2;
return x;
}
public void setX (float x) {
if (this.x != x) {
this.x = x;
positionChanged();
}
}
/** Sets the x position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setX (float x, int alignment) {
if ((alignment & right) != 0)
x -= width;
else if ((alignment & left) == 0) //
x -= width / 2;
if (this.x != x) {
this.x = x;
positionChanged();
}
}
/** Returns the Y position of the actor's bottom edge. */
public float getY () {
return y;
}
public void setY (float y) {
if (this.y != y) {
this.y = y;
positionChanged();
}
}
/** Sets the y position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setY (float y, int alignment) {
if ((alignment & top) != 0)
y -= height;
else if ((alignment & bottom) == 0) //
y -= height / 2;
if (this.y != y) {
this.y = y;
positionChanged();
}
}
/** Returns the Y position of the specified {@link Align alignment}. */
public float getY (int alignment) {
float y = this.y;
if ((alignment & top) != 0)
y += height;
else if ((alignment & bottom) == 0) //
y += height / 2;
return y;
}
/** Sets the position of the actor's bottom left corner. */
public void setPosition (float x, float y) {
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
}
/** Sets the position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setPosition (float x, float y, int alignment) {
if ((alignment & right) != 0)
x -= width;
else if ((alignment & left) == 0) //
x -= width / 2;
if ((alignment & top) != 0)
y -= height;
else if ((alignment & bottom) == 0) //
y -= height / 2;
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
}
/** Add x and y to current position */
public void moveBy (float x, float y) {
if (x != 0 || y != 0) {
this.x += x;
this.y += y;
positionChanged();
}
}
public float getWidth () {
return width;
}
public void setWidth (float width) {
if (this.width != width) {
this.width = width;
sizeChanged();
}
}
public float getHeight () {
return height;
}
public void setHeight (float height) {
if (this.height != height) {
this.height = height;
sizeChanged();
}
}
/** Returns y plus height. */
public float getTop () {
return y + height;
}
/** Returns x plus width. */
public float getRight () {
return x + width;
}
/** Called when the actor's position has been changed. */
protected void positionChanged () {
}
/** Called when the actor's size has been changed. */
protected void sizeChanged () {
}
/** Called when the actor's scale has been changed. */
protected void scaleChanged () {
}
/** Called when the actor's rotation has been changed. */
protected void rotationChanged () {
}
/** Sets the width and height. */
public void setSize (float width, float height) {
if (this.width != width || this.height != height) {
this.width = width;
this.height = height;
sizeChanged();
}
}
/** Adds the specified size to the current size. */
public void sizeBy (float size) {
if (size != 0) {
width += size;
height += size;
sizeChanged();
}
}
/** Adds the specified size to the current size. */
public void sizeBy (float width, float height) {
if (width != 0 || height != 0) {
this.width += width;
this.height += height;
sizeChanged();
}
}
/** Set bounds the x, y, width, and height. */
public void setBounds (float x, float y, float width, float height) {
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
if (this.width != width || this.height != height) {
this.width = width;
this.height = height;
sizeChanged();
}
}
public float getOriginX () {
return originX;
}
public void setOriginX (float originX) {
this.originX = originX;
}
public float getOriginY () {
return originY;
}
public void setOriginY (float originY) {
this.originY = originY;
}
/** Sets the origin position which is relative to the actor's bottom left corner. */
public void setOrigin (float originX, float originY) {
this.originX = originX;
this.originY = originY;
}
/** Sets the origin position to the specified {@link Align alignment}. */
public void setOrigin (int alignment) {
if ((alignment & left) != 0)
originX = 0;
else if ((alignment & right) != 0)
originX = width;
else
originX = width / 2;
if ((alignment & bottom) != 0)
originY = 0;
else if ((alignment & top) != 0)
originY = height;
else
originY = height / 2;
}
public float getScaleX () {
return scaleX;
}
public void setScaleX (float scaleX) {
if (this.scaleX != scaleX) {
this.scaleX = scaleX;
scaleChanged();
}
}
public float getScaleY () {
return scaleY;
}
public void setScaleY (float scaleY) {
if (this.scaleY != scaleY) {
this.scaleY = scaleY;
scaleChanged();
}
}
/** Sets the scale for both X and Y */
public void setScale (float scaleXY) {
if (this.scaleX != scaleXY || this.scaleY != scaleXY) {
this.scaleX = scaleXY;
this.scaleY = scaleXY;
scaleChanged();
}
}
/** Sets the scale X and scale Y. */
public void setScale (float scaleX, float scaleY) {
if (this.scaleX != scaleX || this.scaleY != scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
scaleChanged();
}
}
/** Adds the specified scale to the current scale. */
public void scaleBy (float scale) {
if (scale != 0) {
scaleX += scale;
scaleY += scale;
scaleChanged();
}
}
/** Adds the specified scale to the current scale. */
public void scaleBy (float scaleX, float scaleY) {
if (scaleX != 0 || scaleY != 0) {
this.scaleX += scaleX;
this.scaleY += scaleY;
scaleChanged();
}
}
public float getRotation () {
return rotation;
}
public void setRotation (float degrees) {
if (this.rotation != degrees) {
this.rotation = degrees;
rotationChanged();
}
}
/** Adds the specified rotation to the current rotation. */
public void rotateBy (float amountInDegrees) {
if (amountInDegrees != 0) {
rotation = (rotation + amountInDegrees) % 360;
rotationChanged();
}
}
public void setColor (Color color) {
this.color.set(color);
}
public void setColor (float r, float g, float b, float a) {
color.set(r, g, b, a);
}
/** Returns the color the actor will be tinted when drawn. The returned instance can be modified to change the color. */
public Color getColor () {
return color;
}
/** @see #setName(String)
* @return May be null. */
public @Null String getName () {
return name;
}
/** Set the actor's name, which is used for identification convenience and by {@link #toString()}.
* @param name May be null.
* @see Group#findActor(String) */
public void setName (@Null String name) {
this.name = name;
}
/** Changes the z-order for this actor so it is in front of all siblings. */
public void toFront () {
setZIndex(Integer.MAX_VALUE);
}
/** Changes the z-order for this actor so it is in back of all siblings. */
public void toBack () {
setZIndex(0);
}
/** Sets the z-index of this actor. The z-index is the index into the parent's {@link Group#getChildren() children}, where a
* lower index is below a higher index. Setting a z-index higher than the number of children will move the child to the front.
* Setting a z-index less than zero is invalid.
* @return true if the z-index changed. */
public boolean setZIndex (int index) {
if (index < 0) throw new IllegalArgumentException("ZIndex cannot be < 0.");
Group parent = this.parent;
if (parent == null) return false;
Array<Actor> children = parent.children;
if (children.size <= 1) return false;
index = Math.min(index, children.size - 1);
if (children.get(index) == this) return false;
if (!children.removeValue(this, true)) return false;
children.insert(index, this);
return true;
}
/** Returns the z-index of this actor, or -1 if the actor is not in a group.
* @see #setZIndex(int) */
public int getZIndex () {
Group parent = this.parent;
if (parent == null) return -1;
return parent.children.indexOf(this, true);
}
/** Calls {@link #clipBegin(float, float, float, float)} to clip this actor's bounds. */
public boolean clipBegin () {
return clipBegin(x, y, width, height);
}
/** Clips the specified screen aligned rectangle, specified relative to the transform matrix of the stage's Batch. The
* transform matrix and the stage's camera must not have rotational components. Calling this method must be followed by a call
* to {@link #clipEnd()} if true is returned.
* @return false if the clipping area is zero and no drawing should occur.
* @see ScissorStack */
public boolean clipBegin (float x, float y, float width, float height) {
if (width <= 0 || height <= 0) return false;
Stage stage = this.stage;
if (stage == null) return false;
Rectangle tableBounds = Rectangle.tmp;
tableBounds.x = x;
tableBounds.y = y;
tableBounds.width = width;
tableBounds.height = height;
Rectangle scissorBounds = Pools.obtain(Rectangle.class);
stage.calculateScissors(tableBounds, scissorBounds);
if (ScissorStack.pushScissors(scissorBounds)) return true;
Pools.free(scissorBounds);
return false;
}
/** Ends clipping begun by {@link #clipBegin(float, float, float, float)}. */
public void clipEnd () {
Pools.free(ScissorStack.popScissors());
}
/** Transforms the specified point in screen coordinates to the actor's local coordinate system.
* @see Stage#screenToStageCoordinates(Vector2) */
public Vector2 screenToLocalCoordinates (Vector2 screenCoords) {
Stage stage = this.stage;
if (stage == null) return screenCoords;
return stageToLocalCoordinates(stage.screenToStageCoordinates(screenCoords));
}
/** Transforms the specified point in the stage's coordinates to the actor's local coordinate system. */
public Vector2 stageToLocalCoordinates (Vector2 stageCoords) {
if (parent != null) parent.stageToLocalCoordinates(stageCoords);
parentToLocalCoordinates(stageCoords);
return stageCoords;
}
/** Converts the coordinates given in the parent's coordinate system to this actor's coordinate system. */
public Vector2 parentToLocalCoordinates (Vector2 parentCoords) {
final float rotation = this.rotation;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float childX = x;
final float childY = y;
if (rotation == 0) {
if (scaleX == 1 && scaleY == 1) {
parentCoords.x -= childX;
parentCoords.y -= childY;
} else {
final float originX = this.originX;
final float originY = this.originY;
parentCoords.x = (parentCoords.x - childX - originX) / scaleX + originX;
parentCoords.y = (parentCoords.y - childY - originY) / scaleY + originY;
}
} else {
final float cos = (float)Math.cos(rotation * MathUtils.degreesToRadians);
final float sin = (float)Math.sin(rotation * MathUtils.degreesToRadians);
final float originX = this.originX;
final float originY = this.originY;
final float tox = parentCoords.x - childX - originX;
final float toy = parentCoords.y - childY - originY;
parentCoords.x = (tox * cos + toy * sin) / scaleX + originX;
parentCoords.y = (tox * -sin + toy * cos) / scaleY + originY;
}
return parentCoords;
}
/** Transforms the specified point in the actor's coordinates to be in screen coordinates.
* @see Stage#stageToScreenCoordinates(Vector2) */
public Vector2 localToScreenCoordinates (Vector2 localCoords) {
Stage stage = this.stage;
if (stage == null) return localCoords;
return stage.stageToScreenCoordinates(localToAscendantCoordinates(null, localCoords));
}
/** Transforms the specified point in the actor's coordinates to be in the stage's coordinates. */
public Vector2 localToStageCoordinates (Vector2 localCoords) {
return localToAscendantCoordinates(null, localCoords);
}
/** Transforms the specified point in the actor's coordinates to be in the parent's coordinates. */
public Vector2 localToParentCoordinates (Vector2 localCoords) {
final float rotation = -this.rotation;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float x = this.x;
final float y = this.y;
if (rotation == 0) {
if (scaleX == 1 && scaleY == 1) {
localCoords.x += x;
localCoords.y += y;
} else {
final float originX = this.originX;
final float originY = this.originY;
localCoords.x = (localCoords.x - originX) * scaleX + originX + x;
localCoords.y = (localCoords.y - originY) * scaleY + originY + y;
}
} else {
final float cos = (float)Math.cos(rotation * MathUtils.degreesToRadians);
final float sin = (float)Math.sin(rotation * MathUtils.degreesToRadians);
final float originX = this.originX;
final float originY = this.originY;
final float tox = (localCoords.x - originX) * scaleX;
final float toy = (localCoords.y - originY) * scaleY;
localCoords.x = (tox * cos + toy * sin) + originX + x;
localCoords.y = (tox * -sin + toy * cos) + originY + y;
}
return localCoords;
}
/** Converts coordinates for this actor to those of an ascendant. The ascendant is not required to be the immediate parent.
* @throws IllegalArgumentException if the specified actor is not an ascendant of this actor. */
public Vector2 localToAscendantCoordinates (@Null Actor ascendant, Vector2 localCoords) {
Actor actor = this;
do {
actor.localToParentCoordinates(localCoords);
actor = actor.parent;
if (actor == ascendant) return localCoords;
} while (actor != null);
throw new IllegalArgumentException("Actor is not an ascendant: " + ascendant);
}
/** Converts coordinates for this actor to those of another actor, which can be anywhere in the stage. */
public Vector2 localToActorCoordinates (Actor actor, Vector2 localCoords) {
localToStageCoordinates(localCoords);
return actor.stageToLocalCoordinates(localCoords);
}
/** Draws this actor's debug lines if {@link #getDebug()} is true. */
public void drawDebug (ShapeRenderer shapes) {
drawDebugBounds(shapes);
}
/** Draws a rectangle for the bounds of this actor if {@link #getDebug()} is true. */
protected void drawDebugBounds (ShapeRenderer shapes) {
if (!debug) return;
shapes.set(ShapeType.Line);
if (stage != null) shapes.setColor(stage.getDebugColor());
shapes.rect(x, y, originX, originY, width, height, scaleX, scaleY, rotation);
}
/** If true, {@link #drawDebug(ShapeRenderer)} will be called for this actor. */
public void setDebug (boolean enabled) {
debug = enabled;
if (enabled) Stage.debug = true;
}
public boolean getDebug () {
return debug;
}
/** Calls {@link #setDebug(boolean)} with {@code true}. */
public Actor debug () {
setDebug(true);
return this;
}
public String toString () {
String name = this.name;
if (name == null) {
name = getClass().getName();
int dotIndex = name.lastIndexOf('.');
if (dotIndex != -1) name = name.substring(dotIndex + 1);
}
return name;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d;
import static com.badlogic.gdx.utils.Align.*;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.DelayedRemovalArray;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.reflect.ClassReflection;
/** 2D scene graph node. An actor has a position, rectangular size, origin, scale, rotation, Z index, and color. The position
* corresponds to the unrotated, unscaled bottom left corner of the actor. The position is relative to the actor's parent. The
* origin is relative to the position and is used for scale and rotation.
* <p>
* An actor has a list of in progress {@link Action actions} that are applied to the actor (often over time). These are generally
* used to change the presentation of the actor (moving it, resizing it, etc). See {@link #act(float)}, {@link Action}, and its
* many subclasses.
* <p>
* An actor has two kinds of listeners associated with it: "capture" and regular. The listeners are notified of events the actor
* or its children receive. The regular listeners are designed to allow an actor to respond to events that have been delivered.
* The capture listeners are designed to allow a parent or container actor to handle events before child actors. See {@link #fire}
* for more details.
* <p>
* An {@link InputListener} can receive all the basic input events. More complex listeners (like {@link ClickListener} and
* {@link ActorGestureListener}) can listen for and combine primitive events and recognize complex interactions like multi-touch
* or pinch.
* @author mzechner
* @author Nathan Sweet */
public class Actor {
private @Null Stage stage;
@Null Group parent;
private final DelayedRemovalArray<EventListener> listeners = new DelayedRemovalArray(0);
private final DelayedRemovalArray<EventListener> captureListeners = new DelayedRemovalArray(0);
private final Array<Action> actions = new Array(0);
private @Null String name;
private Touchable touchable = Touchable.enabled;
private boolean visible = true, debug;
float x, y;
float width, height;
float originX, originY;
float scaleX = 1, scaleY = 1;
float rotation;
final Color color = new Color(1, 1, 1, 1);
private @Null Object userObject;
/** Draws the actor. The batch is configured to draw in the parent's coordinate system.
* {@link Batch#draw(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float, float, float, float, float, float)
* This draw method} is convenient to draw a rotated and scaled TextureRegion. {@link Batch#begin()} has already been called on
* the batch. If {@link Batch#end()} is called to draw without the batch then {@link Batch#begin()} must be called before the
* method returns.
* <p>
* The default implementation does nothing.
* @param parentAlpha The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all
* children. */
public void draw (Batch batch, float parentAlpha) {
}
/** Updates the actor based on time. Typically this is called each frame by {@link Stage#act(float)}.
* <p>
* The default implementation calls {@link Action#act(float)} on each action and removes actions that are complete.
* @param delta Time in seconds since the last frame. */
public void act (float delta) {
Array<Action> actions = this.actions;
if (actions.size == 0) return;
if (stage != null && stage.getActionsRequestRendering()) Gdx.graphics.requestRendering();
try {
for (int i = 0; i < actions.size; i++) {
Action action = actions.get(i);
if (action.act(delta) && i < actions.size) {
Action current = actions.get(i);
int actionIndex = current == action ? i : actions.indexOf(action, true);
if (actionIndex != -1) {
actions.removeIndex(actionIndex);
action.setActor(null);
i--;
}
}
}
} catch (RuntimeException ex) {
String context = toString();
throw new RuntimeException("Actor: " + context.substring(0, Math.min(context.length(), 128)), ex);
}
}
/** Sets this actor as the event {@link Event#setTarget(Actor) target} and propagates the event to this actor and ascendants as
* necessary. If this actor is not in the stage, the stage must be set before calling this method.
* <p>
* Events are fired in 2 phases:
* <ol>
* <li>The first phase (the "capture" phase) notifies listeners on each actor starting at the root and propagating down the
* hierarchy to (and including) this actor.</li>
* <li>The second phase notifies listeners on each actor starting at this actor and, if {@link Event#getBubbles()} is true,
* propagating upward to the root.</li>
* </ol>
* If the event is {@link Event#stop() stopped} at any time, it will not propagate to the next actor.
* @return true if the event was {@link Event#cancel() cancelled}. */
public boolean fire (Event event) {
if (event.getStage() == null) event.setStage(getStage());
event.setTarget(this);
// Collect ascendants so event propagation is unaffected by hierarchy changes.
Array<Group> ascendants = Pools.obtain(Array.class);
Group parent = this.parent;
while (parent != null) {
ascendants.add(parent);
parent = parent.parent;
}
try {
// Notify ascendants' capture listeners, starting at the root. Ascendants may stop an event before children receive it.
Object[] ascendantsArray = ascendants.items;
for (int i = ascendants.size - 1; i >= 0; i--) {
Group currentTarget = (Group)ascendantsArray[i];
currentTarget.notify(event, true);
if (event.isStopped()) return event.isCancelled();
}
// Notify the target capture listeners.
notify(event, true);
if (event.isStopped()) return event.isCancelled();
// Notify the target listeners.
notify(event, false);
if (!event.getBubbles()) return event.isCancelled();
if (event.isStopped()) return event.isCancelled();
// Notify ascendants' actor listeners, starting at the target. Children may stop an event before ascendants receive it.
for (int i = 0, n = ascendants.size; i < n; i++) {
((Group)ascendantsArray[i]).notify(event, false);
if (event.isStopped()) return event.isCancelled();
}
return event.isCancelled();
} finally {
ascendants.clear();
Pools.free(ascendants);
}
}
/** Notifies this actor's listeners of the event. The event is not propagated to any ascendants. The event
* {@link Event#setTarget(Actor) target} must be set before calling this method. Before notifying the listeners, this actor is
* set as the {@link Event#getListenerActor() listener actor}. If this actor is not in the stage, the stage must be set before
* calling this method.
* @param capture If true, the capture listeners will be notified instead of the regular listeners.
* @return true if the event was {@link Event#cancel() cancelled}. */
public boolean notify (Event event, boolean capture) {
if (event.getTarget() == null) throw new IllegalArgumentException("The event target cannot be null.");
DelayedRemovalArray<EventListener> listeners = capture ? captureListeners : this.listeners;
if (listeners.size == 0) return event.isCancelled();
event.setListenerActor(this);
event.setCapture(capture);
if (event.getStage() == null) event.setStage(stage);
try {
listeners.begin();
for (int i = 0, n = listeners.size; i < n; i++)
if (listeners.get(i).handle(event)) event.handle();
listeners.end();
} catch (RuntimeException ex) {
String context = toString();
throw new RuntimeException("Actor: " + context.substring(0, Math.min(context.length(), 128)), ex);
}
return event.isCancelled();
}
/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains
* the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the
* bottom left of the actor and width,height is the upper right).
* <p>
* This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not
* occur on this Actor.
* <p>
* The default implementation returns this actor if the point is within this actor's bounds and this actor is visible.
* @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}.
* @see Touchable */
public @Null Actor hit (float x, float y, boolean touchable) {
if (touchable && this.touchable != Touchable.enabled) return null;
if (!isVisible()) return null;
return x >= 0 && x < width && y >= 0 && y < height ? this : null;
}
/** Removes this actor from its parent, if it has a parent.
* @see Group#removeActor(Actor) */
public boolean remove () {
if (parent != null) return parent.removeActor(this, true);
return false;
}
/** Add a listener to receive events that {@link #hit(float, float, boolean) hit} this actor. See {@link #fire(Event)}.
* @see InputListener
* @see ClickListener */
public boolean addListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
if (!listeners.contains(listener, true)) {
listeners.add(listener);
return true;
}
return false;
}
public boolean removeListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
return listeners.removeValue(listener, true);
}
public DelayedRemovalArray<EventListener> getListeners () {
return listeners;
}
/** Adds a listener that is only notified during the capture phase.
* @see #fire(Event) */
public boolean addCaptureListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
if (!captureListeners.contains(listener, true)) captureListeners.add(listener);
return true;
}
public boolean removeCaptureListener (EventListener listener) {
if (listener == null) throw new IllegalArgumentException("listener cannot be null.");
return captureListeners.removeValue(listener, true);
}
public DelayedRemovalArray<EventListener> getCaptureListeners () {
return captureListeners;
}
public void addAction (Action action) {
action.setActor(this);
actions.add(action);
if (stage != null && stage.getActionsRequestRendering()) Gdx.graphics.requestRendering();
}
/** @param action May be null, in which case nothing is done. */
public void removeAction (@Null Action action) {
if (action != null && actions.removeValue(action, true)) action.setActor(null);
}
public Array<Action> getActions () {
return actions;
}
/** Returns true if the actor has one or more actions. */
public boolean hasActions () {
return actions.size > 0;
}
/** Removes all actions on this actor. */
public void clearActions () {
for (int i = actions.size - 1; i >= 0; i--)
actions.get(i).setActor(null);
actions.clear();
}
/** Removes all listeners on this actor. */
public void clearListeners () {
listeners.clear();
captureListeners.clear();
}
/** Removes all actions and listeners on this actor. */
public void clear () {
clearActions();
clearListeners();
}
/** Returns the stage that this actor is currently in, or null if not in a stage. */
public @Null Stage getStage () {
return stage;
}
/** Called by the framework when this actor or any ascendant is added to a group that is in the stage.
* @param stage May be null if the actor or any ascendant is no longer in a stage. */
protected void setStage (Stage stage) {
this.stage = stage;
}
/** Returns true if this actor is the same as or is the descendant of the specified actor. */
public boolean isDescendantOf (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
Actor parent = this;
do {
if (parent == actor) return true;
parent = parent.parent;
} while (parent != null);
return false;
}
/** Returns true if this actor is the same as or is the ascendant of the specified actor. */
public boolean isAscendantOf (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
do {
if (actor == this) return true;
actor = actor.parent;
} while (actor != null);
return false;
}
/** Returns this actor or the first ascendant of this actor that is assignable with the specified type, or null if none were
* found. */
public @Null <T extends Actor> T firstAscendant (Class<T> type) {
if (type == null) throw new IllegalArgumentException("actor cannot be null.");
Actor actor = this;
do {
if (ClassReflection.isInstance(type, actor)) return (T)actor;
actor = actor.parent;
} while (actor != null);
return null;
}
/** Returns true if the actor's parent is not null. */
public boolean hasParent () {
return parent != null;
}
/** Returns the parent actor, or null if not in a group. */
public @Null Group getParent () {
return parent;
}
/** Called by the framework when an actor is added to or removed from a group.
* @param parent May be null if the actor has been removed from the parent. */
protected void setParent (@Null Group parent) {
this.parent = parent;
}
/** Returns true if input events are processed by this actor. */
public boolean isTouchable () {
return touchable == Touchable.enabled;
}
public Touchable getTouchable () {
return touchable;
}
/** Determines how touch events are distributed to this actor. Default is {@link Touchable#enabled}. */
public void setTouchable (Touchable touchable) {
this.touchable = touchable;
}
public boolean isVisible () {
return visible;
}
/** If false, the actor will not be drawn and will not receive touch events. Default is true. */
public void setVisible (boolean visible) {
this.visible = visible;
}
/** Returns true if this actor and all ascendants are visible. */
public boolean ascendantsVisible () {
Actor actor = this;
do {
if (!actor.isVisible()) return false;
actor = actor.parent;
} while (actor != null);
return true;
}
/** @deprecated Use {@link #ascendantsVisible()}. */
@Deprecated
public boolean ancestorsVisible () {
return ascendantsVisible();
}
/** Returns true if this actor is the {@link Stage#getKeyboardFocus() keyboard focus} actor. */
public boolean hasKeyboardFocus () {
Stage stage = getStage();
return stage != null && stage.getKeyboardFocus() == this;
}
/** Returns true if this actor is the {@link Stage#getScrollFocus() scroll focus} actor. */
public boolean hasScrollFocus () {
Stage stage = getStage();
return stage != null && stage.getScrollFocus() == this;
}
/** Returns true if this actor is a target actor for touch focus.
* @see Stage#addTouchFocus(EventListener, Actor, Actor, int, int) */
public boolean isTouchFocusTarget () {
Stage stage = getStage();
if (stage == null) return false;
for (int i = 0, n = stage.touchFocuses.size; i < n; i++)
if (stage.touchFocuses.get(i).target == this) return true;
return false;
}
/** Returns true if this actor is a listener actor for touch focus.
* @see Stage#addTouchFocus(EventListener, Actor, Actor, int, int) */
public boolean isTouchFocusListener () {
Stage stage = getStage();
if (stage == null) return false;
for (int i = 0, n = stage.touchFocuses.size; i < n; i++)
if (stage.touchFocuses.get(i).listenerActor == this) return true;
return false;
}
/** Returns an application specific object for convenience, or null. */
public @Null Object getUserObject () {
return userObject;
}
/** Sets an application specific object for convenience. */
public void setUserObject (@Null Object userObject) {
this.userObject = userObject;
}
/** Returns the X position of the actor's left edge. */
public float getX () {
return x;
}
/** Returns the X position of the specified {@link Align alignment}. */
public float getX (int alignment) {
float x = this.x;
if ((alignment & right) != 0)
x += width;
else if ((alignment & left) == 0) //
x += width / 2;
return x;
}
public void setX (float x) {
if (this.x != x) {
this.x = x;
positionChanged();
}
}
/** Sets the x position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setX (float x, int alignment) {
if ((alignment & right) != 0)
x -= width;
else if ((alignment & left) == 0) //
x -= width / 2;
if (this.x != x) {
this.x = x;
positionChanged();
}
}
/** Returns the Y position of the actor's bottom edge. */
public float getY () {
return y;
}
public void setY (float y) {
if (this.y != y) {
this.y = y;
positionChanged();
}
}
/** Sets the y position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setY (float y, int alignment) {
if ((alignment & top) != 0)
y -= height;
else if ((alignment & bottom) == 0) //
y -= height / 2;
if (this.y != y) {
this.y = y;
positionChanged();
}
}
/** Returns the Y position of the specified {@link Align alignment}. */
public float getY (int alignment) {
float y = this.y;
if ((alignment & top) != 0)
y += height;
else if ((alignment & bottom) == 0) //
y += height / 2;
return y;
}
/** Sets the position of the actor's bottom left corner. */
public void setPosition (float x, float y) {
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
}
/** Sets the position using the specified {@link Align alignment}. Note this may set the position to non-integer
* coordinates. */
public void setPosition (float x, float y, int alignment) {
if ((alignment & right) != 0)
x -= width;
else if ((alignment & left) == 0) //
x -= width / 2;
if ((alignment & top) != 0)
y -= height;
else if ((alignment & bottom) == 0) //
y -= height / 2;
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
}
/** Add x and y to current position */
public void moveBy (float x, float y) {
if (x != 0 || y != 0) {
this.x += x;
this.y += y;
positionChanged();
}
}
public float getWidth () {
return width;
}
public void setWidth (float width) {
if (this.width != width) {
this.width = width;
sizeChanged();
}
}
public float getHeight () {
return height;
}
public void setHeight (float height) {
if (this.height != height) {
this.height = height;
sizeChanged();
}
}
/** Returns y plus height. */
public float getTop () {
return y + height;
}
/** Returns x plus width. */
public float getRight () {
return x + width;
}
/** Called when the actor's position has been changed. */
protected void positionChanged () {
}
/** Called when the actor's size has been changed. */
protected void sizeChanged () {
}
/** Called when the actor's scale has been changed. */
protected void scaleChanged () {
}
/** Called when the actor's rotation has been changed. */
protected void rotationChanged () {
}
/** Sets the width and height. */
public void setSize (float width, float height) {
if (this.width != width || this.height != height) {
this.width = width;
this.height = height;
sizeChanged();
}
}
/** Adds the specified size to the current size. */
public void sizeBy (float size) {
if (size != 0) {
width += size;
height += size;
sizeChanged();
}
}
/** Adds the specified size to the current size. */
public void sizeBy (float width, float height) {
if (width != 0 || height != 0) {
this.width += width;
this.height += height;
sizeChanged();
}
}
/** Set bounds the x, y, width, and height. */
public void setBounds (float x, float y, float width, float height) {
if (this.x != x || this.y != y) {
this.x = x;
this.y = y;
positionChanged();
}
if (this.width != width || this.height != height) {
this.width = width;
this.height = height;
sizeChanged();
}
}
public float getOriginX () {
return originX;
}
public void setOriginX (float originX) {
this.originX = originX;
}
public float getOriginY () {
return originY;
}
public void setOriginY (float originY) {
this.originY = originY;
}
/** Sets the origin position which is relative to the actor's bottom left corner. */
public void setOrigin (float originX, float originY) {
this.originX = originX;
this.originY = originY;
}
/** Sets the origin position to the specified {@link Align alignment}. */
public void setOrigin (int alignment) {
if ((alignment & left) != 0)
originX = 0;
else if ((alignment & right) != 0)
originX = width;
else
originX = width / 2;
if ((alignment & bottom) != 0)
originY = 0;
else if ((alignment & top) != 0)
originY = height;
else
originY = height / 2;
}
public float getScaleX () {
return scaleX;
}
public void setScaleX (float scaleX) {
if (this.scaleX != scaleX) {
this.scaleX = scaleX;
scaleChanged();
}
}
public float getScaleY () {
return scaleY;
}
public void setScaleY (float scaleY) {
if (this.scaleY != scaleY) {
this.scaleY = scaleY;
scaleChanged();
}
}
/** Sets the scale for both X and Y */
public void setScale (float scaleXY) {
if (this.scaleX != scaleXY || this.scaleY != scaleXY) {
this.scaleX = scaleXY;
this.scaleY = scaleXY;
scaleChanged();
}
}
/** Sets the scale X and scale Y. */
public void setScale (float scaleX, float scaleY) {
if (this.scaleX != scaleX || this.scaleY != scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
scaleChanged();
}
}
/** Adds the specified scale to the current scale. */
public void scaleBy (float scale) {
if (scale != 0) {
scaleX += scale;
scaleY += scale;
scaleChanged();
}
}
/** Adds the specified scale to the current scale. */
public void scaleBy (float scaleX, float scaleY) {
if (scaleX != 0 || scaleY != 0) {
this.scaleX += scaleX;
this.scaleY += scaleY;
scaleChanged();
}
}
public float getRotation () {
return rotation;
}
public void setRotation (float degrees) {
if (this.rotation != degrees) {
this.rotation = degrees;
rotationChanged();
}
}
/** Adds the specified rotation to the current rotation. */
public void rotateBy (float amountInDegrees) {
if (amountInDegrees != 0) {
rotation = (rotation + amountInDegrees) % 360;
rotationChanged();
}
}
public void setColor (Color color) {
this.color.set(color);
}
public void setColor (float r, float g, float b, float a) {
color.set(r, g, b, a);
}
/** Returns the color the actor will be tinted when drawn. The returned instance can be modified to change the color. */
public Color getColor () {
return color;
}
/** @see #setName(String)
* @return May be null. */
public @Null String getName () {
return name;
}
/** Set the actor's name, which is used for identification convenience and by {@link #toString()}.
* @param name May be null.
* @see Group#findActor(String) */
public void setName (@Null String name) {
this.name = name;
}
/** Changes the z-order for this actor so it is in front of all siblings. */
public void toFront () {
setZIndex(Integer.MAX_VALUE);
}
/** Changes the z-order for this actor so it is in back of all siblings. */
public void toBack () {
setZIndex(0);
}
/** Sets the z-index of this actor. The z-index is the index into the parent's {@link Group#getChildren() children}, where a
* lower index is below a higher index. Setting a z-index higher than the number of children will move the child to the front.
* Setting a z-index less than zero is invalid.
* @return true if the z-index changed. */
public boolean setZIndex (int index) {
if (index < 0) throw new IllegalArgumentException("ZIndex cannot be < 0.");
Group parent = this.parent;
if (parent == null) return false;
Array<Actor> children = parent.children;
if (children.size <= 1) return false;
index = Math.min(index, children.size - 1);
if (children.get(index) == this) return false;
if (!children.removeValue(this, true)) return false;
children.insert(index, this);
return true;
}
/** Returns the z-index of this actor, or -1 if the actor is not in a group.
* @see #setZIndex(int) */
public int getZIndex () {
Group parent = this.parent;
if (parent == null) return -1;
return parent.children.indexOf(this, true);
}
/** Calls {@link #clipBegin(float, float, float, float)} to clip this actor's bounds. */
public boolean clipBegin () {
return clipBegin(x, y, width, height);
}
/** Clips the specified screen aligned rectangle, specified relative to the transform matrix of the stage's Batch. The
* transform matrix and the stage's camera must not have rotational components. Calling this method must be followed by a call
* to {@link #clipEnd()} if true is returned.
* @return false if the clipping area is zero and no drawing should occur.
* @see ScissorStack */
public boolean clipBegin (float x, float y, float width, float height) {
if (width <= 0 || height <= 0) return false;
Stage stage = this.stage;
if (stage == null) return false;
Rectangle tableBounds = Rectangle.tmp;
tableBounds.x = x;
tableBounds.y = y;
tableBounds.width = width;
tableBounds.height = height;
Rectangle scissorBounds = Pools.obtain(Rectangle.class);
stage.calculateScissors(tableBounds, scissorBounds);
if (ScissorStack.pushScissors(scissorBounds)) return true;
Pools.free(scissorBounds);
return false;
}
/** Ends clipping begun by {@link #clipBegin(float, float, float, float)}. */
public void clipEnd () {
Pools.free(ScissorStack.popScissors());
}
/** Transforms the specified point in screen coordinates to the actor's local coordinate system.
* @see Stage#screenToStageCoordinates(Vector2) */
public Vector2 screenToLocalCoordinates (Vector2 screenCoords) {
Stage stage = this.stage;
if (stage == null) return screenCoords;
return stageToLocalCoordinates(stage.screenToStageCoordinates(screenCoords));
}
/** Transforms the specified point in the stage's coordinates to the actor's local coordinate system. */
public Vector2 stageToLocalCoordinates (Vector2 stageCoords) {
if (parent != null) parent.stageToLocalCoordinates(stageCoords);
parentToLocalCoordinates(stageCoords);
return stageCoords;
}
/** Converts the coordinates given in the parent's coordinate system to this actor's coordinate system. */
public Vector2 parentToLocalCoordinates (Vector2 parentCoords) {
final float rotation = this.rotation;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float childX = x;
final float childY = y;
if (rotation == 0) {
if (scaleX == 1 && scaleY == 1) {
parentCoords.x -= childX;
parentCoords.y -= childY;
} else {
final float originX = this.originX;
final float originY = this.originY;
parentCoords.x = (parentCoords.x - childX - originX) / scaleX + originX;
parentCoords.y = (parentCoords.y - childY - originY) / scaleY + originY;
}
} else {
final float cos = (float)Math.cos(rotation * MathUtils.degreesToRadians);
final float sin = (float)Math.sin(rotation * MathUtils.degreesToRadians);
final float originX = this.originX;
final float originY = this.originY;
final float tox = parentCoords.x - childX - originX;
final float toy = parentCoords.y - childY - originY;
parentCoords.x = (tox * cos + toy * sin) / scaleX + originX;
parentCoords.y = (tox * -sin + toy * cos) / scaleY + originY;
}
return parentCoords;
}
/** Transforms the specified point in the actor's coordinates to be in screen coordinates.
* @see Stage#stageToScreenCoordinates(Vector2) */
public Vector2 localToScreenCoordinates (Vector2 localCoords) {
Stage stage = this.stage;
if (stage == null) return localCoords;
return stage.stageToScreenCoordinates(localToAscendantCoordinates(null, localCoords));
}
/** Transforms the specified point in the actor's coordinates to be in the stage's coordinates. */
public Vector2 localToStageCoordinates (Vector2 localCoords) {
return localToAscendantCoordinates(null, localCoords);
}
/** Transforms the specified point in the actor's coordinates to be in the parent's coordinates. */
public Vector2 localToParentCoordinates (Vector2 localCoords) {
final float rotation = -this.rotation;
final float scaleX = this.scaleX;
final float scaleY = this.scaleY;
final float x = this.x;
final float y = this.y;
if (rotation == 0) {
if (scaleX == 1 && scaleY == 1) {
localCoords.x += x;
localCoords.y += y;
} else {
final float originX = this.originX;
final float originY = this.originY;
localCoords.x = (localCoords.x - originX) * scaleX + originX + x;
localCoords.y = (localCoords.y - originY) * scaleY + originY + y;
}
} else {
final float cos = (float)Math.cos(rotation * MathUtils.degreesToRadians);
final float sin = (float)Math.sin(rotation * MathUtils.degreesToRadians);
final float originX = this.originX;
final float originY = this.originY;
final float tox = (localCoords.x - originX) * scaleX;
final float toy = (localCoords.y - originY) * scaleY;
localCoords.x = (tox * cos + toy * sin) + originX + x;
localCoords.y = (tox * -sin + toy * cos) + originY + y;
}
return localCoords;
}
/** Converts coordinates for this actor to those of an ascendant. The ascendant is not required to be the immediate parent.
* @throws IllegalArgumentException if the specified actor is not an ascendant of this actor. */
public Vector2 localToAscendantCoordinates (@Null Actor ascendant, Vector2 localCoords) {
Actor actor = this;
do {
actor.localToParentCoordinates(localCoords);
actor = actor.parent;
if (actor == ascendant) return localCoords;
} while (actor != null);
throw new IllegalArgumentException("Actor is not an ascendant: " + ascendant);
}
/** Converts coordinates for this actor to those of another actor, which can be anywhere in the stage. */
public Vector2 localToActorCoordinates (Actor actor, Vector2 localCoords) {
localToStageCoordinates(localCoords);
return actor.stageToLocalCoordinates(localCoords);
}
/** Draws this actor's debug lines if {@link #getDebug()} is true. */
public void drawDebug (ShapeRenderer shapes) {
drawDebugBounds(shapes);
}
/** Draws a rectangle for the bounds of this actor if {@link #getDebug()} is true. */
protected void drawDebugBounds (ShapeRenderer shapes) {
if (!debug) return;
shapes.set(ShapeType.Line);
if (stage != null) shapes.setColor(stage.getDebugColor());
shapes.rect(x, y, originX, originY, width, height, scaleX, scaleY, rotation);
}
/** If true, {@link #drawDebug(ShapeRenderer)} will be called for this actor. */
public void setDebug (boolean enabled) {
debug = enabled;
if (enabled) Stage.debug = true;
}
public boolean getDebug () {
return debug;
}
/** Calls {@link #setDebug(boolean)} with {@code true}. */
public Actor debug () {
setDebug(true);
return this;
}
public String toString () {
String name = this.name;
if (name == null) {
name = getClass().getName();
int dotIndex = name.lastIndexOf('.');
if (dotIndex != -1) name = name.substring(dotIndex + 1);
}
return name;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/scenes/scene2d/actions/SizeByAction.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
/** Moves an actor from its current size to a relative size.
* @author Nathan Sweet */
public class SizeByAction extends RelativeTemporalAction {
private float amountWidth, amountHeight;
protected void updateRelative (float percentDelta) {
target.sizeBy(amountWidth * percentDelta, amountHeight * percentDelta);
}
public void setAmount (float width, float height) {
amountWidth = width;
amountHeight = height;
}
public float getAmountWidth () {
return amountWidth;
}
public void setAmountWidth (float width) {
amountWidth = width;
}
public float getAmountHeight () {
return amountHeight;
}
public void setAmountHeight (float height) {
amountHeight = height;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.actions;
/** Moves an actor from its current size to a relative size.
* @author Nathan Sweet */
public class SizeByAction extends RelativeTemporalAction {
private float amountWidth, amountHeight;
protected void updateRelative (float percentDelta) {
target.sizeBy(amountWidth * percentDelta, amountHeight * percentDelta);
}
public void setAmount (float width, float height) {
amountWidth = width;
amountHeight = height;
}
public float getAmountWidth () {
return amountWidth;
}
public void setAmountWidth (float width) {
amountWidth = width;
}
public float getAmountHeight () {
return amountHeight;
}
public void setAmountHeight (float height) {
amountHeight = height;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btTriangleRaycastCallback.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class btTriangleRaycastCallback extends btTriangleCallback {
private long swigCPtr;
protected btTriangleRaycastCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleRaycastCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleRaycastCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public btTriangleRaycastCallback (long cPtr, boolean cMemoryOwn) {
this("btTriangleRaycastCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleRaycastCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleRaycastCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleRaycastCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.btTriangleRaycastCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.btTriangleRaycastCallback_change_ownership(this, swigCPtr, true);
}
public void setFrom (btVector3 value) {
CollisionJNI.btTriangleRaycastCallback_from_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getFrom () {
long cPtr = CollisionJNI.btTriangleRaycastCallback_from_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setTo (btVector3 value) {
CollisionJNI.btTriangleRaycastCallback_to_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTo () {
long cPtr = CollisionJNI.btTriangleRaycastCallback_to_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setFlags (long value) {
CollisionJNI.btTriangleRaycastCallback_flags_set(swigCPtr, this, value);
}
public long getFlags () {
return CollisionJNI.btTriangleRaycastCallback_flags_get(swigCPtr, this);
}
public void setHitFraction (float value) {
CollisionJNI.btTriangleRaycastCallback_hitFraction_set(swigCPtr, this, value);
}
public float getHitFraction () {
return CollisionJNI.btTriangleRaycastCallback_hitFraction_get(swigCPtr, this);
}
public btTriangleRaycastCallback (Vector3 from, Vector3 to, long flags) {
this(CollisionJNI.new_btTriangleRaycastCallback__SWIG_0(from, to, flags), true);
CollisionJNI.btTriangleRaycastCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public btTriangleRaycastCallback (Vector3 from, Vector3 to) {
this(CollisionJNI.new_btTriangleRaycastCallback__SWIG_1(from, to), true);
CollisionJNI.btTriangleRaycastCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public void processTriangle (btVector3 triangle, int partId, int triangleIndex) {
if (getClass() == btTriangleRaycastCallback.class)
CollisionJNI.btTriangleRaycastCallback_processTriangle(swigCPtr, this, btVector3.getCPtr(triangle), triangle, partId,
triangleIndex);
else
CollisionJNI.btTriangleRaycastCallback_processTriangleSwigExplicitbtTriangleRaycastCallback(swigCPtr, this,
btVector3.getCPtr(triangle), triangle, partId, triangleIndex);
}
public float reportHit (Vector3 hitNormalLocal, float hitFraction, int partId, int triangleIndex) {
return CollisionJNI.btTriangleRaycastCallback_reportHit(swigCPtr, this, hitNormalLocal, hitFraction, partId, triangleIndex);
}
public final static class EFlags {
public final static int kF_None = 0;
public final static int kF_FilterBackfaces = 1 << 0;
public final static int kF_KeepUnflippedNormal = 1 << 1;
public final static int kF_UseSubSimplexConvexCastRaytest = 1 << 2;
public final static int kF_UseGjkConvexCastRaytest = 1 << 3;
public final static int kF_Terminator = 0xFFFFFFFF;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class btTriangleRaycastCallback extends btTriangleCallback {
private long swigCPtr;
protected btTriangleRaycastCallback (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleRaycastCallback_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleRaycastCallback, normally you should not need this constructor it's intended for low-level
* usage. */
public btTriangleRaycastCallback (long cPtr, boolean cMemoryOwn) {
this("btTriangleRaycastCallback", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleRaycastCallback_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleRaycastCallback obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleRaycastCallback(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
protected void swigDirectorDisconnect () {
swigCMemOwn = false;
delete();
}
public void swigReleaseOwnership () {
swigCMemOwn = false;
CollisionJNI.btTriangleRaycastCallback_change_ownership(this, swigCPtr, false);
}
public void swigTakeOwnership () {
swigCMemOwn = true;
CollisionJNI.btTriangleRaycastCallback_change_ownership(this, swigCPtr, true);
}
public void setFrom (btVector3 value) {
CollisionJNI.btTriangleRaycastCallback_from_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getFrom () {
long cPtr = CollisionJNI.btTriangleRaycastCallback_from_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setTo (btVector3 value) {
CollisionJNI.btTriangleRaycastCallback_to_set(swigCPtr, this, btVector3.getCPtr(value), value);
}
public btVector3 getTo () {
long cPtr = CollisionJNI.btTriangleRaycastCallback_to_get(swigCPtr, this);
return (cPtr == 0) ? null : new btVector3(cPtr, false);
}
public void setFlags (long value) {
CollisionJNI.btTriangleRaycastCallback_flags_set(swigCPtr, this, value);
}
public long getFlags () {
return CollisionJNI.btTriangleRaycastCallback_flags_get(swigCPtr, this);
}
public void setHitFraction (float value) {
CollisionJNI.btTriangleRaycastCallback_hitFraction_set(swigCPtr, this, value);
}
public float getHitFraction () {
return CollisionJNI.btTriangleRaycastCallback_hitFraction_get(swigCPtr, this);
}
public btTriangleRaycastCallback (Vector3 from, Vector3 to, long flags) {
this(CollisionJNI.new_btTriangleRaycastCallback__SWIG_0(from, to, flags), true);
CollisionJNI.btTriangleRaycastCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public btTriangleRaycastCallback (Vector3 from, Vector3 to) {
this(CollisionJNI.new_btTriangleRaycastCallback__SWIG_1(from, to), true);
CollisionJNI.btTriangleRaycastCallback_director_connect(this, swigCPtr, swigCMemOwn, true);
}
public void processTriangle (btVector3 triangle, int partId, int triangleIndex) {
if (getClass() == btTriangleRaycastCallback.class)
CollisionJNI.btTriangleRaycastCallback_processTriangle(swigCPtr, this, btVector3.getCPtr(triangle), triangle, partId,
triangleIndex);
else
CollisionJNI.btTriangleRaycastCallback_processTriangleSwigExplicitbtTriangleRaycastCallback(swigCPtr, this,
btVector3.getCPtr(triangle), triangle, partId, triangleIndex);
}
public float reportHit (Vector3 hitNormalLocal, float hitFraction, int partId, int triangleIndex) {
return CollisionJNI.btTriangleRaycastCallback_reportHit(swigCPtr, this, hitNormalLocal, hitFraction, partId, triangleIndex);
}
public final static class EFlags {
public final static int kF_None = 0;
public final static int kF_FilterBackfaces = 1 << 0;
public final static int kF_KeepUnflippedNormal = 1 << 1;
public final static int kF_UseSubSimplexConvexCastRaytest = 1 << 2;
public final static int kF_UseGjkConvexCastRaytest = 1 << 3;
public final static int kF_Terminator = 0xFFFFFFFF;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./tests/gdx-tests/src/com/badlogic/gdx/tests/box2d/SphereStack.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
* Copyright 2010 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.badlogic.gdx.tests.box2d;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.EdgeShape;
import com.badlogic.gdx.physics.box2d.World;
public class SphereStack extends Box2DTest {
int e_count = 10;
@Override
protected void createWorld (World world) {
{
BodyDef bd = new BodyDef();
Body ground = world.createBody(bd);
EdgeShape shape = new EdgeShape();
shape.set(new Vector2(-40, 0), new Vector2(40, 0));
ground.createFixture(shape, 0);
shape.dispose();
}
{
CircleShape shape = new CircleShape();
shape.setRadius(1.0f);
for (int i = 0; i < e_count; i++) {
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 4.0f + 3.0f * i);
Body body = world.createBody(bd);
body.createFixture(shape, 1.0f);
}
shape.dispose();
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
* Copyright 2010 Mario Zechner ([email protected]), Nathan Sweet ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.badlogic.gdx.tests.box2d;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.EdgeShape;
import com.badlogic.gdx.physics.box2d.World;
public class SphereStack extends Box2DTest {
int e_count = 10;
@Override
protected void createWorld (World world) {
{
BodyDef bd = new BodyDef();
Body ground = world.createBody(bd);
EdgeShape shape = new EdgeShape();
shape.set(new Vector2(-40, 0), new Vector2(40, 0));
ground.createFixture(shape, 0);
shape.dispose();
}
{
CircleShape shape = new CircleShape();
shape.setRadius(1.0f);
for (int i = 0; i < e_count; i++) {
BodyDef bd = new BodyDef();
bd.type = BodyType.DynamicBody;
bd.position.set(0, 4.0f + 3.0f * i);
Body body = world.createBody(bd);
body.createFixture(shape, 1.0f);
}
shape.dispose();
}
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-tools/src/com/badlogic/gdx/tools/flame/CountPanel.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools.flame;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
/** @author Inferno */
class CountPanel extends EditorPanel {
Slider maxSlider, minSlider;
public CountPanel (final FlameMain editor, String name, String description, int min, int max) {
super(editor, name, description);
initializeComponents(min, max);
setValue(null);
}
private void initializeComponents (int min, int max) {
// Min
minSlider = new Slider(0, 0, 999999, 1);
minSlider.setValue(min);
minSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
ParticleController controller = editor.getEmitter();
controller.emitter.minParticleCount = (int)minSlider.getValue();
editor.restart();
}
});
// Max
maxSlider = new Slider(0, 0, 999999, 1);
maxSlider.setValue(max);
maxSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
ParticleController controller = editor.getEmitter();
controller.emitter.maxParticleCount = (int)maxSlider.getValue();
editor.restart();
}
});
int i = 0;
contentPanel.add(new JLabel("Min"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(minSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(new JLabel("Max"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(maxSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.tools.flame;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
/** @author Inferno */
class CountPanel extends EditorPanel {
Slider maxSlider, minSlider;
public CountPanel (final FlameMain editor, String name, String description, int min, int max) {
super(editor, name, description);
initializeComponents(min, max);
setValue(null);
}
private void initializeComponents (int min, int max) {
// Min
minSlider = new Slider(0, 0, 999999, 1);
minSlider.setValue(min);
minSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
ParticleController controller = editor.getEmitter();
controller.emitter.minParticleCount = (int)minSlider.getValue();
editor.restart();
}
});
// Max
maxSlider = new Slider(0, 0, 999999, 1);
maxSlider.setValue(max);
maxSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
ParticleController controller = editor.getEmitter();
controller.emitter.maxParticleCount = (int)maxSlider.getValue();
editor.restart();
}
});
int i = 0;
contentPanel.add(new JLabel("Min"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(minSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(new JLabel("Max"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
contentPanel.add(maxSlider, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/softbody/com/badlogic/gdx/physics/bullet/softbody/SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.softbody;
public class SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.softbody;
public class SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t {
private transient long swigCPtr;
protected SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_btAlignedObjectArrayT_btSoftBody__Cluster_p_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/org/jbox2d/collision/broadphase/Pair.java | /*******************************************************************************
* Copyright (c) 2013, Daniel Murphy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
package org.jbox2d.collision.broadphase;
// updated to rev 100
/** Java note: at the "creation" of each node, a random key is given to that node, and that's what we sort from. */
public class Pair implements Comparable<Pair> {
public int proxyIdA;
public int proxyIdB;
public int compareTo (Pair pair2) {
if (this.proxyIdA < pair2.proxyIdA) {
return -1;
}
if (this.proxyIdA == pair2.proxyIdA) {
return proxyIdB < pair2.proxyIdB ? -1 : proxyIdB == pair2.proxyIdB ? 0 : 1;
}
return 1;
}
}
| /*******************************************************************************
* Copyright (c) 2013, Daniel Murphy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
package org.jbox2d.collision.broadphase;
// updated to rev 100
/** Java note: at the "creation" of each node, a random key is given to that node, and that's what we sort from. */
public class Pair implements Comparable<Pair> {
public int proxyIdA;
public int proxyIdB;
public int compareTo (Pair pair2) {
if (this.proxyIdA < pair2.proxyIdA) {
return -1;
}
if (this.proxyIdA == pair2.proxyIdA) {
return proxyIdB < pair2.proxyIdB ? -1 : proxyIdB == pair2.proxyIdB ? 0 : 1;
}
return 1;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/btTriangleMeshShape.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class btTriangleMeshShape extends btConcaveShape {
private long swigCPtr;
protected btTriangleMeshShape (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleMeshShape_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleMeshShape, normally you should not need this constructor it's intended for low-level usage. */
public btTriangleMeshShape (long cPtr, boolean cMemoryOwn) {
this("btTriangleMeshShape", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleMeshShape_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleMeshShape obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleMeshShape(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return CollisionJNI.btTriangleMeshShape_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
CollisionJNI.btTriangleMeshShape_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return CollisionJNI.btTriangleMeshShape_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
CollisionJNI.btTriangleMeshShape_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return CollisionJNI.btTriangleMeshShape_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
CollisionJNI.btTriangleMeshShape_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return CollisionJNI.btTriangleMeshShape_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
CollisionJNI.btTriangleMeshShape_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public Vector3 localGetSupportingVertex (Vector3 vec) {
return CollisionJNI.btTriangleMeshShape_localGetSupportingVertex(swigCPtr, this, vec);
}
public Vector3 localGetSupportingVertexWithoutMargin (Vector3 vec) {
return CollisionJNI.btTriangleMeshShape_localGetSupportingVertexWithoutMargin(swigCPtr, this, vec);
}
public void recalcLocalAabb () {
CollisionJNI.btTriangleMeshShape_recalcLocalAabb(swigCPtr, this);
}
public btStridingMeshInterface getMeshInterface () {
long cPtr = CollisionJNI.btTriangleMeshShape_getMeshInterface(swigCPtr, this);
return (cPtr == 0) ? null : new btStridingMeshInterface(cPtr, false);
}
public btStridingMeshInterface getMeshInterfaceConst () {
long cPtr = CollisionJNI.btTriangleMeshShape_getMeshInterfaceConst(swigCPtr, this);
return (cPtr == 0) ? null : new btStridingMeshInterface(cPtr, false);
}
public Vector3 getLocalAabbMin () {
return CollisionJNI.btTriangleMeshShape_getLocalAabbMin(swigCPtr, this);
}
public Vector3 getLocalAabbMax () {
return CollisionJNI.btTriangleMeshShape_getLocalAabbMax(swigCPtr, this);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
public class btTriangleMeshShape extends btConcaveShape {
private long swigCPtr;
protected btTriangleMeshShape (final String className, long cPtr, boolean cMemoryOwn) {
super(className, CollisionJNI.btTriangleMeshShape_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btTriangleMeshShape, normally you should not need this constructor it's intended for low-level usage. */
public btTriangleMeshShape (long cPtr, boolean cMemoryOwn) {
this("btTriangleMeshShape", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(CollisionJNI.btTriangleMeshShape_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btTriangleMeshShape obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
CollisionJNI.delete_btTriangleMeshShape(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return CollisionJNI.btTriangleMeshShape_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
CollisionJNI.btTriangleMeshShape_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return CollisionJNI.btTriangleMeshShape_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
CollisionJNI.btTriangleMeshShape_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return CollisionJNI.btTriangleMeshShape_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
CollisionJNI.btTriangleMeshShape_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return CollisionJNI.btTriangleMeshShape_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
CollisionJNI.btTriangleMeshShape_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public Vector3 localGetSupportingVertex (Vector3 vec) {
return CollisionJNI.btTriangleMeshShape_localGetSupportingVertex(swigCPtr, this, vec);
}
public Vector3 localGetSupportingVertexWithoutMargin (Vector3 vec) {
return CollisionJNI.btTriangleMeshShape_localGetSupportingVertexWithoutMargin(swigCPtr, this, vec);
}
public void recalcLocalAabb () {
CollisionJNI.btTriangleMeshShape_recalcLocalAabb(swigCPtr, this);
}
public btStridingMeshInterface getMeshInterface () {
long cPtr = CollisionJNI.btTriangleMeshShape_getMeshInterface(swigCPtr, this);
return (cPtr == 0) ? null : new btStridingMeshInterface(cPtr, false);
}
public btStridingMeshInterface getMeshInterfaceConst () {
long cPtr = CollisionJNI.btTriangleMeshShape_getMeshInterfaceConst(swigCPtr, this);
return (cPtr == 0) ? null : new btStridingMeshInterface(cPtr, false);
}
public Vector3 getLocalAabbMin () {
return CollisionJNI.btTriangleMeshShape_getLocalAabbMin(swigCPtr, this);
}
public Vector3 getLocalAabbMax () {
return CollisionJNI.btTriangleMeshShape_getLocalAabbMax(swigCPtr, this);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/google/gwt/corp/compatibility/Compatibility.java | /*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Modifications
Copyright 2003-2004 Bytonic Software
Copyright 2010 Google Inc.
*/
package com.google.gwt.corp.compatibility;
import java.io.UnsupportedEncodingException;
public class Compatibility {
public interface Impl {
int floatToIntBits (float f);
float intBitsToFloat (int i);
String createString (byte[] b, int ofs, int length);
String getOriginatingServerAddress ();
void printStackTrace (Throwable e);
String createString (byte[] b, String encoding);
void sleep (int i);
}
public static Impl impl;
public static int floatToIntBits (float f) {
return impl.floatToIntBits(f);
}
public static float intBitsToFloat (int i) {
return impl.intBitsToFloat(i);
}
public static String newString (byte[] b) {
return impl.createString(b, 0, b.length);
}
public static String newString (byte[] b, int s, int l) {
return impl.createString(b, s, l);
}
public static String newString (byte[] b, String encoding) throws UnsupportedEncodingException {
return impl.createString(b, encoding);
}
public static String getOriginatingServerAddress () {
return impl.getOriginatingServerAddress();
}
public static void printStackTrace (Throwable e) {
impl.printStackTrace(e);
}
public static void sleep (int i) {
impl.sleep(i);
}
public static String bytesToString (byte[] data, int len) {
char[] chars = new char[len];
for (int i = 0; i < len; i++) {
chars[i] = (char)data[i];
}
return new String(chars);
}
public static int stringToBytes (String s, byte[] data) {
int len = s.length();
for (int i = 0; i < len; i++) {
data[i] = (byte)s.charAt(i);
}
return len;
}
public static String bytesToHex (byte[] data, int len) {
char[] hex = new char[len * 2];
for (int i = 0; i < len; i++) {
int di = data[i];
hex[i << 1] = Character.forDigit((di >> 4) & 15, 16);
hex[(i << 1) + 1] = Character.forDigit(di & 15, 16);
}
return new String(hex);
}
public static int hexToBytes (String hex, byte[] data) {
int len = hex.length();
for (int i = 0; i < len; i += 2) {
data[i >> 1] = (byte)((Character.digit(hex.charAt(i), 16) << 4) | Character.digit(hex.charAt(i + 1), 16));
}
return len / 2;
}
}
| /*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Modifications
Copyright 2003-2004 Bytonic Software
Copyright 2010 Google Inc.
*/
package com.google.gwt.corp.compatibility;
import java.io.UnsupportedEncodingException;
public class Compatibility {
public interface Impl {
int floatToIntBits (float f);
float intBitsToFloat (int i);
String createString (byte[] b, int ofs, int length);
String getOriginatingServerAddress ();
void printStackTrace (Throwable e);
String createString (byte[] b, String encoding);
void sleep (int i);
}
public static Impl impl;
public static int floatToIntBits (float f) {
return impl.floatToIntBits(f);
}
public static float intBitsToFloat (int i) {
return impl.intBitsToFloat(i);
}
public static String newString (byte[] b) {
return impl.createString(b, 0, b.length);
}
public static String newString (byte[] b, int s, int l) {
return impl.createString(b, s, l);
}
public static String newString (byte[] b, String encoding) throws UnsupportedEncodingException {
return impl.createString(b, encoding);
}
public static String getOriginatingServerAddress () {
return impl.getOriginatingServerAddress();
}
public static void printStackTrace (Throwable e) {
impl.printStackTrace(e);
}
public static void sleep (int i) {
impl.sleep(i);
}
public static String bytesToString (byte[] data, int len) {
char[] chars = new char[len];
for (int i = 0; i < len; i++) {
chars[i] = (char)data[i];
}
return new String(chars);
}
public static int stringToBytes (String s, byte[] data) {
int len = s.length();
for (int i = 0; i < len; i++) {
data[i] = (byte)s.charAt(i);
}
return len;
}
public static String bytesToHex (byte[] data, int len) {
char[] hex = new char[len * 2];
for (int i = 0; i < len; i++) {
int di = data[i];
hex[i << 1] = Character.forDigit((di >> 4) & 15, 16);
hex[(i << 1) + 1] = Character.forDigit(di & 15, 16);
}
return new String(hex);
}
public static int hexToBytes (String hex, byte[] data) {
int len = hex.length();
for (int i = 0; i < len; i += 2) {
data[i >> 1] = (byte)((Character.digit(hex.charAt(i), 16) << 4) | Character.digit(hex.charAt(i + 1), 16));
}
return len / 2;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/scenes/scene2d/ui/SplitPane.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.Layout;
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.Null;
/** A container that contains two widgets and is divided either horizontally or vertically. The user may resize the widgets. The
* child widgets are always sized to fill their side of the SplitPane.
* <p>
* Minimum and maximum split amounts can be set to limit the motion of the resizing handle. The handle position is also prevented
* from shrinking the children below their minimum sizes. If these limits over-constrain the handle, it will be locked and placed
* at an averaged location, resulting in cropped children. The minimum child size can be ignored (allowing dynamic cropping) by
* wrapping the child in a {@linkplain Container} with a minimum size of 0 and {@linkplain Container#fill() fill()} set, or by
* overriding {@link #clampSplitAmount()}.
* <p>
* The preferred size of a SplitPane is that of the child widgets and the size of the {@link SplitPaneStyle#handle}. The widgets
* are sized depending on the SplitPane size and the {@link #setSplitAmount(float) split position}.
* @author mzechner
* @author Nathan Sweet */
public class SplitPane extends WidgetGroup {
SplitPaneStyle style;
private @Null Actor firstWidget, secondWidget;
boolean vertical;
float splitAmount = 0.5f, minAmount, maxAmount = 1;
private final Rectangle firstWidgetBounds = new Rectangle();
private final Rectangle secondWidgetBounds = new Rectangle();
final Rectangle handleBounds = new Rectangle();
boolean cursorOverHandle;
private final Rectangle tempScissors = new Rectangle();
Vector2 lastPoint = new Vector2();
Vector2 handlePosition = new Vector2();
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, Skin skin) {
this(firstWidget, secondWidget, vertical, skin, "default-" + (vertical ? "vertical" : "horizontal"));
}
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, Skin skin, String styleName) {
this(firstWidget, secondWidget, vertical, skin.get(styleName, SplitPaneStyle.class));
}
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, SplitPaneStyle style) {
this.vertical = vertical;
setStyle(style);
setFirstWidget(firstWidget);
setSecondWidget(secondWidget);
setSize(getPrefWidth(), getPrefHeight());
initialize();
}
private void initialize () {
addListener(new InputListener() {
int draggingPointer = -1;
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
if (handleBounds.contains(x, y)) {
draggingPointer = pointer;
lastPoint.set(x, y);
handlePosition.set(handleBounds.x, handleBounds.y);
return true;
}
return false;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
if (pointer == draggingPointer) draggingPointer = -1;
}
public void touchDragged (InputEvent event, float x, float y, int pointer) {
if (pointer != draggingPointer) return;
Drawable handle = style.handle;
if (!vertical) {
float delta = x - lastPoint.x;
float availWidth = getWidth() - handle.getMinWidth();
float dragX = handlePosition.x + delta;
handlePosition.x = dragX;
dragX = Math.max(0, dragX);
dragX = Math.min(availWidth, dragX);
splitAmount = dragX / availWidth;
lastPoint.set(x, y);
} else {
float delta = y - lastPoint.y;
float availHeight = getHeight() - handle.getMinHeight();
float dragY = handlePosition.y + delta;
handlePosition.y = dragY;
dragY = Math.max(0, dragY);
dragY = Math.min(availHeight, dragY);
splitAmount = 1 - (dragY / availHeight);
lastPoint.set(x, y);
}
invalidate();
}
public boolean mouseMoved (InputEvent event, float x, float y) {
cursorOverHandle = handleBounds.contains(x, y);
return false;
}
});
}
public void setStyle (SplitPaneStyle style) {
this.style = style;
invalidateHierarchy();
}
/** Returns the split pane's style. Modifying the returned style may not have an effect until {@link #setStyle(SplitPaneStyle)}
* is called. */
public SplitPaneStyle getStyle () {
return style;
}
public void layout () {
clampSplitAmount();
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
if (firstWidget instanceof Layout) ((Layout)firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
if (secondWidget instanceof Layout) ((Layout)secondWidget).validate();
}
}
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
public float getPrefHeight () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefHeight() : firstWidget.getHeight());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefHeight() : secondWidget.getHeight());
if (!vertical) return Math.max(first, second);
return first + style.handle.getMinHeight() + second;
}
public float getMinWidth () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinWidth() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinWidth() : 0;
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
public float getMinHeight () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinHeight() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinHeight() : 0;
if (!vertical) return Math.max(first, second);
return first + style.handle.getMinHeight() + second;
}
public void setVertical (boolean vertical) {
if (this.vertical == vertical) return;
this.vertical = vertical;
invalidateHierarchy();
}
public boolean isVertical () {
return vertical;
}
private void calculateHorizBoundsAndPositions () {
Drawable handle = style.handle;
float height = getHeight();
float availWidth = getWidth() - handle.getMinWidth();
float leftAreaWidth = (int)(availWidth * splitAmount);
float rightAreaWidth = availWidth - leftAreaWidth;
float handleWidth = handle.getMinWidth();
firstWidgetBounds.set(0, 0, leftAreaWidth, height);
secondWidgetBounds.set(leftAreaWidth + handleWidth, 0, rightAreaWidth, height);
handleBounds.set(leftAreaWidth, 0, handleWidth, height);
}
private void calculateVertBoundsAndPositions () {
Drawable handle = style.handle;
float width = getWidth();
float height = getHeight();
float availHeight = height - handle.getMinHeight();
float topAreaHeight = (int)(availHeight * splitAmount);
float bottomAreaHeight = availHeight - topAreaHeight;
float handleHeight = handle.getMinHeight();
firstWidgetBounds.set(0, height - topAreaHeight, width, topAreaHeight);
secondWidgetBounds.set(0, 0, width, bottomAreaHeight);
handleBounds.set(0, bottomAreaHeight, width, handleHeight);
}
public void draw (Batch batch, float parentAlpha) {
Stage stage = getStage();
if (stage == null) return;
validate();
Color color = getColor();
float alpha = color.a * parentAlpha;
applyTransform(batch, computeTransform());
if (firstWidget != null && firstWidget.isVisible()) {
batch.flush();
stage.calculateScissors(firstWidgetBounds, tempScissors);
if (ScissorStack.pushScissors(tempScissors)) {
firstWidget.draw(batch, alpha);
batch.flush();
ScissorStack.popScissors();
}
}
if (secondWidget != null && secondWidget.isVisible()) {
batch.flush();
stage.calculateScissors(secondWidgetBounds, tempScissors);
if (ScissorStack.pushScissors(tempScissors)) {
secondWidget.draw(batch, alpha);
batch.flush();
ScissorStack.popScissors();
}
}
batch.setColor(color.r, color.g, color.b, alpha);
style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height);
resetTransform(batch);
}
/** @param splitAmount The split amount between the min and max amount. This parameter is clamped during layout. See
* {@link #clampSplitAmount()}. */
public void setSplitAmount (float splitAmount) {
this.splitAmount = splitAmount; // will be clamped during layout
invalidate();
}
public float getSplitAmount () {
return splitAmount;
}
/** Called during layout to clamp the {@link #splitAmount} within the set limits. By default it imposes the limits of the
* {@linkplain #getMinSplitAmount() min amount}, {@linkplain #getMaxSplitAmount() max amount}, and min sizes of the children.
* This method is internally called in response to layout, so it should not call {@link #invalidate()}. */
protected void clampSplitAmount () {
float effectiveMinAmount = minAmount, effectiveMaxAmount = maxAmount;
if (vertical) {
float availableHeight = getHeight() - style.handle.getMinHeight();
if (firstWidget instanceof Layout) effectiveMinAmount = Math.max(effectiveMinAmount,
Math.min(((Layout)firstWidget).getMinHeight() / availableHeight, 1));
if (secondWidget instanceof Layout) effectiveMaxAmount = Math.min(effectiveMaxAmount,
1 - Math.min(((Layout)secondWidget).getMinHeight() / availableHeight, 1));
} else {
float availableWidth = getWidth() - style.handle.getMinWidth();
if (firstWidget instanceof Layout)
effectiveMinAmount = Math.max(effectiveMinAmount, Math.min(((Layout)firstWidget).getMinWidth() / availableWidth, 1));
if (secondWidget instanceof Layout) effectiveMaxAmount = Math.min(effectiveMaxAmount,
1 - Math.min(((Layout)secondWidget).getMinWidth() / availableWidth, 1));
}
if (effectiveMinAmount > effectiveMaxAmount) // Locked handle. Average the position.
splitAmount = 0.5f * (effectiveMinAmount + effectiveMaxAmount);
else
splitAmount = Math.max(Math.min(splitAmount, effectiveMaxAmount), effectiveMinAmount);
}
public float getMinSplitAmount () {
return minAmount;
}
public void setMinSplitAmount (float minAmount) {
if (minAmount < 0 || minAmount > 1) throw new GdxRuntimeException("minAmount has to be >= 0 and <= 1");
this.minAmount = minAmount;
}
public float getMaxSplitAmount () {
return maxAmount;
}
public void setMaxSplitAmount (float maxAmount) {
if (maxAmount < 0 || maxAmount > 1) throw new GdxRuntimeException("maxAmount has to be >= 0 and <= 1");
this.maxAmount = maxAmount;
}
/** @param widget May be null. */
public void setFirstWidget (@Null Actor widget) {
if (firstWidget != null) super.removeActor(firstWidget);
firstWidget = widget;
if (widget != null) super.addActor(widget);
invalidate();
}
/** @param widget May be null. */
public void setSecondWidget (@Null Actor widget) {
if (secondWidget != null) super.removeActor(secondWidget);
secondWidget = widget;
if (widget != null) super.addActor(widget);
invalidate();
}
public void addActor (Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public void addActorAt (int index, Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public void addActorBefore (Actor actorBefore, Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public boolean removeActor (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
if (actor == firstWidget) {
setFirstWidget(null);
return true;
}
if (actor == secondWidget) {
setSecondWidget(null);
return true;
}
return true;
}
public boolean removeActor (Actor actor, boolean unfocus) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
if (actor == firstWidget) {
super.removeActor(actor, unfocus);
firstWidget = null;
invalidate();
return true;
}
if (actor == secondWidget) {
super.removeActor(actor, unfocus);
secondWidget = null;
invalidate();
return true;
}
return false;
}
public Actor removeActorAt (int index, boolean unfocus) {
Actor actor = super.removeActorAt(index, unfocus);
if (actor == firstWidget) {
super.removeActor(actor, unfocus);
firstWidget = null;
invalidate();
} else if (actor == secondWidget) {
super.removeActor(actor, unfocus);
secondWidget = null;
invalidate();
}
return actor;
}
public boolean isCursorOverHandle () {
return cursorOverHandle;
}
/** The style for a splitpane, see {@link SplitPane}.
* @author mzechner
* @author Nathan Sweet */
static public class SplitPaneStyle {
public Drawable handle;
public SplitPaneStyle () {
}
public SplitPaneStyle (Drawable handle) {
this.handle = handle;
}
public SplitPaneStyle (SplitPaneStyle style) {
handle = style.handle;
}
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.scenes.scene2d.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.Layout;
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.Null;
/** A container that contains two widgets and is divided either horizontally or vertically. The user may resize the widgets. The
* child widgets are always sized to fill their side of the SplitPane.
* <p>
* Minimum and maximum split amounts can be set to limit the motion of the resizing handle. The handle position is also prevented
* from shrinking the children below their minimum sizes. If these limits over-constrain the handle, it will be locked and placed
* at an averaged location, resulting in cropped children. The minimum child size can be ignored (allowing dynamic cropping) by
* wrapping the child in a {@linkplain Container} with a minimum size of 0 and {@linkplain Container#fill() fill()} set, or by
* overriding {@link #clampSplitAmount()}.
* <p>
* The preferred size of a SplitPane is that of the child widgets and the size of the {@link SplitPaneStyle#handle}. The widgets
* are sized depending on the SplitPane size and the {@link #setSplitAmount(float) split position}.
* @author mzechner
* @author Nathan Sweet */
public class SplitPane extends WidgetGroup {
SplitPaneStyle style;
private @Null Actor firstWidget, secondWidget;
boolean vertical;
float splitAmount = 0.5f, minAmount, maxAmount = 1;
private final Rectangle firstWidgetBounds = new Rectangle();
private final Rectangle secondWidgetBounds = new Rectangle();
final Rectangle handleBounds = new Rectangle();
boolean cursorOverHandle;
private final Rectangle tempScissors = new Rectangle();
Vector2 lastPoint = new Vector2();
Vector2 handlePosition = new Vector2();
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, Skin skin) {
this(firstWidget, secondWidget, vertical, skin, "default-" + (vertical ? "vertical" : "horizontal"));
}
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, Skin skin, String styleName) {
this(firstWidget, secondWidget, vertical, skin.get(styleName, SplitPaneStyle.class));
}
/** @param firstWidget May be null.
* @param secondWidget May be null. */
public SplitPane (@Null Actor firstWidget, @Null Actor secondWidget, boolean vertical, SplitPaneStyle style) {
this.vertical = vertical;
setStyle(style);
setFirstWidget(firstWidget);
setSecondWidget(secondWidget);
setSize(getPrefWidth(), getPrefHeight());
initialize();
}
private void initialize () {
addListener(new InputListener() {
int draggingPointer = -1;
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
if (handleBounds.contains(x, y)) {
draggingPointer = pointer;
lastPoint.set(x, y);
handlePosition.set(handleBounds.x, handleBounds.y);
return true;
}
return false;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
if (pointer == draggingPointer) draggingPointer = -1;
}
public void touchDragged (InputEvent event, float x, float y, int pointer) {
if (pointer != draggingPointer) return;
Drawable handle = style.handle;
if (!vertical) {
float delta = x - lastPoint.x;
float availWidth = getWidth() - handle.getMinWidth();
float dragX = handlePosition.x + delta;
handlePosition.x = dragX;
dragX = Math.max(0, dragX);
dragX = Math.min(availWidth, dragX);
splitAmount = dragX / availWidth;
lastPoint.set(x, y);
} else {
float delta = y - lastPoint.y;
float availHeight = getHeight() - handle.getMinHeight();
float dragY = handlePosition.y + delta;
handlePosition.y = dragY;
dragY = Math.max(0, dragY);
dragY = Math.min(availHeight, dragY);
splitAmount = 1 - (dragY / availHeight);
lastPoint.set(x, y);
}
invalidate();
}
public boolean mouseMoved (InputEvent event, float x, float y) {
cursorOverHandle = handleBounds.contains(x, y);
return false;
}
});
}
public void setStyle (SplitPaneStyle style) {
this.style = style;
invalidateHierarchy();
}
/** Returns the split pane's style. Modifying the returned style may not have an effect until {@link #setStyle(SplitPaneStyle)}
* is called. */
public SplitPaneStyle getStyle () {
return style;
}
public void layout () {
clampSplitAmount();
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
if (firstWidget instanceof Layout) ((Layout)firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
if (secondWidget instanceof Layout) ((Layout)secondWidget).validate();
}
}
public float getPrefWidth () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefWidth() : firstWidget.getWidth());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefWidth() : secondWidget.getWidth());
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
public float getPrefHeight () {
float first = firstWidget == null ? 0
: (firstWidget instanceof Layout ? ((Layout)firstWidget).getPrefHeight() : firstWidget.getHeight());
float second = secondWidget == null ? 0
: (secondWidget instanceof Layout ? ((Layout)secondWidget).getPrefHeight() : secondWidget.getHeight());
if (!vertical) return Math.max(first, second);
return first + style.handle.getMinHeight() + second;
}
public float getMinWidth () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinWidth() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinWidth() : 0;
if (vertical) return Math.max(first, second);
return first + style.handle.getMinWidth() + second;
}
public float getMinHeight () {
float first = firstWidget instanceof Layout ? ((Layout)firstWidget).getMinHeight() : 0;
float second = secondWidget instanceof Layout ? ((Layout)secondWidget).getMinHeight() : 0;
if (!vertical) return Math.max(first, second);
return first + style.handle.getMinHeight() + second;
}
public void setVertical (boolean vertical) {
if (this.vertical == vertical) return;
this.vertical = vertical;
invalidateHierarchy();
}
public boolean isVertical () {
return vertical;
}
private void calculateHorizBoundsAndPositions () {
Drawable handle = style.handle;
float height = getHeight();
float availWidth = getWidth() - handle.getMinWidth();
float leftAreaWidth = (int)(availWidth * splitAmount);
float rightAreaWidth = availWidth - leftAreaWidth;
float handleWidth = handle.getMinWidth();
firstWidgetBounds.set(0, 0, leftAreaWidth, height);
secondWidgetBounds.set(leftAreaWidth + handleWidth, 0, rightAreaWidth, height);
handleBounds.set(leftAreaWidth, 0, handleWidth, height);
}
private void calculateVertBoundsAndPositions () {
Drawable handle = style.handle;
float width = getWidth();
float height = getHeight();
float availHeight = height - handle.getMinHeight();
float topAreaHeight = (int)(availHeight * splitAmount);
float bottomAreaHeight = availHeight - topAreaHeight;
float handleHeight = handle.getMinHeight();
firstWidgetBounds.set(0, height - topAreaHeight, width, topAreaHeight);
secondWidgetBounds.set(0, 0, width, bottomAreaHeight);
handleBounds.set(0, bottomAreaHeight, width, handleHeight);
}
public void draw (Batch batch, float parentAlpha) {
Stage stage = getStage();
if (stage == null) return;
validate();
Color color = getColor();
float alpha = color.a * parentAlpha;
applyTransform(batch, computeTransform());
if (firstWidget != null && firstWidget.isVisible()) {
batch.flush();
stage.calculateScissors(firstWidgetBounds, tempScissors);
if (ScissorStack.pushScissors(tempScissors)) {
firstWidget.draw(batch, alpha);
batch.flush();
ScissorStack.popScissors();
}
}
if (secondWidget != null && secondWidget.isVisible()) {
batch.flush();
stage.calculateScissors(secondWidgetBounds, tempScissors);
if (ScissorStack.pushScissors(tempScissors)) {
secondWidget.draw(batch, alpha);
batch.flush();
ScissorStack.popScissors();
}
}
batch.setColor(color.r, color.g, color.b, alpha);
style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height);
resetTransform(batch);
}
/** @param splitAmount The split amount between the min and max amount. This parameter is clamped during layout. See
* {@link #clampSplitAmount()}. */
public void setSplitAmount (float splitAmount) {
this.splitAmount = splitAmount; // will be clamped during layout
invalidate();
}
public float getSplitAmount () {
return splitAmount;
}
/** Called during layout to clamp the {@link #splitAmount} within the set limits. By default it imposes the limits of the
* {@linkplain #getMinSplitAmount() min amount}, {@linkplain #getMaxSplitAmount() max amount}, and min sizes of the children.
* This method is internally called in response to layout, so it should not call {@link #invalidate()}. */
protected void clampSplitAmount () {
float effectiveMinAmount = minAmount, effectiveMaxAmount = maxAmount;
if (vertical) {
float availableHeight = getHeight() - style.handle.getMinHeight();
if (firstWidget instanceof Layout) effectiveMinAmount = Math.max(effectiveMinAmount,
Math.min(((Layout)firstWidget).getMinHeight() / availableHeight, 1));
if (secondWidget instanceof Layout) effectiveMaxAmount = Math.min(effectiveMaxAmount,
1 - Math.min(((Layout)secondWidget).getMinHeight() / availableHeight, 1));
} else {
float availableWidth = getWidth() - style.handle.getMinWidth();
if (firstWidget instanceof Layout)
effectiveMinAmount = Math.max(effectiveMinAmount, Math.min(((Layout)firstWidget).getMinWidth() / availableWidth, 1));
if (secondWidget instanceof Layout) effectiveMaxAmount = Math.min(effectiveMaxAmount,
1 - Math.min(((Layout)secondWidget).getMinWidth() / availableWidth, 1));
}
if (effectiveMinAmount > effectiveMaxAmount) // Locked handle. Average the position.
splitAmount = 0.5f * (effectiveMinAmount + effectiveMaxAmount);
else
splitAmount = Math.max(Math.min(splitAmount, effectiveMaxAmount), effectiveMinAmount);
}
public float getMinSplitAmount () {
return minAmount;
}
public void setMinSplitAmount (float minAmount) {
if (minAmount < 0 || minAmount > 1) throw new GdxRuntimeException("minAmount has to be >= 0 and <= 1");
this.minAmount = minAmount;
}
public float getMaxSplitAmount () {
return maxAmount;
}
public void setMaxSplitAmount (float maxAmount) {
if (maxAmount < 0 || maxAmount > 1) throw new GdxRuntimeException("maxAmount has to be >= 0 and <= 1");
this.maxAmount = maxAmount;
}
/** @param widget May be null. */
public void setFirstWidget (@Null Actor widget) {
if (firstWidget != null) super.removeActor(firstWidget);
firstWidget = widget;
if (widget != null) super.addActor(widget);
invalidate();
}
/** @param widget May be null. */
public void setSecondWidget (@Null Actor widget) {
if (secondWidget != null) super.removeActor(secondWidget);
secondWidget = widget;
if (widget != null) super.addActor(widget);
invalidate();
}
public void addActor (Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public void addActorAt (int index, Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public void addActorBefore (Actor actorBefore, Actor actor) {
throw new UnsupportedOperationException("Use SplitPane#setWidget.");
}
public boolean removeActor (Actor actor) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
if (actor == firstWidget) {
setFirstWidget(null);
return true;
}
if (actor == secondWidget) {
setSecondWidget(null);
return true;
}
return true;
}
public boolean removeActor (Actor actor, boolean unfocus) {
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
if (actor == firstWidget) {
super.removeActor(actor, unfocus);
firstWidget = null;
invalidate();
return true;
}
if (actor == secondWidget) {
super.removeActor(actor, unfocus);
secondWidget = null;
invalidate();
return true;
}
return false;
}
public Actor removeActorAt (int index, boolean unfocus) {
Actor actor = super.removeActorAt(index, unfocus);
if (actor == firstWidget) {
super.removeActor(actor, unfocus);
firstWidget = null;
invalidate();
} else if (actor == secondWidget) {
super.removeActor(actor, unfocus);
secondWidget = null;
invalidate();
}
return actor;
}
public boolean isCursorOverHandle () {
return cursorOverHandle;
}
/** The style for a splitpane, see {@link SplitPane}.
* @author mzechner
* @author Nathan Sweet */
static public class SplitPaneStyle {
public Drawable handle;
public SplitPaneStyle () {
}
public SplitPaneStyle (Drawable handle) {
this.handle = handle;
}
public SplitPaneStyle (SplitPaneStyle style) {
handle = style.handle;
}
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-tools/src/com/badlogic/gdx/tools/flame/TemplatePickerPanel.java |
package com.badlogic.gdx.tools.flame;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import com.badlogic.gdx.utils.Array;
/** @author Inferno */
public class TemplatePickerPanel<T> extends EditorPanel<Array<T>> implements LoaderButton.Listener<T> {
public interface Listener<T> {
void onTemplateChecked (T template, boolean isChecked);
}
Array<T> loadedTemplates;
Array<T> excludedTemplates;
Class<T> type;
JTable templatesTable;
DefaultTableModel templatesTableModel;
boolean isOneModelSelectedRequired = true, isMultipleSelectionAllowed = true;
Listener listener;
int lastSelected = -1;
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type) {
this(editor, value, listener, type, null, true, true);
}
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type, LoaderButton<T> loaderButton) {
this(editor, value, listener, type, loaderButton, true, true);
}
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type, LoaderButton<T> loaderButton,
boolean isOneModelSelectedRequired, boolean isMultipleSelectionAllowed) {
super(editor, "", "");
this.type = type;
this.listener = listener;
this.isOneModelSelectedRequired = isOneModelSelectedRequired;
this.isMultipleSelectionAllowed = isMultipleSelectionAllowed;
loadedTemplates = new Array<T>();
excludedTemplates = new Array<T>();
initializeComponents(type, loaderButton);
setValue(value);
}
@Override
public void setValue (Array<T> value) {
super.setValue(value);
if (value == null) return;
if (!isMultipleSelectionAllowed && value.size > 1) throw new RuntimeException(
"Multiple selection must be enabled to ensure consistency between picked and available models.");
for (int i = 0; i < value.size; ++i) {
T model = value.get(i);
int index = loadedTemplates.indexOf(model, true);
if (index > -1) {
EditorPanel.setValue(templatesTableModel, true, index, 1);
lastSelected = index;
}
}
}
public void setOneModelSelectionRequired (boolean isOneModelSelectionRequired) {
this.isOneModelSelectedRequired = isOneModelSelectionRequired;
}
public void setMultipleSelectionAllowed (boolean isMultipleSelectionAllowed) {
this.isMultipleSelectionAllowed = isMultipleSelectionAllowed;
}
public void setExcludedTemplates (Array<T> excludedTemplates) {
this.excludedTemplates.clear();
this.excludedTemplates.addAll(excludedTemplates);
}
public void setLoadedTemplates (Array<T> templates) {
loadedTemplates.clear();
loadedTemplates.addAll(templates);
loadedTemplates.removeAll(excludedTemplates, true);
templatesTableModel.getDataVector().removeAllElements();
int i = 0;
for (T template : templates) {
templatesTableModel.addRow(new Object[] {getTemplateName(template, i), false});
i++;
}
lastSelected = -1;
setValue(value);
}
protected String getTemplateName (T template, int index) {
String name = editor.assetManager.getAssetFileName(template);
return name == null ? "template " + index : name;
}
public void reloadTemplates () {
setLoadedTemplates(editor.assetManager.getAll(type, new Array<T>()));
}
protected void initializeComponents (Class<T> type, LoaderButton<T> loaderButton) {
int i = 0;
if (loaderButton != null) {
loaderButton.setListener(this);
contentPanel.add(loaderButton, new GridBagConstraints(0, i++, 1, 1, 1, 0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0));
}
JScrollPane scroll = new JScrollPane();
contentPanel.add(scroll, new GridBagConstraints(0, i, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 6), 0, 0));
{
templatesTable = new JTable() {
public Class getColumnClass (int column) {
return column == 1 ? Boolean.class : super.getColumnClass(column);
}
@Override
public Dimension getPreferredScrollableViewportSize () {
Dimension dim = super.getPreferredScrollableViewportSize();
dim.height = getPreferredSize().height;
return dim;
}
};
templatesTable.getTableHeader().setReorderingAllowed(false);
templatesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scroll.setViewportView(templatesTable);
templatesTableModel = new DefaultTableModel(new String[0][0], new String[] {"Template", "Selected"});
templatesTable.setModel(templatesTableModel);
reloadTemplates();
templatesTableModel.addTableModelListener(new TableModelListener() {
public void tableChanged (TableModelEvent event) {
if (event.getColumn() != 1) return;
int row = event.getFirstRow();
boolean checked = (Boolean)templatesTable.getValueAt(row, 1);
if (isOneModelSelectedRequired && (value.size == 1 && !checked)) {
EditorPanel.setValue(templatesTableModel, true, row, 1);
return;
}
templateChecked(row, checked);
}
});
}
}
protected void templateChecked (int index, Boolean isChecked) {
T template = loadedTemplates.get(index);
if (isChecked) {
if (!isMultipleSelectionAllowed) {
if (lastSelected > -1) {
value.removeValue(loadedTemplates.get(lastSelected), true);
EditorPanel.setValue(templatesTableModel, false, lastSelected, 1);
}
}
value.add(template);
lastSelected = index;
} else {
value.removeValue(template, true);
}
listener.onTemplateChecked(template, isChecked);
}
@Override
public void onResourceLoaded (T model) {
reloadTemplates();
if (lastSelected == -1 && isOneModelSelectedRequired) {
templateChecked(loadedTemplates.size - 1, true);
} else {
setValue(value);
}
revalidate();
repaint();
}
}
|
package com.badlogic.gdx.tools.flame;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import com.badlogic.gdx.utils.Array;
/** @author Inferno */
public class TemplatePickerPanel<T> extends EditorPanel<Array<T>> implements LoaderButton.Listener<T> {
public interface Listener<T> {
void onTemplateChecked (T template, boolean isChecked);
}
Array<T> loadedTemplates;
Array<T> excludedTemplates;
Class<T> type;
JTable templatesTable;
DefaultTableModel templatesTableModel;
boolean isOneModelSelectedRequired = true, isMultipleSelectionAllowed = true;
Listener listener;
int lastSelected = -1;
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type) {
this(editor, value, listener, type, null, true, true);
}
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type, LoaderButton<T> loaderButton) {
this(editor, value, listener, type, loaderButton, true, true);
}
public TemplatePickerPanel (FlameMain editor, Array<T> value, Listener listener, Class<T> type, LoaderButton<T> loaderButton,
boolean isOneModelSelectedRequired, boolean isMultipleSelectionAllowed) {
super(editor, "", "");
this.type = type;
this.listener = listener;
this.isOneModelSelectedRequired = isOneModelSelectedRequired;
this.isMultipleSelectionAllowed = isMultipleSelectionAllowed;
loadedTemplates = new Array<T>();
excludedTemplates = new Array<T>();
initializeComponents(type, loaderButton);
setValue(value);
}
@Override
public void setValue (Array<T> value) {
super.setValue(value);
if (value == null) return;
if (!isMultipleSelectionAllowed && value.size > 1) throw new RuntimeException(
"Multiple selection must be enabled to ensure consistency between picked and available models.");
for (int i = 0; i < value.size; ++i) {
T model = value.get(i);
int index = loadedTemplates.indexOf(model, true);
if (index > -1) {
EditorPanel.setValue(templatesTableModel, true, index, 1);
lastSelected = index;
}
}
}
public void setOneModelSelectionRequired (boolean isOneModelSelectionRequired) {
this.isOneModelSelectedRequired = isOneModelSelectionRequired;
}
public void setMultipleSelectionAllowed (boolean isMultipleSelectionAllowed) {
this.isMultipleSelectionAllowed = isMultipleSelectionAllowed;
}
public void setExcludedTemplates (Array<T> excludedTemplates) {
this.excludedTemplates.clear();
this.excludedTemplates.addAll(excludedTemplates);
}
public void setLoadedTemplates (Array<T> templates) {
loadedTemplates.clear();
loadedTemplates.addAll(templates);
loadedTemplates.removeAll(excludedTemplates, true);
templatesTableModel.getDataVector().removeAllElements();
int i = 0;
for (T template : templates) {
templatesTableModel.addRow(new Object[] {getTemplateName(template, i), false});
i++;
}
lastSelected = -1;
setValue(value);
}
protected String getTemplateName (T template, int index) {
String name = editor.assetManager.getAssetFileName(template);
return name == null ? "template " + index : name;
}
public void reloadTemplates () {
setLoadedTemplates(editor.assetManager.getAll(type, new Array<T>()));
}
protected void initializeComponents (Class<T> type, LoaderButton<T> loaderButton) {
int i = 0;
if (loaderButton != null) {
loaderButton.setListener(this);
contentPanel.add(loaderButton, new GridBagConstraints(0, i++, 1, 1, 1, 0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 6), 0, 0));
}
JScrollPane scroll = new JScrollPane();
contentPanel.add(scroll, new GridBagConstraints(0, i, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 6), 0, 0));
{
templatesTable = new JTable() {
public Class getColumnClass (int column) {
return column == 1 ? Boolean.class : super.getColumnClass(column);
}
@Override
public Dimension getPreferredScrollableViewportSize () {
Dimension dim = super.getPreferredScrollableViewportSize();
dim.height = getPreferredSize().height;
return dim;
}
};
templatesTable.getTableHeader().setReorderingAllowed(false);
templatesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scroll.setViewportView(templatesTable);
templatesTableModel = new DefaultTableModel(new String[0][0], new String[] {"Template", "Selected"});
templatesTable.setModel(templatesTableModel);
reloadTemplates();
templatesTableModel.addTableModelListener(new TableModelListener() {
public void tableChanged (TableModelEvent event) {
if (event.getColumn() != 1) return;
int row = event.getFirstRow();
boolean checked = (Boolean)templatesTable.getValueAt(row, 1);
if (isOneModelSelectedRequired && (value.size == 1 && !checked)) {
EditorPanel.setValue(templatesTableModel, true, row, 1);
return;
}
templateChecked(row, checked);
}
});
}
}
protected void templateChecked (int index, Boolean isChecked) {
T template = loadedTemplates.get(index);
if (isChecked) {
if (!isMultipleSelectionAllowed) {
if (lastSelected > -1) {
value.removeValue(loadedTemplates.get(lastSelected), true);
EditorPanel.setValue(templatesTableModel, false, lastSelected, 1);
}
}
value.add(template);
lastSelected = index;
} else {
value.removeValue(template, true);
}
listener.onTemplateChecked(template, isChecked);
}
@Override
public void onResourceLoaded (T model) {
reloadTemplates();
if (lastSelected == -1 && isOneModelSelectedRequired) {
templateChecked(loadedTemplates.size - 1, true);
} else {
setValue(value);
}
revalidate();
repaint();
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btMultiBodyPoint2Point.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
public class btMultiBodyPoint2Point extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyPoint2Point (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyPoint2Point, normally you should not need this constructor it's intended for low-level usage. */
public btMultiBodyPoint2Point (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyPoint2Point", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyPoint2Point obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyPoint2Point(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btMultiBodyPoint2Point (btMultiBody body, int link, btRigidBody bodyB, Vector3 pivotInA, Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_0(btMultiBody.getCPtr(body), body, link, btRigidBody.getCPtr(bodyB),
bodyB, pivotInA, pivotInB), true);
}
public btMultiBodyPoint2Point (btMultiBody bodyA, int linkA, btMultiBody bodyB, int linkB, Vector3 pivotInA,
Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_1(btMultiBody.getCPtr(bodyA), bodyA, linkA, btMultiBody.getCPtr(bodyB),
bodyB, linkB, pivotInA, pivotInB), true);
}
public Vector3 getPivotInB () {
return DynamicsJNI.btMultiBodyPoint2Point_getPivotInB(swigCPtr, this);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
import com.badlogic.gdx.math.Vector3;
public class btMultiBodyPoint2Point extends btMultiBodyConstraint {
private long swigCPtr;
protected btMultiBodyPoint2Point (final String className, long cPtr, boolean cMemoryOwn) {
super(className, DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(cPtr), cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btMultiBodyPoint2Point, normally you should not need this constructor it's intended for low-level usage. */
public btMultiBodyPoint2Point (long cPtr, boolean cMemoryOwn) {
this("btMultiBodyPoint2Point", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(DynamicsJNI.btMultiBodyPoint2Point_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
}
public static long getCPtr (btMultiBodyPoint2Point obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btMultiBodyPoint2Point(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public long operatorNew (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDelete (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNew (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDelete (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
}
public long operatorNewArray (long sizeInBytes) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
}
public void operatorDeleteArray (long ptr) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
}
public long operatorNewArray (long arg0, long ptr) {
return DynamicsJNI.btMultiBodyPoint2Point_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
}
public void operatorDeleteArray (long arg0, long arg1) {
DynamicsJNI.btMultiBodyPoint2Point_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
}
public btMultiBodyPoint2Point (btMultiBody body, int link, btRigidBody bodyB, Vector3 pivotInA, Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_0(btMultiBody.getCPtr(body), body, link, btRigidBody.getCPtr(bodyB),
bodyB, pivotInA, pivotInB), true);
}
public btMultiBodyPoint2Point (btMultiBody bodyA, int linkA, btMultiBody bodyB, int linkB, Vector3 pivotInA,
Vector3 pivotInB) {
this(DynamicsJNI.new_btMultiBodyPoint2Point__SWIG_1(btMultiBody.getCPtr(bodyA), bodyA, linkA, btMultiBody.getCPtr(bodyB),
bodyB, linkB, pivotInA, pivotInB), true);
}
public Vector3 getPivotInB () {
return DynamicsJNI.btMultiBodyPoint2Point_getPivotInB(swigCPtr, this);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/utils/async/AsyncTask.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.async;
/** Task to be submitted to an {@link AsyncExecutor}, returning a result of type T.
* @author badlogic */
public interface AsyncTask<T> {
public T call () throws Exception;
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.async;
/** Task to be submitted to an {@link AsyncExecutor}, returning a result of type T.
* @author badlogic */
public interface AsyncTask<T> {
public T call () throws Exception;
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/collision/com/badlogic/gdx/physics/bullet/collision/SWIGTYPE_p_gim_arrayT_GUINT_t.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public class SWIGTYPE_p_gim_arrayT_GUINT_t {
private transient long swigCPtr;
protected SWIGTYPE_p_gim_arrayT_GUINT_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_gim_arrayT_GUINT_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_gim_arrayT_GUINT_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.collision;
public class SWIGTYPE_p_gim_arrayT_GUINT_t {
private transient long swigCPtr;
protected SWIGTYPE_p_gim_arrayT_GUINT_t (long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_gim_arrayT_GUINT_t () {
swigCPtr = 0;
}
protected static long getCPtr (SWIGTYPE_p_gim_arrayT_GUINT_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-box2d/gdx-box2d/src/com/badlogic/gdx/physics/box2d/Transform.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d;
import com.badlogic.gdx.math.Vector2;
/** Encodes a Box2D transform. We are lazy so we only store a 4 float wide array. First two floats are the position of the
* b2Transform struct. Next two floats are the cosine and sine of the rotation angle.
* @author mzechner */
public class Transform {
public static final int POS_X = 0;
public static final int POS_Y = 1;
public static final int COS = 2;
public static final int SIN = 3;
public float[] vals = new float[4];
private Vector2 position = new Vector2();
private Vector2 orientation = new Vector2();
public Transform () {
}
/** Constructs a new Transform instance with the given position and angle
* @param position the position
* @param angle the angle in radians */
public Transform (Vector2 position, float angle) {
setPosition(position);
setRotation(angle);
}
/** Constructs a new Transform instance with the given position and orientation
* @param position the position
* @param orientation where the transform is pointing */
public Transform (Vector2 position, Vector2 orientation) {
setPosition(position);
setOrientation(orientation);
}
/** Transforms the given vector by this transform
* @param v the vector */
public Vector2 mul (Vector2 v) {
float x = vals[POS_X] + vals[COS] * v.x + -vals[SIN] * v.y;
float y = vals[POS_Y] + vals[SIN] * v.x + vals[COS] * v.y;
v.x = x;
v.y = y;
return v;
}
/** @return the position, modification of the vector has no effect on the Transform */
public Vector2 getPosition () {
return position.set(vals[0], vals[1]);
}
/** Sets the rotation of this transform
* @param angle angle in radians */
public void setRotation (float angle) {
float c = (float)Math.cos(angle), s = (float)Math.sin(angle);
vals[COS] = c;
vals[SIN] = s;
}
public float getRotation () {
return (float)Math.atan2(vals[SIN], vals[COS]);
}
/** @return A vector 2 pointing to where the body is facing */
public Vector2 getOrientation () {
return orientation.set(vals[COS], vals[SIN]);
}
/** Set where the body should "look at" */
public void setOrientation (Vector2 orientation) {
this.vals[COS] = orientation.x;
this.vals[SIN] = orientation.y;
}
/** Sets the position of this transform
* @param pos the position */
public void setPosition (Vector2 pos) {
this.vals[POS_X] = pos.x;
this.vals[POS_Y] = pos.y;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d;
import com.badlogic.gdx.math.Vector2;
/** Encodes a Box2D transform. We are lazy so we only store a 4 float wide array. First two floats are the position of the
* b2Transform struct. Next two floats are the cosine and sine of the rotation angle.
* @author mzechner */
public class Transform {
public static final int POS_X = 0;
public static final int POS_Y = 1;
public static final int COS = 2;
public static final int SIN = 3;
public float[] vals = new float[4];
private Vector2 position = new Vector2();
private Vector2 orientation = new Vector2();
public Transform () {
}
/** Constructs a new Transform instance with the given position and angle
* @param position the position
* @param angle the angle in radians */
public Transform (Vector2 position, float angle) {
setPosition(position);
setRotation(angle);
}
/** Constructs a new Transform instance with the given position and orientation
* @param position the position
* @param orientation where the transform is pointing */
public Transform (Vector2 position, Vector2 orientation) {
setPosition(position);
setOrientation(orientation);
}
/** Transforms the given vector by this transform
* @param v the vector */
public Vector2 mul (Vector2 v) {
float x = vals[POS_X] + vals[COS] * v.x + -vals[SIN] * v.y;
float y = vals[POS_Y] + vals[SIN] * v.x + vals[COS] * v.y;
v.x = x;
v.y = y;
return v;
}
/** @return the position, modification of the vector has no effect on the Transform */
public Vector2 getPosition () {
return position.set(vals[0], vals[1]);
}
/** Sets the rotation of this transform
* @param angle angle in radians */
public void setRotation (float angle) {
float c = (float)Math.cos(angle), s = (float)Math.sin(angle);
vals[COS] = c;
vals[SIN] = s;
}
public float getRotation () {
return (float)Math.atan2(vals[SIN], vals[COS]);
}
/** @return A vector 2 pointing to where the body is facing */
public Vector2 getOrientation () {
return orientation.set(vals[COS], vals[SIN]);
}
/** Set where the body should "look at" */
public void setOrientation (Vector2 orientation) {
this.vals[COS] = orientation.x;
this.vals[SIN] = orientation.y;
}
/** Sets the position of this transform
* @param pos the position */
public void setPosition (Vector2 pos) {
this.vals[POS_X] = pos.x;
this.vals[POS_Y] = pos.y;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-box2d/gdx-box2d/src/com/badlogic/gdx/physics/box2d/JointDef.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d;
public class JointDef {
public enum JointType {
Unknown(0), RevoluteJoint(1), PrismaticJoint(2), DistanceJoint(3), PulleyJoint(4), MouseJoint(5), GearJoint(6), WheelJoint(
7), WeldJoint(8), FrictionJoint(9), RopeJoint(10), MotorJoint(11);
public static JointType[] valueTypes = new JointType[] {Unknown, RevoluteJoint, PrismaticJoint, DistanceJoint, PulleyJoint,
MouseJoint, GearJoint, WheelJoint, WeldJoint, FrictionJoint, RopeJoint, MotorJoint};
private int value;
JointType (int value) {
this.value = value;
}
public int getValue () {
return value;
}
}
/** The joint type is set automatically for concrete joint types. **/
public JointType type = JointType.Unknown;
/** The first attached body. **/
public Body bodyA = null;
/** The second attached body **/
public Body bodyB = null;
/** Set this flag to true if the attached bodies should collide. **/
public boolean collideConnected = false;
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.physics.box2d;
public class JointDef {
public enum JointType {
Unknown(0), RevoluteJoint(1), PrismaticJoint(2), DistanceJoint(3), PulleyJoint(4), MouseJoint(5), GearJoint(6), WheelJoint(
7), WeldJoint(8), FrictionJoint(9), RopeJoint(10), MotorJoint(11);
public static JointType[] valueTypes = new JointType[] {Unknown, RevoluteJoint, PrismaticJoint, DistanceJoint, PulleyJoint,
MouseJoint, GearJoint, WheelJoint, WeldJoint, FrictionJoint, RopeJoint, MotorJoint};
private int value;
JointType (int value) {
this.value = value;
}
public int getValue () {
return value;
}
}
/** The joint type is set automatically for concrete joint types. **/
public JointType type = JointType.Unknown;
/** The first attached body. **/
public Body bodyA = null;
/** The second attached body **/
public Body bodyB = null;
/** Set this flag to true if the attached bodies should collide. **/
public boolean collideConnected = false;
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/math/Bezier.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.math;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.GdxRuntimeException;
/** Implementation of the Bezier curve.
* @author Xoppa */
public class Bezier<T extends Vector<T>> implements Path<T> {
// TODO implement Serializable
/** Simple linear interpolation
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the line.
* @param p0 The start point.
* @param p1 The end point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T linear (final T out, final float t, final T p0, final T p1, final T tmp) {
// B1(t) = p0 + (p1-p0)*t
return out.set(p0).scl(1f - t).add(tmp.set(p1).scl(t)); // Could just use lerp...
}
/** Simple linear interpolation derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the line.
* @param p0 The start point.
* @param p1 The end point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T linear_derivative (final T out, final float t, final T p0, final T p1, final T tmp) {
// B1'(t) = p1-p0
return out.set(p1).sub(p0);
}
/** Quadratic Bezier curve
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T quadratic (final T out, final float t, final T p0, final T p1, final T p2, final T tmp) {
// B2(t) = (1 - t) * (1 - t) * p0 + 2 * (1-t) * t * p1 + t*t*p2
final float dt = 1f - t;
return out.set(p0).scl(dt * dt).add(tmp.set(p1).scl(2 * dt * t)).add(tmp.set(p2).scl(t * t));
}
/** Quadratic Bezier curve derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T quadratic_derivative (final T out, final float t, final T p0, final T p1, final T p2,
final T tmp) {
// B2'(t) = 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1)
final float dt = 1f - t;
return out.set(p1).sub(p0).scl(2).scl(1 - t).add(tmp.set(p2).sub(p1).scl(t).scl(2));
}
/** Cubic Bezier curve
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param p3 The fourth bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T cubic (final T out, final float t, final T p0, final T p1, final T p2, final T p3,
final T tmp) {
// B3(t) = (1-t) * (1-t) * (1-t) * p0 + 3 * (1-t) * (1-t) * t * p1 + 3 * (1-t) * t * t * p2 + t * t * t * p3
final float dt = 1f - t;
final float dt2 = dt * dt;
final float t2 = t * t;
return out.set(p0).scl(dt2 * dt).add(tmp.set(p1).scl(3 * dt2 * t)).add(tmp.set(p2).scl(3 * dt * t2))
.add(tmp.set(p3).scl(t2 * t));
}
/** Cubic Bezier curve derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param p3 The fourth bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T cubic_derivative (final T out, final float t, final T p0, final T p1, final T p2,
final T p3, final T tmp) {
// B3'(t) = 3 * (1-t) * (1-t) * (p1 - p0) + 6 * (1 - t) * t * (p2 - p1) + 3 * t * t * (p3 - p2)
final float dt = 1f - t;
final float dt2 = dt * dt;
final float t2 = t * t;
return out.set(p1).sub(p0).scl(dt2 * 3).add(tmp.set(p2).sub(p1).scl(dt * t * 6)).add(tmp.set(p3).sub(p2).scl(t2 * 3));
}
public Array<T> points = new Array<T>();
private T tmp;
private T tmp2;
private T tmp3;
public Bezier () {
}
public Bezier (final T... points) {
set(points);
}
public Bezier (final T[] points, final int offset, final int length) {
set(points, offset, length);
}
public Bezier (final Array<T> points, final int offset, final int length) {
set(points, offset, length);
}
public Bezier set (final T... points) {
return set(points, 0, points.length);
}
public Bezier set (final T[] points, final int offset, final int length) {
if (length < 2 || length > 4)
throw new GdxRuntimeException("Only first, second and third degree Bezier curves are supported.");
if (tmp == null) tmp = points[0].cpy();
if (tmp2 == null) tmp2 = points[0].cpy();
if (tmp3 == null) tmp3 = points[0].cpy();
this.points.clear();
this.points.addAll(points, offset, length);
return this;
}
public Bezier set (final Array<T> points, final int offset, final int length) {
if (length < 2 || length > 4)
throw new GdxRuntimeException("Only first, second and third degree Bezier curves are supported.");
if (tmp == null) tmp = points.get(0).cpy();
if (tmp2 == null) tmp2 = points.get(0).cpy();
if (tmp3 == null) tmp3 = points.get(0).cpy();
this.points.clear();
this.points.addAll(points, offset, length);
return this;
}
@Override
public T valueAt (final T out, final float t) {
final int n = points.size;
if (n == 2)
linear(out, t, points.get(0), points.get(1), tmp);
else if (n == 3)
quadratic(out, t, points.get(0), points.get(1), points.get(2), tmp);
else if (n == 4) cubic(out, t, points.get(0), points.get(1), points.get(2), points.get(3), tmp);
return out;
}
@Override
public T derivativeAt (final T out, final float t) {
final int n = points.size;
if (n == 2)
linear_derivative(out, t, points.get(0), points.get(1), tmp);
else if (n == 3)
quadratic_derivative(out, t, points.get(0), points.get(1), points.get(2), tmp);
else if (n == 4) cubic_derivative(out, t, points.get(0), points.get(1), points.get(2), points.get(3), tmp);
return out;
}
@Override
public float approximate (final T v) {
// TODO: make a real approximate method
T p1 = points.get(0);
T p2 = points.get(points.size - 1);
T p3 = v;
float l1Sqr = p1.dst2(p2);
float l2Sqr = p3.dst2(p2);
float l3Sqr = p3.dst2(p1);
float l1 = (float)Math.sqrt(l1Sqr);
float s = (l2Sqr + l1Sqr - l3Sqr) / (2 * l1);
return MathUtils.clamp((l1 - s) / l1, 0f, 1f);
}
@Override
public float locate (T v) {
// TODO implement a precise method
return approximate(v);
}
@Override
public float approxLength (int samples) {
float tempLength = 0;
for (int i = 0; i < samples; ++i) {
tmp2.set(tmp3);
valueAt(tmp3, (i) / ((float)samples - 1));
if (i > 0) tempLength += tmp2.dst(tmp3);
}
return tempLength;
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.math;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.GdxRuntimeException;
/** Implementation of the Bezier curve.
* @author Xoppa */
public class Bezier<T extends Vector<T>> implements Path<T> {
// TODO implement Serializable
/** Simple linear interpolation
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the line.
* @param p0 The start point.
* @param p1 The end point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T linear (final T out, final float t, final T p0, final T p1, final T tmp) {
// B1(t) = p0 + (p1-p0)*t
return out.set(p0).scl(1f - t).add(tmp.set(p1).scl(t)); // Could just use lerp...
}
/** Simple linear interpolation derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the line.
* @param p0 The start point.
* @param p1 The end point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T linear_derivative (final T out, final float t, final T p0, final T p1, final T tmp) {
// B1'(t) = p1-p0
return out.set(p1).sub(p0);
}
/** Quadratic Bezier curve
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T quadratic (final T out, final float t, final T p0, final T p1, final T p2, final T tmp) {
// B2(t) = (1 - t) * (1 - t) * p0 + 2 * (1-t) * t * p1 + t*t*p2
final float dt = 1f - t;
return out.set(p0).scl(dt * dt).add(tmp.set(p1).scl(2 * dt * t)).add(tmp.set(p2).scl(t * t));
}
/** Quadratic Bezier curve derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T quadratic_derivative (final T out, final float t, final T p0, final T p1, final T p2,
final T tmp) {
// B2'(t) = 2 * (1 - t) * (p1 - p0) + 2 * t * (p2 - p1)
final float dt = 1f - t;
return out.set(p1).sub(p0).scl(2).scl(1 - t).add(tmp.set(p2).sub(p1).scl(t).scl(2));
}
/** Cubic Bezier curve
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param p3 The fourth bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T cubic (final T out, final float t, final T p0, final T p1, final T p2, final T p3,
final T tmp) {
// B3(t) = (1-t) * (1-t) * (1-t) * p0 + 3 * (1-t) * (1-t) * t * p1 + 3 * (1-t) * t * t * p2 + t * t * t * p3
final float dt = 1f - t;
final float dt2 = dt * dt;
final float t2 = t * t;
return out.set(p0).scl(dt2 * dt).add(tmp.set(p1).scl(3 * dt2 * t)).add(tmp.set(p2).scl(3 * dt * t2))
.add(tmp.set(p3).scl(t2 * t));
}
/** Cubic Bezier curve derivative
* @param out The {@link Vector} to set to the result.
* @param t The location (ranging 0..1) on the curve.
* @param p0 The first bezier point.
* @param p1 The second bezier point.
* @param p2 The third bezier point.
* @param p3 The fourth bezier point.
* @param tmp A temporary vector to be used by the calculation.
* @return The value specified by out for chaining */
public static <T extends Vector<T>> T cubic_derivative (final T out, final float t, final T p0, final T p1, final T p2,
final T p3, final T tmp) {
// B3'(t) = 3 * (1-t) * (1-t) * (p1 - p0) + 6 * (1 - t) * t * (p2 - p1) + 3 * t * t * (p3 - p2)
final float dt = 1f - t;
final float dt2 = dt * dt;
final float t2 = t * t;
return out.set(p1).sub(p0).scl(dt2 * 3).add(tmp.set(p2).sub(p1).scl(dt * t * 6)).add(tmp.set(p3).sub(p2).scl(t2 * 3));
}
public Array<T> points = new Array<T>();
private T tmp;
private T tmp2;
private T tmp3;
public Bezier () {
}
public Bezier (final T... points) {
set(points);
}
public Bezier (final T[] points, final int offset, final int length) {
set(points, offset, length);
}
public Bezier (final Array<T> points, final int offset, final int length) {
set(points, offset, length);
}
public Bezier set (final T... points) {
return set(points, 0, points.length);
}
public Bezier set (final T[] points, final int offset, final int length) {
if (length < 2 || length > 4)
throw new GdxRuntimeException("Only first, second and third degree Bezier curves are supported.");
if (tmp == null) tmp = points[0].cpy();
if (tmp2 == null) tmp2 = points[0].cpy();
if (tmp3 == null) tmp3 = points[0].cpy();
this.points.clear();
this.points.addAll(points, offset, length);
return this;
}
public Bezier set (final Array<T> points, final int offset, final int length) {
if (length < 2 || length > 4)
throw new GdxRuntimeException("Only first, second and third degree Bezier curves are supported.");
if (tmp == null) tmp = points.get(0).cpy();
if (tmp2 == null) tmp2 = points.get(0).cpy();
if (tmp3 == null) tmp3 = points.get(0).cpy();
this.points.clear();
this.points.addAll(points, offset, length);
return this;
}
@Override
public T valueAt (final T out, final float t) {
final int n = points.size;
if (n == 2)
linear(out, t, points.get(0), points.get(1), tmp);
else if (n == 3)
quadratic(out, t, points.get(0), points.get(1), points.get(2), tmp);
else if (n == 4) cubic(out, t, points.get(0), points.get(1), points.get(2), points.get(3), tmp);
return out;
}
@Override
public T derivativeAt (final T out, final float t) {
final int n = points.size;
if (n == 2)
linear_derivative(out, t, points.get(0), points.get(1), tmp);
else if (n == 3)
quadratic_derivative(out, t, points.get(0), points.get(1), points.get(2), tmp);
else if (n == 4) cubic_derivative(out, t, points.get(0), points.get(1), points.get(2), points.get(3), tmp);
return out;
}
@Override
public float approximate (final T v) {
// TODO: make a real approximate method
T p1 = points.get(0);
T p2 = points.get(points.size - 1);
T p3 = v;
float l1Sqr = p1.dst2(p2);
float l2Sqr = p3.dst2(p2);
float l3Sqr = p3.dst2(p1);
float l1 = (float)Math.sqrt(l1Sqr);
float s = (l2Sqr + l1Sqr - l3Sqr) / (2 * l1);
return MathUtils.clamp((l1 - s) / l1, 0f, 1f);
}
@Override
public float locate (T v) {
// TODO implement a precise method
return approximate(v);
}
@Override
public float approxLength (int samples) {
float tempLength = 0;
for (int i = 0; i < samples; ++i) {
tmp2.set(tmp3);
valueAt(tmp3, (i) / ((float)samples - 1));
if (i > 0) tempLength += tmp2.dst(tmp3);
}
return tempLength;
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./extensions/gdx-bullet/jni/swig-src/dynamics/com/badlogic/gdx/physics/bullet/dynamics/btSliderConstraintData.java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btSliderConstraintData extends BulletBase {
private long swigCPtr;
protected btSliderConstraintData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSliderConstraintData, normally you should not need this constructor it's intended for low-level usage. */
public btSliderConstraintData (long cPtr, boolean cMemoryOwn) {
this("btSliderConstraintData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSliderConstraintData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btSliderConstraintData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setTypeConstraintData (btTypedConstraintData value) {
DynamicsJNI.btSliderConstraintData_typeConstraintData_set(swigCPtr, this, btTypedConstraintData.getCPtr(value), value);
}
public btTypedConstraintData getTypeConstraintData () {
long cPtr = DynamicsJNI.btSliderConstraintData_typeConstraintData_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTypedConstraintData(cPtr, false);
}
public void setRbAFrame (btTransformFloatData value) {
DynamicsJNI.btSliderConstraintData_rbAFrame_set(swigCPtr, this, btTransformFloatData.getCPtr(value), value);
}
public btTransformFloatData getRbAFrame () {
long cPtr = DynamicsJNI.btSliderConstraintData_rbAFrame_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTransformFloatData(cPtr, false);
}
public void setRbBFrame (btTransformFloatData value) {
DynamicsJNI.btSliderConstraintData_rbBFrame_set(swigCPtr, this, btTransformFloatData.getCPtr(value), value);
}
public btTransformFloatData getRbBFrame () {
long cPtr = DynamicsJNI.btSliderConstraintData_rbBFrame_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTransformFloatData(cPtr, false);
}
public void setLinearUpperLimit (float value) {
DynamicsJNI.btSliderConstraintData_linearUpperLimit_set(swigCPtr, this, value);
}
public float getLinearUpperLimit () {
return DynamicsJNI.btSliderConstraintData_linearUpperLimit_get(swigCPtr, this);
}
public void setLinearLowerLimit (float value) {
DynamicsJNI.btSliderConstraintData_linearLowerLimit_set(swigCPtr, this, value);
}
public float getLinearLowerLimit () {
return DynamicsJNI.btSliderConstraintData_linearLowerLimit_get(swigCPtr, this);
}
public void setAngularUpperLimit (float value) {
DynamicsJNI.btSliderConstraintData_angularUpperLimit_set(swigCPtr, this, value);
}
public float getAngularUpperLimit () {
return DynamicsJNI.btSliderConstraintData_angularUpperLimit_get(swigCPtr, this);
}
public void setAngularLowerLimit (float value) {
DynamicsJNI.btSliderConstraintData_angularLowerLimit_set(swigCPtr, this, value);
}
public float getAngularLowerLimit () {
return DynamicsJNI.btSliderConstraintData_angularLowerLimit_get(swigCPtr, this);
}
public void setUseLinearReferenceFrameA (int value) {
DynamicsJNI.btSliderConstraintData_useLinearReferenceFrameA_set(swigCPtr, this, value);
}
public int getUseLinearReferenceFrameA () {
return DynamicsJNI.btSliderConstraintData_useLinearReferenceFrameA_get(swigCPtr, this);
}
public void setUseOffsetForConstraintFrame (int value) {
DynamicsJNI.btSliderConstraintData_useOffsetForConstraintFrame_set(swigCPtr, this, value);
}
public int getUseOffsetForConstraintFrame () {
return DynamicsJNI.btSliderConstraintData_useOffsetForConstraintFrame_get(swigCPtr, this);
}
public btSliderConstraintData () {
this(DynamicsJNI.new_btSliderConstraintData(), true);
}
}
| /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.badlogic.gdx.physics.bullet.dynamics;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.physics.bullet.collision.*;
public class btSliderConstraintData extends BulletBase {
private long swigCPtr;
protected btSliderConstraintData (final String className, long cPtr, boolean cMemoryOwn) {
super(className, cPtr, cMemoryOwn);
swigCPtr = cPtr;
}
/** Construct a new btSliderConstraintData, normally you should not need this constructor it's intended for low-level usage. */
public btSliderConstraintData (long cPtr, boolean cMemoryOwn) {
this("btSliderConstraintData", cPtr, cMemoryOwn);
construct();
}
@Override
protected void reset (long cPtr, boolean cMemoryOwn) {
if (!destroyed) destroy();
super.reset(swigCPtr = cPtr, cMemoryOwn);
}
public static long getCPtr (btSliderConstraintData obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@Override
protected void finalize () throws Throwable {
if (!destroyed) destroy();
super.finalize();
}
@Override
protected synchronized void delete () {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
DynamicsJNI.delete_btSliderConstraintData(swigCPtr);
}
swigCPtr = 0;
}
super.delete();
}
public void setTypeConstraintData (btTypedConstraintData value) {
DynamicsJNI.btSliderConstraintData_typeConstraintData_set(swigCPtr, this, btTypedConstraintData.getCPtr(value), value);
}
public btTypedConstraintData getTypeConstraintData () {
long cPtr = DynamicsJNI.btSliderConstraintData_typeConstraintData_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTypedConstraintData(cPtr, false);
}
public void setRbAFrame (btTransformFloatData value) {
DynamicsJNI.btSliderConstraintData_rbAFrame_set(swigCPtr, this, btTransformFloatData.getCPtr(value), value);
}
public btTransformFloatData getRbAFrame () {
long cPtr = DynamicsJNI.btSliderConstraintData_rbAFrame_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTransformFloatData(cPtr, false);
}
public void setRbBFrame (btTransformFloatData value) {
DynamicsJNI.btSliderConstraintData_rbBFrame_set(swigCPtr, this, btTransformFloatData.getCPtr(value), value);
}
public btTransformFloatData getRbBFrame () {
long cPtr = DynamicsJNI.btSliderConstraintData_rbBFrame_get(swigCPtr, this);
return (cPtr == 0) ? null : new btTransformFloatData(cPtr, false);
}
public void setLinearUpperLimit (float value) {
DynamicsJNI.btSliderConstraintData_linearUpperLimit_set(swigCPtr, this, value);
}
public float getLinearUpperLimit () {
return DynamicsJNI.btSliderConstraintData_linearUpperLimit_get(swigCPtr, this);
}
public void setLinearLowerLimit (float value) {
DynamicsJNI.btSliderConstraintData_linearLowerLimit_set(swigCPtr, this, value);
}
public float getLinearLowerLimit () {
return DynamicsJNI.btSliderConstraintData_linearLowerLimit_get(swigCPtr, this);
}
public void setAngularUpperLimit (float value) {
DynamicsJNI.btSliderConstraintData_angularUpperLimit_set(swigCPtr, this, value);
}
public float getAngularUpperLimit () {
return DynamicsJNI.btSliderConstraintData_angularUpperLimit_get(swigCPtr, this);
}
public void setAngularLowerLimit (float value) {
DynamicsJNI.btSliderConstraintData_angularLowerLimit_set(swigCPtr, this, value);
}
public float getAngularLowerLimit () {
return DynamicsJNI.btSliderConstraintData_angularLowerLimit_get(swigCPtr, this);
}
public void setUseLinearReferenceFrameA (int value) {
DynamicsJNI.btSliderConstraintData_useLinearReferenceFrameA_set(swigCPtr, this, value);
}
public int getUseLinearReferenceFrameA () {
return DynamicsJNI.btSliderConstraintData_useLinearReferenceFrameA_get(swigCPtr, this);
}
public void setUseOffsetForConstraintFrame (int value) {
DynamicsJNI.btSliderConstraintData_useOffsetForConstraintFrame_set(swigCPtr, this, value);
}
public int getUseOffsetForConstraintFrame () {
return DynamicsJNI.btSliderConstraintData_useOffsetForConstraintFrame_get(swigCPtr, this);
}
public btSliderConstraintData () {
this(DynamicsJNI.new_btSliderConstraintData(), true);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/graphics/g3d/environment/PointLight.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.environment;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector3;
public class PointLight extends BaseLight<PointLight> {
public final Vector3 position = new Vector3();
public float intensity;
public PointLight setPosition (float positionX, float positionY, float positionZ) {
this.position.set(positionX, positionY, positionZ);
return this;
}
public PointLight setPosition (Vector3 position) {
this.position.set(position);
return this;
}
public PointLight setIntensity (float intensity) {
this.intensity = intensity;
return this;
}
public PointLight set (final PointLight copyFrom) {
return set(copyFrom.color, copyFrom.position, copyFrom.intensity);
}
public PointLight set (final Color color, final Vector3 position, final float intensity) {
if (color != null) this.color.set(color);
if (position != null) this.position.set(position);
this.intensity = intensity;
return this;
}
public PointLight set (final float r, final float g, final float b, final Vector3 position, final float intensity) {
this.color.set(r, g, b, 1f);
if (position != null) this.position.set(position);
this.intensity = intensity;
return this;
}
public PointLight set (final Color color, final float x, final float y, final float z, final float intensity) {
if (color != null) this.color.set(color);
this.position.set(x, y, z);
this.intensity = intensity;
return this;
}
public PointLight set (final float r, final float g, final float b, final float x, final float y, final float z,
final float intensity) {
this.color.set(r, g, b, 1f);
this.position.set(x, y, z);
this.intensity = intensity;
return this;
}
@Override
public boolean equals (Object obj) {
return (obj instanceof PointLight) && equals((PointLight)obj);
}
public boolean equals (PointLight other) {
return (other != null
&& (other == this || (color.equals(other.color) && position.equals(other.position) && intensity == other.intensity)));
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.graphics.g3d.environment;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector3;
public class PointLight extends BaseLight<PointLight> {
public final Vector3 position = new Vector3();
public float intensity;
public PointLight setPosition (float positionX, float positionY, float positionZ) {
this.position.set(positionX, positionY, positionZ);
return this;
}
public PointLight setPosition (Vector3 position) {
this.position.set(position);
return this;
}
public PointLight setIntensity (float intensity) {
this.intensity = intensity;
return this;
}
public PointLight set (final PointLight copyFrom) {
return set(copyFrom.color, copyFrom.position, copyFrom.intensity);
}
public PointLight set (final Color color, final Vector3 position, final float intensity) {
if (color != null) this.color.set(color);
if (position != null) this.position.set(position);
this.intensity = intensity;
return this;
}
public PointLight set (final float r, final float g, final float b, final Vector3 position, final float intensity) {
this.color.set(r, g, b, 1f);
if (position != null) this.position.set(position);
this.intensity = intensity;
return this;
}
public PointLight set (final Color color, final float x, final float y, final float z, final float intensity) {
if (color != null) this.color.set(color);
this.position.set(x, y, z);
this.intensity = intensity;
return this;
}
public PointLight set (final float r, final float g, final float b, final float x, final float y, final float z,
final float intensity) {
this.color.set(r, g, b, 1f);
this.position.set(x, y, z);
this.intensity = intensity;
return this;
}
@Override
public boolean equals (Object obj) {
return (obj instanceof PointLight) && equals((PointLight)obj);
}
public boolean equals (PointLight other) {
return (other != null
&& (other == this || (color.equals(other.color) && position.equals(other.position) && intensity == other.intensity)));
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./gdx/src/com/badlogic/gdx/utils/reflect/ArrayReflection.java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.reflect;
/** Utilities for Array reflection.
* @author nexsoftware */
public final class ArrayReflection {
/** Creates a new array with the specified component type and length. */
static public Object newInstance (Class c, int size) {
return java.lang.reflect.Array.newInstance(c, size);
}
/** Returns the length of the supplied array. */
static public int getLength (Object array) {
return java.lang.reflect.Array.getLength(array);
}
/** Returns the value of the indexed component in the supplied array. */
static public Object get (Object array, int index) {
return java.lang.reflect.Array.get(array, index);
}
/** Sets the value of the indexed component in the supplied array to the supplied value. */
static public void set (Object array, int index, Object value) {
java.lang.reflect.Array.set(array, index, value);
}
}
| /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.utils.reflect;
/** Utilities for Array reflection.
* @author nexsoftware */
public final class ArrayReflection {
/** Creates a new array with the specified component type and length. */
static public Object newInstance (Class c, int size) {
return java.lang.reflect.Array.newInstance(c, size);
}
/** Returns the length of the supplied array. */
static public int getLength (Object array) {
return java.lang.reflect.Array.getLength(array);
}
/** Returns the value of the indexed component in the supplied array. */
static public Object get (Object array, int index) {
return java.lang.reflect.Array.get(array, index);
}
/** Sets the value of the indexed component in the supplied array to the supplied value. */
static public void set (Object array, int index, Object value) {
java.lang.reflect.Array.set(array, index, value);
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./tests/gdx-tests-iosrobovm/src/com/badlogic/gdx/tests/IosTestWrapper.java |
package com.badlogic.gdx.tests;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTests;
public class IosTestWrapper extends AbstractTestWrapper {
@Override
protected Instancer[] getTestList () {
Instancer[] tests = new Instancer[GdxTests.tests.size()];
int i = 0;
for (final Class<? extends GdxTest> aClass : GdxTests.tests) {
tests[i] = new IosInstancer(aClass);
i++;
}
return tests;
}
class IosInstancer implements Instancer {
final Class<? extends GdxTest> clazz;
IosInstancer (Class<? extends GdxTest> clazz) {
this.clazz = clazz;
}
@Override
public GdxTest instance () {
try {
return clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@Override
public String getSimpleName () {
return clazz.getSimpleName();
}
}
}
|
package com.badlogic.gdx.tests;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.tests.utils.GdxTests;
public class IosTestWrapper extends AbstractTestWrapper {
@Override
protected Instancer[] getTestList () {
Instancer[] tests = new Instancer[GdxTests.tests.size()];
int i = 0;
for (final Class<? extends GdxTest> aClass : GdxTests.tests) {
tests[i] = new IosInstancer(aClass);
i++;
}
return tests;
}
class IosInstancer implements Instancer {
final Class<? extends GdxTest> clazz;
IosInstancer (Class<? extends GdxTest> clazz) {
this.clazz = clazz;
}
@Override
public GdxTest instance () {
try {
return clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
@Override
public String getSimpleName () {
return clazz.getSimpleName();
}
}
}
| -1 |
libgdx/libgdx | 7,305 | Adds status detection for an httpRequest | This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | supermaximus80 | "2023-12-22T21:58:24Z" | "2023-12-27T14:37:55Z" | 60f074309093046d7fd9dd3c895bba398b415797 | 2b691f735f4b167c062f8f68186a6d7237d3d855 | Adds status detection for an httpRequest. This commit adds the public boolean isHttpRequestPending (HttpRequest httpRequest) method to Gdx.net user interface. It allows end users to detect if an httpRequest is pending or already finished. It helpfull for creating advanced business logic. | ./tests/gdx-tests-android/assets/data/g3d/Knight.png | PNG
IHDR {C tEXtSoftware Adobe ImageReadyqe< |