45 lines
1.3 KiB
Markdown
45 lines
1.3 KiB
Markdown
# UIGraphicsComponent — giriş
|
|
|
|
[← UIGraphicsComponent](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 1/3 · [sonraki](_giris-2.md)
|
|
|
|
mchorse.mappet.api.ui.components
|
|
|
|
Class UIGraphicsComponent
|
|
java.lang.Object
|
|
|
|
mchorse.mappet.api.ui.components.UIComponent
|
|
mchorse.mappet.api.ui.components.UIGraphicsComponent
|
|
|
|
public class UIGraphicsComponent
|
|
extends UIComponent
|
|
|
|
Graphics UI component.
|
|
|
|
This component allows drawing solid colored rectangles, gradient rectangles, images loaded through Minecraft's texture manager, text and McLib icons. Think of it as a very primitive
|
|
canvas implementation.
|
|
|
|
This component can be created using IMappetUIBuilder.graphics() method.
|
|
|
|
function main(c)
|
|
{
|
|
var ui = mappet.createUI(c, "handler").background();
|
|
|
|
// Background rendering
|
|
var back = ui.graphics().rx(0.5, -150).ry(1, -250).wh(300, 250);
|
|
var icons = Java.type("mchorse.mclib.client.gui.utils.IconRegistry").icons.keySet();
|
|
|
|
back.shadow(80, 80, 300 - 160, 250 - 160, 0x88ff1493, 0x00ff1493, 80);
|
|
back.shadow(80, 80, 300 - 160, 250 - 160, 0x880088ff, 0x000088ff, 40);
|
|
|
|
for each (var icon in icons)
|
|
{
|
|
var x = Math.random() * 280 + 10;
|
|
var y = Math.random() * 230 + 10;
|
|
|
|
back.icon(icon, x - 1, y - 1, 0xff000000 + Math.random() * 0xffffff);
|
|
}
|
|
|
|
// Draw my favorite "me"
|