Compare commits
909 Commits
4.0.93
...
v5.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f8a31cf3a9 | ||
![]() |
5372f09c67 | ||
![]() |
b9f0e88f7e | ||
![]() |
a5c3767cca | ||
![]() |
05e21484cf | ||
![]() |
6c204494b5 | ||
![]() |
af4cdcd485 | ||
![]() |
2977f0b1a7 | ||
![]() |
16a31cf1ae | ||
![]() |
dd14a2a86c | ||
![]() |
a8559bfbbc | ||
![]() |
a77f8e139f | ||
![]() |
07af3990ac | ||
![]() |
33eee8e00a | ||
![]() |
3f32134018 | ||
![]() |
5b12935851 | ||
![]() |
7a4d563875 | ||
![]() |
a0105fda37 | ||
![]() |
d2f997ab4c | ||
![]() |
eb58f592ed | ||
![]() |
8b6b896520 | ||
![]() |
34f240fe59 | ||
![]() |
e78411f3a8 | ||
![]() |
3128a19901 | ||
![]() |
14d58eac32 | ||
![]() |
7488b12704 | ||
![]() |
f5fa82c95e | ||
![]() |
6ddd093d56 | ||
![]() |
b5ce3a996d | ||
![]() |
d8409d5f1e | ||
![]() |
7773d431e8 | ||
![]() |
5f916903ab | ||
![]() |
60fe29660d | ||
![]() |
596e0087e5 | ||
![]() |
8034247494 | ||
![]() |
73b60e6da8 | ||
![]() |
57e00a7ce0 | ||
![]() |
1a6aa3b7ab | ||
![]() |
e6eb05ce22 | ||
![]() |
ddf63637fe | ||
![]() |
c02aec0f6b | ||
![]() |
280eebbccd | ||
![]() |
48611c2c38 | ||
![]() |
5dbbc25b2b | ||
![]() |
23c85d8a75 | ||
![]() |
cdd0f72266 | ||
![]() |
68189bf720 | ||
![]() |
376c2cc5c5 | ||
![]() |
38b587cdd4 | ||
![]() |
dd65aaf086 | ||
![]() |
db7604ee88 | ||
![]() |
d94749177b | ||
![]() |
d061be627b | ||
![]() |
3dede19f1f | ||
![]() |
916d2eb99e | ||
![]() |
9fadc0faab | ||
![]() |
ba6c7ec78d | ||
![]() |
0b4fc055bf | ||
![]() |
8a841fa68f | ||
![]() |
f71983679c | ||
![]() |
be3cc48e32 | ||
![]() |
956656236b | ||
![]() |
a53de69c4e | ||
![]() |
a7abbda061 | ||
![]() |
c267d14348 | ||
![]() |
7db2709ff0 | ||
![]() |
86a3614f89 | ||
![]() |
b8e0b5d8e3 | ||
![]() |
c7a8df3d5a | ||
![]() |
3be8966132 | ||
![]() |
61cefa6cd7 | ||
![]() |
e1dd41bb32 | ||
![]() |
24466ca653 | ||
![]() |
1c9497dc92 | ||
![]() |
5dd3ed43cf | ||
![]() |
368cdebd78 | ||
![]() |
3d7279144b | ||
![]() |
18682eccfa | ||
![]() |
f70c565e7d | ||
![]() |
b9035efc9e | ||
![]() |
493fc7b6f9 | ||
![]() |
52db6e15ee | ||
![]() |
28de2b179b | ||
![]() |
4a6c37f502 | ||
![]() |
9ce734e204 | ||
![]() |
fb3a0edfac | ||
![]() |
e613c7d546 | ||
![]() |
6db6455bb6 | ||
![]() |
86e928724a | ||
![]() |
f31d8f88c2 | ||
![]() |
940eac6bc4 | ||
![]() |
6908f51b4a | ||
![]() |
a537f678fb | ||
![]() |
1019aaba5f | ||
![]() |
5770ac6396 | ||
![]() |
7171f691a3 | ||
![]() |
0ad7b71cf2 | ||
![]() |
006d7296a2 | ||
![]() |
443c49f83e | ||
![]() |
9884965595 | ||
![]() |
e0379466e0 | ||
![]() |
622cba4642 | ||
![]() |
50c7a582ef | ||
![]() |
e501fd4a09 | ||
![]() |
29808c8800 | ||
![]() |
fcfb71132c | ||
![]() |
2017d34197 | ||
![]() |
662c7bd397 | ||
![]() |
cf5011c149 | ||
![]() |
954520ae3b | ||
![]() |
6ffcd6dfb0 | ||
![]() |
80e7a6010a | ||
![]() |
0dc023ba89 | ||
![]() |
e70021d0dd | ||
![]() |
eb63bda7d2 | ||
![]() |
10833aa45d | ||
![]() |
eed844357e | ||
![]() |
6d91676dab | ||
![]() |
69410d62ea | ||
![]() |
977425e700 | ||
![]() |
50746b3c75 | ||
![]() |
1c5364f917 | ||
![]() |
89d099ff7d | ||
![]() |
49d409260a | ||
![]() |
a50b62a2d8 | ||
![]() |
6b21ebcc9b | ||
![]() |
3c8aa4a249 | ||
![]() |
a8e9fa5895 | ||
![]() |
c9f8b4a8ed | ||
![]() |
6b38479166 | ||
![]() |
4ccbc1b958 | ||
![]() |
54d7d284c8 | ||
![]() |
ca1721ef9a | ||
![]() |
58ed74e020 | ||
![]() |
e8ce83b162 | ||
![]() |
9b91f06011 | ||
![]() |
17247cbbf1 | ||
![]() |
10b81dd232 | ||
![]() |
3f3a5dbd3b | ||
![]() |
6ff8ee749d | ||
![]() |
db5f146818 | ||
![]() |
ddcf51a2b7 | ||
![]() |
b7467afd1b | ||
![]() |
ee993f0cdb | ||
![]() |
bc6d3ce16f | ||
![]() |
1fae899497 | ||
![]() |
8319f60c95 | ||
![]() |
f6fe1a3205 | ||
![]() |
01e2b53a3f | ||
![]() |
da9eb3cea7 | ||
![]() |
c044b32c04 | ||
![]() |
46279e7762 | ||
![]() |
4936b014ae | ||
![]() |
c1cd0d8780 | ||
![]() |
557af32cc9 | ||
![]() |
729a85a9a9 | ||
![]() |
34146c2f18 | ||
![]() |
00146bb8f8 | ||
![]() |
6026d79ebb | ||
![]() |
fc28f272b3 | ||
![]() |
9702db06a5 | ||
![]() |
209f83d697 | ||
![]() |
0ef8eb32a5 | ||
![]() |
8115b8181e | ||
![]() |
e79a328748 | ||
![]() |
2083ee1029 | ||
![]() |
3e982cdd87 | ||
![]() |
883527b289 | ||
![]() |
a4d84efdd5 | ||
![]() |
e46c8493bc | ||
![]() |
4c443b09cf | ||
![]() |
98bc2236f4 | ||
![]() |
5199299639 | ||
![]() |
3268d1db25 | ||
![]() |
741770924b | ||
![]() |
49aa9469bb | ||
![]() |
7cbe34436c | ||
![]() |
122f7ecf3e | ||
![]() |
d79bdd9554 | ||
![]() |
3e331cb2e8 | ||
![]() |
361fb6aeab | ||
![]() |
b4a76895ee | ||
![]() |
b2251e1a12 | ||
![]() |
1c1860370a | ||
![]() |
1a190b2a44 | ||
![]() |
b1e0f72416 | ||
![]() |
2c4ae7573e | ||
![]() |
04ff1f2726 | ||
![]() |
eaa5200f95 | ||
![]() |
53c749b79e | ||
![]() |
eb96ee8497 | ||
![]() |
458444ee7b | ||
![]() |
c8eb13f18f | ||
![]() |
a224b93edc | ||
![]() |
f077ca6723 | ||
![]() |
6bbfa1d4a1 | ||
![]() |
3c3dc6ef6e | ||
![]() |
5c101dbcda | ||
![]() |
701b78361a | ||
![]() |
07f26027f6 | ||
![]() |
09cf13d6e2 | ||
![]() |
42f91565fa | ||
![]() |
ac6c146808 | ||
![]() |
59ad23f8ac | ||
![]() |
769c6fe3d5 | ||
![]() |
07b92911ab | ||
![]() |
eb57bcfc87 | ||
![]() |
7addeba73a | ||
![]() |
263902b45a | ||
![]() |
d283f759fe | ||
![]() |
fabd028a63 | ||
![]() |
2b18272c41 | ||
![]() |
a1fb39da3d | ||
![]() |
09602fdf9e | ||
![]() |
d574ef17ba | ||
![]() |
0e3f70627b | ||
![]() |
a814a07105 | ||
![]() |
c49af90a9c | ||
![]() |
24afa155c8 | ||
![]() |
9e5a431516 | ||
![]() |
182a94285c | ||
![]() |
442c2c8dd9 | ||
![]() |
f8fd0dd353 | ||
![]() |
faad9e23ac | ||
![]() |
d2af0da1b1 | ||
![]() |
c65e5c3e49 | ||
![]() |
24a8dfc5f0 | ||
![]() |
9c6790ac37 | ||
![]() |
18ef7460ba | ||
![]() |
63cd0e76c3 | ||
![]() |
bdbf7fd9fc | ||
![]() |
6bbedbd8f9 | ||
![]() |
648bd1ff2e | ||
![]() |
d4288caedb | ||
![]() |
0a35bc3272 | ||
![]() |
d8b737a31f | ||
![]() |
cfd2655f6c | ||
![]() |
1896241b9d | ||
![]() |
0ed22a6ee1 | ||
![]() |
2bfcb99c3e | ||
![]() |
815f8a520a | ||
![]() |
f115b6607f | ||
![]() |
c876f67502 | ||
![]() |
27674f272c | ||
![]() |
02879507e3 | ||
![]() |
0a7629878f | ||
![]() |
b0368232d0 | ||
![]() |
a32bf3db98 | ||
![]() |
64cbbb20d3 | ||
![]() |
dd4fbecc98 | ||
![]() |
807a75a265 | ||
![]() |
6e1b44ea56 | ||
![]() |
d870a54f58 | ||
![]() |
9f464a3f23 | ||
![]() |
ed4e84d665 | ||
![]() |
1e4ab96233 | ||
![]() |
380c034ff5 | ||
![]() |
7c9abe432d | ||
![]() |
2ca853c22c | ||
![]() |
b23d55612a | ||
![]() |
b261faacfc | ||
![]() |
9984b32876 | ||
![]() |
d63ba75430 | ||
![]() |
2db903ed94 | ||
![]() |
3f9bc4d335 | ||
![]() |
3df95d0e21 | ||
![]() |
f445695f6a | ||
![]() |
6f3163d7bd | ||
![]() |
5421eae23d | ||
![]() |
a0e82ee22f | ||
![]() |
1fbf822769 | ||
![]() |
6b0f037722 | ||
![]() |
ae231d2fe6 | ||
![]() |
2e95899da7 | ||
![]() |
3f45b38dfc | ||
![]() |
daf4d36348 | ||
![]() |
477cd16f23 | ||
![]() |
83eded0056 | ||
![]() |
338de9c149 | ||
![]() |
6d99d4e661 | ||
![]() |
4e5a8060c8 | ||
![]() |
eb938e39ff | ||
![]() |
cff8604a5f | ||
![]() |
2afa54bcd2 | ||
![]() |
4da6025b6f | ||
![]() |
c4f64444e7 | ||
![]() |
b0205b296f | ||
![]() |
e0c8b3cc81 | ||
![]() |
80ca92336e | ||
![]() |
6c0681e4ca | ||
![]() |
26e8503dc8 | ||
![]() |
c1ce78efde | ||
![]() |
2f52c2f062 | ||
![]() |
24d11a2446 | ||
![]() |
e1d4ae5bbd | ||
![]() |
dcfe346f54 | ||
![]() |
3906db9efe | ||
![]() |
ba5244d95d | ||
![]() |
52db730870 | ||
![]() |
82d2278ebd | ||
![]() |
30d08ac72d | ||
![]() |
6f1e71c8e5 | ||
![]() |
385be9b5f5 | ||
![]() |
25cb041d78 | ||
![]() |
18fa9cd659 | ||
![]() |
ce760541c5 | ||
![]() |
db51b652f0 | ||
![]() |
4222d98aa9 | ||
![]() |
484f1e5dcb | ||
![]() |
7304b94a77 | ||
![]() |
ee5ec7df72 | ||
![]() |
9a1e4bdf7c | ||
![]() |
a43cca7629 | ||
![]() |
0cdabab2ec | ||
![]() |
28b968ea99 | ||
![]() |
5160033092 | ||
![]() |
ce086c07b9 | ||
![]() |
bf9348488d | ||
![]() |
70b3e0701b | ||
![]() |
dc3d890937 | ||
![]() |
f68be32e2d | ||
![]() |
3758e7af03 | ||
![]() |
5ab1858349 | ||
![]() |
54353bcb24 | ||
![]() |
de7640558d | ||
![]() |
2e17b16516 | ||
![]() |
345f9f1786 | ||
![]() |
8c9214ce5e | ||
![]() |
fc9cc8046d | ||
![]() |
e592bb855d | ||
![]() |
f8407264da | ||
![]() |
202fe2b69a | ||
![]() |
d14a93f9d0 | ||
![]() |
1d1ccdbf06 | ||
![]() |
92fd647316 | ||
![]() |
d8ca506200 | ||
![]() |
928d6eda98 | ||
![]() |
d5e6755694 | ||
![]() |
a1431126ec | ||
![]() |
13c8caeb8c | ||
![]() |
b2b5ee0e19 | ||
![]() |
ff74ecd7c9 | ||
![]() |
0ac3e79156 | ||
![]() |
3a69936e2e | ||
![]() |
e738d5dd5f | ||
![]() |
ed8ee21c04 | ||
![]() |
87220a941a | ||
![]() |
4425d13c7a | ||
![]() |
b818e5f493 | ||
![]() |
403563ba32 | ||
![]() |
156ca68116 | ||
![]() |
de3677a6c3 | ||
![]() |
3b76dfe9f4 | ||
![]() |
6e38ee6d16 | ||
![]() |
454657b00f | ||
![]() |
aad0c4e909 | ||
![]() |
d106ee9ac1 | ||
![]() |
5b1e6e4381 | ||
![]() |
e1106c6145 | ||
![]() |
0c5caf9986 | ||
![]() |
2fdcd6c639 | ||
![]() |
8332adf07b | ||
![]() |
fb40e908c0 | ||
![]() |
b6ef67568a | ||
![]() |
9c591ec3b1 | ||
![]() |
495900c083 | ||
![]() |
7874e2af27 | ||
![]() |
19b37b7111 | ||
![]() |
8593249bc6 | ||
![]() |
6d483ec887 | ||
![]() |
e1a28f0f90 | ||
![]() |
c2ba76a821 | ||
![]() |
c4f8134d89 | ||
![]() |
59416fd0cd | ||
![]() |
ef7ed24114 | ||
![]() |
07dd2bcb5c | ||
![]() |
81dfeb3ab1 | ||
![]() |
09d558744f | ||
![]() |
abe7dd7ccd | ||
![]() |
0da624dc18 | ||
![]() |
a082585b4e | ||
![]() |
d1582723ba | ||
![]() |
829a88f290 | ||
![]() |
79f2e57fa9 | ||
![]() |
322787ba0e | ||
![]() |
7bd2dab47c | ||
![]() |
dd1446cfb0 | ||
![]() |
cf96db75ea | ||
![]() |
da4f350cdb | ||
![]() |
862c012bb6 | ||
![]() |
72a65cb1d2 | ||
![]() |
22379ae31b | ||
![]() |
73e0ba8264 | ||
![]() |
2b0e28f456 | ||
![]() |
151a9b1a74 | ||
![]() |
172d7f049e | ||
![]() |
5ef703eff4 | ||
![]() |
98d970de30 | ||
![]() |
8896fb280a | ||
![]() |
8df5ab9e62 | ||
![]() |
eb32d51999 | ||
![]() |
8901809f88 | ||
![]() |
1de22ef53b | ||
![]() |
d328ae0c7e | ||
![]() |
dabb0f9dad | ||
![]() |
5adcfc5bad | ||
![]() |
b03bf86a35 | ||
![]() |
db1b1eadf1 | ||
![]() |
939266b18b | ||
![]() |
b68a9d8b47 | ||
![]() |
af1a028203 | ||
![]() |
c697d5fb99 | ||
![]() |
b5d2c6f4bc | ||
![]() |
a42c488ac8 | ||
![]() |
1ccc58c015 | ||
![]() |
68a736ea13 | ||
![]() |
a9980f8e89 | ||
![]() |
7156950cb8 | ||
![]() |
833cabfe3b | ||
![]() |
ed23b760a9 | ||
![]() |
98580efafa | ||
![]() |
8794861a11 | ||
![]() |
8fccc7bda4 | ||
![]() |
a09ea0ea13 | ||
![]() |
74c6ca50cb | ||
![]() |
67249c1029 | ||
![]() |
dba79bcca1 | ||
![]() |
006f93dccf | ||
![]() |
94335b9ee2 | ||
![]() |
187e27f232 | ||
![]() |
f7631bd8a5 | ||
![]() |
ad154c34e7 | ||
![]() |
357ecaca1e | ||
![]() |
e67e8d2264 | ||
![]() |
c39fc5f478 | ||
![]() |
b4c84d2058 | ||
![]() |
b7cca91e54 | ||
![]() |
86118abfb3 | ||
![]() |
119d588619 | ||
![]() |
8c1028a28b | ||
![]() |
65e47a11ec | ||
![]() |
c20a705773 | ||
![]() |
bea778cb06 | ||
![]() |
7315fe2403 | ||
![]() |
ef4e0aba6b | ||
![]() |
7d84dda389 | ||
![]() |
de1dab64fd | ||
![]() |
4333d8a3ba | ||
![]() |
4579e619a3 | ||
![]() |
7bcee7e400 | ||
![]() |
bf6ed92b1f | ||
![]() |
87bffb4361 | ||
![]() |
151182c5aa | ||
![]() |
faa678e4f7 | ||
![]() |
6113505367 | ||
![]() |
8eb124c685 | ||
![]() |
4fb2028801 | ||
![]() |
a5cc7de08f | ||
![]() |
8b0845fe9f | ||
![]() |
e127d1bb7b | ||
![]() |
75ff956418 | ||
![]() |
90236f9c43 | ||
![]() |
c480ac2d8e | ||
![]() |
793a242e00 | ||
![]() |
16713e4668 | ||
![]() |
33d731e958 | ||
![]() |
4095b4b65b | ||
![]() |
0a7778f951 | ||
![]() |
7c8c3e8a6a | ||
![]() |
26792429f7 | ||
![]() |
50810aab1d | ||
![]() |
8eeb137764 | ||
![]() |
ff2db6356e | ||
![]() |
c2eba4a0b0 | ||
![]() |
a289c0a521 | ||
![]() |
2f5dd01878 | ||
![]() |
0a95120fbb | ||
![]() |
60bf3115dd | ||
![]() |
d5f4a47eab | ||
![]() |
e5bc6b3a13 | ||
![]() |
4efe9e3d88 | ||
![]() |
869db14995 | ||
![]() |
9531d60479 | ||
![]() |
7d83fe8c07 | ||
![]() |
d285e24ff8 | ||
![]() |
09db74fc65 | ||
![]() |
41be98b306 | ||
![]() |
46cb1318a5 | ||
![]() |
1f98e4a268 | ||
![]() |
15f61e5867 | ||
![]() |
698d3095ec | ||
![]() |
608ebcb0cf | ||
![]() |
78c67a18e6 | ||
![]() |
c12de11ce0 | ||
![]() |
e15b442c1f | ||
![]() |
f84cf59f9e | ||
![]() |
b8aff5e77a | ||
![]() |
9eb5951e66 | ||
![]() |
cb92d56ff6 | ||
![]() |
6223fbb792 | ||
![]() |
16bce2f765 | ||
![]() |
e2f5665700 | ||
![]() |
c9b48ffafa | ||
![]() |
a291d846d8 | ||
![]() |
0287d80cbf | ||
![]() |
97ea23066a | ||
![]() |
e9b8b79d76 | ||
![]() |
44133370bd | ||
![]() |
e1e1fe27ae | ||
![]() |
b426212496 | ||
![]() |
940721c676 | ||
![]() |
c3118e8da3 | ||
![]() |
a9e4d8a606 | ||
![]() |
e5e46d0a5a | ||
![]() |
eed3c7ef36 | ||
![]() |
a6e0853cd6 | ||
![]() |
1dff23f201 | ||
![]() |
0586150eaf | ||
![]() |
c43d6231d7 | ||
![]() |
56230096b3 | ||
![]() |
29e707704e | ||
![]() |
33b417ac94 | ||
![]() |
0069627801 | ||
![]() |
0d3c6ee590 | ||
![]() |
7c2e3d43be | ||
![]() |
3dcd6e2803 | ||
![]() |
689b2ba5c3 | ||
![]() |
f67ba78843 | ||
![]() |
6aa515d085 | ||
![]() |
557aff7534 | ||
![]() |
59e11d8597 | ||
![]() |
26de1ae213 | ||
![]() |
dc32f948da | ||
![]() |
50768df001 | ||
![]() |
4b375b01ac | ||
![]() |
c1b02677f3 | ||
![]() |
eb8cf8028f | ||
![]() |
b80f2b566d | ||
![]() |
748c798172 | ||
![]() |
83472388f4 | ||
![]() |
34f1c5ae49 | ||
![]() |
37732928cb | ||
![]() |
2a6b7f194f | ||
![]() |
0f4d73fae3 | ||
![]() |
906fceeb9a | ||
![]() |
e616d668f3 | ||
![]() |
05baedfd5d | ||
![]() |
5bf3c26b35 | ||
![]() |
59d53c63b9 | ||
![]() |
e1a3409702 | ||
![]() |
f320f34b19 | ||
![]() |
f723182b80 | ||
![]() |
c0c71faac6 | ||
![]() |
5f73fa30fb | ||
![]() |
edbcb32bec | ||
![]() |
f57d3edf0f | ||
![]() |
71ab16a76e | ||
![]() |
7b81ddd877 | ||
![]() |
de50a90235 | ||
![]() |
536b353a24 | ||
![]() |
72740fb62c | ||
![]() |
de3f485191 | ||
![]() |
68738d343c | ||
![]() |
c0529ff5ab | ||
![]() |
4904627a6c | ||
![]() |
d00dae1d9e | ||
![]() |
5270b2bd73 | ||
![]() |
916acf16f7 | ||
![]() |
ceb8b4dde1 | ||
![]() |
577fa8bdf7 | ||
![]() |
ff131165f4 | ||
![]() |
4b45b8d7e4 | ||
![]() |
8431b10a81 | ||
![]() |
1b14519223 | ||
![]() |
5b3526b7e8 | ||
![]() |
b59a2b656f | ||
![]() |
70516b1d88 | ||
![]() |
d73ed4f6f9 | ||
![]() |
d58190e5c5 | ||
![]() |
1b996623f8 | ||
![]() |
09294dbc07 | ||
![]() |
1b27ca9647 | ||
![]() |
891a81f53e | ||
![]() |
ceb7d80ed3 | ||
![]() |
2591efee1c | ||
![]() |
adc473a6c3 | ||
![]() |
8f6e587a0d | ||
![]() |
597f1d0ebb | ||
![]() |
c3746ab388 | ||
![]() |
7f5711cb62 | ||
![]() |
eb066b88e2 | ||
![]() |
22fe36c8b5 | ||
![]() |
cdf9652934 | ||
![]() |
aa5408b1fb | ||
![]() |
facb08e502 | ||
![]() |
111dc42ec9 | ||
![]() |
b08759bf57 | ||
![]() |
a89b196a0c | ||
![]() |
1efa8674fc | ||
![]() |
9ed2aa2a70 | ||
![]() |
26aa52157a | ||
![]() |
825c3e0d26 | ||
![]() |
1f2de9f156 | ||
![]() |
bb52fab95a | ||
![]() |
e1c9db4955 | ||
![]() |
cf9d9bdd5c | ||
![]() |
41f6d8164c | ||
![]() |
31c741b8c6 | ||
![]() |
8619f18b93 | ||
![]() |
fd466d1f57 | ||
![]() |
0c688e714a | ||
![]() |
dd7a4429be | ||
![]() |
8ed7e8251a | ||
![]() |
6bcca6d024 | ||
![]() |
3c6b100188 | ||
![]() |
24cd4b52f6 | ||
![]() |
f63a8fc36e | ||
![]() |
70f6aab913 | ||
![]() |
4c12ad5f1d | ||
![]() |
6d5e4e388f | ||
![]() |
415b05b1dc | ||
![]() |
78e2f8d705 | ||
![]() |
7b0fb791cb | ||
![]() |
bd993b2c43 | ||
![]() |
6a8e15a07f | ||
![]() |
fa6033250c | ||
![]() |
b176699827 | ||
![]() |
3bf0a14951 | ||
![]() |
0c380629d5 | ||
![]() |
79f756a6f1 | ||
![]() |
d35edb72b2 | ||
![]() |
cc9851b49c | ||
![]() |
369bcfdda5 | ||
![]() |
c0e8f9e2a1 | ||
![]() |
7223da00b7 | ||
![]() |
0987ca8b3e | ||
![]() |
a886049f72 | ||
![]() |
168f06b535 | ||
![]() |
def81b6a62 | ||
![]() |
311e451a2f | ||
![]() |
8c7b4cc7bd | ||
![]() |
2494f984a9 | ||
![]() |
cec0ca0b71 | ||
![]() |
a262cebdfb | ||
![]() |
49145136d8 | ||
![]() |
9e01231334 | ||
![]() |
0d869b9f7b | ||
![]() |
ad333dff69 | ||
![]() |
16ae5dd0aa | ||
![]() |
f778f4302b | ||
![]() |
f948fd14a4 | ||
![]() |
9d05dbdd42 | ||
![]() |
9fbc4613ac | ||
![]() |
13bb7b1209 | ||
![]() |
70cbe5156e | ||
![]() |
6933030bcf | ||
![]() |
39f5aad915 | ||
![]() |
64dcfeec09 | ||
![]() |
aeea9c9f57 | ||
![]() |
0d0ce7d44d | ||
![]() |
525ea4b042 | ||
![]() |
7dbd836073 | ||
![]() |
a6f6729b88 | ||
![]() |
d4e290cfed | ||
![]() |
17ea67c2a9 | ||
![]() |
cf436333b9 | ||
![]() |
a77aa15c5e | ||
![]() |
cef7acc1c4 | ||
![]() |
91a84eb000 | ||
![]() |
a09221e4a3 | ||
![]() |
99452c2de0 | ||
![]() |
14244a4561 | ||
![]() |
1c47bbfb36 | ||
![]() |
7e16ea1aa3 | ||
![]() |
16e4df182d | ||
![]() |
1d81690bd5 | ||
![]() |
4980db392b | ||
![]() |
2a99dc6e8a | ||
![]() |
d4898c56f8 | ||
![]() |
dee9442eb6 | ||
![]() |
1bb74af465 | ||
![]() |
f990dacf65 | ||
![]() |
4630ff9d07 | ||
![]() |
06c4377141 | ||
![]() |
4e6fb68e39 | ||
![]() |
e307505d03 | ||
![]() |
f7cfd21c48 | ||
![]() |
e68e9d27bb | ||
![]() |
30a8c5be34 | ||
![]() |
3265ac5b6d | ||
![]() |
6a7d1eaf2e | ||
![]() |
cd587ba8da | ||
![]() |
35f640c1ba | ||
![]() |
2f88ab5178 | ||
![]() |
18f9b66615 | ||
![]() |
ae49eb02c4 | ||
![]() |
e215654bb3 | ||
![]() |
3feae8c257 | ||
![]() |
6f4abd3eb9 | ||
![]() |
6ea781533b | ||
![]() |
456fdc0872 | ||
![]() |
f76a531143 | ||
![]() |
151271c250 | ||
![]() |
22dea528e0 | ||
![]() |
045f7194b5 | ||
![]() |
51007bc5cd | ||
![]() |
612439a88d | ||
![]() |
f145ecd7b3 | ||
![]() |
cf7a39537d | ||
![]() |
23736e8981 | ||
![]() |
d633b032f9 | ||
![]() |
13050967c7 | ||
![]() |
eeaab6d12f | ||
![]() |
c728044260 | ||
![]() |
89a80c685f | ||
![]() |
ec7673d861 | ||
![]() |
f50940ae66 | ||
![]() |
664db415c7 | ||
![]() |
5810972a2d | ||
![]() |
4d5fd7d3d4 | ||
![]() |
f12c9c9ad8 | ||
![]() |
a144258f8d | ||
![]() |
6907cc3847 | ||
![]() |
5f367f7278 | ||
![]() |
73b7523dc6 | ||
![]() |
8eac4b616f | ||
![]() |
ea2a05cfff | ||
![]() |
d307be6d0e | ||
![]() |
a7aa1f3940 | ||
![]() |
ef879413d9 | ||
![]() |
e3eacb53ee | ||
![]() |
3db6edb1f8 | ||
![]() |
3636d99b47 | ||
![]() |
56caeaaf08 | ||
![]() |
a507f7a3ee | ||
![]() |
316e01e7f8 | ||
![]() |
134efa8ec3 | ||
![]() |
85b75b646f | ||
![]() |
09b41fa719 | ||
![]() |
f970352faa | ||
![]() |
76305ae77c | ||
![]() |
6c995d6d20 | ||
![]() |
3d14c9e555 | ||
![]() |
f8fa933a02 | ||
![]() |
fff2edc1c1 | ||
![]() |
190ad686f5 | ||
![]() |
f4b5d57c61 | ||
![]() |
fdec778d04 | ||
![]() |
c227afd8d7 | ||
![]() |
2f91fecd60 | ||
![]() |
406f98245c | ||
![]() |
eaf76105a1 | ||
![]() |
b7e0e7d54d | ||
![]() |
8f109d5a27 | ||
![]() |
907f319ce7 | ||
![]() |
146b69f91e | ||
![]() |
51d23e30e5 | ||
![]() |
a87ba9db6f | ||
![]() |
1f593d576d | ||
![]() |
346003f377 | ||
![]() |
1bd45ec96b | ||
![]() |
c078ed1e55 | ||
![]() |
4f1f04242b | ||
![]() |
976826b9ab | ||
![]() |
b4f2082454 | ||
![]() |
b4318f63d3 | ||
![]() |
6e1140fa0c | ||
![]() |
2322b3dac1 | ||
![]() |
91914c80f7 | ||
![]() |
cc127ff5ba | ||
![]() |
0b3d2be1a2 | ||
![]() |
a44bf9d6d2 | ||
![]() |
a6207f27a3 | ||
![]() |
92664eadc5 | ||
![]() |
edcbd5c9a1 | ||
![]() |
96d8066983 | ||
![]() |
0cf6583bcc | ||
![]() |
063f76750f | ||
![]() |
fef0e68dd3 | ||
![]() |
e40ffbba74 | ||
![]() |
38f58ded69 | ||
![]() |
51c60de26a | ||
![]() |
e977cd2d23 | ||
![]() |
6efdabdb36 | ||
![]() |
8709de1e3e | ||
![]() |
a29332e4dc | ||
![]() |
c82c125bb4 | ||
![]() |
6528a12671 | ||
![]() |
bb3149817d | ||
![]() |
fb805cebf1 | ||
![]() |
0702d0188a | ||
![]() |
185cbbc594 | ||
![]() |
04c4c9ed50 | ||
![]() |
dc445736ef | ||
![]() |
06ea17e7e8 | ||
![]() |
1d2ed3fe9d | ||
![]() |
6e953004f8 | ||
![]() |
1b4d1582d4 | ||
![]() |
90bd58b14a | ||
![]() |
d78cecd34f | ||
![]() |
91771682f0 | ||
![]() |
da5669ab70 | ||
![]() |
afd7ac7c92 | ||
![]() |
e8b1509fc2 | ||
![]() |
db1923c38c | ||
![]() |
86789ac491 | ||
![]() |
8f028f778d | ||
![]() |
2a3d998e7c | ||
![]() |
3969561e8d | ||
![]() |
0118b740fa | ||
![]() |
92a6e4819e | ||
![]() |
2afdcfdfa0 | ||
![]() |
a488f13aa6 | ||
![]() |
5ef46253b1 | ||
![]() |
4a4dbe850c | ||
![]() |
37c643f7bc | ||
![]() |
2e67ec83fd | ||
![]() |
de1a7c67b9 | ||
![]() |
eaba616f71 | ||
![]() |
21cf59ff5a | ||
![]() |
182c25f721 | ||
![]() |
6002dc26dc | ||
![]() |
e30e3cd705 | ||
![]() |
88f0bbca8b | ||
![]() |
6026bb8ff4 | ||
![]() |
d57d186218 | ||
![]() |
834fed0b64 | ||
![]() |
ad7544c7a3 | ||
![]() |
0bf05afead | ||
![]() |
f1bb8b5149 | ||
![]() |
5d34d7a0b0 | ||
![]() |
7b8e1c70ba | ||
![]() |
ba3fd0ebff | ||
![]() |
01ee88cdc7 | ||
![]() |
cd34cbe934 | ||
![]() |
276850b306 | ||
![]() |
883129f379 | ||
![]() |
dea86d7c33 | ||
![]() |
3d89bd50fc | ||
![]() |
54c94f62a4 | ||
![]() |
b9d71b0d9c | ||
![]() |
e5631383dd | ||
![]() |
8dc3bd3831 | ||
![]() |
cdc3e3ed90 | ||
![]() |
5281cd54cc | ||
![]() |
be66e670e9 | ||
![]() |
ee9a3d181d | ||
![]() |
a81170d934 | ||
![]() |
4825313b15 | ||
![]() |
90e1a33829 | ||
![]() |
7ad075cb59 | ||
![]() |
fd67843d0d | ||
![]() |
0b9771815b | ||
![]() |
d01a80c7b9 | ||
![]() |
3f005449ad | ||
![]() |
10e7a11a34 | ||
![]() |
65b02a7460 | ||
![]() |
0b28b0d15a | ||
![]() |
4e32b64bc6 | ||
![]() |
d7509cf7c7 | ||
![]() |
78ec0fd201 | ||
![]() |
e982f6218b | ||
![]() |
4dae5dd567 | ||
![]() |
9f81038f1d | ||
![]() |
40fcb668c4 | ||
![]() |
96afbeb931 | ||
![]() |
1ed005a472 | ||
![]() |
b9abd568d0 | ||
![]() |
6ca3a08dd8 | ||
![]() |
ccf75c63ad | ||
![]() |
f616075508 | ||
![]() |
880ccad7f5 | ||
![]() |
7d9774c01d | ||
![]() |
50b493ab2c | ||
![]() |
66ef1e0abf | ||
![]() |
ae93430539 | ||
![]() |
42022290b8 | ||
![]() |
5c9279c6df | ||
![]() |
69b2a41caa | ||
![]() |
b6d92d69bc | ||
![]() |
940ea8ba19 | ||
![]() |
ea5d92a289 | ||
![]() |
9631bc0c32 | ||
![]() |
7c14f9dd39 | ||
![]() |
59b9373974 | ||
![]() |
ab9403bece | ||
![]() |
7e23652eef | ||
![]() |
6badf722c0 | ||
![]() |
d20b5a0fbb | ||
![]() |
ba791eddcb | ||
![]() |
9a532a19db | ||
![]() |
3b75fd6df4 | ||
![]() |
d6f3b2776e | ||
![]() |
dba2d55193 | ||
![]() |
7cae68c5b8 | ||
![]() |
11c96dbef1 | ||
![]() |
46fff2dec4 | ||
![]() |
72df404d7f | ||
![]() |
cdbd3c515d | ||
![]() |
b0e29bab5b | ||
![]() |
70fada11e7 | ||
![]() |
626651ec51 | ||
![]() |
a47963e77f | ||
![]() |
179183f414 | ||
![]() |
67b7a3a060 | ||
![]() |
63dfc887cc | ||
![]() |
b537c36643 | ||
![]() |
146ed26eed | ||
![]() |
d971a4eb6a |
26
.clang_complete
Normal file
@@ -0,0 +1,26 @@
|
||||
-DGDJS_EXPORTS
|
||||
-DGD_API=
|
||||
-DGD_CORE_API=
|
||||
-DGD_EXTENSION_API=
|
||||
-DGD_IDE_ONLY
|
||||
-DMACOS
|
||||
-DRELEASE
|
||||
-DWXUSINGDLL
|
||||
-D_FILE_OFFSET_BITS=64
|
||||
-D__WXMAC__
|
||||
-D__WXOSX_COCOA__
|
||||
-D__WXOSX__
|
||||
-DwxDEBUG_LEVEL=0
|
||||
-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
|
||||
-Wno-potentially-evaluated-expression
|
||||
-std=gnu++11
|
||||
-I/usr/local/Cellar/wxmac/3.0.2/include/wx-3.0
|
||||
-DNDEBUG
|
||||
-fPIC
|
||||
-I/Users/florian/Projects/F/GD/ExtLibs/SFML/include
|
||||
-I/Users/florian/Projects/F/GD/Core
|
||||
-I/usr/local/Cellar/wxmac/3.0.2/lib/wx/include/osx_cocoa-unicode-3.0
|
||||
-I/usr/local/Cellar/wxmac/3.0.2/include/wx-3.0
|
||||
-I/Users/florian/Projects/F/GD/GDCpp/.
|
||||
-I/Users/florian/Projects/F/GD/GDJS/.
|
||||
-F/Users/florian/Projects/F/GD/ExtLibs/SFML/extlibs/libs-osx/Frameworks
|
11
.gitignore
vendored
@@ -1,11 +1,11 @@
|
||||
/Core/GDCore/Tools/VersionPriv.h
|
||||
/docs/GDJS Runtime Documentation
|
||||
/docs/GDJS Documentation
|
||||
/docs/GDCpp Documentation
|
||||
/docs/GDCore Documentation
|
||||
/ExtLibs/boost
|
||||
/ExtLibs/SFML
|
||||
/ExtLibs/wxwidgets
|
||||
/ExtLibs/wxWidgets
|
||||
/ExtLibs/SFML
|
||||
/ExtLibs/*.7z
|
||||
/scripts/Repository keys
|
||||
/scripts/logs/*.txt
|
||||
@@ -56,6 +56,7 @@ Binaries/Packaging/logs
|
||||
/Binaries/**/JsPlatform/Runtime
|
||||
/Binaries/**/JsPlatform/*.dll
|
||||
/Binaries/**/JsPlatform/*.dll.a
|
||||
/Binaries/Output/Release_Windows/newIDE
|
||||
*.autosave
|
||||
/Binaries/Output/libGD.js/Release
|
||||
/Binaries/Output/libGD.js/Debug
|
||||
@@ -64,12 +65,14 @@ Binaries/Packaging/logs
|
||||
!/scripts/libgettextlib-0-17.dll
|
||||
!/scripts/libgettextsrc-0-17.dll
|
||||
!/xgettext.exe
|
||||
!/Binaries/Output/Release_Windows/locale/libgettextlib-0-17.dll
|
||||
!/Binaries/Output/Release_Windows/locale/libgettextsrc-0-17.dll
|
||||
!/Binaries/Output/Release_Windows/locale/*.dll
|
||||
!/Binaries/Output/Release_Windows/locale/msgcat.exe
|
||||
!/Binaries/Output/Release_Windows/locale/msgfmt.exe
|
||||
!/ExtLibs/curl.exe
|
||||
!/ExtLibs/7za.exe
|
||||
!/ExtLibs/SFML/extlibs/**/*.dll
|
||||
!/ExtLibs/SFML/extlibs/**/*.so
|
||||
!/ExtLibs/SFML/extlibs/**/*.a
|
||||
**/.DS_Store
|
||||
**/node_modules/
|
||||
.idea
|
||||
|
33
.travis.yml
@@ -4,6 +4,14 @@ compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
# Cache .npm folder for faster npm install
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
|
||||
git:
|
||||
depth: 999999
|
||||
|
||||
env:
|
||||
global:
|
||||
- GCC_VERSION="4.8"
|
||||
@@ -34,6 +42,12 @@ before_install:
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
|
||||
install:
|
||||
#Install newIDE tests dependencies
|
||||
- cd newIDE/app && npm install
|
||||
- cd ../..
|
||||
#Install GDJS tests dependencies
|
||||
- cd GDJS/tests && npm install
|
||||
- cd ../..
|
||||
#Get the correct version of gcc/g++
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
||||
#Compile the tests only
|
||||
@@ -42,20 +56,21 @@ install:
|
||||
- cmake -DBUILD_GDJS=FALSE -DBUILD_IDE=FALSE -DBUILD_TESTS=TRUE -DNO_GUI=TRUE -DCMAKE_CXX_COMPILER=$(which $CXX) -DCMAKE_C_COMPILER=$(which $CC) ..
|
||||
- make -j 4
|
||||
- cd ..
|
||||
#Install GDJS tests dependencies
|
||||
- cd GDJS/tests
|
||||
- npm install
|
||||
- cd ../..
|
||||
|
||||
script:
|
||||
#GDJS game engine tests:
|
||||
- cd GDJS/tests
|
||||
- npm test
|
||||
- cd ../..
|
||||
#GDCore and GDCpp game engine tests:
|
||||
- cd .build-tests
|
||||
# - export LD_LIBRARY_PATH=$PWD/Binaries/Output/Release_Linux:$PWD/.build-tests/ExtLibs/SFML/lib:$LD_LIBRARY_PATH
|
||||
- Core/GDCore_tests
|
||||
- GDCpp/GDCpp_tests
|
||||
- Extensions/PathfindingBehavior/PathfindingBehavior_Runtime_tests
|
||||
- Extensions/LinkedObjects/LinkedObjects_Runtime_tests
|
||||
- cd ..
|
||||
#newIDE tests:
|
||||
- cd newIDE/app
|
||||
- npm test
|
||||
- npm run flow
|
||||
- cd ../..
|
||||
#GDJS game engine tests, disabled on Travis CI because ChromeHeadless can't be started.
|
||||
#See them running on Semaphore-CI instead: https://semaphoreci.com/4ian/gd
|
||||
# - cd GDJS/tests && npm test
|
||||
# - cd ../..
|
||||
|
125
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/IDE",
|
||||
"${workspaceRoot}/GDCpp",
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||
"/usr/local/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"/usr/include",
|
||||
"/usr/local/lib/wx/include/osx_cocoa-unicode-3.0",
|
||||
"/usr/local/include/wx-3.0",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"GD_IDE_ONLY",
|
||||
"__WXMAC__",
|
||||
"__WXOSX__",
|
||||
"__WXOSX_COCOA__",
|
||||
"GD_CORE_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_EXTENSION_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"WXUSINGDLL"
|
||||
],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||
"/usr/local/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"/usr/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/IDE",
|
||||
"${workspaceRoot}/GDCpp",
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"GD_IDE_ONLY",
|
||||
"__WXMAC__",
|
||||
"__WXOSX__",
|
||||
"__WXOSX_COCOA__",
|
||||
"GD_CORE_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_EXTENSION_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"WXUSINGDLL"
|
||||
],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/IDE",
|
||||
"${workspaceRoot}/GDCpp",
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"GD_IDE_ONLY",
|
||||
"__WXMAC__",
|
||||
"__WXOSX__",
|
||||
"__WXOSX_COCOA__",
|
||||
"GD_CORE_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"GD_EXTENSION_API=/* Macro used to export classes on Windows, please ignore */",
|
||||
"WXUSINGDLL"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
97
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.associations": {
|
||||
"*.idl": "java",
|
||||
"iosfwd": "cpp",
|
||||
"functional": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"random": "cpp",
|
||||
"__config": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"exception": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"new": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"complex": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"memory": "cpp",
|
||||
"ostream": "cpp",
|
||||
"sstream": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"hashtable": "cpp",
|
||||
"tuple": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"__split_buffer": "cpp",
|
||||
"deque": "cpp",
|
||||
"iterator": "cpp",
|
||||
"list": "cpp",
|
||||
"map": "cpp",
|
||||
"queue": "cpp",
|
||||
"regex": "cpp",
|
||||
"set": "cpp",
|
||||
"stack": "cpp",
|
||||
"string": "cpp",
|
||||
"vector": "cpp",
|
||||
"iostream": "cpp",
|
||||
"__functional_03": "cpp",
|
||||
"__hash_table": "cpp",
|
||||
"__tree": "cpp",
|
||||
"bitset": "cpp",
|
||||
"__bit_reference": "cpp",
|
||||
"__mutex_base": "cpp",
|
||||
"fstream": "cpp",
|
||||
"ios": "cpp",
|
||||
"__locale": "cpp",
|
||||
"valarray": "cpp",
|
||||
"freeglut_spaceball.c": "cpp",
|
||||
"__tuple": "cpp",
|
||||
"hash_map": "cpp",
|
||||
"hash_set": "cpp",
|
||||
"system_error": "cpp",
|
||||
"__nullptr": "cpp",
|
||||
"__functional_base": "cpp",
|
||||
"__functional_base_03": "cpp",
|
||||
"chrono": "cpp",
|
||||
"ratio": "cpp",
|
||||
"atomic": "cpp",
|
||||
"locale": "cpp",
|
||||
"string_view": "cpp",
|
||||
"__string": "cpp",
|
||||
"cstring": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"cstdint": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"Binaries/*build*": true,
|
||||
"Binaries/Output": true,
|
||||
"Binaries/Packaging/GDevelop.app": true,
|
||||
"ExtLibs/SFML": true,
|
||||
"docs": true,
|
||||
"GDJS/docs": true,
|
||||
"GDCpp/docs": true,
|
||||
"Core/docs": true,
|
||||
"Extensions/CommonDialogs/dlib-18.16": true,
|
||||
"newIDE/electron-app/dist": true,
|
||||
"newIDE/app/build": true,
|
||||
"newIDE/app/resources/GDJS": true,
|
||||
"newIDE/electron-app/app/www": true
|
||||
},
|
||||
// Support for Flowtype:
|
||||
"javascript.validate.enable": false,
|
||||
"flow.useNPMPackagedFlow": true
|
||||
}
|
748
Binaries/Output/Release_Windows/Examples/Copy_Variables.gdg
Normal file
@@ -0,0 +1,748 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project firstLayout="">
|
||||
<gdVersion build="95" major="4" minor="0" revision="8" />
|
||||
<properties folderProject="false" linuxExecutableFilename="" macExecutableFilename="" packageName="com.example.gamename" projectFile="C:\Users\Maciel\Programacion\gits\GD\Binaries\Output\Release_Windows\Examples\Copy_Variables.gdg" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<name>Project</name>
|
||||
<author></author>
|
||||
<windowWidth>800</windowWidth>
|
||||
<windowHeight>600</windowHeight>
|
||||
<latestCompilationDirectory></latestCompilationDirectory>
|
||||
<maxFPS>60</maxFPS>
|
||||
<minFPS>10</minFPS>
|
||||
<verticalSync>false</verticalSync>
|
||||
<extensions>
|
||||
<extension name="BuiltinObject" />
|
||||
<extension name="BuiltinAudio" />
|
||||
<extension name="BuiltinVariables" />
|
||||
<extension name="BuiltinTime" />
|
||||
<extension name="BuiltinMouse" />
|
||||
<extension name="BuiltinKeyboard" />
|
||||
<extension name="BuiltinJoystick" />
|
||||
<extension name="BuiltinCamera" />
|
||||
<extension name="BuiltinWindow" />
|
||||
<extension name="BuiltinFile" />
|
||||
<extension name="BuiltinNetwork" />
|
||||
<extension name="BuiltinScene" />
|
||||
<extension name="BuiltinAdvanced" />
|
||||
<extension name="Sprite" />
|
||||
<extension name="BuiltinCommonInstructions" />
|
||||
<extension name="BuiltinCommonConversions" />
|
||||
<extension name="BuiltinStringInstructions" />
|
||||
<extension name="BuiltinMathematicalTools" />
|
||||
<extension name="BuiltinExternalLayouts" />
|
||||
<extension name="TextObject" />
|
||||
</extensions>
|
||||
<platforms>
|
||||
<platform name="GDevelop C++ platform" />
|
||||
<platform name="GDevelop JS platform" />
|
||||
</platforms>
|
||||
<currentPlatform>GDevelop C++ platform</currentPlatform>
|
||||
</properties>
|
||||
<resources>
|
||||
<resources />
|
||||
<resourceFolders />
|
||||
</resources>
|
||||
<objects />
|
||||
<objectsGroups />
|
||||
<variables />
|
||||
<layouts>
|
||||
<layout b="30" disableInputWhenNotFocused="true" mangledName="Scene" name="Scene" oglFOV="90.000000" oglZFar="500.000000" oglZNear="1.000000" r="30" standardSortMethod="false" stopSoundsOnStartup="true" title="" v="30">
|
||||
<uiSettings grid="false" gridB="80" gridG="80" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="80" gridWidth="32" snap="true" windowMask="false" zoomFactor="0.701632" />
|
||||
<objectsGroups />
|
||||
<variables>
|
||||
<variable name="Scene">
|
||||
<children>
|
||||
<variable name="A" value="5" />
|
||||
<variable name="B">
|
||||
<children>
|
||||
<variable name="alpha">
|
||||
<children>
|
||||
<variable name="x" value="5.5" />
|
||||
<variable name="y" value="-8" />
|
||||
</children>
|
||||
</variable>
|
||||
<variable name="beta" value="150;255;150" />
|
||||
<variable name="gamma" value="Apples" />
|
||||
</children>
|
||||
</variable>
|
||||
</children>
|
||||
</variable>
|
||||
</variables>
|
||||
<instances>
|
||||
<instance angle="0.000000" customSize="false" height="0.000000" layer="" locked="false" name="DebugText" width="0.000000" x="400.000000" y="300.000000" zOrder="1">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables>
|
||||
<variable name="ID" value="3" />
|
||||
</initialVariables>
|
||||
</instance>
|
||||
<instance angle="0.000000" customSize="false" height="0.000000" layer="" locked="false" name="DebugText" width="0.000000" x="20.000000" y="20.000000" zOrder="1">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables>
|
||||
<variable name="ID" value="0" />
|
||||
</initialVariables>
|
||||
</instance>
|
||||
<instance angle="0.000000" customSize="false" height="0.000000" layer="" locked="false" name="DebugText" width="0.000000" x="400.000000" y="20.000000" zOrder="1">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables>
|
||||
<variable name="ID" value="1" />
|
||||
</initialVariables>
|
||||
</instance>
|
||||
<instance angle="0.000000" customSize="false" height="0.000000" layer="" locked="false" name="DebugText" width="0.000000" x="20.000000" y="300.000000" zOrder="1">
|
||||
<numberProperties />
|
||||
<stringProperties />
|
||||
<initialVariables>
|
||||
<variable name="ID" value="2" />
|
||||
</initialVariables>
|
||||
</instance>
|
||||
</instances>
|
||||
<objects>
|
||||
<object bold="false" italic="false" name="DebugText" smoothed="true" type="TextObject::Text" underlined="false">
|
||||
<variables />
|
||||
<behaviors />
|
||||
<string>DebugText</string>
|
||||
<font></font>
|
||||
<characterSize>24</characterSize>
|
||||
<color b="220" g="220" r="220" />
|
||||
</object>
|
||||
</objects>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>Update debug text at the beginning (only Scene variable will be drawn because others haven't childrend)</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="DepartScene" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>If "A" key is pressed, convert the Scene variable into JSON and parse it into a Global variable, then randomize a child from the Global structure, to identify it</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="KeyPressed" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>a</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<condition>
|
||||
<type inverted="false" value="BuiltinCommonInstructions::Once" />
|
||||
<parameters />
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToGlobalVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>ToJSON(Scene)</parameter>
|
||||
<parameter>Global</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarGlobal" />
|
||||
<parameters>
|
||||
<parameter>Global.B.alpha.x</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>Random(1000)</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>If "S" key is pressed, convert the Global variable into JSON and parse it into an Object variable, then randomize another child from the Object structure, to identify it</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="KeyPressed" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>s</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>2</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<condition>
|
||||
<type inverted="false" value="BuiltinCommonInstructions::Once" />
|
||||
<parameters />
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToObjectVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>GlobalVarToJSON(Global)</parameter>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>Object</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>Object.B.alpha.y</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>Random(1000)</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>If "D" key is pressed, convert the Object variable into JSON (note there are no whitespaces after the "," before the variable name in the ObjectVarToJSON) and parse it into another scene variable Scene_2</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="KeyPressed" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>d</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>2</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<condition>
|
||||
<type inverted="false" value="BuiltinCommonInstructions::Once" />
|
||||
<parameters />
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>ObjectVarToJSON(DebugText,Object)</parameter>
|
||||
<parameter>Scene_2</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>Time to update the debug text objects, set Update = 0 to update it only once, and start a counter "i" = 0</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>Update</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>0</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>i</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>0</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>Repeat 4 times because there are 4 debug objects, in each repeat select the object with ID = i (counter variable)
Update the counter variable (i + 1)
Clear the temporal variable Temp, otherwise children are kept from one update to another, messing up the test</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Repeat</type>
|
||||
<repeatExpression>4</repeatExpression>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>Variable(i)</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="ModVarScene" />
|
||||
<parameters>
|
||||
<parameter>i</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="VariableClearChildren" />
|
||||
<parameters>
|
||||
<parameter>Temp</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>Set starting title in function of the debug object ID, and copy the testing variables into the variable Temp (this way Temp will be equal to one of the variables under test)</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>0</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>"Scene" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>ToJSON(Scene)</parameter>
|
||||
<parameter>Temp</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>1</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>"Global" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>GlobalVarToJSON(Global)</parameter>
|
||||
<parameter>Temp</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>2</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>"Object" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>ObjectVarToJSON(DebugText,Object)</parameter>
|
||||
<parameter>Temp</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VarObjet" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>ID</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>3</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>=</parameter>
|
||||
<parameter>"Scene_2" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<type inverted="false" value="JSONToVariableStructure" />
|
||||
<parameters>
|
||||
<parameter>ToJSON(Scene_2)</parameter>
|
||||
<parameter>Temp</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Comment</type>
|
||||
<color b="128" g="255" r="128" textB="0" textG="0" textR="0" />
|
||||
<comment>Copy values from variable Test in the debug object, to draw it, one debug object is selected at each iteration and one variable is copy into Temp variable</comment>
|
||||
<comment2></comment2>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp</parameter>
|
||||
<parameter>"A"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"____A = " + VariableString(Temp.A) + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp</parameter>
|
||||
<parameter>"B"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"____B" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp.B</parameter>
|
||||
<parameter>"alpha"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"________alpha" + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp.B.alpha</parameter>
|
||||
<parameter>"x"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"____________x = " + VariableString(Temp.B.alpha.x) + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp.B.alpha</parameter>
|
||||
<parameter>"y"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"____________y = " + VariableString(Temp.B.alpha.y) + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
</events>
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp.B</parameter>
|
||||
<parameter>"beta"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"________beta = " + VariableString(Temp.B.beta) + NewLine()</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<type inverted="false" value="VariableChildExists" />
|
||||
<parameters>
|
||||
<parameter>Temp.B</parameter>
|
||||
<parameter>"gamma"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<type inverted="false" value="TextObject::String" />
|
||||
<parameters>
|
||||
<parameter>DebugText</parameter>
|
||||
<parameter>+</parameter>
|
||||
<parameter>"________gamma = " + VariableString(Temp.B.gamma)</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
</events>
|
||||
</event>
|
||||
</events>
|
||||
</event>
|
||||
</events>
|
||||
</event>
|
||||
</events>
|
||||
<layers>
|
||||
<layer name="New layer" visibility="true">
|
||||
<cameras>
|
||||
<camera defaultSize="true" defaultViewport="true" height="0.000000" viewportBottom="1.000000" viewportLeft="0.000000" viewportRight="1.000000" viewportTop="0.000000" width="0.000000" />
|
||||
</cameras>
|
||||
<effects />
|
||||
</layer>
|
||||
<layer name="" visibility="true">
|
||||
<cameras>
|
||||
<camera defaultSize="true" defaultViewport="true" height="0.000000" viewportBottom="1.000000" viewportLeft="0.000000" viewportRight="1.000000" viewportTop="0.000000" width="0.000000" />
|
||||
</cameras>
|
||||
<effects />
|
||||
</layer>
|
||||
</layers>
|
||||
<behaviorsSharedData />
|
||||
</layout>
|
||||
</layouts>
|
||||
<externalEvents />
|
||||
<externalLayouts />
|
||||
<externalSourceFiles />
|
||||
</project>
|
@@ -1,15 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project firstLayout="">
|
||||
<gdVersion build="84" major="3" minor="6" revision="0" />
|
||||
<properties linuxExecutableFilename="" macExecutableFilename="" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<gdVersion build="97" major="4" minor="0" revision="0" />
|
||||
<properties folderProject="false" linuxExecutableFilename="" macExecutableFilename="" orientation="default" packageName="" projectFile="C:\Users\Maciel\Programacion\gits\GD\Binaries\Output\Release_Windows\Examples\Particles - Explosions.gdg" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<name>Explosions</name>
|
||||
<author></author>
|
||||
<windowWidth>800</windowWidth>
|
||||
<windowHeight>600</windowHeight>
|
||||
<latestCompilationDirectory></latestCompilationDirectory>
|
||||
<latestCompilationDirectory>C:\Users\Maciel\AppData\Local\Temp\GDTemporaries\JSCocosExportParticles</latestCompilationDirectory>
|
||||
<maxFPS>60</maxFPS>
|
||||
<minFPS>10</minFPS>
|
||||
<verticalSync>false</verticalSync>
|
||||
<platformSpecificAssets />
|
||||
<loadingScreen showGDevelopSplash="true" />
|
||||
<extensions>
|
||||
<extension name="BuiltinObject" />
|
||||
<extension name="BuiltinAudio" />
|
||||
@@ -34,6 +36,7 @@
|
||||
</extensions>
|
||||
<platforms>
|
||||
<platform name="GDevelop C++ platform" />
|
||||
<platform name="GDevelop JS platform" />
|
||||
</platforms>
|
||||
<currentPlatform>GDevelop C++ platform</currentPlatform>
|
||||
</properties>
|
||||
@@ -48,40 +51,40 @@
|
||||
<variables />
|
||||
<layouts>
|
||||
<layout b="0" disableInputWhenNotFocused="true" mangledName="New_32scene" name="New scene" oglFOV="90.000000" oglZFar="500.000000" oglZNear="1.000000" r="0" standardSortMethod="true" stopSoundsOnStartup="true" title="" v="0">
|
||||
<uiSettings associatedLayout="" grid="false" gridB="255" gridG="180" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="158" gridWidth="32" snap="true" windowMask="false" zoomFactor="1.000000" />
|
||||
<uiSettings grid="false" gridB="255" gridG="180" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="158" gridWidth="32" snap="true" windowMask="false" zoomFactor="1.000000" />
|
||||
<objectsGroups />
|
||||
<variables />
|
||||
<instances />
|
||||
<objects>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Mutable" destroyWhenNoParticles="true" emissionEditionSimpleMode="false" emitterAngleA="180.000000" emitterAngleB="160.000000" emitterForceMax="40.000000" emitterForceMin="5.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="-1.000000" friction="2.000000" gravityEditionSimpleMode="false" greenParam="Mutable" maxParticleNb="5000" name="Explosion" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="50.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="20.000000" particleGreen1="128.000000" particleGreen2="50.000000" particleLifeTimeMax="1.500000" particleLifeTimeMin="0.700000" particleRed1="255.000000" particleRed2="50.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Mutable" rendererParam1="20.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Random" tank="1000.000000" textureParticleName="ExplosionTexture.png" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Mutable" destroyWhenNoParticles="true" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="360.000000" emitterForceMax="70.000000" emitterForceMin="30.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="-1.000000" friction="2.000000" gravityEditionSimpleMode="false" greenParam="Mutable" maxParticleNb="100" name="Explosion" particleAlpha1="225.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="50.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="20.000000" particleGreen1="128.000000" particleGreen2="50.000000" particleLifeTimeMax="1.500000" particleLifeTimeMin="0.700000" particleRed1="255.000000" particleRed2="50.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Mutable" rendererParam1="20.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Random" tank="100.000000" textureParticleName="ExplosionTexture.png" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Mutable" destroyWhenNoParticles="true" emissionEditionSimpleMode="false" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="130.000000" emitterForceMin="50.000000" emitterXDirection="1.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="-1.000000" friction="2.000000" gravityEditionSimpleMode="false" greenParam="Mutable" maxParticleNb="5000" name="Explosion2" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="75.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="30.000000" particleGreen1="76.000000" particleGreen2="180.000000" particleLifeTimeMax="1.500000" particleLifeTimeMin="0.700000" particleRed1="153.000000" particleRed2="1.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="0.050000" rendererParam2="1.000000" rendererType="Line" sizeParam="Random" tank="350.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Mutable" destroyWhenNoParticles="true" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="360.000000" emitterForceMax="130.000000" emitterForceMin="130.000000" emitterXDirection="1.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="-1.000000" friction="2.000000" gravityEditionSimpleMode="false" greenParam="Mutable" maxParticleNb="151" name="Explosion2" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="75.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="30.000000" particleGreen1="76.000000" particleGreen2="180.000000" particleLifeTimeMax="1.000000" particleLifeTimeMin="0.700000" particleRed1="153.000000" particleRed2="1.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="3.000000" rendererParam2="6.000000" rendererType="Line" sizeParam="Random" tank="40.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Enabled" destroyWhenNoParticles="true" emissionEditionSimpleMode="false" emitterAngleA="45.000000" emitterAngleB="180.000000" emitterForceMax="10.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="400.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Enabled" maxParticleNb="5000" name="ExplosionSmoke" particleAlpha1="153.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="0.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="30.000000" particleGreen1="25.000000" particleGreen2="0.800000" particleLifeTimeMax="1.200000" particleLifeTimeMin="0.700000" particleRed1="25.000000" particleRed2="0.100000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="20.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Random" tank="500.000000" textureParticleName="ExplosionTexture.png" type="ParticleSystem::ParticleEmitter" zoneRadius="20.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Enabled" destroyWhenNoParticles="true" emissionEditionSimpleMode="false" emitterAngleA="45.000000" emitterAngleB="180.000000" emitterForceMax="10.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="400.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Enabled" maxParticleNb="50" name="ExplosionSmoke" particleAlpha1="153.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="25.000000" particleBlue2="0.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="30.000000" particleGreen1="25.000000" particleGreen2="0.800000" particleLifeTimeMax="2.000000" particleLifeTimeMin="0.700000" particleRed1="25.000000" particleRed2="0.100000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="20.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Random" tank="50.000000" textureParticleName="ExplosionTexture.png" type="ParticleSystem::ParticleEmitter" zoneRadius="20.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
</objects>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<instruction>
|
||||
<type inverted="false" value="Timer" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>Random(0.3)+0.2</parameter>
|
||||
<parameter>"Creating"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<instruction>
|
||||
<type inverted="false" value="Create" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
@@ -90,9 +93,9 @@
|
||||
<parameter>Random(600)</parameter>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
<instruction>
|
||||
<type inverted="false" value="Create" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
@@ -101,9 +104,9 @@
|
||||
<parameter>Explosion.Y()</parameter>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
<instruction>
|
||||
<type inverted="false" value="Create" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
@@ -112,16 +115,16 @@
|
||||
<parameter>Explosion.Y()</parameter>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
<instruction>
|
||||
<type inverted="false" value="ResetTimer" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>"Creating"</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
@@ -131,9 +134,10 @@
|
||||
<cameras>
|
||||
<camera defaultSize="true" defaultViewport="true" height="0.000000" viewportBottom="1.000000" viewportLeft="0.000000" viewportRight="1.000000" viewportTop="0.000000" width="0.000000" />
|
||||
</cameras>
|
||||
<effects />
|
||||
</layer>
|
||||
</layers>
|
||||
<automatismsSharedData />
|
||||
<behaviorsSharedData />
|
||||
</layout>
|
||||
</layouts>
|
||||
<externalEvents />
|
||||
|
@@ -1,15 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<project firstLayout="">
|
||||
<gdVersion build="84" major="3" minor="6" revision="0" />
|
||||
<properties linuxExecutableFilename="" macExecutableFilename="" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<gdVersion build="97" major="4" minor="0" revision="0" />
|
||||
<properties folderProject="false" linuxExecutableFilename="" macExecutableFilename="" orientation="default" packageName="" projectFile="C:\Users\Maciel\Programacion\gits\GD\Binaries\Output\Release_Windows\Examples\Particles - Various effects.gdg" useExternalSourceFiles="false" winExecutableFilename="" winExecutableIconFile="">
|
||||
<name>Project</name>
|
||||
<author></author>
|
||||
<windowWidth>800</windowWidth>
|
||||
<windowHeight>600</windowHeight>
|
||||
<latestCompilationDirectory></latestCompilationDirectory>
|
||||
<latestCompilationDirectory>C:\Users\Maciel\AppData\Local\Temp\GDTemporaries\JSCocosExportParticles</latestCompilationDirectory>
|
||||
<maxFPS>60</maxFPS>
|
||||
<minFPS>10</minFPS>
|
||||
<verticalSync>false</verticalSync>
|
||||
<platformSpecificAssets />
|
||||
<loadingScreen showGDevelopSplash="true" />
|
||||
<extensions>
|
||||
<extension name="BuiltinObject" />
|
||||
<extension name="BuiltinAudio" />
|
||||
@@ -34,6 +36,7 @@
|
||||
</extensions>
|
||||
<platforms>
|
||||
<platform name="GDevelop C++ platform" />
|
||||
<platform name="GDevelop JS platform" />
|
||||
</platforms>
|
||||
<currentPlatform>GDevelop C++ platform</currentPlatform>
|
||||
</properties>
|
||||
@@ -47,8 +50,8 @@
|
||||
<objectsGroups />
|
||||
<variables />
|
||||
<layouts>
|
||||
<layout b="0" disableInputWhenNotFocused="true" mangledName="Nouvelle_32sc_232ne" name="Nouvelle scène" oglFOV="90.000000" oglZFar="500.000000" oglZNear="1.000000" r="0" standardSortMethod="true" stopSoundsOnStartup="true" title="" v="0">
|
||||
<uiSettings associatedLayout="" grid="false" gridB="255" gridG="180" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="158" gridWidth="32" snap="true" windowMask="false" zoomFactor="1.000000" />
|
||||
<layout b="0" disableInputWhenNotFocused="true" mangledName="Scene" name="Scene" oglFOV="90.000000" oglZFar="500.000000" oglZNear="1.000000" r="0" standardSortMethod="true" stopSoundsOnStartup="true" title="" v="0">
|
||||
<uiSettings grid="false" gridB="255" gridG="180" gridHeight="32" gridOffsetX="0" gridOffsetY="0" gridR="158" gridWidth="32" snap="true" windowMask="false" zoomFactor="1.000000" />
|
||||
<objectsGroups />
|
||||
<variables />
|
||||
<instances>
|
||||
@@ -99,47 +102,47 @@
|
||||
</instance>
|
||||
</instances>
|
||||
<objects>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Mutable" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="10.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="300.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Fire" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="30.000000" particleBlue1="50.000000" particleBlue2="0.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="-100.000000" particleGravityZ="0.000000" particleGreen1="50.000000" particleGreen2="204.000000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="240.000000" particleRed2="1.000000" particleSize1="100.000000" particleSize2="0.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="10.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Mutable" tank="-1.000000" textureParticleName="Fire" type="ParticleSystem::ParticleEmitter" zoneRadius="5.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Mutable" blueParam="Mutable" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="10.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="30.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Mutable" maxParticleNb="200" name="Fire" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="30.000000" particleBlue1="50.000000" particleBlue2="0.000000" particleEditionSimpleMode="true" particleGravityX="0.000000" particleGravityY="-100.000000" particleGravityZ="0.000000" particleGreen1="50.000000" particleGreen2="191.000000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="240.000000" particleRed2="255.000000" particleSize1="100.000000" particleSize2="0.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Mutable" rendererParam1="10.000000" rendererParam2="20.000000" rendererType="Quad" sizeParam="Mutable" tank="-1.000000" textureParticleName="Fire" type="ParticleSystem::ParticleEmitter" zoneRadius="5.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="false" alphaParam="Mutable" angleParam="Random" blueParam="Enabled" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="0.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="200.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Enabled" maxParticleNb="5000" name="Smoke" particleAlpha1="160.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="360.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="50.000000" particleBlue2="0.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="-100.000000" particleGravityZ="0.000000" particleGreen1="50.000000" particleGreen2="0.800000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="50.000000" particleRed2="1.000000" particleSize1="20.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="30.000000" rendererParam2="30.000000" rendererType="Quad" sizeParam="Mutable" tank="-1.000000" textureParticleName="Fire" type="ParticleSystem::ParticleEmitter" zoneRadius="7.000000">
|
||||
<object additive="false" alphaParam="Mutable" angleParam="Random" blueParam="Mutable" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="360.000000" emitterForceMax="0.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="150.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Mutable" maxParticleNb="150" name="Smoke" particleAlpha1="160.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="360.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="255.000000" particleBlue2="149.000000" particleEditionSimpleMode="true" particleGravityX="0.000000" particleGravityY="-100.000000" particleGravityZ="0.000000" particleGreen1="250.000000" particleGreen2="144.000000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="253.000000" particleRed2="135.000000" particleSize1="20.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Mutable" rendererParam1="30.000000" rendererParam2="30.000000" rendererType="Quad" sizeParam="Mutable" tank="-1.000000" textureParticleName="Fire" type="ParticleSystem::ParticleEmitter" zoneRadius="15.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="65.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="200.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Particles" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="125.000000" particleBlue2="204.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="250.000000" particleGreen1="125.000000" particleGreen2="204.000000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="204.000000" particleRed2="255.000000" particleSize1="0.000000" particleSize2="0.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="8.000000" rendererParam2="1.000000" rendererType="Point" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="65.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="200.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Particles" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="125.000000" particleBlue2="204.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="250.000000" particleGreen1="125.000000" particleGreen2="204.000000" particleLifeTimeMax="2.500000" particleLifeTimeMin="0.500000" particleRed1="204.000000" particleRed2="255.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="8.000000" rendererParam2="1.000000" rendererType="Point" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="2.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="false" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="0.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="100.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Beam" particleAlpha1="250.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="204.000000" particleBlue2="255.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="0.000000" particleGravityZ="500.000000" particleGreen1="127.000000" particleGreen2="230.000000" particleLifeTimeMax="2.000000" particleLifeTimeMin="0.500000" particleRed1="153.000000" particleRed2="180.000000" particleSize1="0.000000" particleSize2="0.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="3.000000" rendererParam2="1.000000" rendererType="Line" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="3.000000">
|
||||
<object additive="false" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="false" emitterAngleA="-55.000000" emitterAngleB="-35.000000" emitterForceMax="5.000000" emitterForceMin="0.000000" emitterXDirection="0.000000" emitterYDirection="1.000000" emitterZDirection="0.000000" flow="100.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="151" name="Beam" particleAlpha1="250.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="204.000000" particleBlue2="255.000000" particleEditionSimpleMode="false" particleGravityX="100.000000" particleGravityY="0.000000" particleGravityZ="500.000000" particleGreen1="127.000000" particleGreen2="230.000000" particleLifeTimeMax="2.000000" particleLifeTimeMin="0.500000" particleRed1="153.000000" particleRed2="180.000000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="100.000000" rendererParam2="3.000000" rendererType="Line" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="20.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="0.000000" emitterForceMax="65.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="0.000000" flow="300.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Beam2" particleAlpha1="125.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="255.000000" particleBlue2="204.000000" particleEditionSimpleMode="false" particleGravityX="-500.000000" particleGravityY="0.000000" particleGravityZ="0.000000" particleGreen1="204.000000" particleGreen2="125.000000" particleLifeTimeMax="5.000000" particleLifeTimeMin="0.500000" particleRed1="127.000000" particleRed2="0.500000" particleSize1="0.000000" particleSize2="0.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="0.500000" rendererParam2="2.000000" rendererType="Line" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="3.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="false" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="0.000000" emitterForceMax="65.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="0.000000" flow="50.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Random" maxParticleNb="5000" name="Beam2" particleAlpha1="125.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="255.000000" particleBlue2="204.000000" particleEditionSimpleMode="false" particleGravityX="-500.000000" particleGravityY="0.000000" particleGravityZ="0.000000" particleGreen1="204.000000" particleGreen2="125.000000" particleLifeTimeMax="5.000000" particleLifeTimeMin="0.500000" particleRed1="127.000000" particleRed2="0.500000" particleSize1="100.000000" particleSize2="100.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Enabled" rendererParam1="10.000000" rendererParam2="3.000000" rendererType="Line" sizeParam="Random" tank="-1.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="10.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="true" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="180.000000" emitterForceMax="100.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="400.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Enabled" maxParticleNb="5000" name="Pyro" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="204.000000" particleBlue2="255.000000" particleEditionSimpleMode="false" particleGravityX="0.000000" particleGravityY="-100.000000" particleGravityZ="0.000000" particleGreen1="127.000000" particleGreen2="1.000000" particleLifeTimeMax="1.000000" particleLifeTimeMin="0.500000" particleRed1="127.000000" particleRed2="230.000000" particleSize1="100.000000" particleSize2="1.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="0.060000" rendererParam2="3.000000" rendererType="Line" sizeParam="Mutable" tank="600.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="7.000000">
|
||||
<object additive="true" alphaParam="Mutable" angleParam="Random" blueParam="Random" destroyWhenNoParticles="true" emissionEditionSimpleMode="true" emitterAngleA="0.000000" emitterAngleB="360.000000" emitterForceMax="100.000000" emitterForceMin="25.000000" emitterXDirection="0.000000" emitterYDirection="0.000000" emitterZDirection="1.000000" flow="70.000000" friction="2.000000" gravityEditionSimpleMode="true" greenParam="Enabled" maxParticleNb="151" name="Pyro" particleAlpha1="204.000000" particleAlpha2="0.000000" particleAlphaRandomness1="0.000000" particleAlphaRandomness2="0.000000" particleAngle1="0.000000" particleAngle2="0.000000" particleAngleRandomness1="0.000000" particleAngleRandomness2="0.000000" particleBlue1="204.000000" particleBlue2="255.000000" particleEditionSimpleMode="false" particleGravityX="-0.000080" particleGravityY="-200.000000" particleGravityZ="0.000000" particleGreen1="127.000000" particleGreen2="1.000000" particleLifeTimeMax="1.000000" particleLifeTimeMin="0.500000" particleRed1="127.000000" particleRed2="230.000000" particleSize1="100.000000" particleSize2="1.000000" particleSizeRandomness1="0.000000" particleSizeRandomness2="0.000000" redParam="Random" rendererParam1="8.000000" rendererParam2="8.000000" rendererType="Line" sizeParam="Mutable" tank="80.000000" textureParticleName="" type="ParticleSystem::ParticleEmitter" zoneRadius="25.000000">
|
||||
<variables />
|
||||
<automatisms />
|
||||
<behaviors />
|
||||
</object>
|
||||
</objects>
|
||||
<events>
|
||||
<event disabled="false" folded="false">
|
||||
<type>BuiltinCommonInstructions::Standard</type>
|
||||
<conditions>
|
||||
<condition>
|
||||
<instruction>
|
||||
<type inverted="false" value="Timer" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>Random(0.3)+1</parameter>
|
||||
<parameter>1</parameter>
|
||||
<parameter>"Creating"</parameter>
|
||||
</parameters>
|
||||
<subConditions />
|
||||
</condition>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
</conditions>
|
||||
<actions>
|
||||
<action>
|
||||
<instruction>
|
||||
<type inverted="false" value="Create" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
@@ -148,16 +151,16 @@
|
||||
<parameter>100+Random(300)</parameter>
|
||||
<parameter></parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
<instruction>
|
||||
<type inverted="false" value="ResetTimer" />
|
||||
<parameters>
|
||||
<parameter></parameter>
|
||||
<parameter>"Creating"</parameter>
|
||||
</parameters>
|
||||
<subActions />
|
||||
</action>
|
||||
<subInstructions />
|
||||
</instruction>
|
||||
</actions>
|
||||
<events />
|
||||
</event>
|
||||
@@ -167,9 +170,10 @@
|
||||
<cameras>
|
||||
<camera defaultSize="true" defaultViewport="true" height="0.000000" viewportBottom="1.000000" viewportLeft="0.000000" viewportRight="1.000000" viewportTop="0.000000" width="0.000000" />
|
||||
</cameras>
|
||||
<effects />
|
||||
</layer>
|
||||
</layers>
|
||||
<automatismsSharedData />
|
||||
<behaviorsSharedData />
|
||||
</layout>
|
||||
</layouts>
|
||||
<externalEvents />
|
||||
|
1864
Binaries/Output/Release_Windows/Examples/SkeletonTest.gdg
Normal file
1
Binaries/Output/Release_Windows/Examples/skeleton.json
Normal file
@@ -0,0 +1 @@
|
||||
{"SubTexture":[{"frameY":0,"y":234,"frameWidth":112,"frameX":0,"frameHeight":210,"width":111,"height":209,"name":"parts/tailTip","x":456},{"width":112,"y":234,"height":86,"name":"parts/armUpperL","x":340},{"width":48,"y":859,"height":80,"name":"parts/armL","x":373},{"width":96,"y":922,"height":78,"name":"parts/handL","x":1},{"frameY":0,"y":677,"frameWidth":204,"frameX":0,"frameHeight":180,"width":203,"height":180,"name":"parts/legL","x":238},{"frameY":0,"y":397,"frameWidth":236,"frameX":0,"frameHeight":348,"width":235,"height":347,"name":"parts/body","x":1},{"width":216,"y":397,"height":278,"name":"parts/tail","x":238},{"width":208,"y":746,"height":174,"name":"parts/clothes1","x":1},{"width":124,"y":677,"height":282,"name":"parts/hair","x":443},{"frameY":0,"y":1,"frameWidth":338,"frameX":0,"frameHeight":394,"width":337,"height":394,"name":"parts/head","x":1},{"width":28,"y":961,"height":46,"name":"parts/eyeL","x":459},{"frameY":0,"y":961,"frameWidth":38,"frameX":0,"frameHeight":58,"width":37,"height":58,"name":"parts/eyeR","x":420},{"frameY":0,"y":1,"frameWidth":180,"frameX":0,"frameHeight":232,"width":180,"height":231,"name":"parts/legR","x":340},{"width":160,"y":859,"height":94,"name":"parts/armUpperR","x":211},{"frameY":0,"y":941,"frameWidth":46,"frameX":0,"frameHeight":78,"width":45,"height":77,"name":"parts/armR","x":373},{"width":98,"y":322,"height":58,"name":"parts/handR","x":340},{"frameY":0,"y":955,"frameWidth":120,"frameX":0,"frameHeight":36,"width":119,"height":36,"name":"parts/beardL","x":237},{"width":136,"y":955,"height":36,"name":"parts/beardR","x":99}],"width":1024,"height":1024,"name":"dragon","imagePath":"dragon_tex.png"}
|
BIN
Binaries/Output/Release_Windows/Examples/skeleton_texture.png
Normal file
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 486 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 638 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 469 B |
After Width: | Height: | Size: 600 B |
BIN
Binaries/Output/Release_Windows/locale/libexpat.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libgettextlib.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libgettextpo.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libgettextsrc.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libiconv2.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libintl-8.dll
Normal file
BIN
Binaries/Output/Release_Windows/locale/libintl3.dll
Normal file
BIN
Binaries/Output/Release_Windows/res/GD-logo-big.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
Binaries/Output/Release_Windows/res/centerPoint.png
Normal file
After Width: | Height: | Size: 1005 B |
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 382 B |
BIN
Binaries/Output/Release_Windows/res/conditions/raycast.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
Binaries/Output/Release_Windows/res/conditions/raycast24.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
Binaries/Output/Release_Windows/res/originPoint.png
Normal file
After Width: | Height: | Size: 1006 B |
BIN
Binaries/Output/Release_Windows/res/ribbon_default/export32.png
Normal file
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 568 B |
After Width: | Height: | Size: 1.6 KiB |
BIN
Binaries/Output/Release_Windows/res/ribbon_default/networkpreview64.png
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
Binaries/Output/Release_Windows/res/ribbon_default/objects64.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.1 KiB |
@@ -51,9 +51,9 @@ cd $CUR_DIR/opensuse-build-service/gdevelop
|
||||
tar zxf gdevelop_$GD_VERSION.orig.tar.gz
|
||||
echo "[OK]"
|
||||
|
||||
#We need to include ExtLibs/SFML.7z and ExtLibs/boost.7z because buildbot do not have access to internet
|
||||
#We need to include ExtLibs/SFML.7z because the buildbot do not have access to internet
|
||||
printf " Copying SFML archive... "
|
||||
cp $GD_BASE_DIR/ExtLibs/SFML.7z gdevelop-$GD_VERSION/ExtLibs/
|
||||
cp -rf $GD_BASE_DIR/ExtLibs/SFML gdevelop-$GD_VERSION/ExtLibs/
|
||||
echo "[OK]"
|
||||
|
||||
#Recreate the tar.gz with the added sources
|
||||
|
@@ -11,7 +11,7 @@ IF NOT EXIST "%INNOSETUP_EXE%" set INNOSETUP_EXE=C:\Program Files\Inno Setup 5\I
|
||||
IF EXIST "%INNOSETUP_EXE%" (
|
||||
echo "Note: InnoSetup found at %INNOSETUP_EXE%"
|
||||
) ELSE (
|
||||
echo Warning: InnoSetup not found! Skipping installer creation.
|
||||
echo Warning: InnoSetup Unicode not found! Skipping installer creation.
|
||||
SET SKIPINSTALLER=1
|
||||
)
|
||||
|
||||
@@ -35,14 +35,14 @@ del Output\Release_Windows\log.txt > NUL 2> NUL
|
||||
|
||||
echo.
|
||||
echo --Creating installer...
|
||||
IF NOT "%SKIPINSTALLER%"=="1" "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" Releases\InnoSetupInstallerScript.iss /Q
|
||||
IF NOT "%SKIPINSTALLER%"=="1" "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" Releases\InnoSetupInstallerScript.iss /Qp
|
||||
IF "%SKIPINSTALLER%"=="1" echo (Skipped)
|
||||
|
||||
echo.
|
||||
echo --Creating archive...
|
||||
if exist Releases\gd4xxxx.7z (del Releases\gd4xxxx.7z)
|
||||
cd Output\Release_Windows\
|
||||
IF NOT "%SKIPINSTALLERANDARCHIVE%"=="1" "..\..\..\ExtLibs\7za.exe" a ..\..\Releases\gd4xxxx.7z * > ..\..\Packaging\logs\7zArchiveLog.txt
|
||||
IF NOT "%SKIPINSTALLERANDARCHIVE%"=="1" "..\..\..\ExtLibs\7za.exe" a ..\..\Releases\gd4xxxx.7z * -bb
|
||||
IF "%SKIPINSTALLERANDARCHIVE%"=="1" echo (Skipped)
|
||||
cd ..\..\..
|
||||
|
||||
|
@@ -2,7 +2,9 @@
|
||||
Version=1.0
|
||||
Name=GDevelop
|
||||
GenericName=Game creator IDE
|
||||
GenericName[de]=Entwicklungsumgebung für Spiele
|
||||
Comment=HTML5 and native game development software
|
||||
Comment[de]=Entwicklungsumgebung für native und HTML5-Spiele
|
||||
Exec=sh -c "gdevelop %F"
|
||||
MimeType=application/x-gdevelop-project;
|
||||
Icon=GDevelop
|
||||
|
@@ -12,11 +12,11 @@ Source100: gdevelop-rpmlintrc
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: git rsync curl gcc-c++ cmake p7zip glew-devel xorg-x11-devel libsndfile-devel openal-soft-devel desktop-file-utils
|
||||
BuildRequires: git rsync curl gcc-c++ cmake p7zip glew-devel libsndfile-devel openal-soft-devel desktop-file-utils
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: systemd-devel libjpeg-turbo-devel gtk2-devel wxGTK3-devel
|
||||
BuildRequires: systemd-devel libjpeg-turbo-devel gtk2-devel wxGTK3-devel libX11-devel
|
||||
%else
|
||||
BuildRequires: update-desktop-files libudev-devel libjpeg8-devel wxWidgets-3_0-devel
|
||||
BuildRequires: update-desktop-files libudev-devel libjpeg8-devel wxWidgets-3_0-devel xorg-x11-devel
|
||||
%endif
|
||||
Requires: gcc-c++ p7zip
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
; Inno Setup installation script for GDevelop.
|
||||
; Inno Setup installation script for GDevelop 4.
|
||||
|
||||
[Setup]
|
||||
AppName=GDevelop
|
||||
@@ -13,17 +13,17 @@ AllowNoIcons=yes
|
||||
LicenseFile=..\Output\Release_Windows\License-en.rtf
|
||||
InfoBeforeFile=..\Output\Release_Windows\Informations-en.rtf
|
||||
OutputDir=.\
|
||||
OutputBaseFilename=gd4090
|
||||
OutputBaseFilename=gd4097
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
SetupIconFile=..\Output\Release_Windows\res\icon.ico
|
||||
VersionInfoVersion=4.0
|
||||
WizardImageFile=Setup bitmap\wizbmp.bmp
|
||||
WizardSmallImageFile=Setup bitmap/smallicon.bmp
|
||||
AppCopyright=2008-2016 Florian Rival
|
||||
AppCopyright=2008-2018 Florian Rival
|
||||
VersionInfoCompany=Florian Rival
|
||||
VersionInfoDescription=GDevelop setup
|
||||
VersionInfoCopyright=2008-2016 Florian Rival
|
||||
VersionInfoCopyright=2008-2018 Florian Rival
|
||||
VersionInfoProductName=GDevelop
|
||||
VersionInfoProductVersion=4.0
|
||||
|
||||
|
@@ -4,6 +4,9 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
|
||||
# Add utility functions
|
||||
include(scripts/CMakeClangUtils.txt) # To add clang-format and clang-tidy support to a target
|
||||
|
||||
# Macro for defining an option
|
||||
macro(gd_set_option var default type docstring)
|
||||
if(NOT DEFINED ${var})
|
||||
@@ -18,6 +21,7 @@ gd_set_option(BUILD_IDE TRUE BOOL "TRUE to build the IDE")
|
||||
gd_set_option(BUILD_EXTENSIONS TRUE BOOL "TRUE to build the extensions")
|
||||
gd_set_option(BUILD_TESTS FALSE BOOL "TRUE to build the tests")
|
||||
gd_set_option(NO_GUI FALSE BOOL "TRUE to build without wxWidgets GUI")
|
||||
gd_set_option(FULL_VERSION_NUMBER TRUE BOOL "TRUE to build GDevelop with its full version number (lastest tag + commit hash), FALSE to only use the lastest tag (avoid rebulding many source file when developping)")
|
||||
|
||||
#Setting up installation directory, for Linux (has to be done before "project" command).
|
||||
IF(NOT WIN32)
|
||||
@@ -76,6 +80,8 @@ endif()
|
||||
set(GD_base_dir ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
#Add all the CMakeLists:
|
||||
ADD_SUBDIRECTORY(Version)
|
||||
|
||||
ADD_SUBDIRECTORY(ExtLibs)
|
||||
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Core/CMakeLists.txt" AND BUILD_CORE)
|
||||
ADD_SUBDIRECTORY(Core)
|
||||
|
@@ -72,7 +72,12 @@ IF(NO_GUI)
|
||||
list(REMOVE_ITEM source_files "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.h" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs_dialogs_bitmaps.cpp")
|
||||
ENDIF()
|
||||
|
||||
file(GLOB_RECURSE formatted_source_files tests/* GDCore/Events/* GDCore/Extensions/* GDCore/IDE/* GDCore/Project/* GDCore/Serialization/* GDCore/Tools/*)
|
||||
list(REMOVE_ITEM formatted_source_files "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs.h" "${CMAKE_CURRENT_SOURCE_DIR}/GDCore/IDE/Dialogs/GDCoreDialogs_dialogs_bitmaps.cpp")
|
||||
gd_add_clang_utils(GDCore "${formatted_source_files}")
|
||||
|
||||
add_library(GDCore SHARED ${source_files})
|
||||
add_dependencies(GDCore GDVersion)
|
||||
IF(EMSCRIPTEN)
|
||||
set_target_properties(GDCore PROPERTIES SUFFIX ".bc")
|
||||
ELSEIF(WIN32)
|
||||
|
@@ -78,6 +78,7 @@
|
||||
* The installation is fairly simple :<br>
|
||||
* <br>
|
||||
* - Launch the installer.<br>
|
||||
* - Uncheck "Check for updated files on the TDM-GCC server" (otherwise you won't get TDM-GCC 4.9.2 but a more recent version that won't be compatible with wxWidgets pre-compiled binaries)
|
||||
* - Choose Create.<br>
|
||||
|
||||
\image html compilerInstall1.png
|
||||
@@ -531,7 +532,7 @@ AddEvent("Name",
|
||||
"Description",
|
||||
"Group",
|
||||
"path-to-a-16-by-16-icon.png",
|
||||
std::shared_ptr<gd::BaseEvent>(new EventClassName))
|
||||
std::make_shared<EventClassName>())
|
||||
* \endcode
|
||||
*
|
||||
* The event must be able to generate its code when events are being translated to C++ or Javascript:<br>
|
||||
@@ -543,7 +544,7 @@ AddEvent("Standard",
|
||||
_("Standard event: Actions are run if conditions are fulfilled."),
|
||||
"",
|
||||
"res/eventaddicon.png",
|
||||
std::shared_ptr<gd::BaseEvent>(new gd::StandardEvent))
|
||||
std::make_shared<gd::StandardEvent>())
|
||||
.SetCodeGenerator(std::shared_ptr<gd::EventMetadata::CodeGenerator>(codeGen));
|
||||
* \endcode
|
||||
|
||||
@@ -560,8 +561,8 @@ gd::BehaviorMetadata & aut = AddBehavior("Name",
|
||||
"Group",
|
||||
"path-to-a-32-by-32-icon.png",
|
||||
"BehaviorClassName",
|
||||
std::shared_ptr<gd::Behavior>(new BehaviorClassName),
|
||||
std::shared_ptr<gd::BehaviorsSharedData>(new BehaviorSharedDataClassName));
|
||||
std::make_shared<BehaviorClassName>(),
|
||||
std::make_shared<BehaviorSharedDataClassName>());
|
||||
* \endcode
|
||||
* The last line can be replaced by <code>std::shared_ptr<gd::BehaviorsSharedData>()</code> if no shared data are being used.
|
||||
*
|
||||
@@ -619,8 +620,8 @@ public:
|
||||
"",
|
||||
"CppPlatform/Extensions/myicon.png",
|
||||
"PhysicsBehavior",
|
||||
std::shared_ptr<gd::Behavior>(new BehaviorClassName),
|
||||
std::shared_ptr<gd::BehaviorsSharedData>(new BehaviorSharedDataClassName));
|
||||
std::make_shared<BehaviorClassName>(),
|
||||
std::make_shared<BehaviorSharedDataClassName>());
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
behaviorInfo.SetIncludeFile("MyExtension/MyIncludeFile.h");
|
||||
|
@@ -1,152 +1,189 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#include <wx/dcmemory.h>
|
||||
#endif
|
||||
#include "CommentEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/IDE/Dialogs/EditComment.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
void CommentEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
element.AddChild("color")
|
||||
.SetAttribute("r", r)
|
||||
.SetAttribute("g", v)
|
||||
.SetAttribute("b", b)
|
||||
.SetAttribute("textR", textR)
|
||||
.SetAttribute("textG", textG)
|
||||
.SetAttribute("textB", textB);
|
||||
void CommentEvent::SerializeTo(SerializerElement &element) const {
|
||||
element.AddChild("color")
|
||||
.SetAttribute("r", r)
|
||||
.SetAttribute("g", v)
|
||||
.SetAttribute("b", b)
|
||||
.SetAttribute("textR", textR)
|
||||
.SetAttribute("textG", textG)
|
||||
.SetAttribute("textB", textB);
|
||||
|
||||
element.AddChild("comment").SetValue(com1);
|
||||
element.AddChild("comment2").SetValue(com2);
|
||||
element.AddChild("comment").SetValue(com1);
|
||||
element.AddChild("comment2").SetValue(com2);
|
||||
}
|
||||
|
||||
void CommentEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
const SerializerElement & colorElement = element.GetChild("color", 0, "Couleur");
|
||||
r = colorElement.GetIntAttribute("r");
|
||||
v = colorElement.GetIntAttribute("g", 0, "v");
|
||||
b = colorElement.GetIntAttribute("b");
|
||||
textR = colorElement.GetIntAttribute("textR");
|
||||
textG = colorElement.GetIntAttribute("textG");
|
||||
textB = colorElement.GetIntAttribute("textB");
|
||||
void CommentEvent::UnserializeFrom(gd::Project &project,
|
||||
const SerializerElement &element) {
|
||||
const SerializerElement &colorElement =
|
||||
element.GetChild("color", 0, "Couleur");
|
||||
r = colorElement.GetIntAttribute("r");
|
||||
v = colorElement.GetIntAttribute("g", 0, "v");
|
||||
b = colorElement.GetIntAttribute("b");
|
||||
textR = colorElement.GetIntAttribute("textR");
|
||||
textG = colorElement.GetIntAttribute("textG");
|
||||
textB = colorElement.GetIntAttribute("textB");
|
||||
|
||||
com1 = element.GetChild("comment", 0, "Com1").GetValue().GetString();
|
||||
com2 = element.GetChild("comment2", 0, "Com2").GetValue().GetString();
|
||||
com1 = element.GetChild("comment", 0, "Com1").GetValue().GetString();
|
||||
com2 = element.GetChild("comment2", 0, "Com2").GetValue().GetString();
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType CommentEvent::EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
|
||||
{
|
||||
gd::BaseEvent::EditEventReturnType CommentEvent::EditEvent(
|
||||
wxWindow *parent_,
|
||||
gd::Project &game_,
|
||||
gd::Layout &scene_,
|
||||
gd::MainFrameWrapper &mainFrameWrapper_) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
EditComment dialog(parent_, *this);
|
||||
if ( dialog.ShowModal() == 0) return Cancelled;
|
||||
EditComment dialog(parent_, *this);
|
||||
if (dialog.ShowModal() == 0) return Cancelled;
|
||||
#endif
|
||||
|
||||
return ChangesMadeButNoNeedForEventsRecompilation;
|
||||
return ChangesMadeButNoNeedForEventsRecompilation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event
|
||||
*/
|
||||
void CommentEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform &)
|
||||
{
|
||||
void CommentEvent::Render(wxDC &dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas &areas,
|
||||
gd::EventsEditorSelection &selection,
|
||||
const gd::Platform &) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
x += 1; //Small border
|
||||
x += 1; // Small border
|
||||
|
||||
gd::EventsRenderingHelper *renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
renderingHelper->GetHTMLRenderer().SetDC(&dc);
|
||||
renderingHelper->GetHTMLRenderer().SetStandardFonts(
|
||||
renderingHelper->GetNiceFont().GetPointSize());
|
||||
|
||||
// Prepare HTML texts
|
||||
gd::String str1 =
|
||||
"<FONT color=" +
|
||||
wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX) + ">" +
|
||||
renderingHelper->GetHTMLText(com1) + "</FONT>";
|
||||
gd::String str2 =
|
||||
"<FONT color=" +
|
||||
wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX) + ">" +
|
||||
renderingHelper->GetHTMLText(com2) + "</FONT>";
|
||||
|
||||
// Calculate space constraints
|
||||
const int sideSeparation = 3; // Spacing between text and borders
|
||||
|
||||
unsigned int textWidth = com2.empty() ? width - sideSeparation * 2
|
||||
: width / 2 - sideSeparation * 2;
|
||||
renderingHelper->GetHTMLRenderer().SetSize(textWidth, 9999);
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
|
||||
unsigned int text1Height =
|
||||
renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
|
||||
unsigned int text2Height =
|
||||
renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
// Prepare background
|
||||
dc.SetBrush(wxBrush(wxColour(r, v, b), wxBRUSHSTYLE_TRANSPARENT));
|
||||
dc.SetPen(wxPen(wxColour(r / 2, v / 2, b / 2), 1));
|
||||
|
||||
// Draw the background
|
||||
unsigned int height = std::max(text1Height, text2Height) + sideSeparation * 2;
|
||||
height = std::max(height, (unsigned int)15);
|
||||
wxRect rectangle(x, y, width - 2, height);
|
||||
dc.GradientFillLinear(rectangle,
|
||||
wxColour(r + 20 > 255 ? 255 : r + 20,
|
||||
v + 20 > 255 ? 255 : v + 20,
|
||||
b + 20 > 255 ? 255 : b + 20),
|
||||
wxColour(r, v, b),
|
||||
wxSOUTH);
|
||||
dc.DrawRectangle(rectangle);
|
||||
|
||||
// Draw text
|
||||
{
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
|
||||
wxArrayInt neededArray;
|
||||
renderingHelper->GetHTMLRenderer().Render(
|
||||
x + sideSeparation, y + sideSeparation, neededArray);
|
||||
}
|
||||
if (!com2.empty()) // Optional text
|
||||
{
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
|
||||
wxArrayInt neededArray;
|
||||
renderingHelper->GetHTMLRenderer().Render(
|
||||
x + sideSeparation + textWidth + sideSeparation,
|
||||
y + sideSeparation,
|
||||
neededArray);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int CommentEvent::GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform &) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper *renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1, 1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
renderingHelper->GetHTMLRenderer().SetDC(&dc);
|
||||
renderingHelper->GetHTMLRenderer().SetStandardFonts(renderingHelper->GetNiceFont().GetPointSize());
|
||||
renderingHelper->GetHTMLRenderer().SetStandardFonts(
|
||||
renderingHelper->GetNiceFont().GetPointSize());
|
||||
|
||||
//Prepare HTML texts
|
||||
gd::String str1 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com1)+"</FONT>";
|
||||
gd::String str2 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com2)+"</FONT>";
|
||||
gd::String str1 =
|
||||
"<FONT color=" +
|
||||
wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX) + ">" +
|
||||
renderingHelper->GetHTMLText(com1) + "</FONT>";
|
||||
gd::String str2 =
|
||||
"<FONT color=" +
|
||||
wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX) + ">" +
|
||||
renderingHelper->GetHTMLText(com2) + "</FONT>";
|
||||
|
||||
//Calculate space constraints
|
||||
const int sideSeparation = 3; //Spacing between text and borders
|
||||
// Calculate space constraints
|
||||
const int sideSeparation = 3; // Spacing between text and borders
|
||||
|
||||
unsigned int textWidth = com2.empty() ? width-sideSeparation*2 : width/2-sideSeparation*2;
|
||||
unsigned int textWidth = com2.empty() ? width - sideSeparation * 2
|
||||
: width / 2 - sideSeparation * 2;
|
||||
renderingHelper->GetHTMLRenderer().SetSize(textWidth, 9999);
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
|
||||
unsigned int text1Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
unsigned int text1Height =
|
||||
renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
|
||||
unsigned int text2Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
unsigned int text2Height =
|
||||
renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
//Prepare background
|
||||
dc.SetBrush(wxBrush(wxColour(r, v, b), wxBRUSHSTYLE_TRANSPARENT));
|
||||
dc.SetPen(wxPen(wxColour(r/2, v/2, b/2), 1));
|
||||
|
||||
//Draw the background
|
||||
unsigned int height = std::max(text1Height, text2Height)+sideSeparation*2;
|
||||
unsigned int height =
|
||||
std::max(text1Height, text2Height) + sideSeparation * 2;
|
||||
height = std::max(height, (unsigned int)15);
|
||||
wxRect rectangle(x, y, width-2, height);
|
||||
dc.GradientFillLinear(rectangle, wxColour(r+20 > 255 ? 255 : r+20, v+20 > 255 ? 255 : v+20, b+20 > 255 ? 255 : b+20), wxColour(r, v, b), wxSOUTH);
|
||||
dc.DrawRectangle(rectangle);
|
||||
|
||||
//Draw text
|
||||
{
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
|
||||
wxArrayInt neededArray;
|
||||
renderingHelper->GetHTMLRenderer().Render(x + sideSeparation, y+sideSeparation, neededArray);
|
||||
}
|
||||
if ( !com2.empty() ) //Optional text
|
||||
{
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
|
||||
wxArrayInt neededArray;
|
||||
renderingHelper->GetHTMLRenderer().Render(x + sideSeparation + textWidth + sideSeparation, y+sideSeparation, neededArray);
|
||||
}
|
||||
renderedHeight = height;
|
||||
}
|
||||
#endif
|
||||
return renderedHeight + 2; // 2 : 2 small borders
|
||||
}
|
||||
|
||||
unsigned int CommentEvent::GetRenderedHeight(unsigned int width, const gd::Platform &) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1,1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetDC(&dc);
|
||||
renderingHelper->GetHTMLRenderer().SetStandardFonts(renderingHelper->GetNiceFont().GetPointSize());
|
||||
|
||||
gd::String str1 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com1)+"</FONT>";
|
||||
gd::String str2 = "<FONT color="+wxColour(textR, textG, textB).GetAsString(wxC2S_HTML_SYNTAX)+">"+renderingHelper->GetHTMLText(com2)+"</FONT>";
|
||||
|
||||
//Calculate space constraints
|
||||
const int sideSeparation = 3; //Spacing between text and borders
|
||||
|
||||
unsigned int textWidth = com2.empty() ? width-sideSeparation*2 : width/2-sideSeparation*2;
|
||||
renderingHelper->GetHTMLRenderer().SetSize(textWidth, 9999);
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str1);
|
||||
unsigned int text1Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
renderingHelper->GetHTMLRenderer().SetHtmlText(str2);
|
||||
unsigned int text2Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
|
||||
|
||||
unsigned int height = std::max(text1Height, text2Height)+sideSeparation*2;
|
||||
height = std::max(height, (unsigned int)15);
|
||||
renderedHeight = height;
|
||||
}
|
||||
#endif
|
||||
return renderedHeight+2;//2 : 2 small borders
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,61 +1,105 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef COMMENTEVENT_H
|
||||
#define COMMENTEVENT_H
|
||||
|
||||
#include "GDCore/Events/Event.h"
|
||||
class TiXmlElement;
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class MainFrameWrapper; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class MainFrameWrapper;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
class wxWindow;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Allows to add a text in the events editor.
|
||||
*/
|
||||
class GD_CORE_API CommentEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
CommentEvent() : BaseEvent(), r(255), v(230), b(109), textR(0), textG(0), textB(0) {};
|
||||
virtual ~CommentEvent() {};
|
||||
virtual gd::CommentEvent * Clone() const { return new CommentEvent(*this);}
|
||||
class GD_CORE_API CommentEvent : public gd::BaseEvent {
|
||||
public:
|
||||
CommentEvent()
|
||||
: BaseEvent(), r(255), v(230), b(109), textR(0), textG(0), textB(0){};
|
||||
virtual ~CommentEvent(){};
|
||||
virtual gd::CommentEvent* Clone() const { return new CommentEvent(*this); }
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
int GetBackgroundColorRed() const { return r; }
|
||||
int GetBackgroundColorGreen() const { return v; }
|
||||
int GetBackgroundColorBlue() const { return b; }
|
||||
void SetBackgroundColor(int r_, int g_, int b_) {
|
||||
r = r_;
|
||||
v = g_;
|
||||
b = b_;
|
||||
}
|
||||
|
||||
int r; ///< Background color Red component
|
||||
int v; ///< Background color Green component
|
||||
int b; ///< Background color Blue component
|
||||
int GetTextColorRed() const { return textR; }
|
||||
int GetTextColorGreen() const { return textG; }
|
||||
int GetTextColorBlue() const { return textB; }
|
||||
void SetTextColor(int r_, int g_, int b_) {
|
||||
textR = r_;
|
||||
textG = g_;
|
||||
textB = b_;
|
||||
}
|
||||
|
||||
int textR; ///< Text color Red component
|
||||
int textG; ///< Text color Green component
|
||||
int textB; ///< Text color Blue component
|
||||
const gd::String& GetComment() const { return com1; }
|
||||
void SetComment(const gd::String& comment) { com1 = comment; }
|
||||
|
||||
gd::String com1; ///< Comment gd::String
|
||||
gd::String com2; ///< Optional second comment gd::String
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & );
|
||||
int r; ///< Background color Red component
|
||||
int v; ///< Background color Green component
|
||||
int b; ///< Background color Blue component
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & ) const;
|
||||
int textR; ///< Text color Red component
|
||||
int textG; ///< Text color Green component
|
||||
int textB; ///< Text color Blue component
|
||||
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
|
||||
gd::String com1; ///< Comment
|
||||
gd::String com2; ///< Optional second column comment, deprecated
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform&);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform&) const;
|
||||
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // COMMENTEVENT_H
|
||||
#endif // COMMENTEVENT_H
|
||||
|
@@ -1,164 +1,198 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "ForEachEvent.h"
|
||||
#include <iostream>
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/IDE/Dialogs/EditForEachEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
ForEachEvent::ForEachEvent() :
|
||||
BaseEvent(),
|
||||
objectsToPick(""),
|
||||
objectsToPickSelected(false)
|
||||
{
|
||||
ForEachEvent::ForEachEvent()
|
||||
: BaseEvent(), objectsToPick(""), objectsToPickSelected(false) {}
|
||||
|
||||
vector<gd::InstructionsList*> ForEachEvent::GetAllConditionsVectors() {
|
||||
vector<gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < gd::InstructionsList* > ForEachEvent::GetAllConditionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
vector<gd::InstructionsList*> ForEachEvent::GetAllActionsVectors() {
|
||||
vector<gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allConditions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < gd::InstructionsList* > ForEachEvent::GetAllActionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<gd::Expression*> ForEachEvent::GetAllExpressions() {
|
||||
vector<gd::Expression*> allExpressions;
|
||||
allExpressions.push_back(&objectsToPick);
|
||||
|
||||
return allActions;
|
||||
return allExpressions;
|
||||
}
|
||||
vector<const gd::InstructionsList*> ForEachEvent::GetAllConditionsVectors()
|
||||
const {
|
||||
vector<const gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < gd::Expression* > ForEachEvent::GetAllExpressions()
|
||||
{
|
||||
vector < gd::Expression* > allExpressions;
|
||||
allExpressions.push_back(&objectsToPick);
|
||||
vector<const gd::InstructionsList*> ForEachEvent::GetAllActionsVectors() const {
|
||||
vector<const gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allExpressions;
|
||||
}
|
||||
vector < const gd::InstructionsList* > ForEachEvent::GetAllConditionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > ForEachEvent::GetAllActionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<const gd::Expression*> ForEachEvent::GetAllExpressions() const {
|
||||
vector<const gd::Expression*> allExpressions;
|
||||
allExpressions.push_back(&objectsToPick);
|
||||
|
||||
return allActions;
|
||||
return allExpressions;
|
||||
}
|
||||
|
||||
vector < const gd::Expression* > ForEachEvent::GetAllExpressions() const
|
||||
{
|
||||
vector < const gd::Expression* > allExpressions;
|
||||
allExpressions.push_back(&objectsToPick);
|
||||
|
||||
return allExpressions;
|
||||
void ForEachEvent::SerializeTo(SerializerElement& element) const {
|
||||
element.AddChild("object").SetValue(objectsToPick.GetPlainString());
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events,
|
||||
element.AddChild("events"));
|
||||
}
|
||||
|
||||
void ForEachEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
element.AddChild("object").SetValue(objectsToPick.GetPlainString());
|
||||
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
|
||||
}
|
||||
|
||||
void ForEachEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
objectsToPick = gd::Expression(element.GetChild("object", 0, "Object").GetValue().GetString());
|
||||
gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
|
||||
void ForEachEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
objectsToPick = gd::Expression(
|
||||
element.GetChild("object", 0, "Object").GetValue().GetString());
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void ForEachEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void ForEachEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int forEachTextHeight = 20;
|
||||
|
||||
// Draw header rectangle
|
||||
wxRect headerRect(x, y, width, forEachTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
|
||||
// For Each text
|
||||
dc.SetFont(renderingHelper->GetNiceFont().Bold());
|
||||
if (!IsDisabled())
|
||||
dc.SetTextForeground(wxColour(0, 0, 0));
|
||||
else
|
||||
dc.SetTextForeground(wxColour(160, 160, 160));
|
||||
dc.DrawText(_("For each object") + " " + objectsToPick.GetPlainString() +
|
||||
_(", repeat :"),
|
||||
x + 4,
|
||||
y + 3);
|
||||
|
||||
// Draw conditions rectangle
|
||||
wxRect rect(x,
|
||||
y + forEachTextHeight,
|
||||
renderingHelper->GetConditionsColumnWidth() + border,
|
||||
GetRenderedHeight(width, platform) - forEachTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
// Draw actions and conditions
|
||||
renderingHelper->DrawConditionsList(
|
||||
conditions,
|
||||
dc,
|
||||
x + border,
|
||||
y + forEachTextHeight + border,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
renderingHelper->DrawActionsList(
|
||||
actions,
|
||||
dc,
|
||||
x + renderingHelper->GetConditionsColumnWidth() + border,
|
||||
y + forEachTextHeight + border,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int ForEachEvent::GetRenderedHeight(
|
||||
unsigned int width, const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper* renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int forEachTextHeight = 20;
|
||||
|
||||
//Draw header rectangle
|
||||
wxRect headerRect(x, y, width, forEachTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
// Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(
|
||||
conditions,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(
|
||||
actions,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
platform);
|
||||
|
||||
//For Each text
|
||||
dc.SetFont( renderingHelper->GetNiceFont().Bold() );
|
||||
dc.SetTextForeground(wxColour(0,0,0));
|
||||
dc.DrawText( _("For each object") + " " + objectsToPick.GetPlainString() + _(", repeat :"), x + 4, y + 3 );
|
||||
renderedHeight =
|
||||
((conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight) +
|
||||
forEachTextHeight) +
|
||||
border * 2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
//Draw conditions rectangle
|
||||
wxRect rect(x, y+forEachTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-forEachTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
//Draw actions and conditions
|
||||
renderingHelper->DrawConditionsList(conditions, dc,
|
||||
x+border,
|
||||
y+forEachTextHeight+border,
|
||||
renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
|
||||
renderingHelper->DrawActionsList(actions, dc,
|
||||
x+renderingHelper->GetConditionsColumnWidth()+border,
|
||||
y+forEachTextHeight+border,
|
||||
width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int ForEachEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int forEachTextHeight = 20;
|
||||
|
||||
//Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(conditions, renderingHelper->GetConditionsColumnWidth()-border, platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(actions, width-renderingHelper->GetConditionsColumnWidth()-border*2, platform);
|
||||
|
||||
renderedHeight = (( conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight ) + forEachTextHeight)+border*2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType ForEachEvent::EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
|
||||
{
|
||||
gd::BaseEvent::EditEventReturnType ForEachEvent::EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
EditForEachEvent dialog(parent_, *this, game_, scene_);
|
||||
if ( dialog.ShowModal() == 0 ) return Cancelled;
|
||||
EditForEachEvent dialog(parent_, *this, game_, scene_);
|
||||
if (dialog.ShowModal() == 0) return Cancelled;
|
||||
#endif
|
||||
|
||||
return ChangesMade;
|
||||
return ChangesMade;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef FOREACHEVENT_H
|
||||
@@ -9,79 +9,107 @@
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
class RuntimeScene;
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class MainFrameWrapper; }
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class MainFrameWrapper;
|
||||
}
|
||||
class TiXmlElement;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
class wxWindow;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Event repeated for each object of a list.
|
||||
*
|
||||
* Each time the event is repeated, only the specific object of the list is picked.
|
||||
* Each time the event is repeated, only the specific object of the list is
|
||||
* picked.
|
||||
*/
|
||||
class GD_CORE_API ForEachEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
ForEachEvent();
|
||||
virtual ~ForEachEvent() {};
|
||||
virtual gd::ForEachEvent * Clone() const { return new ForEachEvent(*this);}
|
||||
class GD_CORE_API ForEachEvent : public gd::BaseEvent {
|
||||
public:
|
||||
ForEachEvent();
|
||||
virtual ~ForEachEvent(){};
|
||||
virtual gd::ForEachEvent* Clone() const { return new ForEachEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const {return true;}
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
virtual bool CanHaveSubEvents() const {return true;}
|
||||
virtual const gd::EventsList & GetSubEvents() const {return events;};
|
||||
virtual gd::EventsList & GetSubEvents() {return events;};
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList& GetSubEvents() const { return events; };
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
const gd::InstructionsList & GetConditions() const { return conditions; };
|
||||
gd::InstructionsList & GetConditions() { return conditions; };
|
||||
const gd::InstructionsList& GetConditions() const { return conditions; };
|
||||
gd::InstructionsList& GetConditions() { return conditions; };
|
||||
|
||||
const gd::InstructionsList & GetActions() const { return actions; };
|
||||
gd::InstructionsList & GetActions() { return actions; };
|
||||
const gd::InstructionsList& GetActions() const { return actions; };
|
||||
gd::InstructionsList& GetActions() { return actions; };
|
||||
|
||||
const gd::String & GetObjectToPick() const { return objectsToPick.GetPlainString(); };
|
||||
void SetObjectToPick(gd::String objectsToPick_) { objectsToPick = gd::Expression(objectsToPick_); };
|
||||
const gd::String& GetObjectToPick() const {
|
||||
return objectsToPick.GetPlainString();
|
||||
};
|
||||
void SetObjectToPick(gd::String objectsToPick_) {
|
||||
objectsToPick = gd::Expression(objectsToPick_);
|
||||
};
|
||||
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllConditionsVectors() const;
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllActionsVectors() const;
|
||||
virtual std::vector < const gd::Expression* > GetAllExpressions() const;
|
||||
virtual std::vector < gd::InstructionsList* > GetAllConditionsVectors();
|
||||
virtual std::vector < gd::InstructionsList* > GetAllActionsVectors();
|
||||
virtual std::vector < gd::Expression* > GetAllExpressions();
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
|
||||
const;
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
|
||||
virtual std::vector<const gd::Expression*> GetAllExpressions() const;
|
||||
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
|
||||
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
|
||||
virtual std::vector<gd::Expression*> GetAllExpressions();
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_);
|
||||
|
||||
private:
|
||||
gd::Expression objectsToPick;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
gd::EventsList events;
|
||||
private:
|
||||
gd::Expression objectsToPick;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
gd::EventsList events;
|
||||
|
||||
bool objectsToPickSelected;
|
||||
bool objectsToPickSelected;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // FOREACHEVENT_H
|
||||
#endif // FOREACHEVENT_H
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GroupEvent.h"
|
||||
@@ -10,155 +10,154 @@
|
||||
#include <wx/renderer.h>
|
||||
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
|
||||
#endif
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EventStoreDialog.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/IDE/Dialogs/GroupEventDialog.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/IDE/Dialogs/GroupEventDialog.h"
|
||||
#include "GDCore/IDE/Dialogs/EventStoreDialog.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
GroupEvent::GroupEvent() :
|
||||
BaseEvent(),
|
||||
creationTime(0),
|
||||
colorR(74),
|
||||
colorG(176),
|
||||
colorB(228)
|
||||
{
|
||||
GroupEvent::GroupEvent()
|
||||
: BaseEvent(), creationTime(0), colorR(74), colorG(176), colorB(228) {}
|
||||
|
||||
void GroupEvent::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("name", name);
|
||||
element.SetAttribute("source", source);
|
||||
element.SetAttribute("creationTime", (int)creationTime);
|
||||
element.SetAttribute("colorR", (int)colorR);
|
||||
element.SetAttribute("colorG", (int)colorG);
|
||||
element.SetAttribute("colorB", (int)colorB);
|
||||
gd::EventsListSerialization::SerializeEventsTo(events,
|
||||
element.AddChild("events"));
|
||||
|
||||
gd::SerializerElement& parametersElement = element.AddChild("parameters");
|
||||
parametersElement.ConsiderAsArrayOf("parameter");
|
||||
for (std::size_t i = 0; i < parameters.size(); ++i)
|
||||
parametersElement.AddChild("parameter").SetValue(parameters[i]);
|
||||
}
|
||||
|
||||
void GroupEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
element.SetAttribute("name", name);
|
||||
element.SetAttribute("source", source);
|
||||
element.SetAttribute("creationTime", (int)creationTime);
|
||||
element.SetAttribute("colorR", (int)colorR);
|
||||
element.SetAttribute("colorG", (int)colorG);
|
||||
element.SetAttribute("colorB", (int)colorB);
|
||||
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
|
||||
void GroupEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
name = element.GetStringAttribute("name");
|
||||
source = element.GetStringAttribute("source");
|
||||
creationTime = element.GetIntAttribute("creationTime");
|
||||
colorR = element.GetIntAttribute("colorR");
|
||||
colorG = element.GetIntAttribute("colorG");
|
||||
colorB = element.GetIntAttribute("colorB");
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events"));
|
||||
|
||||
gd::SerializerElement & parametersElement = element.AddChild("parameters");
|
||||
parametersElement.ConsiderAsArrayOf("parameter");
|
||||
for ( std::size_t i = 0;i < parameters.size();++i)
|
||||
parametersElement.AddChild("parameter").SetValue(parameters[i]);
|
||||
parameters.clear();
|
||||
gd::SerializerElement& parametersElement = element.GetChild("parameters");
|
||||
parametersElement.ConsiderAsArrayOf("parameters");
|
||||
for (std::size_t i = 0; i < parametersElement.GetChildrenCount(); ++i)
|
||||
parameters.push_back(parametersElement.GetChild(i).GetValue().GetString());
|
||||
}
|
||||
|
||||
void GroupEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
name = element.GetStringAttribute("name");
|
||||
source = element.GetStringAttribute("source");
|
||||
creationTime = element.GetIntAttribute("creationTime");
|
||||
colorR = element.GetIntAttribute("colorR");
|
||||
colorG = element.GetIntAttribute("colorG");
|
||||
colorB = element.GetIntAttribute("colorB");
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events"));
|
||||
|
||||
parameters.clear();
|
||||
gd::SerializerElement & parametersElement = element.GetChild("parameters");
|
||||
parametersElement.ConsiderAsArrayOf("parameters");
|
||||
for ( std::size_t i = 0;i < parametersElement.GetChildrenCount();++i)
|
||||
parameters.push_back(parametersElement.GetChild(i).GetValue().GetString());
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType GroupEvent::EditEvent(wxWindow* parent_, gd::Project & project, gd::Layout & scene, gd::MainFrameWrapper & mainFrameWrapper)
|
||||
{
|
||||
if (events.IsEmpty())
|
||||
events.InsertNewEvent(project, "BuiltinCommonInstructions::Standard");
|
||||
gd::BaseEvent::EditEventReturnType GroupEvent::EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene,
|
||||
gd::MainFrameWrapper& mainFrameWrapper) {
|
||||
if (events.IsEmpty())
|
||||
events.InsertNewEvent(project, "BuiltinCommonInstructions::Standard");
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (source.empty())
|
||||
{
|
||||
GroupEventDialog dialog(parent_, *this);
|
||||
dialog.ShowModal();
|
||||
return ChangesMadeButNoNeedForEventsRecompilation;
|
||||
if (source.empty()) {
|
||||
GroupEventDialog dialog(parent_, *this);
|
||||
dialog.ShowModal();
|
||||
return ChangesMadeButNoNeedForEventsRecompilation;
|
||||
} else {
|
||||
gd::EventStoreDialog dialog(parent_, project, scene);
|
||||
|
||||
size_t found = source.rfind("/");
|
||||
if (found != gd::String::npos && found < source.size() - 1) {
|
||||
gd::String sourceId = source.substr(found + 1, source.size());
|
||||
dialog.RefreshWith(sourceId, parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
gd::EventStoreDialog dialog(parent_, project, scene);
|
||||
|
||||
size_t found = source.rfind("/");
|
||||
if (found != gd::String::npos && found < source.size()-1) {
|
||||
gd::String sourceId = source.substr(found+1, source.size());
|
||||
dialog.RefreshWith(sourceId, parameters);
|
||||
}
|
||||
if (dialog.ShowModal() != 1) return Cancelled;
|
||||
|
||||
if (dialog.ShowModal() != 1) return Cancelled;
|
||||
|
||||
//Insert new events
|
||||
*this = dialog.GetGroupEvent();
|
||||
return ChangesMade;
|
||||
}
|
||||
// Insert new events
|
||||
*this = dialog.GetGroupEvent();
|
||||
return ChangesMade;
|
||||
}
|
||||
#else
|
||||
return Cancelled;
|
||||
return Cancelled;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GroupEvent::SetBackgroundColor(unsigned int colorR_, unsigned int colorG_, unsigned int colorB_)
|
||||
{
|
||||
colorR = colorR_;
|
||||
colorG = colorG_;
|
||||
colorB = colorB_;
|
||||
void GroupEvent::SetBackgroundColor(unsigned int colorR_,
|
||||
unsigned int colorG_,
|
||||
unsigned int colorB_) {
|
||||
colorR = colorR_;
|
||||
colorG = colorG_;
|
||||
colorB = colorB_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void GroupEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void GroupEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
|
||||
wxColour backgroundColor = wxColour(colorR, colorG, colorB);
|
||||
wxColour textColor = colorR + colorG + colorB > 200 * 3 ? *wxBLACK : *wxWHITE;
|
||||
if (IsDisabled()) {
|
||||
backgroundColor.MakeDisabled();
|
||||
textColor = wxColour(160, 160, 160);
|
||||
}
|
||||
|
||||
dc.SetBrush(wxBrush(backgroundColor));
|
||||
dc.SetPen(wxPen(backgroundColor.ChangeLightness(70)));
|
||||
wxRect rect(x + 1, y, width - 2, GetRenderedHeight(width, platform) - 2);
|
||||
dc.DrawRectangle(rect);
|
||||
|
||||
dc.SetTextBackground(backgroundColor);
|
||||
dc.SetTextForeground(textColor);
|
||||
dc.SetFont(
|
||||
wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
|
||||
dc.DrawText(groupTitle, x + 5, y + 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int GroupEvent::GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1, 1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
|
||||
wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
|
||||
wxColour backgroundColor = wxColour(colorR, colorG, colorB);
|
||||
wxColour textColor = colorR + colorG + colorB > 200*3 ? *wxBLACK : *wxWHITE;
|
||||
if (IsDisabled())
|
||||
{
|
||||
backgroundColor.MakeDisabled();
|
||||
textColor = wxColour(160, 160, 160);
|
||||
}
|
||||
|
||||
dc.SetBrush(wxBrush(backgroundColor));
|
||||
dc.SetPen(wxPen(backgroundColor.ChangeLightness(70)));
|
||||
wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2);
|
||||
dc.DrawRectangle(rect);
|
||||
dc.SetFont(wxFont(
|
||||
12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
wxRect text = dc.GetTextExtent(groupTitle);
|
||||
|
||||
dc.SetTextBackground(backgroundColor);
|
||||
dc.SetTextForeground(textColor);
|
||||
dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) );
|
||||
dc.DrawText( groupTitle, x+5, y + 5 );
|
||||
#endif
|
||||
}
|
||||
renderedHeight = text.GetHeight() + 10;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
unsigned int GroupEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1,1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
|
||||
wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
|
||||
|
||||
dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
|
||||
wxRect text = dc.GetTextExtent(groupTitle);
|
||||
|
||||
renderedHeight = text.GetHeight()+10;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,136 +1,165 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef GDCORE_GROUPEVENT_H
|
||||
#define GDCORE_GROUPEVENT_H
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd { class Project; }
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
class RuntimeScene;
|
||||
class TiXmlElement;
|
||||
class EventsCodeGenerationContext;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief A group event, containing only sub events and some (visual only) properties.
|
||||
*/
|
||||
class GD_CORE_API GroupEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
GroupEvent();
|
||||
virtual ~GroupEvent() {};
|
||||
virtual gd::GroupEvent * Clone() const { return new GroupEvent(*this);}
|
||||
|
||||
virtual bool IsExecutable() const {return true;}
|
||||
|
||||
/**
|
||||
* \brief Get the name of the group.
|
||||
*/
|
||||
const gd::String & GetName() const { return name; }
|
||||
|
||||
/**
|
||||
* \brief Change the name of the group.
|
||||
*/
|
||||
void SetName(const gd::String & name_) { name = name_; }
|
||||
|
||||
/**
|
||||
* \brief Get the source of the group.
|
||||
* \note The source is usually an URL from which
|
||||
* the group and its events was downloaded.
|
||||
*/
|
||||
const gd::String & GetSource() const { return source; }
|
||||
|
||||
/**
|
||||
* \brief Set the source of the group.
|
||||
*/
|
||||
void SetSource(const gd::String & source_) { source = source_; }
|
||||
|
||||
/**
|
||||
* \brief Get the vector containing the parameters that have been used to
|
||||
* create the group and its sub events.
|
||||
* \note These parameters are optional and only used to remember how the
|
||||
* group was created from an events template for example: if the user wants
|
||||
* to update the group with a new version of the template, the parameters
|
||||
* can be displayed again to easy the update.
|
||||
*/
|
||||
std::vector<gd::String> & GetCreationParameters() { return parameters; }
|
||||
const std::vector<gd::String> & GetCreationParameters() const { return parameters; }
|
||||
|
||||
/**
|
||||
* \brief Return the creation timestamp
|
||||
* \return The timestamp, or 0 if not specified for the group.
|
||||
*/
|
||||
unsigned int GetCreationTimestamp() const { return creationTime; }
|
||||
|
||||
/**
|
||||
* \brief Set timestamp of the creation of the group.
|
||||
* \note This is purely optional and only used for checking for example if
|
||||
* a new version of the group is available, if it has a source URL.
|
||||
*/
|
||||
void SetCreationTimestamp(unsigned int creationTime_) { creationTime = creationTime_; }
|
||||
|
||||
/**
|
||||
* \brief Change the color of the group
|
||||
*/
|
||||
void SetBackgroundColor(unsigned int colorR, unsigned int colorG, unsigned int colorB);
|
||||
|
||||
/**
|
||||
* \brief Get background color red component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorR() const { return colorR; };
|
||||
|
||||
/**
|
||||
* \brief Get background color green component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorG() const { return colorG; };
|
||||
|
||||
/**
|
||||
* \brief Get background color blue component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorB() const { return colorB; };
|
||||
|
||||
virtual bool CanHaveSubEvents() const {return true;}
|
||||
virtual const gd::EventsList & GetSubEvents() const {return events;};
|
||||
virtual gd::EventsList & GetSubEvents() {return events;};
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
|
||||
virtual gd::BaseEvent::EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & project, gd::Layout & scene, gd::MainFrameWrapper & mainFrameWrapper);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
|
||||
private:
|
||||
EventsList events;
|
||||
|
||||
gd::String name; ///<Optional. A name displayed in the events editor.
|
||||
gd::String source; ///< Optional. The source can contains the URL from which the group was downloaded.
|
||||
unsigned int creationTime; ///< Optional. The time when the group was created from an event template.
|
||||
std::vector<gd::String> parameters; ///< Optional. Can be used to remember the parameters used if the group was created from an events template.
|
||||
unsigned int colorR;
|
||||
unsigned int colorG;
|
||||
unsigned int colorB;
|
||||
};
|
||||
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
|
||||
#endif // GDCORE_GROUPEVENT_H
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief A group event, containing only sub events and some (visual only)
|
||||
* properties.
|
||||
*/
|
||||
class GD_CORE_API GroupEvent : public gd::BaseEvent {
|
||||
public:
|
||||
GroupEvent();
|
||||
virtual ~GroupEvent(){};
|
||||
virtual gd::GroupEvent* Clone() const { return new GroupEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
/**
|
||||
* \brief Get the name of the group.
|
||||
*/
|
||||
const gd::String& GetName() const { return name; }
|
||||
|
||||
/**
|
||||
* \brief Change the name of the group.
|
||||
*/
|
||||
void SetName(const gd::String& name_) { name = name_; }
|
||||
|
||||
/**
|
||||
* \brief Get the source of the group.
|
||||
* \note The source is usually an URL from which
|
||||
* the group and its events was downloaded.
|
||||
*/
|
||||
const gd::String& GetSource() const { return source; }
|
||||
|
||||
/**
|
||||
* \brief Set the source of the group.
|
||||
*/
|
||||
void SetSource(const gd::String& source_) { source = source_; }
|
||||
|
||||
/**
|
||||
* \brief Get the vector containing the parameters that have been used to
|
||||
* create the group and its sub events.
|
||||
* \note These parameters are optional and only used to remember how the
|
||||
* group was created from an events template for example: if the user wants
|
||||
* to update the group with a new version of the template, the parameters
|
||||
* can be displayed again to easy the update.
|
||||
*/
|
||||
std::vector<gd::String>& GetCreationParameters() { return parameters; }
|
||||
const std::vector<gd::String>& GetCreationParameters() const {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return the creation timestamp
|
||||
* \return The timestamp, or 0 if not specified for the group.
|
||||
*/
|
||||
unsigned int GetCreationTimestamp() const { return creationTime; }
|
||||
|
||||
/**
|
||||
* \brief Set timestamp of the creation of the group.
|
||||
* \note This is purely optional and only used for checking for example if
|
||||
* a new version of the group is available, if it has a source URL.
|
||||
*/
|
||||
void SetCreationTimestamp(unsigned int creationTime_) {
|
||||
creationTime = creationTime_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change the color of the group
|
||||
*/
|
||||
void SetBackgroundColor(unsigned int colorR,
|
||||
unsigned int colorG,
|
||||
unsigned int colorB);
|
||||
|
||||
/**
|
||||
* \brief Get background color red component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorR() const { return colorR; };
|
||||
|
||||
/**
|
||||
* \brief Get background color green component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorG() const { return colorG; };
|
||||
|
||||
/**
|
||||
* \brief Get background color blue component.
|
||||
*/
|
||||
unsigned int GetBackgroundColorB() const { return colorB; };
|
||||
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList& GetSubEvents() const { return events; };
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
virtual gd::BaseEvent::EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene,
|
||||
gd::MainFrameWrapper& mainFrameWrapper);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
private:
|
||||
EventsList events;
|
||||
|
||||
gd::String name; ///< Optional. A name displayed in the events editor.
|
||||
gd::String source; ///< Optional. The source can contains the URL from which
|
||||
///< the group was downloaded.
|
||||
unsigned int creationTime; ///< Optional. The time when the group was created
|
||||
///< from an event template.
|
||||
std::vector<gd::String>
|
||||
parameters; ///< Optional. Can be used to remember the parameters used if
|
||||
///< the group was created from an events template.
|
||||
unsigned int colorR;
|
||||
unsigned int colorG;
|
||||
unsigned int colorB;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_GROUPEVENT_H
|
||||
#endif
|
||||
|
@@ -1,246 +1,250 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#include <wx/dcmemory.h>
|
||||
#endif
|
||||
#include "GDCore/IDE/wxTools/SkinHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/ExternalEvents.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/Builtin/GroupEvent.h"
|
||||
#include "GDCore/Events/Builtin/LinkEvent.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
#include "GDCore/Events/Builtin/LinkEvent.h"
|
||||
#include "GDCore/Events/Builtin/GroupEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/IDE/Dialogs/LinkEventEditor.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/IDE/wxTools/SkinHelper.h"
|
||||
#include "GDCore/Project/ExternalEvents.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
const EventsList * LinkEvent::GetLinkedEvents(const gd::Project & project) const
|
||||
{
|
||||
const EventsList * events = nullptr;
|
||||
const gd::ExternalEvents * linkedExternalEvents = nullptr;
|
||||
if ( project.HasExternalEventsNamed(GetTarget()) )
|
||||
{
|
||||
linkedExternalEvents = &project.GetExternalEvents(GetTarget());
|
||||
events = &project.GetExternalEvents(GetTarget()).GetEvents();
|
||||
}
|
||||
else if ( project.HasLayoutNamed(GetTarget()) )
|
||||
events = &project.GetLayout(GetTarget()).GetEvents();
|
||||
const EventsList* LinkEvent::GetLinkedEvents(const gd::Project& project) const {
|
||||
const EventsList* events = nullptr;
|
||||
const gd::ExternalEvents* linkedExternalEvents = nullptr;
|
||||
if (project.HasExternalEventsNamed(GetTarget())) {
|
||||
linkedExternalEvents = &project.GetExternalEvents(GetTarget());
|
||||
events = &project.GetExternalEvents(GetTarget()).GetEvents();
|
||||
} else if (project.HasLayoutNamed(GetTarget()))
|
||||
events = &project.GetLayout(GetTarget()).GetEvents();
|
||||
|
||||
//If the link only includes an events group, search it inside the layout/external events
|
||||
if( includeConfig == INCLUDE_EVENTS_GROUP )
|
||||
{
|
||||
std::size_t i = 0;
|
||||
std::size_t eventsCount = events->GetEventsCount();
|
||||
for( ; i < eventsCount; ++i )
|
||||
{
|
||||
std::shared_ptr<const GroupEvent> groupEvent = std::dynamic_pointer_cast<const GroupEvent>(events->GetEventSmartPtr(i));
|
||||
if(groupEvent && groupEvent->GetName() == eventsGroupName)
|
||||
{
|
||||
//Get its sub-events
|
||||
events = &groupEvent->GetSubEvents();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(i >= eventsCount) //We didn't find the events group, return nullptr
|
||||
events = nullptr;
|
||||
// If the link only includes an events group, search it inside the
|
||||
// layout/external events
|
||||
if (includeConfig == INCLUDE_EVENTS_GROUP) {
|
||||
std::size_t i = 0;
|
||||
std::size_t eventsCount = events->GetEventsCount();
|
||||
for (; i < eventsCount; ++i) {
|
||||
std::shared_ptr<const GroupEvent> groupEvent =
|
||||
std::dynamic_pointer_cast<const GroupEvent>(
|
||||
events->GetEventSmartPtr(i));
|
||||
if (groupEvent && groupEvent->GetName() == eventsGroupName) {
|
||||
// Get its sub-events
|
||||
events = &groupEvent->GetSubEvents();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return events;
|
||||
if (i >= eventsCount) // We didn't find the events group, return nullptr
|
||||
events = nullptr;
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
void LinkEvent::ReplaceLinkByLinkedEvents(const gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList)
|
||||
{
|
||||
linkWasInvalid = false;
|
||||
//Finding what to link to.
|
||||
const EventsList * eventsToInclude = GetLinkedEvents(project);
|
||||
if ( eventsToInclude != NULL )
|
||||
{
|
||||
std::size_t firstEvent = includeConfig == INCLUDE_BY_INDEX ? GetIncludeStart() : 0;
|
||||
std::size_t lastEvent = includeConfig == INCLUDE_BY_INDEX ? GetIncludeEnd() : eventsToInclude->size() - 1;
|
||||
void LinkEvent::ReplaceLinkByLinkedEvents(
|
||||
const gd::Project& project,
|
||||
EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList) {
|
||||
linkWasInvalid = false;
|
||||
// Finding what to link to.
|
||||
const EventsList* eventsToInclude = GetLinkedEvents(project);
|
||||
if (eventsToInclude != NULL) {
|
||||
std::size_t firstEvent =
|
||||
includeConfig == INCLUDE_BY_INDEX ? GetIncludeStart() : 0;
|
||||
std::size_t lastEvent = includeConfig == INCLUDE_BY_INDEX
|
||||
? GetIncludeEnd()
|
||||
: eventsToInclude->size() - 1;
|
||||
|
||||
//Check bounds
|
||||
if ( firstEvent >= eventsToInclude->size() )
|
||||
{
|
||||
std::cout << "Unable to get events from a link ( Invalid start )" << std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
if ( lastEvent >= eventsToInclude->size() )
|
||||
{
|
||||
std::cout << "Unable to get events from a link ( Invalid end )" << std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
if ( firstEvent > lastEvent )
|
||||
{
|
||||
std::cout << "Unable to get events from a link ( End is before start )" << std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//Insert an empty event to replace the link event ( we'll delete the link event at the end )
|
||||
//( If we just erase the link event without adding a blank event to replace it,
|
||||
//the first event inserted by the link will not be preprocessed ( and it can be annoying if it require preprocessing, such as another link event ). )
|
||||
gd::EmptyEvent emptyEvent;
|
||||
eventList.InsertEvent(emptyEvent, indexOfTheEventInThisList);
|
||||
eventList.InsertEvents(*eventsToInclude, firstEvent, lastEvent, indexOfTheEventInThisList+1);
|
||||
|
||||
//Delete the link event ( which is now at the end of the list of events we've just inserted )
|
||||
eventList.RemoveEvent(indexOfTheEventInThisList + 1 + static_cast<unsigned>(lastEvent-firstEvent)+1);
|
||||
// Check bounds
|
||||
if (firstEvent >= eventsToInclude->size()) {
|
||||
std::cout << "Unable to get events from a link ( Invalid start )"
|
||||
<< std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Unable to get events from a link." << std::endl;
|
||||
linkWasInvalid = true;
|
||||
|
||||
//Delete the link event
|
||||
eventList.RemoveEvent(indexOfTheEventInThisList);
|
||||
return;
|
||||
if (lastEvent >= eventsToInclude->size()) {
|
||||
std::cout << "Unable to get events from a link ( Invalid end )"
|
||||
<< std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
if (firstEvent > lastEvent) {
|
||||
std::cout << "Unable to get events from a link ( End is before start )"
|
||||
<< std::endl;
|
||||
linkWasInvalid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert an empty event to replace the link event ( we'll delete the link
|
||||
// event at the end ) ( If we just erase the link event without adding a
|
||||
// blank event to replace it, the first event inserted by the link will not
|
||||
// be preprocessed ( and it can be annoying if it require preprocessing,
|
||||
// such as another link event ). )
|
||||
gd::EmptyEvent emptyEvent;
|
||||
eventList.InsertEvent(emptyEvent, indexOfTheEventInThisList);
|
||||
eventList.InsertEvents(
|
||||
*eventsToInclude, firstEvent, lastEvent, indexOfTheEventInThisList + 1);
|
||||
|
||||
// Delete the link event ( which is now at the end of the list of events
|
||||
// we've just inserted )
|
||||
eventList.RemoveEvent(indexOfTheEventInThisList + 1 +
|
||||
static_cast<unsigned>(lastEvent - firstEvent) + 1);
|
||||
} else {
|
||||
std::cout << "Unable to get events from a link." << std::endl;
|
||||
linkWasInvalid = true;
|
||||
|
||||
// Delete the link event
|
||||
eventList.RemoveEvent(indexOfTheEventInThisList);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LinkEvent::~LinkEvent()
|
||||
{
|
||||
LinkEvent::~LinkEvent() {}
|
||||
|
||||
void LinkEvent::SerializeTo(SerializerElement& element) const {
|
||||
SerializerElement& includeElement = element.AddChild("include").SetAttribute(
|
||||
"includeConfig", static_cast<int>(GetIncludeConfig()));
|
||||
|
||||
if (GetIncludeConfig() == INCLUDE_EVENTS_GROUP) {
|
||||
includeElement.SetAttribute("eventsGroup", GetEventsGroupName());
|
||||
} else if (GetIncludeConfig() == INCLUDE_BY_INDEX) {
|
||||
includeElement.SetAttribute("start", static_cast<int>(GetIncludeStart()));
|
||||
includeElement.SetAttribute("end", static_cast<int>(GetIncludeEnd()));
|
||||
}
|
||||
|
||||
element.AddChild("target").SetValue(GetTarget());
|
||||
}
|
||||
|
||||
void LinkEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
SerializerElement & includeElement = element.AddChild("include")
|
||||
.SetAttribute("includeConfig", static_cast<int>(GetIncludeConfig()));
|
||||
void LinkEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
SerializerElement& includeElement = element.GetChild("include", 0, "Limites");
|
||||
|
||||
if(GetIncludeConfig() == INCLUDE_EVENTS_GROUP)
|
||||
{
|
||||
includeElement.SetAttribute("eventsGroup", GetEventsGroupName());
|
||||
}
|
||||
else if(GetIncludeConfig() == INCLUDE_BY_INDEX)
|
||||
{
|
||||
includeElement.SetAttribute("start", static_cast<int>(GetIncludeStart()));
|
||||
includeElement.SetAttribute("end", static_cast<int>(GetIncludeEnd()));
|
||||
}
|
||||
SetTarget(element.GetChild("target", 0, "Scene").GetValue().GetString());
|
||||
|
||||
element.AddChild("target").SetValue(GetTarget());
|
||||
if (includeElement.HasAttribute("includeAll")) {
|
||||
// Compatibility with GDevelop <= 4.0.92
|
||||
if (includeElement.GetBoolAttribute("includeAll", true)) {
|
||||
SetIncludeAllEvents();
|
||||
} else {
|
||||
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
|
||||
includeElement.GetIntAttribute("end"));
|
||||
}
|
||||
} else {
|
||||
// GDevelop > 4.0.92
|
||||
IncludeConfig config = static_cast<IncludeConfig>(
|
||||
includeElement.GetIntAttribute("includeConfig", 0));
|
||||
if (config == INCLUDE_ALL)
|
||||
SetIncludeAllEvents();
|
||||
else if (config == INCLUDE_EVENTS_GROUP)
|
||||
SetIncludeEventsGroup(includeElement.GetStringAttribute("eventsGroup"));
|
||||
else if (config == INCLUDE_BY_INDEX)
|
||||
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
|
||||
includeElement.GetIntAttribute("end"));
|
||||
}
|
||||
}
|
||||
|
||||
void LinkEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
SerializerElement & includeElement = element.GetChild("include", 0, "Limites");
|
||||
|
||||
SetTarget(element.GetChild("target", 0, "Scene").GetValue().GetString());
|
||||
|
||||
if(includeElement.HasAttribute("includeAll"))
|
||||
{
|
||||
//Compatibility with GDevelop <= 4.0.92
|
||||
if(includeElement.GetBoolAttribute("includeAll", true))
|
||||
{
|
||||
SetIncludeAllEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
|
||||
includeElement.GetIntAttribute("end"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//GDevelop > 4.0.92
|
||||
IncludeConfig config = static_cast<IncludeConfig>(includeElement.GetIntAttribute("includeConfig", 0));
|
||||
if(config == INCLUDE_ALL)
|
||||
SetIncludeAllEvents();
|
||||
else if(config == INCLUDE_EVENTS_GROUP)
|
||||
SetIncludeEventsGroup(includeElement.GetStringAttribute("eventsGroup"));
|
||||
else if(config == INCLUDE_BY_INDEX)
|
||||
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"), includeElement.GetIntAttribute("end"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType LinkEvent::EditEvent(wxWindow* parent_, gd::Project & project, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
|
||||
{
|
||||
gd::BaseEvent::EditEventReturnType LinkEvent::EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
LinkEventEditor dialog(parent_, *this, project);
|
||||
if ( dialog.ShowModal() == 0 ) return Cancelled;
|
||||
LinkEventEditor dialog(parent_, *this, project);
|
||||
if (dialog.ShowModal() == 0) return Cancelled;
|
||||
#endif
|
||||
|
||||
return ChangesMade;
|
||||
return ChangesMade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void LinkEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
|
||||
dc.SetBrush( wxBrush( wxColour( 255, 255, 255 ) ) );
|
||||
dc.SetPen( wxPen( wxColour( 0, 0, 0 ), 1) );
|
||||
wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2);
|
||||
dc.DrawRectangle(rect);
|
||||
dc.SetBrush(wxBrush(wxColour(255, 255, 255)));
|
||||
dc.SetPen(wxPen(wxColour(0, 0, 0), 1));
|
||||
wxRect rect(x + 1, y, width - 2, GetRenderedHeight(width, platform) - 2);
|
||||
dc.DrawRectangle(rect);
|
||||
|
||||
dc.DrawBitmap( gd::SkinHelper::GetIcon("events", 24), x+4, y + 1, true);
|
||||
dc.DrawBitmap(gd::SkinHelper::GetIcon("events", 24), x + 4, y + 1, true);
|
||||
|
||||
dc.SetTextBackground( wxColour( 255, 255, 255 ) );
|
||||
if ( !IsDisabled() )
|
||||
dc.SetTextForeground( wxColour( 0, 0, 0 ) );
|
||||
else
|
||||
dc.SetTextForeground( wxColour( 160, 160, 160 ) );
|
||||
dc.SetTextBackground(wxColour(255, 255, 255));
|
||||
if (!IsDisabled())
|
||||
dc.SetTextForeground(wxColour(0, 0, 0));
|
||||
else
|
||||
dc.SetTextForeground(wxColour(160, 160, 160));
|
||||
|
||||
dc.SetFont(renderingHelper->GetNiceFont());
|
||||
dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 );
|
||||
dc.SetFont(renderingHelper->GetNiceFont());
|
||||
dc.DrawText(_("Link to ") + GetTarget(), x + 32, y + 3);
|
||||
|
||||
if ( GetIncludeConfig() == INCLUDE_BY_INDEX )
|
||||
{
|
||||
wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
|
||||
dc.DrawText( _("Include only events ")+gd::String::From(GetIncludeStart()+1)+_(" to ")+gd::String::From(GetIncludeEnd()+1), x+textRect.GetWidth()+32+10, y + 5 );
|
||||
}
|
||||
else if ( GetIncludeConfig() == INCLUDE_EVENTS_GROUP )
|
||||
{
|
||||
wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
|
||||
dc.DrawText( _("Include only the events group named \"")+gd::String::From(GetEventsGroupName())+_("\""), x+textRect.GetWidth()+32+10, y + 5 );
|
||||
}
|
||||
if (GetIncludeConfig() == INCLUDE_BY_INDEX) {
|
||||
wxRect textRect = dc.GetTextExtent(_("Link to ") + GetTarget());
|
||||
dc.DrawText(_("Include only events ") +
|
||||
gd::String::From(GetIncludeStart() + 1) + _(" to ") +
|
||||
gd::String::From(GetIncludeEnd() + 1),
|
||||
x + textRect.GetWidth() + 32 + 10,
|
||||
y + 5);
|
||||
} else if (GetIncludeConfig() == INCLUDE_EVENTS_GROUP) {
|
||||
wxRect textRect = dc.GetTextExtent(_("Link to ") + GetTarget());
|
||||
dc.DrawText(_("Include only the events group named \"") +
|
||||
gd::String::From(GetEventsGroupName()) + _("\""),
|
||||
x + textRect.GetWidth() + 32 + 10,
|
||||
y + 5);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Precompute height for the link
|
||||
*/
|
||||
unsigned int LinkEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
unsigned int LinkEvent::GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper* renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1,1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
wxMemoryDC dc;
|
||||
wxBitmap fakeBmp(1, 1);
|
||||
dc.SelectObject(fakeBmp);
|
||||
|
||||
dc.SetFont(renderingHelper->GetNiceFont());
|
||||
wxRect lien = dc.GetTextExtent(_("Link to "));
|
||||
dc.SetFont(renderingHelper->GetNiceFont());
|
||||
wxRect lien = dc.GetTextExtent(_("Link to "));
|
||||
|
||||
renderedHeight = lien.GetHeight()+15;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
renderedHeight = lien.GetHeight() + 15;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,123 +1,164 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef GDCORE_LINKEVENT_H
|
||||
#define GDCORE_LINKEVENT_H
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief A link pointing to external events (or events of another layout) that should be included
|
||||
* and run instead of the link.
|
||||
* \brief A link pointing to external events (or events of another layout) that
|
||||
* should be included and run instead of the link.
|
||||
*/
|
||||
class GD_CORE_API LinkEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
enum IncludeConfig
|
||||
{
|
||||
INCLUDE_ALL = 0,
|
||||
INCLUDE_EVENTS_GROUP = 1,
|
||||
INCLUDE_BY_INDEX = 2 // Deprecated
|
||||
};
|
||||
class GD_CORE_API LinkEvent : public gd::BaseEvent {
|
||||
public:
|
||||
enum IncludeConfig {
|
||||
INCLUDE_ALL = 0,
|
||||
INCLUDE_EVENTS_GROUP = 1,
|
||||
INCLUDE_BY_INDEX = 2 // Deprecated
|
||||
};
|
||||
|
||||
LinkEvent() : BaseEvent(), includeConfig(INCLUDE_ALL), eventsGroupName(), includeStart(gd::String::npos), includeEnd(gd::String::npos), linkWasInvalid(false) {};
|
||||
virtual ~LinkEvent();
|
||||
virtual gd::LinkEvent * Clone() const { return new LinkEvent(*this); }
|
||||
LinkEvent()
|
||||
: BaseEvent(),
|
||||
includeConfig(INCLUDE_ALL),
|
||||
eventsGroupName(),
|
||||
includeStart(gd::String::npos),
|
||||
includeEnd(gd::String::npos),
|
||||
linkWasInvalid(false){};
|
||||
virtual ~LinkEvent();
|
||||
virtual gd::LinkEvent* Clone() const { return new LinkEvent(*this); }
|
||||
|
||||
/**
|
||||
* Get the link target (i.e. the scene or external events the link refers to).
|
||||
*/
|
||||
const gd::String & GetTarget() const { return target; };
|
||||
/**
|
||||
* Get the link target (i.e. the scene or external events the link refers to).
|
||||
*/
|
||||
const gd::String& GetTarget() const { return target; };
|
||||
|
||||
/**
|
||||
* Change the link target (i.e. the scene or external events the link refers to).
|
||||
*/
|
||||
void SetTarget(const gd::String & target_) { target = target_; };
|
||||
/**
|
||||
* Change the link target (i.e. the scene or external events the link refers
|
||||
* to).
|
||||
*/
|
||||
void SetTarget(const gd::String& target_) { target = target_; };
|
||||
|
||||
/**
|
||||
* Return the include config.
|
||||
*/
|
||||
IncludeConfig GetIncludeConfig() const { return includeConfig; }
|
||||
/**
|
||||
* Return the include config.
|
||||
*/
|
||||
IncludeConfig GetIncludeConfig() const { return includeConfig; }
|
||||
|
||||
/**
|
||||
* Return true if the link event must include all the events of the target.
|
||||
*/
|
||||
void SetIncludeAllEvents() { includeConfig = INCLUDE_ALL; }
|
||||
/**
|
||||
* Return true if the link event must include all the events of the target.
|
||||
*/
|
||||
void SetIncludeAllEvents() { includeConfig = INCLUDE_ALL; }
|
||||
|
||||
void SetIncludeEventsGroup(const gd::String& name) { includeConfig = INCLUDE_EVENTS_GROUP; eventsGroupName = name; }
|
||||
void SetIncludeEventsGroup(const gd::String& name) {
|
||||
includeConfig = INCLUDE_EVENTS_GROUP;
|
||||
eventsGroupName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of the first and last event to be included ( Meaningful only if includeAll was set to false, see SetIncludeAllEvents )
|
||||
*/
|
||||
void SetIncludeStartAndEnd(std::size_t includeStart_, std::size_t includeEnd_) { includeConfig = INCLUDE_BY_INDEX; includeStart = includeStart_; includeEnd = includeEnd_; }
|
||||
/**
|
||||
* Set the number of the first and last event to be included ( Meaningful only
|
||||
* if includeAll was set to false, see SetIncludeAllEvents )
|
||||
*/
|
||||
void SetIncludeStartAndEnd(std::size_t includeStart_,
|
||||
std::size_t includeEnd_) {
|
||||
includeConfig = INCLUDE_BY_INDEX;
|
||||
includeStart = includeStart_;
|
||||
includeEnd = includeEnd_;
|
||||
}
|
||||
|
||||
gd::String GetEventsGroupName() const { return eventsGroupName; }
|
||||
gd::String GetEventsGroupName() const { return eventsGroupName; }
|
||||
|
||||
/**
|
||||
* Get the number of the first event to be included. (Meaningful only if includeAll was set to false, see SetIncludeAllEvents)
|
||||
*/
|
||||
std::size_t GetIncludeStart() const { return includeStart; };
|
||||
/**
|
||||
* Get the number of the first event to be included. (Meaningful only if
|
||||
* includeAll was set to false, see SetIncludeAllEvents)
|
||||
*/
|
||||
std::size_t GetIncludeStart() const { return includeStart; };
|
||||
|
||||
/**
|
||||
* Get the number of the last event to be included. (Meaningful only if includeAll was set to false, see SetIncludeAllEvents)
|
||||
*/
|
||||
std::size_t GetIncludeEnd() const { return includeEnd; };
|
||||
/**
|
||||
* Get the number of the last event to be included. (Meaningful only if
|
||||
* includeAll was set to false, see SetIncludeAllEvents)
|
||||
*/
|
||||
std::size_t GetIncludeEnd() const { return includeEnd; };
|
||||
|
||||
/**
|
||||
* The link event must always be preprocessed.
|
||||
*/
|
||||
virtual bool MustBePreprocessed() { return true;}
|
||||
/**
|
||||
* The link event must always be preprocessed.
|
||||
*/
|
||||
virtual bool MustBePreprocessed() { return true; }
|
||||
|
||||
/**
|
||||
* \brief Get a pointer to the list of events that are targeted by the link.
|
||||
*
|
||||
* @param project The project containing the link.
|
||||
* @return NULL if nothing is found or a pointer to the list of events being linked.
|
||||
*/
|
||||
const EventsList * GetLinkedEvents(const gd::Project & project) const;
|
||||
/**
|
||||
* \brief Get a pointer to the list of events that are targeted by the link.
|
||||
*
|
||||
* @param project The project containing the link.
|
||||
* @return NULL if nothing is found or a pointer to the list of events being
|
||||
* linked.
|
||||
*/
|
||||
const EventsList* GetLinkedEvents(const gd::Project& project) const;
|
||||
|
||||
/**
|
||||
* \brief Replace the link in the events list by the linked events.
|
||||
* When implementing a platform with a link event, you should call this function when preprocessing the events
|
||||
* (See gd::EventMetadata::codeGeneration).
|
||||
*/
|
||||
void ReplaceLinkByLinkedEvents(const gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList);
|
||||
/**
|
||||
* \brief Replace the link in the events list by the linked events.
|
||||
* When implementing a platform with a link event, you should call this
|
||||
* function when preprocessing the events (See
|
||||
* gd::EventMetadata::codeGeneration).
|
||||
*/
|
||||
void ReplaceLinkByLinkedEvents(const gd::Project& project,
|
||||
EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList);
|
||||
|
||||
virtual bool IsExecutable() const { return true; };
|
||||
virtual bool IsExecutable() const { return true; };
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_);
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
private:
|
||||
gd::String target; ///< The name of the external events (or scene) to be included
|
||||
private:
|
||||
gd::String
|
||||
target; ///< The name of the external events (or scene) to be included
|
||||
|
||||
IncludeConfig includeConfig; ///< Defines which events are included by this link
|
||||
IncludeConfig
|
||||
includeConfig; ///< Defines which events are included by this link
|
||||
|
||||
gd::String eventsGroupName; ///< If includeConfig is set to INCLUDE_EVENTS_GROUP, represents the name of the events group to be included.
|
||||
gd::String eventsGroupName; ///< If includeConfig is set to
|
||||
///< INCLUDE_EVENTS_GROUP, represents the name of
|
||||
///< the events group to be included.
|
||||
|
||||
std::size_t includeStart; ///< If includeConfig is set to INCLUDE_BY_INDEX, represents the number of the first event of the target to included.
|
||||
std::size_t includeEnd; ///< If includeConfig is set to INCLUDE_BY_INDEX, represents the number of the last event of the target to included.
|
||||
std::size_t includeStart; ///< If includeConfig is set to INCLUDE_BY_INDEX,
|
||||
///< represents the number of the first event of
|
||||
///< the target to included.
|
||||
std::size_t
|
||||
includeEnd; ///< If includeConfig is set to INCLUDE_BY_INDEX, represents
|
||||
///< the number of the last event of the target to included.
|
||||
|
||||
bool linkWasInvalid; ///< Set to true by Preprocess if the links was invalid the last time is was processed. Used to display a warning in the events editor.
|
||||
bool linkWasInvalid; ///< Set to true by Preprocess if the links was invalid
|
||||
///< the last time is was processed. Used to display a
|
||||
///< warning in the events editor.
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_LINKEVENT_H
|
||||
#endif // GDCORE_LINKEVENT_H
|
||||
|
@@ -1,163 +1,200 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "RepeatEvent.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EditRepeatEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/IDE/Dialogs/EditRepeatEvent.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
RepeatEvent::RepeatEvent() :
|
||||
BaseEvent(),
|
||||
repeatNumberExpression(""),
|
||||
repeatNumberExpressionSelected(false)
|
||||
{
|
||||
RepeatEvent::RepeatEvent()
|
||||
: BaseEvent(),
|
||||
repeatNumberExpression(""),
|
||||
repeatNumberExpressionSelected(false) {}
|
||||
|
||||
vector<gd::InstructionsList*> RepeatEvent::GetAllConditionsVectors() {
|
||||
vector<gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector<gd::InstructionsList*> RepeatEvent::GetAllActionsVectors() {
|
||||
vector<gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
vector < gd::InstructionsList* > RepeatEvent::GetAllConditionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < gd::InstructionsList* > RepeatEvent::GetAllActionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<gd::Expression*> RepeatEvent::GetAllExpressions() {
|
||||
vector<gd::Expression*> allExpressions;
|
||||
allExpressions.push_back(&repeatNumberExpression);
|
||||
|
||||
return allActions;
|
||||
return allExpressions;
|
||||
}
|
||||
|
||||
vector < gd::Expression* > RepeatEvent::GetAllExpressions()
|
||||
{
|
||||
vector < gd::Expression* > allExpressions;
|
||||
allExpressions.push_back(&repeatNumberExpression);
|
||||
vector<const gd::InstructionsList*> RepeatEvent::GetAllConditionsVectors()
|
||||
const {
|
||||
vector<const gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allExpressions;
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > RepeatEvent::GetAllConditionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
vector<const gd::InstructionsList*> RepeatEvent::GetAllActionsVectors() const {
|
||||
vector<const gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allConditions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > RepeatEvent::GetAllActionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<const gd::Expression*> RepeatEvent::GetAllExpressions() const {
|
||||
vector<const gd::Expression*> allExpressions;
|
||||
allExpressions.push_back(&repeatNumberExpression);
|
||||
|
||||
return allActions;
|
||||
return allExpressions;
|
||||
}
|
||||
|
||||
vector < const gd::Expression* > RepeatEvent::GetAllExpressions() const
|
||||
{
|
||||
vector < const gd::Expression* > allExpressions;
|
||||
allExpressions.push_back(&repeatNumberExpression);
|
||||
|
||||
return allExpressions;
|
||||
void RepeatEvent::SerializeTo(SerializerElement& element) const {
|
||||
element.AddChild("repeatExpression")
|
||||
.SetValue(repeatNumberExpression.GetPlainString());
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events,
|
||||
element.AddChild("events"));
|
||||
}
|
||||
|
||||
void RepeatEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
element.AddChild("repeatExpression").SetValue(repeatNumberExpression.GetPlainString());
|
||||
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
|
||||
}
|
||||
|
||||
void RepeatEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
repeatNumberExpression = gd::Expression(element.GetChild("repeatExpression", 0, "RepeatExpression").GetValue().GetString());
|
||||
gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
|
||||
void RepeatEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
repeatNumberExpression =
|
||||
gd::Expression(element.GetChild("repeatExpression", 0, "RepeatExpression")
|
||||
.GetValue()
|
||||
.GetString());
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void RepeatEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void RepeatEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatTextHeight = 20;
|
||||
|
||||
// Draw header rectangle
|
||||
wxRect headerRect(x, y, width, repeatTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
|
||||
// Repeat text
|
||||
dc.SetFont(renderingHelper->GetNiceFont().Bold());
|
||||
if (!IsDisabled())
|
||||
dc.SetTextForeground(wxColour(0, 0, 0));
|
||||
else
|
||||
dc.SetTextForeground(wxColour(160, 160, 160));
|
||||
dc.DrawText(_("Repeat") + " " + repeatNumberExpression.GetPlainString() +
|
||||
" " + _("times :"),
|
||||
x + 4,
|
||||
y + 3);
|
||||
|
||||
// Draw conditions rectangle
|
||||
wxRect rect(x,
|
||||
y + repeatTextHeight,
|
||||
renderingHelper->GetConditionsColumnWidth() + border,
|
||||
GetRenderedHeight(width, platform) - repeatTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
// Draw actions and conditions
|
||||
renderingHelper->DrawConditionsList(
|
||||
conditions,
|
||||
dc,
|
||||
x + border,
|
||||
y + repeatTextHeight + border,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
renderingHelper->DrawActionsList(
|
||||
actions,
|
||||
dc,
|
||||
x + renderingHelper->GetConditionsColumnWidth() + border,
|
||||
y + repeatTextHeight + border,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int RepeatEvent::GetRenderedHeight(
|
||||
unsigned int width, const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper* renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatTextHeight = 20;
|
||||
|
||||
//Draw header rectangle
|
||||
wxRect headerRect(x, y, width, repeatTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
// Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(
|
||||
conditions,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(
|
||||
actions,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
platform);
|
||||
|
||||
//Repeat text
|
||||
dc.SetFont( renderingHelper->GetNiceFont().Bold() );
|
||||
dc.SetTextForeground(wxColour(0,0,0));
|
||||
dc.DrawText( _("Repeat") + " " + repeatNumberExpression.GetPlainString() + " " + _("times :"), x + 4, y + 3 );
|
||||
renderedHeight =
|
||||
(conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight) +
|
||||
repeatTextHeight + border * 2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
//Draw conditions rectangle
|
||||
wxRect rect(x, y+repeatTextHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-repeatTextHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
//Draw actions and conditions
|
||||
renderingHelper->DrawConditionsList(conditions, dc,
|
||||
x+border,
|
||||
y+repeatTextHeight+border,
|
||||
renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
|
||||
renderingHelper->DrawActionsList(actions, dc,
|
||||
x+renderingHelper->GetConditionsColumnWidth()+border,
|
||||
y+repeatTextHeight+border,
|
||||
width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int RepeatEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatTextHeight = 20;
|
||||
|
||||
//Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(conditions, renderingHelper->GetConditionsColumnWidth()-border, platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(actions, width-renderingHelper->GetConditionsColumnWidth()-border*2, platform);
|
||||
|
||||
renderedHeight = ( conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight ) + repeatTextHeight + border*2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType RepeatEvent::EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
|
||||
{
|
||||
gd::BaseEvent::EditEventReturnType RepeatEvent::EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
EditRepeatEvent dialog(parent_, *this, game_, scene_);
|
||||
if ( dialog.ShowModal() == 0 ) return Cancelled;
|
||||
EditRepeatEvent dialog(parent_, *this, game_, scene_);
|
||||
if (dialog.ShowModal() == 0) return Cancelled;
|
||||
#endif
|
||||
|
||||
return ChangesMade;
|
||||
return ChangesMade;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,82 +1,105 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_REPEATEVENT_H
|
||||
#define GDCORE_REPEATEVENT_H
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
class RuntimeScene;
|
||||
class TiXmlElement;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Event being repeated a specified number of times.
|
||||
*/
|
||||
class GD_CORE_API RepeatEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
RepeatEvent();
|
||||
virtual ~RepeatEvent() {};
|
||||
virtual gd::RepeatEvent * Clone() const { return new RepeatEvent(*this);}
|
||||
class GD_CORE_API RepeatEvent : public gd::BaseEvent {
|
||||
public:
|
||||
RepeatEvent();
|
||||
virtual ~RepeatEvent(){};
|
||||
virtual gd::RepeatEvent* Clone() const { return new RepeatEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const {return true;}
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
virtual bool CanHaveSubEvents() const {return true;}
|
||||
virtual const gd::EventsList & GetSubEvents() const {return events;};
|
||||
virtual gd::EventsList & GetSubEvents() {return events;};
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList& GetSubEvents() const { return events; };
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
const gd::InstructionsList & GetConditions() const { return conditions; };
|
||||
gd::InstructionsList & GetConditions() { return conditions; };
|
||||
const gd::InstructionsList& GetConditions() const { return conditions; };
|
||||
gd::InstructionsList& GetConditions() { return conditions; };
|
||||
|
||||
const gd::InstructionsList & GetActions() const { return actions; };
|
||||
gd::InstructionsList & GetActions() { return actions; };
|
||||
const gd::InstructionsList& GetActions() const { return actions; };
|
||||
gd::InstructionsList& GetActions() { return actions; };
|
||||
|
||||
const gd::String & GetRepeatExpression() const { return repeatNumberExpression.GetPlainString(); };
|
||||
void SetRepeatExpression(gd::String repeatNumberExpression_) { repeatNumberExpression = gd::Expression(repeatNumberExpression_); };
|
||||
const gd::String& GetRepeatExpression() const {
|
||||
return repeatNumberExpression.GetPlainString();
|
||||
};
|
||||
void SetRepeatExpression(gd::String repeatNumberExpression_) {
|
||||
repeatNumberExpression = gd::Expression(repeatNumberExpression_);
|
||||
};
|
||||
|
||||
virtual std::vector < gd::InstructionsList* > GetAllConditionsVectors();
|
||||
virtual std::vector < gd::InstructionsList* > GetAllActionsVectors();
|
||||
virtual std::vector < gd::Expression* > GetAllExpressions();
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllConditionsVectors() const;
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllActionsVectors() const;
|
||||
virtual std::vector < const gd::Expression* > GetAllExpressions() const;
|
||||
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
|
||||
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
|
||||
virtual std::vector<gd::Expression*> GetAllExpressions();
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
|
||||
const;
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
|
||||
virtual std::vector<const gd::Expression*> GetAllExpressions() const;
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_);
|
||||
|
||||
private:
|
||||
gd::Expression repeatNumberExpression;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
private:
|
||||
gd::Expression repeatNumberExpression;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
|
||||
bool repeatNumberExpressionSelected;
|
||||
bool repeatNumberExpressionSelected;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_REPEATEVENT_H
|
||||
#endif // GDCORE_REPEATEVENT_H
|
||||
|
@@ -1,125 +1,152 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "StandardEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
StandardEvent::StandardEvent() :
|
||||
BaseEvent()
|
||||
{
|
||||
StandardEvent::StandardEvent() : BaseEvent() {}
|
||||
|
||||
StandardEvent::~StandardEvent(){};
|
||||
|
||||
vector<const gd::InstructionsList*> StandardEvent::GetAllConditionsVectors()
|
||||
const {
|
||||
vector<const gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
StandardEvent::~StandardEvent()
|
||||
{
|
||||
};
|
||||
vector<const gd::InstructionsList*> StandardEvent::GetAllActionsVectors()
|
||||
const {
|
||||
vector<const gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
vector < const gd::InstructionsList* > StandardEvent::GetAllConditionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
return allActions;
|
||||
}
|
||||
vector<gd::InstructionsList*> StandardEvent::GetAllConditionsVectors() {
|
||||
vector<gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > StandardEvent::GetAllActionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<gd::InstructionsList*> StandardEvent::GetAllActionsVectors() {
|
||||
vector<gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
}
|
||||
vector < gd::InstructionsList* > StandardEvent::GetAllConditionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < gd::InstructionsList* > StandardEvent::GetAllActionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
void StandardEvent::SerializeTo(SerializerElement& element) const {
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events,
|
||||
element.AddChild("events"));
|
||||
}
|
||||
|
||||
void StandardEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
|
||||
}
|
||||
|
||||
void StandardEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
|
||||
void StandardEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void StandardEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void StandardEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
|
||||
// Draw event rectangle
|
||||
wxRect rect(x,
|
||||
y,
|
||||
renderingHelper->GetConditionsColumnWidth() + border,
|
||||
GetRenderedHeight(width, platform));
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
renderingHelper->DrawConditionsList(
|
||||
conditions,
|
||||
dc,
|
||||
x + border,
|
||||
y + border,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
renderingHelper->DrawActionsList(
|
||||
actions,
|
||||
dc,
|
||||
x + renderingHelper->GetConditionsColumnWidth() + border,
|
||||
y + border,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
|
||||
// Make sure that Render is rendering an event with the same height as
|
||||
// GetRenderedHeight : Use same values for border and similar calls to compute
|
||||
// heights
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int StandardEvent::GetRenderedHeight(
|
||||
unsigned int width, const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper* renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
|
||||
//Draw event rectangle
|
||||
wxRect rect(x, y, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform));
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
// Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(
|
||||
conditions,
|
||||
renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(
|
||||
actions,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
platform);
|
||||
|
||||
renderingHelper->DrawConditionsList(conditions, dc,
|
||||
x+border,
|
||||
y+border,
|
||||
renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
|
||||
renderingHelper->DrawActionsList(actions, dc,
|
||||
x+renderingHelper->GetConditionsColumnWidth()+border,
|
||||
y+border,
|
||||
width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
|
||||
renderedHeight =
|
||||
(conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight) +
|
||||
border * 2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
//Make sure that Render is rendering an event with the same height as GetRenderedHeight : Use same values for border and similar calls to compute heights
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int StandardEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
|
||||
//Get maximum height needed
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(conditions, renderingHelper->GetConditionsColumnWidth()-border*2, platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(actions, width-renderingHelper->GetConditionsColumnWidth()-border*2, platform);
|
||||
|
||||
renderedHeight = (conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight)+border*2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,74 +1,89 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef GDCORE_STANDARDEVENT_H
|
||||
#define GDCORE_STANDARDEVENT_H
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
class RuntimeScene;
|
||||
class TiXmlElement;
|
||||
class EventsCodeGenerationContext;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Standard event, with conditions, actions and support for sub events.
|
||||
*/
|
||||
class GD_CORE_API StandardEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
StandardEvent();
|
||||
virtual ~StandardEvent();
|
||||
virtual gd::StandardEvent * Clone() const { return new StandardEvent(*this);}
|
||||
class GD_CORE_API StandardEvent : public gd::BaseEvent {
|
||||
public:
|
||||
StandardEvent();
|
||||
virtual ~StandardEvent();
|
||||
virtual gd::StandardEvent* Clone() const { return new StandardEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const {return true;}
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
virtual bool CanHaveSubEvents() const {return true;}
|
||||
virtual const gd::EventsList & GetSubEvents() const {return events;};
|
||||
virtual gd::EventsList & GetSubEvents() {return events;};
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList& GetSubEvents() const { return events; };
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
const gd::InstructionsList & GetConditions() const { return conditions; };
|
||||
gd::InstructionsList & GetConditions() { return conditions; };
|
||||
const gd::InstructionsList& GetConditions() const { return conditions; };
|
||||
gd::InstructionsList& GetConditions() { return conditions; };
|
||||
|
||||
const gd::InstructionsList & GetActions() const { return actions; };
|
||||
gd::InstructionsList & GetActions() { return actions; };
|
||||
const gd::InstructionsList& GetActions() const { return actions; };
|
||||
gd::InstructionsList& GetActions() { return actions; };
|
||||
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllConditionsVectors() const;
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllActionsVectors() const;
|
||||
virtual std::vector < gd::InstructionsList* > GetAllConditionsVectors();
|
||||
virtual std::vector < gd::InstructionsList* > GetAllActionsVectors();
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
|
||||
const;
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
|
||||
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
|
||||
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
private:
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
private:
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_STANDARDEVENT_H
|
||||
#endif // GDCORE_STANDARDEVENT_H
|
||||
#endif
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
@@ -10,171 +10,238 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include "GDCore/IDE/wxTools/CommonBitmapProvider.h"
|
||||
#endif
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
|
||||
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
vector < gd::InstructionsList* > WhileEvent::GetAllConditionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&whileConditions);
|
||||
allConditions.push_back(&conditions);
|
||||
vector<gd::InstructionsList*> WhileEvent::GetAllConditionsVectors() {
|
||||
vector<gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&whileConditions);
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < gd::InstructionsList* > WhileEvent::GetAllActionsVectors()
|
||||
{
|
||||
vector < gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<gd::InstructionsList*> WhileEvent::GetAllActionsVectors() {
|
||||
vector<gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > WhileEvent::GetAllConditionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allConditions;
|
||||
allConditions.push_back(&whileConditions);
|
||||
allConditions.push_back(&conditions);
|
||||
vector<const gd::InstructionsList*> WhileEvent::GetAllConditionsVectors()
|
||||
const {
|
||||
vector<const gd::InstructionsList*> allConditions;
|
||||
allConditions.push_back(&whileConditions);
|
||||
allConditions.push_back(&conditions);
|
||||
|
||||
return allConditions;
|
||||
return allConditions;
|
||||
}
|
||||
|
||||
vector < const gd::InstructionsList* > WhileEvent::GetAllActionsVectors() const
|
||||
{
|
||||
vector < const gd::InstructionsList* > allActions;
|
||||
allActions.push_back(&actions);
|
||||
vector<const gd::InstructionsList*> WhileEvent::GetAllActionsVectors() const {
|
||||
vector<const gd::InstructionsList*> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
return allActions;
|
||||
}
|
||||
|
||||
void WhileEvent::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
element.SetAttribute("infiniteLoopWarning", infiniteLoopWarning);
|
||||
gd::EventsListSerialization::SaveConditions(whileConditions, element.AddChild("whileConditions"));
|
||||
gd::EventsListSerialization::SaveConditions(conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SaveActions(actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events, element.AddChild("events"));
|
||||
void WhileEvent::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("infiniteLoopWarning", infiniteLoopWarning);
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
whileConditions, element.AddChild("whileConditions"));
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
conditions, element.AddChild("conditions"));
|
||||
gd::EventsListSerialization::SerializeInstructionsTo(
|
||||
actions, element.AddChild("actions"));
|
||||
gd::EventsListSerialization::SerializeEventsTo(events,
|
||||
element.AddChild("events"));
|
||||
}
|
||||
|
||||
void WhileEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
justCreatedByTheUser = false;
|
||||
infiniteLoopWarning = element.GetBoolAttribute("infiniteLoopWarning");
|
||||
gd::EventsListSerialization::OpenConditions(project, whileConditions, element.GetChild("whileConditions", 0, "WhileConditions"));
|
||||
gd::EventsListSerialization::OpenConditions(project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::OpenActions(project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(project, events, element.GetChild("events", 0, "Events"));
|
||||
void WhileEvent::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
justCreatedByTheUser = false;
|
||||
infiniteLoopWarning = element.GetBoolAttribute("infiniteLoopWarning");
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project,
|
||||
whileConditions,
|
||||
element.GetChild("whileConditions", 0, "WhileConditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the event in the bitmap
|
||||
*/
|
||||
void WhileEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
|
||||
{
|
||||
void WhileEvent::Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
gd::EventsRenderingHelper* renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatHeight = 20;
|
||||
|
||||
// Draw header rectangle
|
||||
int whileConditionsHeight =
|
||||
renderingHelper->GetRenderedConditionsListHeight(
|
||||
whileConditions, width - 80 - border * 2, platform) +
|
||||
border * 2;
|
||||
if (!infiniteLoopWarning && whileConditionsHeight < 32)
|
||||
whileConditionsHeight = 32;
|
||||
wxRect headerRect(x, y, width, whileConditionsHeight + repeatHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
|
||||
// While text
|
||||
dc.SetFont(renderingHelper->GetNiceFont().Bold());
|
||||
if (!IsDisabled())
|
||||
dc.SetTextForeground(wxColour(0, 0, 0));
|
||||
else
|
||||
dc.SetTextForeground(wxColour(160, 160, 160));
|
||||
dc.DrawText(_("While :"), x + 5, y + 5);
|
||||
|
||||
// Draw icon if infinite loop warning is deactivated.
|
||||
if (!infiniteLoopWarning) {
|
||||
if (gd::CommonBitmapProvider::Get()->noProtection.IsOk())
|
||||
dc.DrawBitmap(gd::CommonBitmapProvider::Get()->noProtection,
|
||||
wxPoint(x + 5, y + 5 + 18),
|
||||
/*useMask=*/true);
|
||||
}
|
||||
|
||||
// Draw "while conditions"
|
||||
renderingHelper->DrawConditionsList(whileConditions,
|
||||
dc,
|
||||
x + 80 + border,
|
||||
y + border,
|
||||
width - 80 - border * 2,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
|
||||
dc.SetFont(renderingHelper->GetNiceFont().Bold());
|
||||
if (!IsDisabled())
|
||||
dc.SetTextForeground(wxColour(0, 0, 0));
|
||||
else
|
||||
dc.SetTextForeground(wxColour(160, 160, 160));
|
||||
dc.DrawText(_("Repeat :"), x + 4, y + whileConditionsHeight + 3);
|
||||
whileConditionsHeight += repeatHeight;
|
||||
|
||||
// Draw conditions rectangle
|
||||
wxRect rect(x,
|
||||
y + whileConditionsHeight,
|
||||
renderingHelper->GetConditionsColumnWidth() + border,
|
||||
GetRenderedHeight(width, platform) - whileConditionsHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
renderingHelper->DrawConditionsList(
|
||||
conditions,
|
||||
dc,
|
||||
x + border,
|
||||
y + whileConditionsHeight + border,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
renderingHelper->DrawActionsList(
|
||||
actions,
|
||||
dc,
|
||||
x + renderingHelper->GetConditionsColumnWidth() + border,
|
||||
y + whileConditionsHeight + border,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
this,
|
||||
areas,
|
||||
selection,
|
||||
platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int WhileEvent::GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if (eventHeightNeedUpdate) {
|
||||
gd::EventsRenderingHelper* renderingHelper =
|
||||
gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatHeight = 20;
|
||||
|
||||
//Draw header rectangle
|
||||
int whileConditionsHeight = renderingHelper->GetRenderedConditionsListHeight(whileConditions, width-80-border*2, platform)+border*2;
|
||||
if (!infiniteLoopWarning && whileConditionsHeight < 32 ) whileConditionsHeight = 32;
|
||||
wxRect headerRect(x, y, width, whileConditionsHeight+repeatHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, headerRect);
|
||||
// Get maximum height needed
|
||||
int whileConditionsHeight =
|
||||
renderingHelper->GetRenderedConditionsListHeight(
|
||||
whileConditions, width - 80 - border * 2, platform);
|
||||
if (!infiniteLoopWarning && whileConditionsHeight < 32)
|
||||
whileConditionsHeight = 32;
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(
|
||||
conditions,
|
||||
renderingHelper->GetConditionsColumnWidth() - border,
|
||||
platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(
|
||||
actions,
|
||||
width - renderingHelper->GetConditionsColumnWidth() - border * 2,
|
||||
platform);
|
||||
|
||||
//While text
|
||||
dc.SetFont( renderingHelper->GetNiceFont().Bold() );
|
||||
dc.SetTextForeground(wxColour(0,0,0));
|
||||
dc.DrawText( _("While :"), x+5, y+5 );
|
||||
renderedHeight =
|
||||
((conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight) +
|
||||
whileConditionsHeight + repeatHeight) +
|
||||
border * 2 + border * 2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
//Draw icon if infinite loop warning is deactivated.
|
||||
if (!infiniteLoopWarning)
|
||||
{
|
||||
if ( gd::CommonBitmapProvider::Get()->noProtection.IsOk() )
|
||||
dc.DrawBitmap(gd::CommonBitmapProvider::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true);
|
||||
}
|
||||
|
||||
//Draw "while conditions"
|
||||
renderingHelper->DrawConditionsList(whileConditions, dc, x+80+border, y+border, width-80-border*2, this, areas, selection, platform);
|
||||
|
||||
dc.SetFont( renderingHelper->GetNiceFont().Bold() );
|
||||
dc.SetTextForeground(wxColour(0,0,0));
|
||||
dc.DrawText( _("Repeat :"), x+4, y+whileConditionsHeight+3);
|
||||
whileConditionsHeight += repeatHeight;
|
||||
|
||||
//Draw conditions rectangle
|
||||
wxRect rect(x, y+whileConditionsHeight, renderingHelper->GetConditionsColumnWidth()+border, GetRenderedHeight(width, platform)-whileConditionsHeight);
|
||||
renderingHelper->DrawNiceRectangle(dc, rect);
|
||||
|
||||
renderingHelper->DrawConditionsList(conditions, dc,
|
||||
x+border,
|
||||
y+whileConditionsHeight+border,
|
||||
renderingHelper->GetConditionsColumnWidth()-border, this, areas, selection, platform);
|
||||
renderingHelper->DrawActionsList(actions, dc,
|
||||
x+renderingHelper->GetConditionsColumnWidth()+border,
|
||||
y+whileConditionsHeight+border,
|
||||
width-renderingHelper->GetConditionsColumnWidth()-border*2, this, areas, selection, platform);
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int WhileEvent::GetRenderedHeight(unsigned int width, const gd::Platform & platform) const
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( eventHeightNeedUpdate )
|
||||
{
|
||||
gd::EventsRenderingHelper * renderingHelper = gd::EventsRenderingHelper::Get();
|
||||
int border = renderingHelper->instructionsListBorder;
|
||||
const int repeatHeight = 20;
|
||||
|
||||
//Get maximum height needed
|
||||
int whileConditionsHeight = renderingHelper->GetRenderedConditionsListHeight(whileConditions, width-80-border*2, platform);
|
||||
if (!infiniteLoopWarning && whileConditionsHeight < 32 ) whileConditionsHeight = 32;
|
||||
int conditionsHeight = renderingHelper->GetRenderedConditionsListHeight(conditions, renderingHelper->GetConditionsColumnWidth()-border, platform);
|
||||
int actionsHeight = renderingHelper->GetRenderedActionsListHeight(actions, width-renderingHelper->GetConditionsColumnWidth()-border*2, platform);
|
||||
|
||||
renderedHeight = (( conditionsHeight > actionsHeight ? conditionsHeight : actionsHeight ) + whileConditionsHeight + repeatHeight)+border*2+border*2;
|
||||
eventHeightNeedUpdate = false;
|
||||
}
|
||||
|
||||
return renderedHeight;
|
||||
return renderedHeight;
|
||||
#else
|
||||
return 0;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
gd::BaseEvent::EditEventReturnType WhileEvent::EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
|
||||
{
|
||||
gd::BaseEvent::EditEventReturnType WhileEvent::EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_) {
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( !justCreatedByTheUser )
|
||||
{
|
||||
wxMessageDialog dialog(parent_, _("Do you want to activate the display of a message if the event is repeated 100000 times? This message prevent the software from being frozen if you accidentally create an infinite loop ( by letting the conditions empty for example )."),
|
||||
_("Protection against infinite loops."),
|
||||
wxYES_NO|wxCANCEL|wxICON_INFORMATION);
|
||||
if (!justCreatedByTheUser) {
|
||||
wxMessageDialog dialog(
|
||||
parent_,
|
||||
_("Do you want to activate the display of a message if the event is "
|
||||
"repeated 100000 times? This message prevent the software from being "
|
||||
"frozen if you accidentally create an infinite loop ( by letting the "
|
||||
"conditions empty for example )."),
|
||||
_("Protection against infinite loops."),
|
||||
wxYES_NO | wxCANCEL | wxICON_INFORMATION);
|
||||
|
||||
dialog.SetExtendedMessage(_("This message is activated by default for \"While\" events in the IDE, and is deactivated when the game is compiled to an executable."));
|
||||
dialog.SetYesNoCancelLabels(_("Activate"), _("Deactivate"), _("Cancel"));
|
||||
dialog.SetExtendedMessage(_(
|
||||
"This message is activated by default for \"While\" events in the IDE, "
|
||||
"and is deactivated when the game is compiled to an executable."));
|
||||
dialog.SetYesNoCancelLabels(_("Activate"), _("Deactivate"), _("Cancel"));
|
||||
|
||||
int answer = dialog.ShowModal();
|
||||
if ( answer == wxID_YES ) infiniteLoopWarning = true;
|
||||
else if ( answer == wxID_NO ) infiniteLoopWarning = false;
|
||||
}
|
||||
justCreatedByTheUser = false; //Show Message dialog next time.
|
||||
int answer = dialog.ShowModal();
|
||||
if (answer == wxID_YES)
|
||||
infiniteLoopWarning = true;
|
||||
else if (answer == wxID_NO)
|
||||
infiniteLoopWarning = false;
|
||||
}
|
||||
justCreatedByTheUser = false; // Show Message dialog next time.
|
||||
#endif
|
||||
|
||||
return ChangesMade;
|
||||
return ChangesMade;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
#endif
|
||||
|
@@ -1,92 +1,120 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_WHILEEVENT_H
|
||||
#define GDCORE_WHILEEVENT_H
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Events/Event.h"
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd { class Project; }
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
class RuntimeScene;
|
||||
class TiXmlElement;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief While event is a standard event that is repeated while some conditions are true
|
||||
*
|
||||
* \note The platforms are required to warn the user about a possible infinite loop if the iteration count reach 100 000
|
||||
* and if HasInfiniteLoopWarning() returns true.
|
||||
*/
|
||||
class GD_CORE_API WhileEvent : public gd::BaseEvent
|
||||
{
|
||||
public:
|
||||
WhileEvent() : infiniteLoopWarning(true), justCreatedByTheUser(true) {};
|
||||
virtual ~WhileEvent() {};
|
||||
virtual gd::WhileEvent * Clone() const { return new WhileEvent(*this);}
|
||||
|
||||
virtual bool IsExecutable() const {return true;}
|
||||
|
||||
virtual bool CanHaveSubEvents() const {return true;}
|
||||
virtual const gd::EventsList & GetSubEvents() const {return events;};
|
||||
virtual gd::EventsList & GetSubEvents() {return events;};
|
||||
|
||||
const gd::InstructionsList & GetConditions() const { return conditions; };
|
||||
gd::InstructionsList & GetConditions() { return conditions; };
|
||||
|
||||
const gd::InstructionsList & GetActions() const { return actions; };
|
||||
gd::InstructionsList & GetActions() { return actions; };
|
||||
|
||||
const gd::InstructionsList & GetWhileConditions() const { return whileConditions; };
|
||||
gd::InstructionsList & GetWhileConditions() { return whileConditions; };
|
||||
void SetWhileConditions(gd::InstructionsList & whileConditions_) { whileConditions = whileConditions_; };
|
||||
|
||||
bool HasInfiniteLoopWarning() const { return infiniteLoopWarning; }
|
||||
|
||||
virtual std::vector < gd::InstructionsList* > GetAllConditionsVectors();
|
||||
virtual std::vector < gd::InstructionsList* > GetAllActionsVectors();
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllConditionsVectors() const;
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllActionsVectors() const;
|
||||
|
||||
virtual void SerializeTo(SerializerElement & element) const;
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
|
||||
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
|
||||
|
||||
private:
|
||||
gd::InstructionsList whileConditions;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
bool infiniteLoopWarning; ///< If true, code will be generated to warn the developer against an infinite loop.
|
||||
bool justCreatedByTheUser; ///< Used so as not to show message box to de/activate infinite loop warning when the user create the event
|
||||
|
||||
mutable unsigned int whileConditionsHeight;
|
||||
|
||||
int GetConditionsHeight() const;
|
||||
int GetActionsHeight() const;
|
||||
int GetWhileConditionsHeight() const;
|
||||
};
|
||||
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
|
||||
#endif // GDCORE_WHILEEVENT_H
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief While event is a standard event that is repeated while some conditions
|
||||
* are true
|
||||
*
|
||||
* \note The platforms are required to warn the user about a possible infinite
|
||||
* loop if the iteration count reach 100 000 and if HasInfiniteLoopWarning()
|
||||
* returns true.
|
||||
*/
|
||||
class GD_CORE_API WhileEvent : public gd::BaseEvent {
|
||||
public:
|
||||
WhileEvent() : infiniteLoopWarning(true), justCreatedByTheUser(true){};
|
||||
virtual ~WhileEvent(){};
|
||||
virtual gd::WhileEvent* Clone() const { return new WhileEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList& GetSubEvents() const { return events; };
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
const gd::InstructionsList& GetConditions() const { return conditions; };
|
||||
gd::InstructionsList& GetConditions() { return conditions; };
|
||||
|
||||
const gd::InstructionsList& GetActions() const { return actions; };
|
||||
gd::InstructionsList& GetActions() { return actions; };
|
||||
|
||||
const gd::InstructionsList& GetWhileConditions() const {
|
||||
return whileConditions;
|
||||
};
|
||||
gd::InstructionsList& GetWhileConditions() { return whileConditions; };
|
||||
void SetWhileConditions(gd::InstructionsList& whileConditions_) {
|
||||
whileConditions = whileConditions_;
|
||||
};
|
||||
|
||||
bool HasInfiniteLoopWarning() const { return infiniteLoopWarning; }
|
||||
|
||||
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors();
|
||||
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors();
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
|
||||
const;
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors() const;
|
||||
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* Called by event editor to draw the event.
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const;
|
||||
|
||||
/**
|
||||
* Called when the user want to edit the event
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_);
|
||||
|
||||
private:
|
||||
gd::InstructionsList whileConditions;
|
||||
gd::InstructionsList conditions;
|
||||
gd::InstructionsList actions;
|
||||
EventsList events;
|
||||
bool infiniteLoopWarning; ///< If true, code will be generated to warn the
|
||||
///< developer against an infinite loop.
|
||||
bool justCreatedByTheUser; ///< Used so as not to show message box to
|
||||
///< de/activate infinite loop warning when the
|
||||
///< user create the event
|
||||
|
||||
mutable unsigned int whileConditionsHeight;
|
||||
|
||||
int GetConditionsHeight() const;
|
||||
int GetActionsHeight() const;
|
||||
int GetWhileConditionsHeight() const;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_WHILEEVENT_H
|
||||
|
@@ -1,68 +1,92 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
#include <set>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include <set>
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
void EventsCodeGenerationContext::InheritsFrom(const EventsCodeGenerationContext & parent_)
|
||||
{
|
||||
parent = &parent_;
|
||||
void EventsCodeGenerationContext::InheritsFrom(
|
||||
const EventsCodeGenerationContext& parent_) {
|
||||
parent = &parent_;
|
||||
|
||||
//Objects lists declared by parent became "already declared" in the child context.
|
||||
alreadyDeclaredObjectsLists = parent_.alreadyDeclaredObjectsLists;
|
||||
std::copy( parent_.objectsListsToBeDeclared.begin(), parent_.objectsListsToBeDeclared.end(), std::inserter( alreadyDeclaredObjectsLists, alreadyDeclaredObjectsLists.begin() ) );
|
||||
std::copy( parent_.emptyObjectsListsToBeDeclared.begin(), parent_.emptyObjectsListsToBeDeclared.end(), std::inserter( alreadyDeclaredObjectsLists, alreadyDeclaredObjectsLists.begin() ) );
|
||||
// Objects lists declared by parent became "already declared" in the child
|
||||
// context.
|
||||
alreadyDeclaredObjectsLists = parent_.alreadyDeclaredObjectsLists;
|
||||
std::copy(parent_.objectsListsToBeDeclared.begin(),
|
||||
parent_.objectsListsToBeDeclared.end(),
|
||||
std::inserter(alreadyDeclaredObjectsLists,
|
||||
alreadyDeclaredObjectsLists.begin()));
|
||||
std::copy(parent_.emptyObjectsListsToBeDeclared.begin(),
|
||||
parent_.emptyObjectsListsToBeDeclared.end(),
|
||||
std::inserter(alreadyDeclaredObjectsLists,
|
||||
alreadyDeclaredObjectsLists.begin()));
|
||||
|
||||
depthOfLastUse = parent_.depthOfLastUse;
|
||||
customConditionDepth = parent_.customConditionDepth;
|
||||
contextDepth = parent_.GetContextDepth()+1;
|
||||
if ( parent_.maxDepthLevel )
|
||||
{
|
||||
maxDepthLevel = parent_.maxDepthLevel;
|
||||
*maxDepthLevel = std::max(*maxDepthLevel, contextDepth);
|
||||
}
|
||||
depthOfLastUse = parent_.depthOfLastUse;
|
||||
customConditionDepth = parent_.customConditionDepth;
|
||||
contextDepth = parent_.GetContextDepth() + 1;
|
||||
if (parent_.maxDepthLevel) {
|
||||
maxDepthLevel = parent_.maxDepthLevel;
|
||||
*maxDepthLevel = std::max(*maxDepthLevel, contextDepth);
|
||||
}
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::ObjectsListNeeded(const gd::String & objectName)
|
||||
{
|
||||
if ( emptyObjectsListsToBeDeclared.find(objectName) == emptyObjectsListsToBeDeclared.end() )
|
||||
objectsListsToBeDeclared.insert(objectName);
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
void EventsCodeGenerationContext::EmptyObjectsListNeeded(const gd::String & objectName)
|
||||
{
|
||||
if ( objectsListsToBeDeclared.find(objectName) == objectsListsToBeDeclared.end() )
|
||||
emptyObjectsListsToBeDeclared.insert(objectName);
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
void EventsCodeGenerationContext::Reuse(
|
||||
const EventsCodeGenerationContext& parent_) {
|
||||
InheritsFrom(parent_);
|
||||
if (parent_.CanReuse())
|
||||
contextDepth = parent_.GetContextDepth(); // Keep same context depth
|
||||
}
|
||||
|
||||
std::set<gd::String> EventsCodeGenerationContext::GetAllObjectsToBeDeclared() const
|
||||
{
|
||||
std::set <gd::String> allObjectListsToBeDeclared(objectsListsToBeDeclared.begin(), objectsListsToBeDeclared.end());
|
||||
allObjectListsToBeDeclared.insert(emptyObjectsListsToBeDeclared.begin(), emptyObjectsListsToBeDeclared.end());
|
||||
void EventsCodeGenerationContext::ObjectsListNeeded(
|
||||
const gd::String& objectName) {
|
||||
if (emptyObjectsListsToBeDeclared.find(objectName) ==
|
||||
emptyObjectsListsToBeDeclared.end())
|
||||
objectsListsToBeDeclared.insert(objectName);
|
||||
|
||||
return allObjectListsToBeDeclared;
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
void EventsCodeGenerationContext::EmptyObjectsListNeeded(
|
||||
const gd::String& objectName) {
|
||||
if (objectsListsToBeDeclared.find(objectName) ==
|
||||
objectsListsToBeDeclared.end())
|
||||
emptyObjectsListsToBeDeclared.insert(objectName);
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
|
||||
unsigned int EventsCodeGenerationContext::GetLastDepthObjectListWasNeeded(const gd::String & name) const
|
||||
{
|
||||
if ( depthOfLastUse.count(name) != 0 )
|
||||
return depthOfLastUse.find(name)->second;
|
||||
std::set<gd::String> EventsCodeGenerationContext::GetAllObjectsToBeDeclared()
|
||||
const {
|
||||
std::set<gd::String> allObjectListsToBeDeclared(
|
||||
objectsListsToBeDeclared.begin(), objectsListsToBeDeclared.end());
|
||||
allObjectListsToBeDeclared.insert(emptyObjectsListsToBeDeclared.begin(),
|
||||
emptyObjectsListsToBeDeclared.end());
|
||||
|
||||
std::cout << "WARNING: During code generation, the last depth of an object list was 0." << std::endl;
|
||||
return 0;
|
||||
return allObjectListsToBeDeclared;
|
||||
}
|
||||
|
||||
unsigned int EventsCodeGenerationContext::GetLastDepthObjectListWasNeeded(
|
||||
const gd::String& name) const {
|
||||
if (depthOfLastUse.count(name) != 0) return depthOfLastUse.find(name)->second;
|
||||
|
||||
std::cout << "WARNING: During code generation, the last depth of an object "
|
||||
"list was 0."
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool EventsCodeGenerationContext::IsSameObjectsList(
|
||||
const gd::String& objectName,
|
||||
const EventsCodeGenerationContext& otherContext) const {
|
||||
return GetLastDepthObjectListWasNeeded(objectName) ==
|
||||
otherContext.GetLastDepthObjectListWasNeeded(objectName);
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -1,156 +1,241 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef EVENTSCODEGENERATIONCONTEXT_H
|
||||
#define EVENTSCODEGENERATIONCONTEXT_H
|
||||
|
||||
#include "GDCore/String.h"
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
namespace gd { class Layout; }
|
||||
#include <set>
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Used to manage the context when generating code for events.
|
||||
*
|
||||
* The context refers to :
|
||||
* - The objects lists being available.
|
||||
* - The "current object", i.e the object being used by an action or a condition.
|
||||
* - If conditions are being generated, the context keeps track of the depth of the conditions ( see GetCurrentConditionDepth )
|
||||
* - The "current object", i.e the object being used by an action or a
|
||||
* condition.
|
||||
* - If conditions are being generated, the context keeps track of the depth of
|
||||
* the conditions ( see GetCurrentConditionDepth )
|
||||
* - You can also get the context depth of the last use of an object list.
|
||||
*/
|
||||
class GD_CORE_API EventsCodeGenerationContext
|
||||
{
|
||||
friend class EventsCodeGenerator;
|
||||
public:
|
||||
/**
|
||||
* Default constructor. You may want to call InheritsFrom just after.
|
||||
* \param maxDepthLevel Optional pointer to an unsigned integer that will be updated to contain the maximal scope depth reached.
|
||||
*/
|
||||
EventsCodeGenerationContext(unsigned int * maxDepthLevel_ = nullptr) : contextDepth(0), customConditionDepth(0), maxDepthLevel(maxDepthLevel_), parent(NULL) {};
|
||||
virtual ~EventsCodeGenerationContext() {};
|
||||
class GD_CORE_API EventsCodeGenerationContext {
|
||||
friend class EventsCodeGenerator;
|
||||
|
||||
/**
|
||||
* Call this method to make an EventsCodeGenerationContext as a "child" of another one.
|
||||
* The child will then for example not declare again objects already declared by its parent.
|
||||
*/
|
||||
void InheritsFrom(const EventsCodeGenerationContext & parent);
|
||||
public:
|
||||
/**
|
||||
* Default constructor. You may want to call InheritsFrom just after.
|
||||
* \param maxDepthLevel Optional pointer to an unsigned integer that will be
|
||||
* updated to contain the maximal scope depth reached.
|
||||
*/
|
||||
EventsCodeGenerationContext(unsigned int* maxDepthLevel_ = nullptr)
|
||||
: contextDepth(0),
|
||||
customConditionDepth(0),
|
||||
maxDepthLevel(maxDepthLevel_),
|
||||
parent(NULL),
|
||||
reuseExplicitlyForbidden(false){};
|
||||
virtual ~EventsCodeGenerationContext(){};
|
||||
|
||||
/**
|
||||
* \brief Returns the depth of the inheritance of the context.
|
||||
*
|
||||
* A context created from scratch will returns 0, and a context inheriting from a context with depth n will returns n+1.
|
||||
*/
|
||||
size_t GetContextDepth() const { return contextDepth; }
|
||||
/**
|
||||
* Call this method to make an EventsCodeGenerationContext as a "child" of
|
||||
* another one. The child will then for example not declare again objects
|
||||
* already declared by its parent.
|
||||
*/
|
||||
void InheritsFrom(const EventsCodeGenerationContext& parent);
|
||||
|
||||
/**
|
||||
* \brief Get the parent context, if any.
|
||||
* \return A pointer to the parent context, or NULL if the context has no parent.
|
||||
*/
|
||||
const EventsCodeGenerationContext * GetParentContext() const { return parent; }
|
||||
/**
|
||||
* \brief As InheritsFrom, mark the context as being the child of another one,
|
||||
* but enabling the child context to use the same object lists.
|
||||
*
|
||||
* Used for example for optimizing the last event of a list.
|
||||
*/
|
||||
void Reuse(const EventsCodeGenerationContext& parent);
|
||||
|
||||
/**
|
||||
* Mark the object has being the object being handled by the instruction
|
||||
*/
|
||||
void SetCurrentObject(const gd::String & objectName) { currentObject = objectName; };
|
||||
/**
|
||||
* \brief Forbid any optimization that would reuse and modify the object list
|
||||
* from this context in children context.
|
||||
*
|
||||
* Used in while/for each/repeat or any event that have a loop and must ensure
|
||||
* that the list of objects stay clean.
|
||||
*/
|
||||
void ForbidReuse() { reuseExplicitlyForbidden = true; }
|
||||
|
||||
/**
|
||||
* Set that no particular object is being handled by an instruction
|
||||
*/
|
||||
void SetNoCurrentObject() { currentObject = ""; };
|
||||
/**
|
||||
* \brief Return false if the object lists of the context can not be reused in
|
||||
* a child context.
|
||||
*/
|
||||
bool CanReuse() const {
|
||||
return !reuseExplicitlyForbidden && parent != nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object being handled by the instruction
|
||||
*/
|
||||
const gd::String & GetCurrentObject() const { return currentObject; };
|
||||
/**
|
||||
* \brief Returns the depth of the inheritance of the context.
|
||||
*
|
||||
* A context created from scratch will returns 0, and a context inheriting
|
||||
* from a context with depth n will returns n+1.
|
||||
*/
|
||||
size_t GetContextDepth() const { return contextDepth; }
|
||||
|
||||
/**
|
||||
* \brief Call this when an instruction in the event need an object list.
|
||||
*
|
||||
* The list will be filled with objects from the scene if it is the first time it is requested, unless there is
|
||||
* already an object list with this name ( i.e. ObjectAlreadyDeclared(objectName) returns true ).
|
||||
*/
|
||||
void ObjectsListNeeded(const gd::String & objectName);
|
||||
/**
|
||||
* \brief Get the parent context, if any.
|
||||
* \return A pointer to the parent context, or NULL if the context has no
|
||||
* parent.
|
||||
*/
|
||||
const EventsCodeGenerationContext* GetParentContext() const { return parent; }
|
||||
|
||||
/**
|
||||
* Call this when an instruction in the event need an object list.
|
||||
* An empty event list will be declared, without filling it with objects from the scene. If there is already an object
|
||||
* list with this name, no new list will be declared again.
|
||||
*/
|
||||
void EmptyObjectsListNeeded(const gd::String & objectName);
|
||||
/**
|
||||
* Mark the object has being the object being handled by the instruction
|
||||
*/
|
||||
void SetCurrentObject(const gd::String& objectName) {
|
||||
currentObject = objectName;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if an object list has already been declared (or is going to be declared).
|
||||
*/
|
||||
bool ObjectAlreadyDeclared(const gd::String & objectName) const { return (alreadyDeclaredObjectsLists.find(objectName) != alreadyDeclaredObjectsLists.end()); };
|
||||
/**
|
||||
* Set that no particular object is being handled by an instruction
|
||||
*/
|
||||
void SetNoCurrentObject() { currentObject = ""; };
|
||||
|
||||
/**
|
||||
* \brief Consider that \a objectName is now declared in the context.
|
||||
*/
|
||||
void SetObjectDeclared(const gd::String & objectName ) { alreadyDeclaredObjectsLists.insert(objectName); }
|
||||
/**
|
||||
* Get the object being handled by the instruction
|
||||
*/
|
||||
const gd::String& GetCurrentObject() const { return currentObject; };
|
||||
|
||||
/**
|
||||
* Return all the objects lists which will be declared by the current context
|
||||
* ( the non empty as well as the empty objects lists )
|
||||
*/
|
||||
std::set<gd::String> GetAllObjectsToBeDeclared() const;
|
||||
/**
|
||||
* \brief Call this when an instruction in the event need an object list.
|
||||
*
|
||||
* The list will be filled with objects from the scene if it is the first time
|
||||
* it is requested, unless there is already an object list with this name (
|
||||
* i.e. ObjectAlreadyDeclared(objectName) returns true ).
|
||||
*/
|
||||
void ObjectsListNeeded(const gd::String& objectName);
|
||||
|
||||
/**
|
||||
* Return the objects lists which will be declared by the current context
|
||||
*/
|
||||
const std::set<gd::String> & GetObjectsListsToBeDeclared() const { return objectsListsToBeDeclared; };
|
||||
/**
|
||||
* Call this when an instruction in the event need an object list.
|
||||
* An empty event list will be declared, without filling it with objects from
|
||||
* the scene. If there is already an object list with this name, no new list
|
||||
* will be declared again.
|
||||
*/
|
||||
void EmptyObjectsListNeeded(const gd::String& objectName);
|
||||
|
||||
/**
|
||||
* Return the objects lists which will be declared, but no filled, by the current context
|
||||
*/
|
||||
const std::set<gd::String> & GetObjectsListsToBeDeclaredEmpty() const { return emptyObjectsListsToBeDeclared; };
|
||||
/**
|
||||
* Return true if an object list has already been declared (or is going to be
|
||||
* declared).
|
||||
*/
|
||||
bool ObjectAlreadyDeclared(const gd::String& objectName) const {
|
||||
return (alreadyDeclaredObjectsLists.find(objectName) !=
|
||||
alreadyDeclaredObjectsLists.end());
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the objects lists which are already declared and can be used in the current context without declaration.
|
||||
*/
|
||||
const std::set<gd::String> & GetObjectsListsAlreadyDeclared() const { return alreadyDeclaredObjectsLists; };
|
||||
/**
|
||||
* \brief Consider that \a objectName is now declared in the context.
|
||||
*/
|
||||
void SetObjectDeclared(const gd::String& objectName) {
|
||||
alreadyDeclaredObjectsLists.insert(objectName);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the depth of the context that was in effect when \a objectName was needed.
|
||||
*
|
||||
* If \a objectName is needed in this context, it will return the depth of this context.
|
||||
*/
|
||||
unsigned int GetLastDepthObjectListWasNeeded(const gd::String & objectName) const;
|
||||
/**
|
||||
* Return all the objects lists which will be declared by the current context
|
||||
* ( the non empty as well as the empty objects lists )
|
||||
*/
|
||||
std::set<gd::String> GetAllObjectsToBeDeclared() const;
|
||||
|
||||
/**
|
||||
* \brief Called when a custom condition code is generated.
|
||||
*/
|
||||
void EnterCustomCondition() { customConditionDepth++; };
|
||||
/**
|
||||
* Return the objects lists which will be declared by the current context
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsToBeDeclared() const {
|
||||
return objectsListsToBeDeclared;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Called when a custom condition code generation is over.
|
||||
*/
|
||||
void LeaveCustomCondition() { customConditionDepth--; };
|
||||
/**
|
||||
* Return the objects lists which will be declared, but no filled, by the
|
||||
* current context
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsToBeDeclaredEmpty() const {
|
||||
return emptyObjectsListsToBeDeclared;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the current condition depth : The depth is increased each time a custom condition code is generated,
|
||||
* and decreased when the condition generation is done.
|
||||
*
|
||||
* This can be useful to generate sub conditions booleans with a different name than the parent's conditions.
|
||||
*/
|
||||
size_t GetCurrentConditionDepth() const { return customConditionDepth; }
|
||||
/**
|
||||
* Return the objects lists which are already declared and can be used in the
|
||||
* current context without declaration.
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsAlreadyDeclared() const {
|
||||
return alreadyDeclaredObjectsLists;
|
||||
};
|
||||
|
||||
private:
|
||||
std::set<gd::String> alreadyDeclaredObjectsLists; ///< Objects lists already needed in a parent context.
|
||||
std::set<gd::String> objectsListsToBeDeclared; ///< Objects lists that will be declared in this context.
|
||||
std::set<gd::String> emptyObjectsListsToBeDeclared; ///< Objects lists that will be declared in this context, but not filled with scene's objects.
|
||||
std::map<gd::String, unsigned int> depthOfLastUse; ///< The context depth when an object was last used.
|
||||
gd::String currentObject; ///< The object being used by an action or condition.
|
||||
unsigned int contextDepth; ///< The depth of the context : 0 for a newly created context, n+1 for any context inheriting from context with depth n.
|
||||
unsigned int customConditionDepth; ///< The depth of the conditions being generated.
|
||||
unsigned int * maxDepthLevel; ///< A pointer to a unsigned int updated with the maximum depth reached.
|
||||
const EventsCodeGenerationContext * parent; ///< The parent of the current context. Can be NULL.
|
||||
/**
|
||||
* \brief Get the depth of the context that was in effect when \a objectName
|
||||
* was needed.
|
||||
*
|
||||
* If \a objectName is needed in this context, it will return the depth of
|
||||
* this context.
|
||||
*/
|
||||
unsigned int GetLastDepthObjectListWasNeeded(
|
||||
const gd::String& objectName) const;
|
||||
|
||||
/**
|
||||
* \brief Check if twos context have the same list for an object.
|
||||
*
|
||||
* This can be the case when a context is reusing the lists of another (see
|
||||
* gd::EventsCodeGenerationContext::Reuse).
|
||||
*/
|
||||
bool IsSameObjectsList(const gd::String& objectName,
|
||||
const EventsCodeGenerationContext& otherContext) const;
|
||||
|
||||
/**
|
||||
* \brief Called when a custom condition code is generated.
|
||||
*/
|
||||
void EnterCustomCondition() { customConditionDepth++; };
|
||||
|
||||
/**
|
||||
* \brief Called when a custom condition code generation is over.
|
||||
*/
|
||||
void LeaveCustomCondition() { customConditionDepth--; };
|
||||
|
||||
/**
|
||||
* \brief Get the current condition depth : The depth is increased each time a
|
||||
* custom condition code is generated, and decreased when the condition
|
||||
* generation is done.
|
||||
*
|
||||
* This can be useful to generate sub conditions booleans with a different
|
||||
* name than the parent's conditions.
|
||||
*/
|
||||
size_t GetCurrentConditionDepth() const { return customConditionDepth; }
|
||||
|
||||
private:
|
||||
std::set<gd::String>
|
||||
alreadyDeclaredObjectsLists; ///< Objects lists already needed in a
|
||||
///< parent context.
|
||||
std::set<gd::String>
|
||||
objectsListsToBeDeclared; ///< Objects lists that will be declared in
|
||||
///< this context.
|
||||
std::set<gd::String>
|
||||
emptyObjectsListsToBeDeclared; ///< Objects lists that will be declared
|
||||
///< in this context, but not filled with
|
||||
///< scene's objects.
|
||||
std::map<gd::String, unsigned int>
|
||||
depthOfLastUse; ///< The context depth when an object was last used.
|
||||
gd::String
|
||||
currentObject; ///< The object being used by an action or condition.
|
||||
unsigned int contextDepth; ///< The depth of the context : 0 for a newly
|
||||
///< created context, n+1 for any context
|
||||
///< inheriting from context with depth n.
|
||||
unsigned int
|
||||
customConditionDepth; ///< The depth of the conditions being generated.
|
||||
unsigned int* maxDepthLevel; ///< A pointer to a unsigned int updated with
|
||||
///< the maximum depth reached.
|
||||
const EventsCodeGenerationContext*
|
||||
parent; ///< The parent of the current context. Can be NULL.
|
||||
bool reuseExplicitlyForbidden; ///< If set to true, forbid children context
|
||||
///< to reuse this one without inheriting.
|
||||
};
|
||||
|
||||
}
|
||||
#endif // EVENTSCODEGENERATIONCONTEXT_H
|
||||
} // namespace gd
|
||||
#endif // EVENTSCODEGENERATIONCONTEXT_H
|
||||
|
@@ -1,200 +1,229 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "ExpressionsCodeGeneration.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
CallbacksForGeneratingExpressionCode::CallbacksForGeneratingExpressionCode(gd::String & plainExpression_,
|
||||
EventsCodeGenerator & codeGenerator_,
|
||||
EventsCodeGenerationContext & context_) :
|
||||
plainExpression(plainExpression_),
|
||||
codeGenerator(codeGenerator_),
|
||||
context(context_)
|
||||
{
|
||||
CallbacksForGeneratingExpressionCode::CallbacksForGeneratingExpressionCode(
|
||||
gd::String& plainExpression_,
|
||||
EventsCodeGenerator& codeGenerator_,
|
||||
EventsCodeGenerationContext& context_)
|
||||
: plainExpression(plainExpression_),
|
||||
codeGenerator(codeGenerator_),
|
||||
context(context_) {}
|
||||
|
||||
}
|
||||
|
||||
void CallbacksForGeneratingExpressionCode::OnConstantToken(gd::String text)
|
||||
{
|
||||
plainExpression += text;
|
||||
void CallbacksForGeneratingExpressionCode::OnConstantToken(gd::String text) {
|
||||
plainExpression += text;
|
||||
};
|
||||
|
||||
void CallbacksForGeneratingExpressionCode::OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
|
||||
{
|
||||
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
void CallbacksForGeneratingExpressionCode::OnStaticFunction(
|
||||
gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo) {
|
||||
codeGenerator.AddIncludeFiles(
|
||||
expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
|
||||
//Launch custom code generator if needed
|
||||
if (expressionInfo.codeExtraInformation.HasCustomCodeGenerator())
|
||||
{
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
// Launch custom code generator if needed
|
||||
if (expressionInfo.codeExtraInformation.HasCustomCodeGenerator()) {
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(
|
||||
parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
|
||||
//Special case: For strings expressions, function without name is a string.
|
||||
if ( GetReturnType() == "string" && functionName.empty() )
|
||||
{
|
||||
if ( parameters.empty() ) return;
|
||||
plainExpression += codeGenerator.ConvertToStringExplicit(parameters[0].GetPlainString());
|
||||
// Special case: For strings expressions, function without name is a string.
|
||||
if (GetReturnType() == "string" && functionName.empty()) {
|
||||
if (parameters.empty()) return;
|
||||
plainExpression +=
|
||||
codeGenerator.ConvertToStringExplicit(parameters[0].GetPlainString());
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Prepare parameters
|
||||
std::vector<gd::String> parametersCode = codeGenerator.GenerateParametersCodes(parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 0;i<parametersCode.size();++i)
|
||||
{
|
||||
if ( i != 0 ) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
// Prepare parameters
|
||||
std::vector<gd::String> parametersCode =
|
||||
codeGenerator.GenerateParametersCodes(
|
||||
parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 0; i < parametersCode.size(); ++i) {
|
||||
if (i != 0) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
|
||||
|
||||
plainExpression += expressionInfo.codeExtraInformation.functionCallName+"("+parametersStr+")";
|
||||
plainExpression += expressionInfo.codeExtraInformation.functionCallName +
|
||||
"(" + parametersStr + ")";
|
||||
};
|
||||
|
||||
void CallbacksForGeneratingExpressionCode::OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
|
||||
{
|
||||
const gd::Project & project = codeGenerator.GetProject();
|
||||
const gd::Layout & scene = codeGenerator.GetLayout();
|
||||
void CallbacksForGeneratingExpressionCode::OnObjectFunction(
|
||||
gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo) {
|
||||
const gd::Project& project = codeGenerator.GetProject();
|
||||
const gd::Layout& scene = codeGenerator.GetLayout();
|
||||
|
||||
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
if ( parameters.empty() ) return;
|
||||
codeGenerator.AddIncludeFiles(
|
||||
expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
if (parameters.empty()) return;
|
||||
|
||||
//Launch custom code generator if needed
|
||||
if ( expressionInfo.codeExtraInformation.HasCustomCodeGenerator() )
|
||||
{
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
// Launch custom code generator if needed
|
||||
if (expressionInfo.codeExtraInformation.HasCustomCodeGenerator()) {
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(
|
||||
parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
|
||||
//Prepare parameters
|
||||
std::vector<gd::String> parametersCode = codeGenerator.GenerateParametersCodes(parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 1;i<parametersCode.size();++i)
|
||||
{
|
||||
if ( i != 1 ) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
// Prepare parameters
|
||||
std::vector<gd::String> parametersCode =
|
||||
codeGenerator.GenerateParametersCodes(
|
||||
parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 1; i < parametersCode.size(); ++i) {
|
||||
if (i != 1) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
|
||||
gd::String output = GetReturnType() == "string" ? "\"\"" : "0";
|
||||
gd::String output = GetReturnType() == "string" ? "\"\"" : "0";
|
||||
|
||||
//Get object(s) concerned by function call
|
||||
std::vector<gd::String> realObjects = codeGenerator. ExpandObjectsName(parameters[0].GetPlainString(), context);
|
||||
for (std::size_t i = 0;i<realObjects.size();++i)
|
||||
{
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
// Get object(s) concerned by function call
|
||||
std::vector<gd::String> realObjects =
|
||||
codeGenerator.ExpandObjectsName(parameters[0].GetPlainString(), context);
|
||||
for (std::size_t i = 0; i < realObjects.size(); ++i) {
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
|
||||
gd::String objectType = gd::GetTypeOfObject(project, scene, realObjects[i]);
|
||||
const ObjectMetadata & objInfo = MetadataProvider::GetObjectMetadata(codeGenerator.GetPlatform(), objectType);
|
||||
gd::String objectType = gd::GetTypeOfObject(project, scene, realObjects[i]);
|
||||
const ObjectMetadata& objInfo = MetadataProvider::GetObjectMetadata(
|
||||
codeGenerator.GetPlatform(), objectType);
|
||||
|
||||
//Build gd::String to access the object
|
||||
codeGenerator.AddIncludeFiles(objInfo.includeFiles);
|
||||
output = codeGenerator.GenerateObjectFunctionCall(realObjects[i], objInfo, expressionInfo.codeExtraInformation, parametersStr, output, context);
|
||||
}
|
||||
// Build gd::String to access the object
|
||||
codeGenerator.AddIncludeFiles(objInfo.includeFiles);
|
||||
output = codeGenerator.GenerateObjectFunctionCall(
|
||||
realObjects[i],
|
||||
objInfo,
|
||||
expressionInfo.codeExtraInformation,
|
||||
parametersStr,
|
||||
output,
|
||||
context);
|
||||
}
|
||||
|
||||
plainExpression += output;
|
||||
plainExpression += output;
|
||||
};
|
||||
|
||||
void CallbacksForGeneratingExpressionCode::OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
|
||||
{
|
||||
const gd::Project & project = codeGenerator.GetProject();
|
||||
const gd::Layout & scene = codeGenerator.GetLayout();
|
||||
void CallbacksForGeneratingExpressionCode::OnObjectBehaviorFunction(
|
||||
gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo) {
|
||||
const gd::Project& project = codeGenerator.GetProject();
|
||||
const gd::Layout& scene = codeGenerator.GetLayout();
|
||||
|
||||
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
if ( parameters.size() < 2 ) return;
|
||||
codeGenerator.AddIncludeFiles(
|
||||
expressionInfo.codeExtraInformation.GetIncludeFiles());
|
||||
if (parameters.size() < 2) return;
|
||||
|
||||
//Launch custom code generator if needed
|
||||
if ( expressionInfo.codeExtraInformation.HasCustomCodeGenerator() )
|
||||
{
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
// Launch custom code generator if needed
|
||||
if (expressionInfo.codeExtraInformation.HasCustomCodeGenerator()) {
|
||||
plainExpression += expressionInfo.codeExtraInformation.customCodeGenerator(
|
||||
parameters, codeGenerator, context);
|
||||
return;
|
||||
}
|
||||
|
||||
//Prepare parameters
|
||||
std::vector<gd::String> parametersCode = codeGenerator.GenerateParametersCodes(parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 2;i<parametersCode.size();++i)
|
||||
{
|
||||
if ( i != 2 ) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
// Prepare parameters
|
||||
std::vector<gd::String> parametersCode =
|
||||
codeGenerator.GenerateParametersCodes(
|
||||
parameters, expressionInfo.parameters, context);
|
||||
gd::String parametersStr;
|
||||
for (std::size_t i = 2; i < parametersCode.size(); ++i) {
|
||||
if (i != 2) parametersStr += ", ";
|
||||
parametersStr += parametersCode[i];
|
||||
}
|
||||
|
||||
//Get object(s) concerned by function call
|
||||
std::vector<gd::String> realObjects = codeGenerator. ExpandObjectsName(parameters[0].GetPlainString(), context);
|
||||
// Get object(s) concerned by function call
|
||||
std::vector<gd::String> realObjects =
|
||||
codeGenerator.ExpandObjectsName(parameters[0].GetPlainString(), context);
|
||||
|
||||
gd::String output = GetReturnType() == "string" ? "\"\"" : "0";
|
||||
for (std::size_t i = 0;i<realObjects.size();++i)
|
||||
{
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
gd::String output = GetReturnType() == "string" ? "\"\"" : "0";
|
||||
for (std::size_t i = 0; i < realObjects.size(); ++i) {
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
|
||||
//Cast the object if needed
|
||||
gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, parameters[1].GetPlainString());
|
||||
const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(codeGenerator.GetPlatform(), behaviorType);
|
||||
// Cast the object if needed
|
||||
gd::String behaviorType =
|
||||
gd::GetTypeOfBehavior(project, scene, parameters[1].GetPlainString());
|
||||
const BehaviorMetadata& autoInfo = MetadataProvider::GetBehaviorMetadata(
|
||||
codeGenerator.GetPlatform(), behaviorType);
|
||||
|
||||
//Build gd::String to access the behavior
|
||||
codeGenerator.AddIncludeFiles(autoInfo.includeFiles);
|
||||
output = codeGenerator.GenerateObjectBehaviorFunctionCall(realObjects[i], parameters[1].GetPlainString(), autoInfo, expressionInfo.codeExtraInformation, parametersStr, output, context);
|
||||
}
|
||||
// Build gd::String to access the behavior
|
||||
codeGenerator.AddIncludeFiles(autoInfo.includeFiles);
|
||||
output = codeGenerator.GenerateObjectBehaviorFunctionCall(
|
||||
realObjects[i],
|
||||
parameters[1].GetPlainString(),
|
||||
autoInfo,
|
||||
expressionInfo.codeExtraInformation,
|
||||
parametersStr,
|
||||
output,
|
||||
context);
|
||||
}
|
||||
|
||||
|
||||
plainExpression += output;
|
||||
plainExpression += output;
|
||||
};
|
||||
|
||||
bool CallbacksForGeneratingExpressionCode::OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression)
|
||||
{
|
||||
gd::String newExpression;
|
||||
bool CallbacksForGeneratingExpressionCode::OnSubMathExpression(
|
||||
const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
const gd::Layout& layout,
|
||||
gd::Expression& expression) {
|
||||
gd::String newExpression;
|
||||
|
||||
CallbacksForGeneratingExpressionCode callbacks(newExpression, codeGenerator, context);
|
||||
CallbacksForGeneratingExpressionCode callbacks(
|
||||
newExpression, codeGenerator, context);
|
||||
|
||||
gd::ExpressionParser parser(expression.GetPlainString());
|
||||
if ( !parser.ParseMathExpression(platform, project, layout, callbacks) )
|
||||
{
|
||||
#if defined(GD_IDE_ONLY)
|
||||
firstErrorStr = callbacks.firstErrorStr;
|
||||
firstErrorPos = callbacks.firstErrorPos;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
gd::ExpressionParser parser(expression.GetPlainString());
|
||||
if (!parser.ParseMathExpression(platform, project, layout, callbacks)) {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
firstErrorStr = callbacks.GetFirstError();
|
||||
firstErrorPos = callbacks.GetFirstErrorPosition();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CallbacksForGeneratingExpressionCode::OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression)
|
||||
{
|
||||
gd::String newExpression;
|
||||
bool CallbacksForGeneratingExpressionCode::OnSubTextExpression(
|
||||
const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
const gd::Layout& layout,
|
||||
gd::Expression& expression) {
|
||||
gd::String newExpression;
|
||||
|
||||
CallbacksForGeneratingExpressionCode callbacks(newExpression, codeGenerator, context);
|
||||
CallbacksForGeneratingExpressionCode callbacks(
|
||||
newExpression, codeGenerator, context);
|
||||
|
||||
gd::ExpressionParser parser(expression.GetPlainString());
|
||||
if ( !parser.ParseStringExpression(platform, project, layout, callbacks) )
|
||||
{
|
||||
#if defined(GD_IDE_ONLY)
|
||||
firstErrorStr = callbacks.firstErrorStr;
|
||||
firstErrorPos = callbacks.firstErrorPos;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
gd::ExpressionParser parser(expression.GetPlainString());
|
||||
if (!parser.ParseStringExpression(platform, project, layout, callbacks)) {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
firstErrorStr = callbacks.GetFirstError();
|
||||
firstErrorPos = callbacks.GetFirstErrorPosition();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,24 +1,37 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef EXPRESSIONSCODEGENERATION_H
|
||||
#define EXPRESSIONSCODEGENERATION_H
|
||||
|
||||
#include <vector>
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser.h"
|
||||
namespace gd { class ExpressionMetadata; }
|
||||
namespace gd { class Expression; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class EventsCodeGenerationContext; }
|
||||
namespace gd { class EventsCodeGenerator; }
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class ExpressionMetadata;
|
||||
}
|
||||
namespace gd {
|
||||
class Expression;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsCodeGenerationContext;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsCodeGenerator;
|
||||
}
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Used to generate code from expressions.
|
||||
@@ -27,33 +40,48 @@ namespace gd
|
||||
* \code
|
||||
* gd::String expressionOutputCppCode;
|
||||
*
|
||||
* CallbacksForGeneratingExpressionCode callbacks(expressionOutputCppCode, codeGenerator, context);
|
||||
* gd::ExpressionParser parser(theOriginalGameDevelopExpression);
|
||||
* CallbacksForGeneratingExpressionCode callbacks(expressionOutputCppCode,
|
||||
* codeGenerator, context); gd::ExpressionParser
|
||||
* parser(theOriginalGameDevelopExpression);
|
||||
* parser.ParseStringExpression(platform, project, scene, callbacks);
|
||||
*
|
||||
* if (expressionOutputCppCode.empty()) expressionOutputCppCode = "\"\""; //If generation failed, we make sure output code is not empty.
|
||||
* \endcode
|
||||
* \see EventsCodeGenerator
|
||||
* if (expressionOutputCppCode.empty()) expressionOutputCppCode = "\"\""; //If
|
||||
* generation failed, we make sure output code is not empty. \endcode \see
|
||||
* EventsCodeGenerator
|
||||
*/
|
||||
class GD_CORE_API CallbacksForGeneratingExpressionCode : public gd::ParserCallbacks
|
||||
{
|
||||
public:
|
||||
CallbacksForGeneratingExpressionCode(gd::String & output, EventsCodeGenerator & codeGenerator_, EventsCodeGenerationContext & context_);
|
||||
virtual ~CallbacksForGeneratingExpressionCode() {};
|
||||
class GD_CORE_API CallbacksForGeneratingExpressionCode
|
||||
: public gd::ParserCallbacks {
|
||||
public:
|
||||
CallbacksForGeneratingExpressionCode(gd::String& output,
|
||||
EventsCodeGenerator& codeGenerator_,
|
||||
EventsCodeGenerationContext& context_);
|
||||
virtual ~CallbacksForGeneratingExpressionCode(){};
|
||||
|
||||
void OnConstantToken(gd::String text);
|
||||
void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
|
||||
void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
|
||||
void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
|
||||
bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);
|
||||
bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);
|
||||
void OnConstantToken(gd::String text);
|
||||
void OnStaticFunction(gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo);
|
||||
void OnObjectFunction(gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo);
|
||||
void OnObjectBehaviorFunction(gd::String functionName,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const gd::ExpressionMetadata& expressionInfo);
|
||||
bool OnSubMathExpression(const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
const gd::Layout& layout,
|
||||
gd::Expression& expression);
|
||||
bool OnSubTextExpression(const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
const gd::Layout& layout,
|
||||
gd::Expression& expression);
|
||||
|
||||
private:
|
||||
gd::String & plainExpression;
|
||||
EventsCodeGenerator & codeGenerator;
|
||||
EventsCodeGenerationContext & context;
|
||||
private:
|
||||
gd::String& plainExpression;
|
||||
EventsCodeGenerator& codeGenerator;
|
||||
EventsCodeGenerationContext& context;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // EXPRESSIONSCODEGENERATION_H
|
||||
#endif // EXPRESSIONSCODEGENERATION_H
|
||||
|
@@ -1,118 +1,120 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
EventsList BaseEvent::badSubEvents;
|
||||
std::vector<gd::String> BaseEvent::emptyDependencies;
|
||||
gd::String BaseEvent::emptySourceFile;
|
||||
|
||||
BaseEvent::BaseEvent() :
|
||||
eventHeightNeedUpdate(true),
|
||||
totalTimeDuringLastSession(0),
|
||||
percentDuringLastSession(0),
|
||||
disabled(false),
|
||||
folded(false)
|
||||
{
|
||||
}
|
||||
BaseEvent::BaseEvent()
|
||||
: eventHeightNeedUpdate(true),
|
||||
totalTimeDuringLastSession(0),
|
||||
percentDuringLastSession(0),
|
||||
disabled(false),
|
||||
folded(false) {}
|
||||
|
||||
bool BaseEvent::HasSubEvents() const
|
||||
{
|
||||
return !GetSubEvents().IsEmpty();
|
||||
}
|
||||
bool BaseEvent::HasSubEvents() const { return !GetSubEvents().IsEmpty(); }
|
||||
|
||||
gd::String BaseEvent::GenerateEventCode(gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
|
||||
{
|
||||
if ( IsDisabled() ) return "";
|
||||
gd::String BaseEvent::GenerateEventCode(
|
||||
gd::EventsCodeGenerator& codeGenerator,
|
||||
gd::EventsCodeGenerationContext& context) {
|
||||
if (IsDisabled()) return "";
|
||||
|
||||
try
|
||||
{
|
||||
if ( type.empty() ) return "";
|
||||
try {
|
||||
if (type.empty()) return "";
|
||||
|
||||
const gd::Platform & platform = codeGenerator.GetPlatform();
|
||||
const gd::Platform& platform = codeGenerator.GetPlatform();
|
||||
|
||||
//First try to guess the extension used
|
||||
gd::String eventNamespace = type.substr(0, type.find("::"));
|
||||
std::shared_ptr<gd::PlatformExtension> guessedExtension = platform.GetExtension(eventNamespace);
|
||||
if ( guessedExtension )
|
||||
{
|
||||
std::map<gd::String, gd::EventMetadata > & allEvents = guessedExtension->GetAllEvents();
|
||||
if ( allEvents.find(type) != allEvents.end() )
|
||||
return allEvents[type].codeGeneration(*this, codeGenerator, context);
|
||||
}
|
||||
|
||||
|
||||
//Else make a search in all the extensions
|
||||
for (std::size_t i = 0; i < platform.GetAllPlatformExtensions().size(); ++i)
|
||||
{
|
||||
std::shared_ptr<gd::PlatformExtension> extension = platform.GetAllPlatformExtensions()[i];
|
||||
if ( !extension ) continue;
|
||||
|
||||
std::map<gd::String, gd::EventMetadata > & allEvents = extension->GetAllEvents();
|
||||
if ( allEvents.find(type) != allEvents.end() )
|
||||
return allEvents[type].codeGeneration(*this, codeGenerator, context);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "ERROR: Exception caught during code generation for event \"" << type <<"\"." << std::endl;
|
||||
// First try to guess the extension used
|
||||
gd::String eventNamespace = type.substr(0, type.find("::"));
|
||||
std::shared_ptr<gd::PlatformExtension> guessedExtension =
|
||||
platform.GetExtension(eventNamespace);
|
||||
if (guessedExtension) {
|
||||
std::map<gd::String, gd::EventMetadata>& allEvents =
|
||||
guessedExtension->GetAllEvents();
|
||||
if (allEvents.find(type) != allEvents.end())
|
||||
return allEvents[type].codeGeneration(*this, codeGenerator, context);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
// Else make a search in all the extensions
|
||||
for (std::size_t i = 0; i < platform.GetAllPlatformExtensions().size();
|
||||
++i) {
|
||||
std::shared_ptr<gd::PlatformExtension> extension =
|
||||
platform.GetAllPlatformExtensions()[i];
|
||||
if (!extension) continue;
|
||||
|
||||
void BaseEvent::Preprocess(gd::EventsCodeGenerator & codeGenerator, gd::EventsList & eventList, std::size_t indexOfTheEventInThisList)
|
||||
{
|
||||
if ( IsDisabled() || !MustBePreprocessed() ) return;
|
||||
|
||||
try
|
||||
{
|
||||
if ( type.empty() ) return;
|
||||
|
||||
const gd::Platform & platform = codeGenerator.GetPlatform();
|
||||
|
||||
//First try to guess the extension used
|
||||
gd::String eventNamespace = type.substr(0, type.find("::"));
|
||||
std::shared_ptr<gd::PlatformExtension> guessedExtension = platform.GetExtension(eventNamespace);
|
||||
if ( guessedExtension )
|
||||
{
|
||||
std::map<gd::String, gd::EventMetadata > & allEvents = guessedExtension->GetAllEvents();
|
||||
if ( allEvents.find(type) != allEvents.end() )
|
||||
return allEvents[type].preprocessing(*this, codeGenerator, eventList, indexOfTheEventInThisList);
|
||||
}
|
||||
|
||||
//Else make a search in all the extensions
|
||||
for (std::size_t i = 0;i<platform.GetAllPlatformExtensions().size();++i)
|
||||
{
|
||||
std::shared_ptr<gd::PlatformExtension> extension = platform.GetAllPlatformExtensions()[i];
|
||||
if ( !extension ) continue;
|
||||
|
||||
std::map<gd::String, gd::EventMetadata > & allEvents = extension->GetAllEvents();
|
||||
if ( allEvents.find(type) != allEvents.end() )
|
||||
return allEvents[type].preprocessing(*this, codeGenerator, eventList, indexOfTheEventInThisList);
|
||||
}
|
||||
std::map<gd::String, gd::EventMetadata>& allEvents =
|
||||
extension->GetAllEvents();
|
||||
if (allEvents.find(type) != allEvents.end())
|
||||
return allEvents[type].codeGeneration(*this, codeGenerator, context);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "ERROR: Exception caught during preprocessing of event \"" << type <<"\"." << std::endl;
|
||||
} catch (...) {
|
||||
std::cout << "ERROR: Exception caught during code generation for event \""
|
||||
<< type << "\"." << std::endl;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void BaseEvent::Preprocess(gd::EventsCodeGenerator& codeGenerator,
|
||||
gd::EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList) {
|
||||
if (IsDisabled() || !MustBePreprocessed()) return;
|
||||
|
||||
try {
|
||||
if (type.empty()) return;
|
||||
|
||||
const gd::Platform& platform = codeGenerator.GetPlatform();
|
||||
|
||||
// First try to guess the extension used
|
||||
gd::String eventNamespace = type.substr(0, type.find("::"));
|
||||
std::shared_ptr<gd::PlatformExtension> guessedExtension =
|
||||
platform.GetExtension(eventNamespace);
|
||||
if (guessedExtension) {
|
||||
std::map<gd::String, gd::EventMetadata>& allEvents =
|
||||
guessedExtension->GetAllEvents();
|
||||
if (allEvents.find(type) != allEvents.end())
|
||||
return allEvents[type].preprocessing(
|
||||
*this, codeGenerator, eventList, indexOfTheEventInThisList);
|
||||
}
|
||||
|
||||
// Else make a search in all the extensions
|
||||
for (std::size_t i = 0; i < platform.GetAllPlatformExtensions().size();
|
||||
++i) {
|
||||
std::shared_ptr<gd::PlatformExtension> extension =
|
||||
platform.GetAllPlatformExtensions()[i];
|
||||
if (!extension) continue;
|
||||
|
||||
std::map<gd::String, gd::EventMetadata>& allEvents =
|
||||
extension->GetAllEvents();
|
||||
if (allEvents.find(type) != allEvents.end())
|
||||
return allEvents[type].preprocessing(
|
||||
*this, codeGenerator, eventList, indexOfTheEventInThisList);
|
||||
}
|
||||
} catch (...) {
|
||||
std::cout << "ERROR: Exception caught during preprocessing of event \""
|
||||
<< type << "\"." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
BaseEventSPtr GD_CORE_API CloneRememberingOriginalEvent(BaseEventSPtr event)
|
||||
{
|
||||
gd::BaseEventSPtr copy(event->Clone());
|
||||
//Original event is either the original event of the copied event, or the event copied.
|
||||
copy->originalEvent = event->originalEvent.expired() ? event : event->originalEvent;
|
||||
BaseEventSPtr GD_CORE_API CloneRememberingOriginalEvent(BaseEventSPtr event) {
|
||||
gd::BaseEventSPtr copy(event->Clone());
|
||||
// Original event is either the original event of the copied event, or the
|
||||
// event copied.
|
||||
copy->originalEvent =
|
||||
event->originalEvent.expired() ? event : event->originalEvent;
|
||||
|
||||
return copy;
|
||||
return copy;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,36 +1,55 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef GDCORE_EVENT_H
|
||||
#define GDCORE_EVENT_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "GDCore/String.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
namespace gd { class EventsList; }
|
||||
namespace gd { class MainFrameWrapper; }
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class EventsCodeGenerator; }
|
||||
namespace gd { class EventsCodeGenerationContext; }
|
||||
namespace gd { class Platform; }
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class EventsList;
|
||||
}
|
||||
namespace gd {
|
||||
class MainFrameWrapper;
|
||||
}
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsCodeGenerator;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsCodeGenerationContext;
|
||||
}
|
||||
namespace gd {
|
||||
class Platform;
|
||||
}
|
||||
class wxWindow;
|
||||
namespace gd { class EventsEditorItemsAreas; }
|
||||
namespace gd { class EventsEditorSelection; }
|
||||
namespace gd { class SerializerElement; }
|
||||
namespace gd { class Instruction; }
|
||||
namespace gd {
|
||||
class EventsEditorItemsAreas;
|
||||
}
|
||||
namespace gd {
|
||||
class EventsEditorSelection;
|
||||
}
|
||||
namespace gd {
|
||||
class SerializerElement;
|
||||
}
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
class wxDC;
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
class BaseEvent;
|
||||
typedef std::shared_ptr<BaseEvent> BaseEventSPtr;
|
||||
@@ -38,241 +57,326 @@ typedef std::shared_ptr<BaseEvent> BaseEventSPtr;
|
||||
/**
|
||||
* \brief Base class defining an event.
|
||||
*
|
||||
* Events are usually not instance of Base Event, but instance of a derived class.
|
||||
* Events are usually not instance of Base Event, but instance of a derived
|
||||
* class.
|
||||
*
|
||||
* \ingroup Events
|
||||
*/
|
||||
class GD_CORE_API BaseEvent
|
||||
{
|
||||
public:
|
||||
BaseEvent();
|
||||
virtual ~BaseEvent() {};
|
||||
class GD_CORE_API BaseEvent {
|
||||
public:
|
||||
BaseEvent();
|
||||
virtual ~BaseEvent(){};
|
||||
|
||||
/**
|
||||
* Must return a pointer to a copy of the event.
|
||||
* A such method is needed as the IDE may want to store copies of some events and so need a way to do polymorphic copies.
|
||||
*
|
||||
* Typical implementation example:
|
||||
* \code
|
||||
* return new MyEventClass(*this);
|
||||
* \endcode
|
||||
*/
|
||||
virtual gd::BaseEvent * Clone() const { return new BaseEvent(*this);}
|
||||
/**
|
||||
* Must return a pointer to a copy of the event.
|
||||
* A such method is needed as the IDE may want to store copies of some events
|
||||
* and so need a way to do polymorphic copies.
|
||||
*
|
||||
* Typical implementation example:
|
||||
* \code
|
||||
* return new MyEventClass(*this);
|
||||
* \endcode
|
||||
*/
|
||||
virtual gd::BaseEvent* Clone() const { return new BaseEvent(*this); }
|
||||
|
||||
/** \name Event properties
|
||||
* Members functions to be overridden by derived classes to expose the event properties
|
||||
*/
|
||||
///@{
|
||||
/** \name Event properties
|
||||
* Members functions to be overridden by derived classes to expose the event
|
||||
* properties
|
||||
*/
|
||||
///@{
|
||||
|
||||
/**
|
||||
* Derived class have to redefine this function, so as to return true, if they are executable.
|
||||
*/
|
||||
virtual bool IsExecutable() const {return false;};
|
||||
/**
|
||||
* Derived class have to redefine this function, so as to return true, if they
|
||||
* are executable.
|
||||
*/
|
||||
virtual bool IsExecutable() const { return false; };
|
||||
|
||||
/**
|
||||
* Derived class have to redefine this function, so as to return true, if they have sub events.
|
||||
*/
|
||||
virtual bool CanHaveSubEvents() const {return false;}
|
||||
/**
|
||||
* Derived class have to redefine this function, so as to return true, if they
|
||||
* have sub events.
|
||||
*/
|
||||
virtual bool CanHaveSubEvents() const { return false; }
|
||||
|
||||
/**
|
||||
* Return the sub events, if applicable.
|
||||
*/
|
||||
virtual const gd::EventsList & GetSubEvents() const {return badSubEvents;};
|
||||
/**
|
||||
* Return the sub events, if applicable.
|
||||
*/
|
||||
virtual const gd::EventsList& GetSubEvents() const { return badSubEvents; };
|
||||
|
||||
/**
|
||||
* Return the sub events, if applicable.
|
||||
*/
|
||||
virtual gd::EventsList & GetSubEvents() {return badSubEvents;};
|
||||
/**
|
||||
* Return the sub events, if applicable.
|
||||
*/
|
||||
virtual gd::EventsList& GetSubEvents() { return badSubEvents; };
|
||||
|
||||
/**
|
||||
* \brief Return true if the events has sub events.
|
||||
* \warning This is only applicable when CanHaveSubEvents() return true.
|
||||
*/
|
||||
bool HasSubEvents() const;
|
||||
/**
|
||||
* \brief Return true if the events has sub events.
|
||||
* \warning This is only applicable when CanHaveSubEvents() return true.
|
||||
*/
|
||||
bool HasSubEvents() const;
|
||||
|
||||
/**
|
||||
* Event must be able to return all conditions std::vector they have.
|
||||
* Used to preprocess the conditions.
|
||||
*/
|
||||
virtual std::vector < gd::InstructionsList* > GetAllConditionsVectors() { std::vector < gd::InstructionsList* > noConditions; return noConditions; };
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllConditionsVectors() const { std::vector < const gd::InstructionsList* > noConditions; return noConditions; };
|
||||
/**
|
||||
* Event must be able to return all conditions std::vector they have.
|
||||
* Used to preprocess the conditions.
|
||||
*/
|
||||
virtual std::vector<gd::InstructionsList*> GetAllConditionsVectors() {
|
||||
std::vector<gd::InstructionsList*> noConditions;
|
||||
return noConditions;
|
||||
};
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllConditionsVectors()
|
||||
const {
|
||||
std::vector<const gd::InstructionsList*> noConditions;
|
||||
return noConditions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event must be able to return all actions std::vector they have.
|
||||
* Used to preprocess the actions.
|
||||
*/
|
||||
virtual std::vector < gd::InstructionsList* > GetAllActionsVectors() { std::vector < gd::InstructionsList* > noActions; return noActions; };
|
||||
virtual std::vector < const gd::InstructionsList* > GetAllActionsVectors() const { std::vector < const gd::InstructionsList* > noActions; return noActions; };
|
||||
/**
|
||||
* Event must be able to return all actions std::vector they have.
|
||||
* Used to preprocess the actions.
|
||||
*/
|
||||
virtual std::vector<gd::InstructionsList*> GetAllActionsVectors() {
|
||||
std::vector<gd::InstructionsList*> noActions;
|
||||
return noActions;
|
||||
};
|
||||
virtual std::vector<const gd::InstructionsList*> GetAllActionsVectors()
|
||||
const {
|
||||
std::vector<const gd::InstructionsList*> noActions;
|
||||
return noActions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event must be able to return all expressions they have.
|
||||
* Used to preprocess the expressions.
|
||||
*/
|
||||
virtual std::vector < gd::Expression* > GetAllExpressions() { std::vector < gd::Expression* > noExpr; return noExpr;};
|
||||
virtual std::vector < const gd::Expression* > GetAllExpressions() const { std::vector < const gd::Expression* > noExpr; return noExpr;};
|
||||
/**
|
||||
* Event must be able to return all expressions they have.
|
||||
* Used to preprocess the expressions.
|
||||
*/
|
||||
virtual std::vector<gd::Expression*> GetAllExpressions() {
|
||||
std::vector<gd::Expression*> noExpr;
|
||||
return noExpr;
|
||||
};
|
||||
virtual std::vector<const gd::Expression*> GetAllExpressions() const {
|
||||
std::vector<const gd::Expression*> noExpr;
|
||||
return noExpr;
|
||||
};
|
||||
|
||||
///@}
|
||||
/**
|
||||
* \brief Returns the dependencies on source files of the project.
|
||||
* \note Default implementation returns an empty list of dependencies. This is
|
||||
* fine for most events that are not related to adding custom user source
|
||||
* code.
|
||||
*/
|
||||
virtual const std::vector<gd::String>& GetSourceFileDependencies() const {
|
||||
return emptyDependencies;
|
||||
};
|
||||
|
||||
/** \name Code generation
|
||||
* Members functions used to generate code from the event
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Returns the name of the source file associated with the event
|
||||
* \note Default implementation returns an empty string. This is fine for most
|
||||
* events that are not related to adding custom user source code.
|
||||
*/
|
||||
virtual const gd::String& GetAssociatedGDManagedSourceFile(
|
||||
gd::Project& project) const {
|
||||
return emptySourceFile;
|
||||
};
|
||||
///@}
|
||||
|
||||
/**
|
||||
* \brief Generate the code event: the platform provided by \a codeGenerator is asked for the EventMetadata associated to the event,
|
||||
* which is then used to generate the code event.
|
||||
*
|
||||
* \warning Even if this method is virtual, you should never redefine it: always provide the code generation using gd::EventMetadata.
|
||||
* This method is virtual as some platforms could have hidden events ( such as profiling events ) needing code generation without declaring
|
||||
* the event as a part of an extension.
|
||||
*
|
||||
* \see gd::EventMetadata
|
||||
*/
|
||||
virtual gd::String GenerateEventCode(gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context);
|
||||
/** \name Code generation
|
||||
* Members functions used to generate code from the event
|
||||
*/
|
||||
///@{
|
||||
|
||||
/**
|
||||
* Called before events are compiled: the platform provided by \a codeGenerator is asked for the EventMetadata associated to the event,
|
||||
* which is then used to preprocess the event.
|
||||
*
|
||||
* This is only done if the event MustBePreprocessed() return true.
|
||||
*
|
||||
* \warning Be careful if you're iterating over a list of event, a call to Preprocess can remove the event from the list!
|
||||
*
|
||||
* \see gd::EventMetadata
|
||||
* \see gd::BaseEvent::MustBePreprocessed
|
||||
*/
|
||||
virtual void Preprocess(gd::EventsCodeGenerator & codeGenerator, gd::EventsList & eventList, std::size_t indexOfTheEventInThisList);
|
||||
/**
|
||||
* \brief Generate the code event: the platform provided by \a codeGenerator
|
||||
* is asked for the EventMetadata associated to the event, which is then used
|
||||
* to generate the code event.
|
||||
*
|
||||
* \warning Even if this method is virtual, you should never redefine it:
|
||||
* always provide the code generation using gd::EventMetadata. This method is
|
||||
* virtual as some platforms could have hidden events ( such as profiling
|
||||
* events ) needing code generation without declaring the event as a part of
|
||||
* an extension.
|
||||
*
|
||||
* \see gd::EventMetadata
|
||||
*/
|
||||
virtual gd::String GenerateEventCode(
|
||||
gd::EventsCodeGenerator& codeGenerator,
|
||||
gd::EventsCodeGenerationContext& context);
|
||||
|
||||
/**
|
||||
* \brief If MustBePreprocessed is redefined to return true, the gd::EventMetadata::preprocessing associated to the event will be called
|
||||
* to preprocess the event.
|
||||
*
|
||||
* \see gd::BaseEvent::Preprocess
|
||||
* \see gd::EventMetadata
|
||||
*/
|
||||
virtual bool MustBePreprocessed() { return false;}
|
||||
///@}
|
||||
/**
|
||||
* Called before events are compiled: the platform provided by \a
|
||||
* codeGenerator is asked for the EventMetadata associated to the event, which
|
||||
* is then used to preprocess the event.
|
||||
*
|
||||
* This is only done if the event MustBePreprocessed() return true.
|
||||
*
|
||||
* \warning Be careful if you're iterating over a list of event, a call to
|
||||
* Preprocess can remove the event from the list!
|
||||
*
|
||||
* \see gd::EventMetadata
|
||||
* \see gd::BaseEvent::MustBePreprocessed
|
||||
*/
|
||||
virtual void Preprocess(gd::EventsCodeGenerator& codeGenerator,
|
||||
gd::EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList);
|
||||
|
||||
/** \name Serialization
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Serialize event.
|
||||
*/
|
||||
virtual void SerializeTo(SerializerElement & element) const {};
|
||||
/**
|
||||
* \brief If MustBePreprocessed is redefined to return true, the
|
||||
* gd::EventMetadata::preprocessing associated to the event will be called to
|
||||
* preprocess the event.
|
||||
*
|
||||
* \see gd::BaseEvent::Preprocess
|
||||
* \see gd::EventMetadata
|
||||
*/
|
||||
virtual bool MustBePreprocessed() { return false; }
|
||||
///@}
|
||||
|
||||
/**
|
||||
* \brief Unserialize the event.
|
||||
*/
|
||||
virtual void UnserializeFrom(gd::Project & project, const SerializerElement & element) {};
|
||||
///@}
|
||||
/** \name Serialization
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Serialize event.
|
||||
*/
|
||||
virtual void SerializeTo(SerializerElement& element) const {};
|
||||
|
||||
/** \name Common properties
|
||||
* Common method shared by all events. ( No need for them to be overridden by derived classes ).
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Unserialize the event.
|
||||
*/
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element){};
|
||||
///@}
|
||||
|
||||
/**
|
||||
* \brief Return the event type
|
||||
*/
|
||||
const gd::String & GetType() const { return type; };
|
||||
/** \name Common properties
|
||||
* Common method shared by all events. ( No need for them to be overridden by
|
||||
* derived classes ).
|
||||
*/
|
||||
///@{
|
||||
|
||||
/**
|
||||
* \brief Change the event type
|
||||
*/
|
||||
void SetType(gd::String type_) { type = type_; };
|
||||
/**
|
||||
* \brief Return the event type
|
||||
*/
|
||||
const gd::String& GetType() const { return type; };
|
||||
|
||||
/**
|
||||
* \brief Set if the event if disabled or not
|
||||
*/
|
||||
void SetDisabled(bool disable = true) { disabled = disable; }
|
||||
/**
|
||||
* \brief Change the event type
|
||||
*/
|
||||
void SetType(gd::String type_) { type = type_; };
|
||||
|
||||
/**
|
||||
* \brief True if event is disabled
|
||||
*/
|
||||
bool IsDisabled() const { return disabled; }
|
||||
/**
|
||||
* \brief Set if the event if disabled or not
|
||||
*/
|
||||
void SetDisabled(bool disable = true) { disabled = disable; }
|
||||
|
||||
/**
|
||||
* \brief Set if the event must be folded (i.e: sub events must
|
||||
* be hidden in the events editor).
|
||||
*/
|
||||
void SetFolded(bool fold = true) { folded = fold; }
|
||||
/**
|
||||
* \brief True if event is disabled
|
||||
*/
|
||||
bool IsDisabled() const { return disabled; }
|
||||
|
||||
/**
|
||||
* \brief True if the event should be folded in the events editor.
|
||||
*/
|
||||
bool IsFolded() const { return folded; }
|
||||
/**
|
||||
* \brief Set if the event must be folded (i.e: sub events must
|
||||
* be hidden in the events editor).
|
||||
*/
|
||||
void SetFolded(bool fold = true) { folded = fold; }
|
||||
|
||||
///@}
|
||||
/**
|
||||
* \brief True if the event should be folded in the events editor.
|
||||
*/
|
||||
bool IsFolded() const { return folded; }
|
||||
|
||||
/** \name Event rendering
|
||||
* Method and members used to render the event
|
||||
*/
|
||||
///@{
|
||||
///@}
|
||||
|
||||
/**
|
||||
* Redefine this method to draw the event.
|
||||
*
|
||||
* \param dc The wxWidgets drawing context to be used.
|
||||
* \param x The x position where the events must be drawn.
|
||||
* \param y The y position where the events must be drawn.
|
||||
* \param width The width available for drawing.
|
||||
* \param areas Use this object to indicate the areas where items have been drawn
|
||||
* \param selection Give access to the current selection(s), to draw for example hovering or selecting effects.
|
||||
*
|
||||
* \note The height of the drawing must be the same as the height returned by BaseEvent::GetRenderedHeight
|
||||
*
|
||||
* \see gd::EventsRenderingHelper
|
||||
* \see EventsEditorSelection
|
||||
* \see EventsEditorItemsAreas
|
||||
*/
|
||||
virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform) {return;}
|
||||
/** \name Event rendering
|
||||
* Method and members used to render the event
|
||||
*/
|
||||
///@{
|
||||
|
||||
/**
|
||||
* Must return the height of the event when rendered.
|
||||
*
|
||||
* \note The height of the drawing must be the same as the height of the drawing made by BaseEvent::Render
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const {return 0;};
|
||||
/**
|
||||
* Redefine this method to draw the event.
|
||||
*
|
||||
* \param dc The wxWidgets drawing context to be used.
|
||||
* \param x The x position where the events must be drawn.
|
||||
* \param y The y position where the events must be drawn.
|
||||
* \param width The width available for drawing.
|
||||
* \param areas Use this object to indicate the areas where items have been
|
||||
* drawn \param selection Give access to the current selection(s), to draw for
|
||||
* example hovering or selecting effects.
|
||||
*
|
||||
* \note The height of the drawing must be the same as the height returned by
|
||||
* BaseEvent::GetRenderedHeight
|
||||
*
|
||||
* \see gd::EventsRenderingHelper
|
||||
* \see EventsEditorSelection
|
||||
* \see EventsEditorItemsAreas
|
||||
*/
|
||||
virtual void Render(wxDC& dc,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
gd::EventsEditorItemsAreas& areas,
|
||||
gd::EventsEditorSelection& selection,
|
||||
const gd::Platform& platform) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by EditEvent to describe what sort of changes have been made to the event.
|
||||
* \see BaseEvent::EditEvent
|
||||
*/
|
||||
enum EditEventReturnType
|
||||
{
|
||||
ChangesMade,
|
||||
Cancelled,
|
||||
ChangesMadeButNoNeedForEventsRecompilation
|
||||
};
|
||||
/**
|
||||
* Must return the height of the event when rendered.
|
||||
*
|
||||
* \note The height of the drawing must be the same as the height of the
|
||||
* drawing made by BaseEvent::Render
|
||||
*/
|
||||
virtual unsigned int GetRenderedHeight(unsigned int width,
|
||||
const gd::Platform& platform) const {
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when the user want to edit the event.
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_) { return ChangesMade; };
|
||||
/**
|
||||
* Used by EditEvent to describe what sort of changes have been made to the
|
||||
* event. \see BaseEvent::EditEvent
|
||||
*/
|
||||
enum EditEventReturnType {
|
||||
ChangesMade,
|
||||
Cancelled,
|
||||
ChangesMadeButNoNeedForEventsRecompilation
|
||||
};
|
||||
|
||||
///@}
|
||||
/**
|
||||
* Called when the user want to edit the event.
|
||||
*/
|
||||
virtual EditEventReturnType EditEvent(
|
||||
wxWindow* parent_,
|
||||
gd::Project& game_,
|
||||
gd::Layout& scene_,
|
||||
gd::MainFrameWrapper& mainFrameWrapper_) {
|
||||
return ChangesMade;
|
||||
};
|
||||
|
||||
mutable bool eventHeightNeedUpdate; ///<Automatically set to true/false by the events editor
|
||||
///@}
|
||||
|
||||
std::weak_ptr<gd::BaseEvent> originalEvent; ///< Pointer only used for profiling events, so as to remember the original event from which it has been copied.
|
||||
signed long long totalTimeDuringLastSession; ///< Total time, in microseconds, used by the event during the last run. Used for profiling.
|
||||
float percentDuringLastSession; ///< Total time used by the event during the last run. Used for profiling.
|
||||
mutable bool eventHeightNeedUpdate; ///< Automatically set to true/false by
|
||||
///< the events editor
|
||||
|
||||
protected:
|
||||
mutable unsigned int renderedHeight;
|
||||
std::weak_ptr<gd::BaseEvent>
|
||||
originalEvent; ///< Pointer only used for profiling events, so as to
|
||||
///< remember the original event from which it has been
|
||||
///< copied.
|
||||
signed long long
|
||||
totalTimeDuringLastSession; ///< Total time, in microseconds, used by the
|
||||
///< event during the last run. Used for
|
||||
///< profiling.
|
||||
float percentDuringLastSession; ///< Total time used by the event during the
|
||||
///< last run. Used for profiling.
|
||||
|
||||
private:
|
||||
bool folded; ///< True if the subevents should be hidden in the events editor
|
||||
bool disabled; ///<True if the event is disabled and must not be executed
|
||||
gd::String type; ///<Type of the event. Must be assigned at the creation. Used for saving the event for instance.
|
||||
protected:
|
||||
mutable unsigned int renderedHeight;
|
||||
|
||||
static gd::EventsList badSubEvents;
|
||||
private:
|
||||
bool folded; ///< True if the subevents should be hidden in the events editor
|
||||
bool disabled; ///< True if the event is disabled and must not be executed
|
||||
gd::String type; ///< Type of the event. Must be assigned at the creation.
|
||||
///< Used for saving the event for instance.
|
||||
|
||||
static gd::EventsList badSubEvents;
|
||||
static std::vector<gd::String> emptyDependencies;
|
||||
static gd::String emptySourceFile;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone an event and insert a reference to the original event into the newly created event.
|
||||
* Used for profiling events for example.
|
||||
* Clone an event and insert a reference to the original event into the newly
|
||||
* created event. Used for profiling events for example.
|
||||
*
|
||||
* \see BaseEvent
|
||||
* \ingroup Events
|
||||
@@ -283,14 +387,13 @@ BaseEventSPtr GD_CORE_API CloneRememberingOriginalEvent(BaseEventSPtr event);
|
||||
* \brief Empty event doing nothing.
|
||||
* \see gd::BaseEvent
|
||||
*/
|
||||
class EmptyEvent : public BaseEvent
|
||||
{
|
||||
public:
|
||||
EmptyEvent() : BaseEvent() {};
|
||||
virtual ~EmptyEvent() {};
|
||||
class EmptyEvent : public BaseEvent {
|
||||
public:
|
||||
EmptyEvent() : BaseEvent(){};
|
||||
virtual ~EmptyEvent(){};
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_EVENT_H
|
||||
#endif // GDCORE_EVENT_H
|
||||
#endif
|
||||
|
@@ -1,127 +1,116 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "EventsList.h"
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "Serialization.h"
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
EventsList::EventsList()
|
||||
{
|
||||
}
|
||||
EventsList::EventsList() {}
|
||||
|
||||
void EventsList::InsertEvents(const EventsList& otherEvents,
|
||||
size_t begin,
|
||||
size_t end,
|
||||
size_t position) {
|
||||
if (begin >= otherEvents.size()) return;
|
||||
if (end < begin) return;
|
||||
if (end >= otherEvents.size()) end = otherEvents.size() - 1;
|
||||
|
||||
void EventsList::InsertEvents(const EventsList & otherEvents, size_t begin, size_t end, size_t position)
|
||||
{
|
||||
if (begin >= otherEvents.size()) return;
|
||||
if (end < begin) return;
|
||||
if (end >= otherEvents.size()) end = otherEvents.size()-1;
|
||||
|
||||
for (std::size_t insertPos = 0;insertPos <= (end-begin);insertPos++)
|
||||
{
|
||||
if (position != (size_t)-1 && position+insertPos < events.size())
|
||||
events.insert(events.begin()+position+insertPos, CloneRememberingOriginalEvent(otherEvents.events[begin+insertPos]));
|
||||
else
|
||||
events.push_back(CloneRememberingOriginalEvent(otherEvents.events[begin+insertPos]));
|
||||
}
|
||||
}
|
||||
|
||||
gd::BaseEvent & EventsList::InsertEvent(const gd::BaseEvent & evt, size_t position)
|
||||
{
|
||||
std::shared_ptr<gd::BaseEvent> event(evt.Clone());
|
||||
if (position<events.size())
|
||||
events.insert(events.begin()+position, event);
|
||||
for (std::size_t insertPos = 0; insertPos <= (end - begin); insertPos++) {
|
||||
if (position != (size_t)-1 && position + insertPos < events.size())
|
||||
events.insert(
|
||||
events.begin() + position + insertPos,
|
||||
CloneRememberingOriginalEvent(otherEvents.events[begin + insertPos]));
|
||||
else
|
||||
events.push_back(event);
|
||||
|
||||
return *event;
|
||||
events.push_back(
|
||||
CloneRememberingOriginalEvent(otherEvents.events[begin + insertPos]));
|
||||
}
|
||||
}
|
||||
|
||||
void EventsList::InsertEvent(std::shared_ptr<gd::BaseEvent> event, size_t position)
|
||||
{
|
||||
if (position<events.size())
|
||||
events.insert(events.begin()+position, event);
|
||||
else
|
||||
events.push_back(event);
|
||||
gd::BaseEvent& EventsList::InsertEvent(const gd::BaseEvent& evt,
|
||||
size_t position) {
|
||||
std::shared_ptr<gd::BaseEvent> event(evt.Clone());
|
||||
if (position < events.size())
|
||||
events.insert(events.begin() + position, event);
|
||||
else
|
||||
events.push_back(event);
|
||||
|
||||
return *event;
|
||||
}
|
||||
|
||||
gd::BaseEvent & EventsList::InsertNewEvent(gd::Project & project, const gd::String & eventType, size_t position)
|
||||
{
|
||||
gd::BaseEventSPtr event = project.CreateEvent(eventType);
|
||||
if ( event == std::shared_ptr<gd::BaseEvent>())
|
||||
{
|
||||
std::cout << "Unknown event of type " << eventType;
|
||||
event = std::shared_ptr<gd::BaseEvent>(new EmptyEvent);
|
||||
void EventsList::InsertEvent(std::shared_ptr<gd::BaseEvent> event,
|
||||
size_t position) {
|
||||
if (position < events.size())
|
||||
events.insert(events.begin() + position, event);
|
||||
else
|
||||
events.push_back(event);
|
||||
}
|
||||
|
||||
gd::BaseEvent& EventsList::InsertNewEvent(gd::Project& project,
|
||||
const gd::String& eventType,
|
||||
size_t position) {
|
||||
gd::BaseEventSPtr event = project.CreateEvent(eventType);
|
||||
if (event == std::shared_ptr<gd::BaseEvent>()) {
|
||||
std::cout << "Unknown event of type " << eventType;
|
||||
event = std::make_shared<EmptyEvent>();
|
||||
}
|
||||
|
||||
InsertEvent(event, position);
|
||||
return *event;
|
||||
}
|
||||
|
||||
void EventsList::RemoveEvent(size_t index) {
|
||||
events.erase(events.begin() + index);
|
||||
}
|
||||
|
||||
void EventsList::RemoveEvent(const gd::BaseEvent& event) {
|
||||
for (size_t i = 0; i < events.size(); ++i) {
|
||||
if (events[i].get() == &event) {
|
||||
events.erase(events.begin() + i);
|
||||
return;
|
||||
}
|
||||
|
||||
InsertEvent(event, position);
|
||||
return *event;
|
||||
}
|
||||
}
|
||||
|
||||
void EventsList::RemoveEvent(size_t index)
|
||||
{
|
||||
events.erase(events.begin()+index);
|
||||
void EventsList::SerializeTo(SerializerElement& element) const {
|
||||
EventsListSerialization::SerializeEventsTo(*this, element);
|
||||
}
|
||||
|
||||
void EventsList::RemoveEvent(const gd::BaseEvent & event)
|
||||
{
|
||||
for (size_t i = 0; i < events.size(); ++i)
|
||||
{
|
||||
if (events[i].get() == &event)
|
||||
{
|
||||
events.erase(events.begin()+i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
void EventsList::UnserializeFrom(gd::Project& project,
|
||||
const SerializerElement& element) {
|
||||
EventsListSerialization::UnserializeEventsFrom(project, *this, element);
|
||||
}
|
||||
|
||||
void EventsList::SerializeTo(SerializerElement & element) const
|
||||
{
|
||||
EventsListSerialization::SerializeEventsTo(*this, element);
|
||||
bool EventsList::Contains(const gd::BaseEvent& eventToSearch,
|
||||
bool recursive) const {
|
||||
for (std::size_t i = 0; i < GetEventsCount(); ++i) {
|
||||
if (&GetEvent(i) == &eventToSearch) return true;
|
||||
if (recursive && GetEvent(i).CanHaveSubEvents() &&
|
||||
GetEvent(i).GetSubEvents().Contains(eventToSearch))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EventsList::UnserializeFrom(gd::Project & project, const SerializerElement & element)
|
||||
{
|
||||
EventsListSerialization::UnserializeEventsFrom(project, *this, element);
|
||||
EventsList::EventsList(const EventsList& other) { Init(other); }
|
||||
|
||||
EventsList& EventsList::operator=(const EventsList& other) {
|
||||
if (this != &other) Init(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool EventsList::Contains(const gd::BaseEvent & eventToSearch, bool recursive) const
|
||||
{
|
||||
for (std::size_t i = 0;i<GetEventsCount();++i)
|
||||
{
|
||||
if ( &GetEvent(i) == &eventToSearch) return true;
|
||||
if ( recursive && GetEvent(i).CanHaveSubEvents() && GetEvent(i).GetSubEvents().Contains(eventToSearch) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
void EventsList::Init(const gd::EventsList& other) {
|
||||
events.clear();
|
||||
for (size_t i = 0; i < other.events.size(); ++i)
|
||||
events.push_back(CloneRememberingOriginalEvent(other.events[i]));
|
||||
}
|
||||
|
||||
EventsList::EventsList(const EventsList & other)
|
||||
{
|
||||
Init(other);
|
||||
}
|
||||
|
||||
EventsList & EventsList::operator=(const EventsList & other)
|
||||
{
|
||||
if ( this != &other )
|
||||
Init(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void EventsList::Init(const gd::EventsList & other)
|
||||
{
|
||||
events.clear();
|
||||
for(size_t i = 0;i<other.events.size();++i)
|
||||
events.push_back(CloneRememberingOriginalEvent(other.events[i]));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
@@ -1,23 +1,28 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef GDCORE_EVENTSLIST_H
|
||||
#define GDCORE_EVENTSLIST_H
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/String.h"
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class BaseEvent; }
|
||||
namespace gd { class SerializerElement; }
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class BaseEvent;
|
||||
}
|
||||
namespace gd {
|
||||
class SerializerElement;
|
||||
}
|
||||
class TiXmlElement;
|
||||
|
||||
#undef CreateEvent
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief A list of events.
|
||||
@@ -25,154 +30,174 @@ namespace gd
|
||||
* \see BaseEvent
|
||||
* \ingroup Events
|
||||
*/
|
||||
class GD_CORE_API EventsList
|
||||
{
|
||||
public:
|
||||
EventsList();
|
||||
EventsList(const EventsList&);
|
||||
virtual ~EventsList() {};
|
||||
EventsList& operator=(const EventsList & rhs);
|
||||
class GD_CORE_API EventsList {
|
||||
public:
|
||||
EventsList();
|
||||
EventsList(const EventsList&);
|
||||
virtual ~EventsList(){};
|
||||
EventsList& operator=(const EventsList& rhs);
|
||||
|
||||
/**
|
||||
* \brief Insert the specified event to the list
|
||||
* \note The event passed by parameter is copied.
|
||||
* \param event The event that must be copied and inserted into the list
|
||||
* \param position Insertion position. If the position is invalid, the object is inserted at the end of the objects list.
|
||||
* \return A reference to the event in the list
|
||||
*/
|
||||
gd::BaseEvent & InsertEvent(const gd::BaseEvent & event, size_t position = (size_t)-1);
|
||||
/**
|
||||
* \brief Insert the specified event to the list
|
||||
* \note The event passed by parameter is copied.
|
||||
* \param event The event that must be copied and inserted into the list
|
||||
* \param position Insertion position. If the position is invalid, the object
|
||||
* is inserted at the end of the objects list. \return A reference to the
|
||||
* event in the list
|
||||
*/
|
||||
gd::BaseEvent& InsertEvent(const gd::BaseEvent& event,
|
||||
size_t position = (size_t)-1);
|
||||
|
||||
/**
|
||||
* \brief Insert the specified event to the list.
|
||||
* \note The event passed by parameter is not copied.
|
||||
* \param event The smart pointer to the event that must be inserted into the list
|
||||
* \param position Insertion position. If the position is invalid, the object is inserted at the end of the objects list.
|
||||
*/
|
||||
void InsertEvent(std::shared_ptr<gd::BaseEvent> event, size_t position = (size_t)-1);
|
||||
/**
|
||||
* \brief Insert the specified event to the list.
|
||||
* \note The event passed by parameter is not copied.
|
||||
* \param event The smart pointer to the event that must be inserted into the
|
||||
* list \param position Insertion position. If the position is invalid, the
|
||||
* object is inserted at the end of the objects list.
|
||||
*/
|
||||
void InsertEvent(std::shared_ptr<gd::BaseEvent> event,
|
||||
size_t position = (size_t)-1);
|
||||
|
||||
/**
|
||||
* \brief Insert a new event to the list.
|
||||
* \note The event is created using the project current platform.
|
||||
* \param project The project the events list belongs to.
|
||||
* \param eventType The type of the event
|
||||
* \param position Insertion position. If the position is invalid, the object is inserted at the end of the objects list.
|
||||
*/
|
||||
gd::BaseEvent & InsertNewEvent(gd::Project & project, const gd::String & eventType, size_t position = (size_t)-1);
|
||||
/**
|
||||
* \brief Insert a new event to the list.
|
||||
* \note The event is created using the project current platform.
|
||||
* \param project The project the events list belongs to.
|
||||
* \param eventType The type of the event
|
||||
* \param position Insertion position. If the position is invalid, the object
|
||||
* is inserted at the end of the objects list.
|
||||
*/
|
||||
gd::BaseEvent& InsertNewEvent(gd::Project& project,
|
||||
const gd::String& eventType,
|
||||
size_t position = (size_t)-1);
|
||||
|
||||
/**
|
||||
* \brief Copy events from another list
|
||||
*/
|
||||
void InsertEvents(const EventsList & otherEvents, size_t begin, size_t end, size_t position = (size_t)-1);
|
||||
/**
|
||||
* \brief Copy events from another list
|
||||
*/
|
||||
void InsertEvents(const EventsList& otherEvents,
|
||||
size_t begin,
|
||||
size_t end,
|
||||
size_t position = (size_t)-1);
|
||||
|
||||
/**
|
||||
* \brief Return the number of events.
|
||||
*/
|
||||
size_t GetEventsCount() const { return events.size(); };
|
||||
/**
|
||||
* \brief Return the number of events.
|
||||
*/
|
||||
size_t GetEventsCount() const { return events.size(); };
|
||||
|
||||
/**
|
||||
* \brief Return the smart pointer to the event at position \a index in the events list.
|
||||
*/
|
||||
std::shared_ptr<BaseEvent> GetEventSmartPtr(size_t index) { return events[index]; };
|
||||
/**
|
||||
* \brief Return the smart pointer to the event at position \a index in the
|
||||
* events list.
|
||||
*/
|
||||
std::shared_ptr<BaseEvent> GetEventSmartPtr(size_t index) {
|
||||
return events[index];
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Return the smart pointer to the event at position \a index in the events list.
|
||||
*/
|
||||
std::shared_ptr<const BaseEvent> GetEventSmartPtr(size_t index) const { return events[index]; };
|
||||
/**
|
||||
* \brief Return the smart pointer to the event at position \a index in the
|
||||
* events list.
|
||||
*/
|
||||
std::shared_ptr<const BaseEvent> GetEventSmartPtr(size_t index) const {
|
||||
return events[index];
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Return a reference to the event at position \a index in the events list.
|
||||
*/
|
||||
gd::BaseEvent & GetEvent(size_t index) { return *events[index]; };
|
||||
/**
|
||||
* \brief Return a reference to the event at position \a index in the events
|
||||
* list.
|
||||
*/
|
||||
gd::BaseEvent& GetEvent(size_t index) { return *events[index]; };
|
||||
|
||||
/**
|
||||
* \brief Return a reference to the event at position \a index in the events list.
|
||||
*/
|
||||
const gd::BaseEvent & GetEvent(size_t index) const { return *events[index]; };
|
||||
/**
|
||||
* \brief Return a reference to the event at position \a index in the events
|
||||
* list.
|
||||
*/
|
||||
const gd::BaseEvent& GetEvent(size_t index) const { return *events[index]; };
|
||||
|
||||
/**
|
||||
* \brief Remove the specified event.
|
||||
*/
|
||||
void RemoveEvent(const gd::BaseEvent & event);
|
||||
/**
|
||||
* \brief Remove the specified event.
|
||||
*/
|
||||
void RemoveEvent(const gd::BaseEvent& event);
|
||||
|
||||
/**
|
||||
* \brief Remove the event at the specified index in the list.
|
||||
*/
|
||||
void RemoveEvent(size_t index);
|
||||
/**
|
||||
* \brief Remove the event at the specified index in the list.
|
||||
*/
|
||||
void RemoveEvent(size_t index);
|
||||
|
||||
/**
|
||||
* \brief Return true if there isn't any event in the list
|
||||
*/
|
||||
bool IsEmpty() const { return events.empty(); };
|
||||
/**
|
||||
* \brief Return true if there isn't any event in the list
|
||||
*/
|
||||
bool IsEmpty() const { return events.empty(); };
|
||||
|
||||
/**
|
||||
* \brief Clear the list of events.
|
||||
*/
|
||||
void Clear() { return events.clear(); };
|
||||
/**
|
||||
* \brief Clear the list of events.
|
||||
*/
|
||||
void Clear() { return events.clear(); };
|
||||
|
||||
/** \name Utilities
|
||||
* Utility methods
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* Return true if the specified event exists in the list.
|
||||
* \param event The event to searched for
|
||||
* \param recursive Set it to false to prevent sub events to be inspected.
|
||||
*/
|
||||
bool Contains(const gd::BaseEvent & eventToSearch, bool recursive = true) const;
|
||||
///@}
|
||||
/** \name Utilities
|
||||
* Utility methods
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* Return true if the specified event exists in the list.
|
||||
* \param event The event to searched for
|
||||
* \param recursive Set it to false to prevent sub events to be inspected.
|
||||
*/
|
||||
bool Contains(const gd::BaseEvent& eventToSearch,
|
||||
bool recursive = true) const;
|
||||
///@}
|
||||
|
||||
/** \name std::vector API compatibility
|
||||
* These functions ensure that the class can be used just like a std::vector.
|
||||
*/
|
||||
///@{
|
||||
/** \name std::vector API compatibility
|
||||
* These functions ensure that the class can be used just like a std::vector.
|
||||
*/
|
||||
///@{
|
||||
|
||||
/**
|
||||
* \brief Alias for GetEventsCount()
|
||||
* \see EventsList::GetEventsCount.
|
||||
*/
|
||||
size_t size() const { return GetEventsCount(); }
|
||||
/**
|
||||
* \brief Alias for GetEventsCount()
|
||||
* \see EventsList::GetEventsCount.
|
||||
*/
|
||||
size_t size() const { return GetEventsCount(); }
|
||||
|
||||
/**
|
||||
* \brief Alias for GetEvent()
|
||||
* \see EventsList::GetEvent.
|
||||
*/
|
||||
gd::BaseEvent & operator[](size_t index) { return GetEvent(index); };
|
||||
/**
|
||||
* \brief Alias for GetEvent()
|
||||
* \see EventsList::GetEvent.
|
||||
*/
|
||||
gd::BaseEvent& operator[](size_t index) { return GetEvent(index); };
|
||||
|
||||
/**
|
||||
* \brief Alias for GetEvent()
|
||||
* \see EventsList::GetEvent.
|
||||
*/
|
||||
const gd::BaseEvent & operator[](size_t index) const { return GetEvent(index); };
|
||||
///@}
|
||||
/**
|
||||
* \brief Alias for GetEvent()
|
||||
* \see EventsList::GetEvent.
|
||||
*/
|
||||
const gd::BaseEvent& operator[](size_t index) const {
|
||||
return GetEvent(index);
|
||||
};
|
||||
///@}
|
||||
|
||||
/** \name Saving and loading
|
||||
* Members functions related to saving and loading the events list.
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Save the objects to xml
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void SerializeTo(SerializerElement & element) const;
|
||||
/** \name Saving and loading
|
||||
* Members functions related to saving and loading the events list.
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Serialize the events to the specified element
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void SerializeTo(SerializerElement& element) const;
|
||||
|
||||
/**
|
||||
* \brief Load the objects from xml
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void UnserializeFrom(gd::Project & project, const SerializerElement & element);
|
||||
///@}
|
||||
/**
|
||||
* \brief Load the events from the specified element
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void UnserializeFrom(gd::Project& project, const SerializerElement& element);
|
||||
///@}
|
||||
|
||||
private:
|
||||
std::vector< std::shared_ptr<BaseEvent> > events;
|
||||
private:
|
||||
std::vector<std::shared_ptr<BaseEvent> > events;
|
||||
|
||||
/**
|
||||
* Initialize from another list of events, copying events. Used by copy-ctor and assign-op.
|
||||
* Don't forget to update me if members were changed !
|
||||
*/
|
||||
void Init(const gd::EventsList & other);
|
||||
/**
|
||||
* Initialize from another list of events, copying events. Used by copy-ctor
|
||||
* and assign-op. Don't forget to update me if members were changed!
|
||||
*/
|
||||
void Init(const gd::EventsList& other);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|