Libraryless. Click here for Pure Java version (5827L/32K).
| 1 | sclass BackgroundPlus<A extends Renderable> is RenderableWithHints {
 | 
| 2 | RGB background; | 
| 3 | new L<A> things; | 
| 4 | |
| 5 | settable Pt preferredSize = new(640, 480); | 
| 6 | |
| 7 |   selfType preferredSize(int w, int h) { ret preferredSize(pt(w, h)); }
 | 
| 8 | |
| 9 |   *() {}
 | 
| 10 |   *(RGB *background, A... things) { this.things = asList(things); }
 | 
| 11 |   *(RGB *background, L<A> *things) {}
 | 
| 12 |   *(Color background, A... things) { this.background = RGB(background); this.things = asList(things); }
 | 
| 13 |   *(Color background, L<A> *things) { this.background = RGB(background); }
 | 
| 14 |   *(int w, int h, Color background, A... things) {
 | 
| 15 | this(background, things); | 
| 16 | preferredSize(w, h); | 
| 17 | } | 
| 18 | |
| 19 |   public void renderOn(Graphics2D g, int w, int h) {
 | 
| 20 | fillRect(g, 0, 0, w, h, toColor(background)); | 
| 21 | for (A a : things) | 
| 22 | a/Renderable.renderOn(g, w, h); | 
| 23 | } | 
| 24 | |
| 25 |   public void renderHints(Graphics2D g, int w, int h) {
 | 
| 26 | renderOn(g, w, h); | 
| 27 | for (A a : things) | 
| 28 | if (a instanceof RenderableWithHints) | 
| 29 | a/RenderableWithHints.renderHints(g, w, h); | 
| 30 | } | 
| 31 | } | 
Began life as a copy of #1014950
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1014966 | 
| Snippet name: | BackgroundPlus | 
| Eternal ID of this version: | #1014966/7 | 
| Text MD5: | 68e985ffd78af471065d53a41adcb853 | 
| Transpilation MD5: | 30121cdd43c10102bace0f14114260ba | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2022-02-05 02:55:23 | 
| Source code size: | 1043 bytes / 31 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 723 / 1454 | 
| Version history: | 6 change(s) | 
| Referenced in: | [show references] |