[fixed] Mp3 decoder.
[fixed] OpenALAudioDevice initial buffer fill.
[updated] Added color constants.
[updated] LibgdxToolkit, added support to call setWidget instead of addActor.
}\r
\r
int totalLength = 0;\r
- int minRequiredLength = buffer.length - OutputBuffer.BUFFERSIZE * 2 - 1;\r
- while (totalLength < minRequiredLength) {\r
+ int minRequiredLength = buffer.length - OutputBuffer.BUFFERSIZE * 2;\r
+ while (totalLength <= minRequiredLength) {\r
Header header = bitstream.readFrame();\r
if (header == null) break;\r
if (setup) {\r
}\r
alSourcei(sourceID, AL_LOOPING, AL_FALSE);\r
alSourcef(sourceID, AL_GAIN, volume);\r
- // Queue empty buffers.\r
- tempBuffer.clear().flip();\r
+ // Fill initial buffers.\r
+ int queuedBuffers = 0;\r
for (int i = 0; i < bufferCount; i++) {\r
int bufferID = buffers.get(i);\r
+ int written = Math.min(bufferSize, length);\r
+ tempBuffer.clear();\r
+ tempBuffer.put(data, offset, written).flip();\r
+ alBufferData(bufferID, format, tempBuffer, sampleRate);\r
+ alSourceQueueBuffers(sourceID, bufferID);\r
+ length -= written;\r
+ offset += written;\r
+ queuedBuffers++;\r
+ }\r
+ // Queue rest of buffers, empty.\r
+ tempBuffer.clear().flip();\r
+ for (int i = queuedBuffers; i < bufferCount; i++) {\r
+ int bufferID = buffers.get(i);\r
alBufferData(bufferID, format, tempBuffer, sampleRate);\r
alSourceQueueBuffers(sourceID, bufferID);\r
}\r
alSourcePlay(sourceID);\r
isPlaying = true;\r
- return;\r
}\r
\r
while (length > 0) {\r
public static final Color RED = new Color(1, 0, 0, 1);\r
public static final Color GREEN = new Color(0, 1, 0, 1);\r
public static final Color BLUE = new Color(0, 0, 1, 1);\r
+ public static final Color LIGHT_GRAY = new Color(0.75f, 0.75f, 0.75f, 1);\r
+ public static final Color GRAY = new Color(0.5f, 0.5f, 0.5f, 1);\r
+ public static final Color DARK_GRAY = new Color(0.25f, 0.25f, 0.25f, 1);\r
+ public static final Color PINK = new Color(1, 0.68f, 0.68f, 1);\r
+ public static final Color ORANGE = new Color(1, 0.78f, 0, 1);\r
+ public static final Color YELLOW = new Color(1, 1, 0, 1);\r
+ public static final Color MAGENTA = new Color(1, 0, 1, 1);\r
+ public static final Color CYAN = new Color(0, 1, 1, 1);\r
\r
/** the red, green, blue and alpha components **/\r
public float r, g, b, a;\r
}
public Button (ButtonStyle style, String name) {
- super(name);
+ super(null, null, null, name);
setStyle(style);
initialize();
}
/** Prevents scrolling out of the widget's bounds. */\r
public boolean clamp = true;\r
\r
+ public FlickScrollPane (Stage stage) {\r
+ this(null, stage, null);\r
+ }\r
+\r
public FlickScrollPane (Actor widget, Stage stage) {\r
this(widget, stage, null);\r
}\r
* @param prefHeight the (preferred) height\r
* @param style the {@link WindowStyle} */\r
public Window (String name, String title, Stage stage, WindowStyle style, int prefWidth, int prefHeight) {\r
- super(name);\r
+ super(null, null, null, name);\r
this.stage = stage;\r
this.title = title;\r
width = prefWidth;\r
\r
public void addChild (Actor parent, Actor child, String layoutString) {\r
if (child.parent != null) child.remove();\r
+ try {\r
+ parent.getClass().getMethod("setWidget", Actor.class).invoke(parent, child);\r
+ } catch (Exception ignored) {\r
+ }\r
((Group)parent).addActor(child);\r
}\r
\r
public boolean isPressed;\r
\r
public Table () {\r
- this(new TableLayout(), null);\r
+ this(null, null, null, null);\r
}\r
\r
- public Table (TableLayout layout) {\r
- this(layout, null);\r
+ public Table (Stage stage, Skin skin) {\r
+ this(stage, skin, null, null);\r
}\r
\r
- public Table (String name) {\r
- this(new TableLayout(), name);\r
- }\r
-\r
- public Table (Skin skin) {\r
- this(new TableLayout(), null);\r
- layout.skin = skin;\r
- }\r
-\r
- public Table (Skin skin, String name) {\r
- this(new TableLayout(), name);\r
- layout.skin = skin;\r
- }\r
-\r
- public Table (TableLayout layout, String name) {\r
+ public Table (Stage stage, Skin skin, TableLayout layout, String name) {\r
super(name);\r
transform = false;\r
+ if (layout == null) layout = new TableLayout();\r
this.layout = layout;\r
layout.setTable(this);\r
+ layout.stage = stage;\r
+ layout.skin = skin;\r
}\r
\r
public void draw (SpriteBatch batch, float parentAlpha) {\r
minFilter = new ComboBox(filters, ui, skin.getStyle(ComboBoxStyle.class), "minfilter");\r
magFilter = new ComboBox(new String[] {"Nearest", "Linear"}, ui, skin.getStyle(ComboBoxStyle.class), "magfilter");\r
\r
- Table table = new Table("container");\r
+ Table table = new Table();\r
table.width = ui.width();\r
table.height = 30;\r
table.y = ui.height() - 30;\r
ComboBox camera = new ComboBox(new String[] {"Camera", "Light"}, ui, skin.getStyle(ComboBoxStyle.class), "camera");\r
Label fps = new Label("fps: ", skin.getStyle(LabelStyle.class), "fps");\r
\r
- Table table = new Table("container");\r
+ Table table = new Table();\r
table.width = ui.width();\r
table.height = ui.height();\r
table.top().padTop(15);\r
skin.getStyle(ComboBoxStyle.class), "shaderCombo");\r
Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "fps");\r
\r
- Table table = new Table("toolbar");\r
+ Table table = new Table();\r
table.width = Gdx.graphics.getWidth();\r
table.height = 100;\r
table.top().padTop(12);\r
final Slider volume = new Slider(0.1f, 1, 0.1f, skin);\r
volume.setValue(1);\r
final Label volumeValue = new Label("1.0", skin);\r
- Table table = new Table("ui");\r
+ Table table = new Table();\r
final Slider pan = new Slider(-1f, 1f, 0.1f, skin);\r
pan.setValue(0);\r
final Label panValue = new Label("0.0", skin);\r