Skip to content

Commit 6753459

Browse files
committed
fix examples
1 parent 401b355 commit 6753459

File tree

4 files changed

+31
-33
lines changed

4 files changed

+31
-33
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ void setup() {
4141
size(800, 800, P2D);
4242
4343
panel = new GPanel(this);
44-
panel.setProp("x", width / 2, "y", height / 2);
44+
panel.prop("x", width / 2, "y", height / 2);
4545
4646
for (int i = 0; i < 100; i++) {
4747
if (random(-10, 10) >= 0) {
4848
GText text = new GText(this, panel);
49-
text.setProp(
49+
text.prop(
5050
"value", "Hello", "x", random(0, width),
5151
"y", random(0, height)
5252
);
5353
5454
panel.add(text);
5555
} else {
5656
GImage image = new GImage(this, panel);
57-
image.setProp(
57+
image.prop(
5858
"image", "data/example.png",
5959
"x", random(10, 50),
6060
"y", random(10, 50)

examples/dialog/dialog.pde

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
// All Copyright Reserved (C)
55
//
66

7-
import api.gbuild.component.*;
8-
import api.gbuild.component.dialog.*;
9-
import api.gbuild.*;
7+
import gbuild.*;
8+
import gbuild.dialog.*;
109

1110
GDialog dialog;
1211

@@ -15,9 +14,9 @@ void setup() {
1514

1615
dialog = new GDialogWithText(this);
1716

18-
dialog.setProp("title", "Title for Dialog");
19-
dialog.setProp("message", "This is an example");
20-
dialog.setProp("isVisible", true);
17+
dialog.prop("title", "Title for Dialog");
18+
dialog.prop("message", "This is an example");
19+
dialog.prop("isVisible", true);
2120
}
2221

2322
void draw() {

examples/menu/menu.pde

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// All Copyright Reserved (C)
55
//
66

7-
import api.gbuild.component.menu.*;
8-
import api.gbuild.component.button.*;
9-
import api.gbuild.*;
7+
import gbuild.menu.*;
8+
import gbuild.button.*;
9+
import gbuild.*;
1010

1111
GMenu barmenu, verticalmenu;
1212
float angle = 0;
@@ -16,23 +16,23 @@ void setup() {
1616
noSmooth();
1717

1818
barmenu = new HorizontalGMenu(this);
19-
barmenu.setProp("x", 0, "y", 0);
20-
barmenu.setProp("color", new GColor(0, 0, 0));
21-
barmenu.setProp("w", width, "h", 50);
19+
barmenu.prop("x", 0, "y", 0);
20+
barmenu.prop("color", new GColor(0, 0, 0));
21+
barmenu.prop("w", width, "h", 50);
2222

2323
verticalmenu = new VerticalGMenu(this);
24-
verticalmenu.setProp("x", width - 150, "y", 0, "color", new GColor(0, 0, 0));
25-
verticalmenu.setProp("w", 150, "h", height);
24+
verticalmenu.prop("x", width - 150, "y", 0, "color", new GColor(0, 0, 0));
25+
verticalmenu.prop("w", 150, "h", height);
2626

2727
for (int i = 0; i < 4; i++) {
2828
String name = "Option " + i;
2929
char keyValue = (char)i;
3030

3131
GButton option = new GButtonOption(this);
32-
option.setProp("value", name, "keyValue", keyValue);
33-
option.setProp("isTransparent", true, "size", 20);
34-
option.setProp("rawColor", new GColor(255, 255, 255));
35-
option.setProp("hoverColor", new GColor(90, 155, 217));
32+
option.prop("value", name, "keyValue", keyValue);
33+
option.prop("isTransparent", true, "size", 20);
34+
option.prop("rawColor", new GColor(255, 255, 255));
35+
option.prop("hoverColor", new GColor(90, 155, 217));
3636
barmenu.add(option);
3737
}
3838

@@ -41,10 +41,10 @@ void setup() {
4141
char keyValue = (char)i;
4242

4343
GButton option = new GButtonOption(this);
44-
option.setProp("value", name, "keyValue", keyValue);
45-
option.setProp("isTransparent", true, "size", 20);
46-
option.setProp("rawColor", new GColor(255, 255, 255));
47-
option.setProp("hoverColor", new GColor(90, 155, 217));
44+
option.prop("value", name, "keyValue", keyValue);
45+
option.prop("isTransparent", true, "size", 20);
46+
option.prop("rawColor", new GColor(255, 255, 255));
47+
option.prop("hoverColor", new GColor(90, 155, 217));
4848
verticalmenu.add(option);
4949
}
5050
}

examples/panel/panel.pde

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// All Copyright Reserved (C)
55
//
66

7-
import api.gbuild.component.*;
8-
import api.gbuild.*;
7+
import gbuild.*;
98

109
int numText = 50;
1110
GPanel panel;
@@ -15,11 +14,11 @@ void setup() {
1514
noStroke();
1615

1716
panel = new GPanel(this);
18-
panel.setProp("x", 0, "y", 0, "isTransparent", true);
17+
panel.prop("x", 0, "y", 0, "isTransparent", true);
1918

2019
for (int i = 0; i < numText; i++) {
2120
GText text = new GText(this);
22-
text.setProp("value", "Hello!", "x", random(0, width), "y", random(0, height));
21+
text.prop("value", "Hello!", "x", random(0, width), "y", random(0, height));
2322
panel.add(text);
2423
}
2524
}
@@ -30,9 +29,9 @@ void draw() {
3029

3130
for (int i = 0; i < numText; i++) {
3231
GText text = (GText)panel.get(i);
33-
text.setProp("x", (Float)text.getProp("x") + random(-10, 10));
34-
text.setProp("y", (Float)text.getProp("y") + random(-10, 10));
35-
text.setProp("size", (int)random(5, 40));
36-
text.setProp("color", new GColor(random(0, 255), random(0, 255), random(0, 255)));
32+
text.prop("x", (Float)text.prop("x") + random(-10, 10));
33+
text.prop("y", (Float)text.prop("y") + random(-10, 10));
34+
text.prop("size", (int)random(5, 40));
35+
text.prop("color", new GColor(random(0, 255), random(0, 255), random(0, 255)));
3736
}
3837
}

0 commit comments

Comments
 (0)