Skip to content

Commit 65ff73b

Browse files
committed
Renamed minRadius. Hotfixes on hit. Fixed "Menu containing Menus". Added more tests. Fixed JavaDoc.
1 parent fc5d814 commit 65ff73b

File tree

14 files changed

+642
-336
lines changed

14 files changed

+642
-336
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
- Introduced `PieWidget` in the new design: the `RadialGroup` now doesn't deal in any way with the `ShapeDrawer`.
44
- `getMaxDiameter` has been renamed to `getCurrentDiameter`.
55
- `getMaxRadius` has been renamed to `getCurrentRadius`.
6+
- `minRadius` has been renamed to `preferredRadius`.
67
- Introduced a new `individuals` demo (named "RadialButtons") to showcase the new `RadialGroup` class.
8+
- Hotfix for a `RadialGroup` containing other `PieMenu`.
9+
- Hotfix on `hit` for when a contained Actor extends beyond the limits of the widget itself.
10+
- Hotfix on `hit` for the `middleCancel` flag of `PieMenu`.
711

812
[3.1.0]
913
- Hotfix for "floating" `Group` that contained `RadialGroup`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ allprojects {
6363
6464
ext {
6565
...
66-
pieMenuVersion = '3.1.0'
66+
pieMenuVersion = '4.0.0'
6767
}
6868
6969
repositories {

src/main/java/com/payne/games/piemenu/AnimatedPieMenu.java

Lines changed: 61 additions & 50 deletions
Large diffs are not rendered by default.

src/main/java/com/payne/games/piemenu/AnimatedPieWidget.java

Lines changed: 61 additions & 50 deletions
Large diffs are not rendered by default.

src/main/java/com/payne/games/piemenu/PieMenu.java

Lines changed: 102 additions & 82 deletions
Large diffs are not rendered by default.

src/main/java/com/payne/games/piemenu/PieWidget.java

Lines changed: 79 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/com/payne/games/piemenu/RadialGroup.java

Lines changed: 96 additions & 70 deletions
Large diffs are not rendered by default.

src/test/java/com/payne/games/piemenu/Demonstration.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import com.badlogic.gdx.scenes.scene2d.InputEvent;
1616
import com.badlogic.gdx.scenes.scene2d.InputListener;
1717
import com.badlogic.gdx.scenes.scene2d.Stage;
18-
import com.badlogic.gdx.scenes.scene2d.ui.*;
18+
import com.badlogic.gdx.scenes.scene2d.ui.Image;
19+
import com.badlogic.gdx.scenes.scene2d.ui.Label;
20+
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
21+
import com.badlogic.gdx.scenes.scene2d.ui.Table;
22+
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
1923
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
2024
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
2125
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
@@ -187,7 +191,7 @@ public void changed(ChangeEvent event, Actor actor) {
187191
* To be used to get the user to transition directly into
188192
* {@link InputListener#touchDragged(InputEvent, float, float, int)}
189193
* as if he had triggered
190-
* {@link InputListener#touchDown(InputEvent, float, float, int, int)}.<br>
194+
* {@link InputListener#touchDown(InputEvent, float, float, int, int)}.<br/>
191195
* I am not certain this is the recommended way of doing this, but for the
192196
* purposes of this demonstration, it works!
193197
*
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
package com.payne.games.piemenu.genericTests;
2+
3+
import com.badlogic.gdx.ApplicationAdapter;
4+
import com.badlogic.gdx.Gdx;
5+
import com.badlogic.gdx.Input;
6+
import com.badlogic.gdx.graphics.Color;
7+
import com.badlogic.gdx.graphics.GL20;
8+
import com.badlogic.gdx.graphics.Pixmap;
9+
import com.badlogic.gdx.graphics.Texture;
10+
import com.badlogic.gdx.graphics.g2d.Batch;
11+
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
12+
import com.badlogic.gdx.graphics.g2d.TextureRegion;
13+
import com.badlogic.gdx.scenes.scene2d.Stage;
14+
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
15+
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
16+
import com.badlogic.gdx.utils.viewport.ScreenViewport;
17+
import com.payne.games.piemenu.PieMenu;
18+
import com.payne.games.piemenu.PieMenu.PieMenuStyle;
19+
20+
21+
public class HitInfiniteMiddle extends ApplicationAdapter {
22+
private Skin skin;
23+
private Stage stage;
24+
private Texture tmpTex;
25+
private Batch batch;
26+
private PieMenu containerWidget;
27+
28+
@Override
29+
public void create() {
30+
31+
/* Setting up the Stage. */
32+
skin = new Skin(Gdx.files.internal("skin.json"));
33+
batch = new PolygonSpriteBatch();
34+
stage = new Stage(new ScreenViewport(), batch);
35+
Gdx.input.setInputProcessor(stage);
36+
stage.setDebugAll(true);
37+
38+
/* Setting up the WhitePixel. */
39+
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
40+
pixmap.setColor(1, 1, 1, 1);
41+
pixmap.fill();
42+
tmpTex = new Texture(pixmap);
43+
pixmap.dispose();
44+
TextureRegion whitePixel = new TextureRegion(tmpTex);
45+
46+
47+
48+
49+
50+
/* Adding the demo widgets. */
51+
PieMenuStyle style1 = new PieMenuStyle();
52+
// style1.sliceColor = Color.ORANGE;
53+
// style1.alternateSliceColor = new Color(.8f, .5f, .2f, 1);
54+
style1.circumferenceWidth = 2;
55+
style1.circumferenceColor = Color.BLACK;
56+
style1.separatorWidth = 2;
57+
style1.separatorColor = Color.BLACK;
58+
59+
containerWidget = new PieMenu(whitePixel, style1, 200, 0.9f);
60+
containerWidget.setName("MAIN");
61+
containerWidget.setInfiniteSelectionRange(true);
62+
containerWidget.setMiddleCancel(true);
63+
64+
for(int i=0 ; i<5 ; i++) {
65+
TextButton tmp = new TextButton("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", skin);
66+
containerWidget.addActor(tmp);
67+
}
68+
69+
70+
stage.addActor(containerWidget);
71+
containerWidget.setFillParent(true);
72+
}
73+
74+
@Override
75+
public void render() {
76+
77+
/* Clearing the screen and filling up the background. */
78+
Gdx.gl.glClearColor(.4f, .4f, .4f, 1);
79+
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
80+
81+
/* Updating and drawing the Stage. */
82+
stage.act();
83+
stage.draw();
84+
85+
containerWidget.centerOnScreen();
86+
87+
if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
88+
containerWidget.rotateBy(Gdx.graphics.getDeltaTime() * 100);
89+
System.out.println(containerWidget.getRotation());
90+
}
91+
92+
}
93+
94+
@Override
95+
public void resize(int width, int height) {
96+
stage.getViewport().update(width, height, true);
97+
}
98+
99+
@Override
100+
public void dispose() {
101+
102+
/* Disposing is good practice! */
103+
skin.dispose();
104+
stage.dispose();
105+
batch.dispose();
106+
tmpTex.dispose();
107+
}
108+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.payne.games.piemenu.genericTests;
2+
3+
import com.badlogic.gdx.ApplicationAdapter;
4+
import com.badlogic.gdx.Gdx;
5+
import com.badlogic.gdx.Input;
6+
import com.badlogic.gdx.graphics.Color;
7+
import com.badlogic.gdx.graphics.GL20;
8+
import com.badlogic.gdx.graphics.Pixmap;
9+
import com.badlogic.gdx.graphics.Texture;
10+
import com.badlogic.gdx.graphics.g2d.Batch;
11+
import com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch;
12+
import com.badlogic.gdx.graphics.g2d.TextureRegion;
13+
import com.badlogic.gdx.scenes.scene2d.Stage;
14+
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
15+
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
16+
import com.badlogic.gdx.utils.viewport.ScreenViewport;
17+
import com.payne.games.piemenu.PieWidget;
18+
19+
20+
public class HitOutside extends ApplicationAdapter {
21+
private Skin skin;
22+
private Stage stage;
23+
private Texture tmpTex;
24+
private Batch batch;
25+
private PieWidget containerWidget;
26+
27+
@Override
28+
public void create() {
29+
30+
/* Setting up the Stage. */
31+
skin = new Skin(Gdx.files.internal("skin.json"));
32+
batch = new PolygonSpriteBatch();
33+
stage = new Stage(new ScreenViewport(), batch);
34+
Gdx.input.setInputProcessor(stage);
35+
stage.setDebugAll(true);
36+
37+
/* Setting up the WhitePixel. */
38+
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
39+
pixmap.setColor(1, 1, 1, 1);
40+
pixmap.fill();
41+
tmpTex = new Texture(pixmap);
42+
pixmap.dispose();
43+
TextureRegion whitePixel = new TextureRegion(tmpTex);
44+
45+
46+
47+
48+
49+
/* Adding the demo widgets. */
50+
PieWidget.PieWidgetStyle style1 = new PieWidget.PieWidgetStyle();
51+
// style1.sliceColor = Color.ORANGE;
52+
// style1.alternateSliceColor = new Color(.8f, .5f, .2f, 1);
53+
style1.circumferenceWidth = 2;
54+
style1.circumferenceColor = Color.BLACK;
55+
style1.separatorWidth = 2;
56+
style1.separatorColor = Color.BLACK;
57+
containerWidget = new PieWidget(whitePixel, style1, 200, 0.9f);
58+
containerWidget.setName("MAIN");
59+
60+
for(int i=0 ; i<5 ; i++) {
61+
TextButton tmp = new TextButton("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", skin);
62+
containerWidget.addActor(tmp);
63+
}
64+
65+
66+
stage.addActor(containerWidget);
67+
containerWidget.setFillParent(true);
68+
}
69+
70+
@Override
71+
public void render() {
72+
73+
/* Clearing the screen and filling up the background. */
74+
Gdx.gl.glClearColor(.4f, .4f, .4f, 1);
75+
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
76+
77+
/* Updating and drawing the Stage. */
78+
stage.act();
79+
stage.draw();
80+
81+
containerWidget.centerOnScreen();
82+
83+
if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
84+
containerWidget.rotateBy(Gdx.graphics.getDeltaTime() * 100);
85+
System.out.println(containerWidget.getRotation());
86+
}
87+
88+
}
89+
90+
@Override
91+
public void resize(int width, int height) {
92+
stage.getViewport().update(width, height, true);
93+
}
94+
95+
@Override
96+
public void dispose() {
97+
98+
/* Disposing is good practice! */
99+
skin.dispose();
100+
stage.dispose();
101+
batch.dispose();
102+
tmpTex.dispose();
103+
}
104+
}

0 commit comments

Comments
 (0)