Libraryless. Click here for Pure Java version (5827L/32K).
sclass BackgroundPlus<A extends Renderable> is RenderableWithHints {
RGB background;
new L<A> things;
settable Pt preferredSize = new(640, 480);
selfType preferredSize(int w, int h) { ret preferredSize(pt(w, h)); }
*() {}
*(RGB *background, A... things) { this.things = asList(things); }
*(RGB *background, L<A> *things) {}
*(Color background, A... things) { this.background = RGB(background); this.things = asList(things); }
*(Color background, L<A> *things) { this.background = RGB(background); }
*(int w, int h, Color background, A... things) {
this(background, things);
preferredSize(w, h);
}
public void renderOn(Graphics2D g, int w, int h) {
fillRect(g, 0, 0, w, h, toColor(background));
for (A a : things)
a/Renderable.renderOn(g, w, h);
}
public void renderHints(Graphics2D g, int w, int h) {
renderOn(g, w, h);
for (A a : things)
if (a instanceof RenderableWithHints)
a/RenderableWithHints.renderHints(g, w, h);
}
}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: | 957 / 2323 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |