Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Remove obsolete 'calcBounds' function. | 475ec330736b5800d12d091415480b163dd244e2 | Jan Allersma | 2018-11-01 14:28:29 |
Setup for decorator pattern. | 762914dec31b1fb1d4cf6bb0cef2e148010652a4 | Jan Allersma | 2018-11-01 14:12:51 |
Revert commit '5678eb6'. | 6225242719b2cfc5ee0de9f8d05edbc7a69007a7 | Jan Allersma | 2018-11-01 14:10:27 |
Make groups movable and resizable. | 1ca7c18ab103a8d1055b27f63192038fd75aef3e | Jan Allersma | 2018-10-17 14:51:32 |
Use translations instead of positions for moving shapes. | 9551c7d2608f01c3950743fd97bd217aab8f5766 | Jan Allersma | 2018-10-16 16:11:03 |
Implement Visitor pattern for Groups. | bd30477ce616362d3f58cef072d1ebc78077fa85 | Jan Allersma | 2018-10-16 13:28:37 |
Implement Visitor pattern for Shapes. | e52412c3059c1ee5fa9abdf4a32db0f47981eee1 | Jan Allersma | 2018-10-16 12:43:17 |
Setup 'Decorator' and 'Ornament' class. | 5678eb6257bcf88502078d08395a394a1c24568b | Jan Allersma | 2018-10-09 09:29:50 |
Use different strats instead of seperate Shapes. | a56e1e665a0292d15139eddfd8ebdeb8c95251b4 | Jan Allersma | 2018-10-01 11:37:45 |
Make ornament interface compatible with Entities. | 21383d5f200a338f8255d7d33b6989937c19fed6 | Jan Allersma | 2018-10-08 20:36:23 |
Fix bug in Rect from commit 6c91140 in other Shapes as well. | 4165a5da98dd9a548a222c6160390e4e54026d48 | Jan Allersma | 2018-09-28 14:53:40 |
Build interface for ornament creation. | adcf22a4e878edc45ac0775a5e15ebf0bb1a937d | Jan Allersma | 2018-10-08 13:53:52 |
Fully implement File I/O. | 45cbb48489a24857cfc76144b38b12ccebfd9e61 | Jan Allersma | 2018-09-27 16:03:40 |
Fix GroupMenu bug. | be41e51819be1a23e7761ea0662eb188ac641aca | Jan Allersma | 2018-09-27 14:55:20 |
Fix TODO's from previous commit. | 89d8172b77336a6c18f30521147eb81287961f11 | Jan Allersma | 2018-09-27 14:06:30 |
Add groups as preparation for step 3. | a91368128e7444f69b3a30ee4d17f9063c8846b8 | Jan Allersma | 2018-09-26 18:31:49 |
Fix minor bug. Small cleanup 'ellipse' code. | 6c911405eb8e48ffe2d63aaff5255adbd4aec889 | Jan Allersma | 2018-09-21 18:10:01 |
Implement file I/O. | 6219eca932d454a7dab5fe8679f07865ce3cf49d | Jan Allersma | 2018-09-21 15:52:45 |
Add shape 'ellipse'. | 99d8b029c769bc291af73df3fd445da3cbf5bef4 | Jan Allersma | 2018-09-21 10:44:36 |
Add shape 'circle'. | 092cb3c3f788b461192a6e164955c53acaf58720 | Jan Allersma | 2018-09-21 09:35:27 |
File | Lines added | Lines deleted |
---|---|---|
source/entities/ornament.d | 1 | 2 |
source/entities/shape/decorator.d | 31 | 4 |
source/entities/shape/shape.d | 2 | 13 |
source/entities/shape/shapeornament.d | 0 | 8 |
File source/entities/ornament.d changed (mode: 100644) (index 653e37d..040c90b) | |||
... | ... | class Ornament : Entity { | |
31 | 31 | } | } |
32 | 32 | ||
33 | 33 | private void calcBounds() { | private void calcBounds() { |
34 | int[2] pos = shape.position; | ||
35 | double[2][2] bounds = shape.calcBounds(pos[0], pos[1]); | ||
34 | double[2][2] bounds = shape.bounds; | ||
36 | 35 | ||
37 | 36 | final switch(position) { | final switch(position) { |
38 | 37 | case "Top": | case "Top": |
File source/entities/shape/decorator.d changed (mode: 100644) (index 8c1b989..b813a0d) | |||
... | ... | module dp.dec.shape; | |
2 | 2 | ||
3 | 3 | import dp.ent.shape; | import dp.ent.shape; |
4 | 4 | import dp.visitor.visitor; | import dp.visitor.visitor; |
5 | import cairo.Context; | ||
5 | 6 | ||
6 | 7 | abstract class Decorator : Shape { | abstract class Decorator : Shape { |
7 | 8 | protected Shape s; | protected Shape s; |
... | ... | abstract class Decorator : Shape { | |
36 | 37 | return s.sizeY; | return s.sizeY; |
37 | 38 | } | } |
38 | 39 | ||
40 | @property | ||
41 | public override Context context() { | ||
42 | return s.context; | ||
43 | } | ||
44 | |||
45 | @property | ||
46 | public override Context context(Context c) { | ||
47 | return s.context = c; | ||
48 | } | ||
49 | |||
50 | @property | ||
51 | public override double size() { | ||
52 | return s.size; | ||
53 | } | ||
54 | |||
55 | @property | ||
56 | public override double size(double s) { | ||
57 | return this.s.size = s; | ||
58 | } | ||
59 | |||
60 | @property | ||
61 | public override double[2][2] bounds() { | ||
62 | return s.bounds; | ||
63 | } | ||
64 | |||
65 | @property | ||
66 | public override double[2][2] bounds(double[2] pos) { | ||
67 | return s.bounds = pos; | ||
68 | } | ||
69 | |||
39 | 70 | public override void accept(Visitor v) { | public override void accept(Visitor v) { |
40 | 71 | s.accept(v); | s.accept(v); |
41 | 72 | } | } |
... | ... | abstract class Decorator : Shape { | |
47 | 78 | public override void render() { | public override void render() { |
48 | 79 | s.render(); | s.render(); |
49 | 80 | } | } |
50 | |||
51 | public override double[2][2] calcBounds(int x, int y) { | ||
52 | return s.calcBounds(x,y); | ||
53 | } | ||
54 | 81 | } | } |
File source/entities/shape/shape.d changed (mode: 100644) (index 40e5f21..fa08cb9) | |||
... | ... | class Shape : Entity { | |
84 | 84 | c.fill(); | c.fill(); |
85 | 85 | } | } |
86 | 86 | } | } |
87 | // ----------------- NEW STUFF | ||
87 | |||
88 | 88 | @property | @property |
89 | 89 | public Context context() { | public Context context() { |
90 | 90 | return c; | return c; |
... | ... | class Shape : Entity { | |
107 | 107 | ||
108 | 108 | @property | @property |
109 | 109 | public double[2][2] bounds() { | public double[2][2] bounds() { |
110 | return calcBounds(position[0], position[1]); | ||
110 | return b; | ||
111 | 111 | } | } |
112 | 112 | ||
113 | 113 | @property | @property |
... | ... | class Shape : Entity { | |
121 | 121 | ||
122 | 122 | return b = result; | return b = result; |
123 | 123 | } | } |
124 | |||
125 | public double[2][2] calcBounds(int x, int y) { | ||
126 | double[2][2] result; | ||
127 | |||
128 | result[0][0] = x - sizeX; // minX | ||
129 | result[1][0] = x + sizeX; // maxX | ||
130 | result[0][1] = y - sizeY; // minY | ||
131 | result[1][1] = y + sizeY; // maxY | ||
132 | |||
133 | return result; | ||
134 | } | ||
135 | 124 | } | } |
File source/entities/shape/shapeornament.d changed (mode: 100644) (index 08bdc94..93e4b8f) | |||
... | ... | class ShapeOrnament : Decorator { | |
37 | 37 | if(o !is null) | if(o !is null) |
38 | 38 | o.render(); | o.render(); |
39 | 39 | } | } |
40 | /+ | ||
41 | public override void move(int x, int y) { | ||
42 | s.move(x,y); | ||
43 | } | ||
44 | 40 | ||
45 | public override void resize(int amount) { | ||
46 | s.resize(amount); | ||
47 | } | ||
48 | +/ | ||
49 | 41 | public void setOrnament(Ornament ornament) { | public void setOrnament(Ornament ornament) { |
50 | 42 | o = ornament; | o = ornament; |
51 | 43 | } | } |