Files

53 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# EPaints.js — main() (satır 39)
[← EPaints.js](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](main-2.md)
```javascript
function main(c)
{
var states = c.getSubject().getStates();
states.setString("mod", "kalem");
states.setString("renk", "4278190080");
states.setString("size", "m");
states.setNumber("lastX", -1);
states.setNumber("lastY", -1);
var ui = mappet.createUI(c, "EPaint").background();
// Status Bar
var status = ui.graphics().id("status");
status.rx(0.5, -CW/2).ry(0.5, -CH/2 - TOP_H - TOOL_H - GAP).wh(CW, TOP_H);
// Tools Bar
var tools = ui.graphics().id("tools");
tools.rx(0.5, -CW/2).ry(0.5, -CH/2 - TOOL_H).wh(CW, TOOL_H);
tools.rect(0, 0, CW, TOOL_H, PANEL_HI);
tools.rect(0, TOOL_H-1, CW, 1, LINE);
// Canvas
var canvas = ui.graphics().id("canvas");
canvas.rxy(0.5, 0.5).wh(CW, CH).anchor(0.5);
canvas.rect(0, 0, CW, CH, BG);
// Ana Click Alanı (canvas + renk paleti)
var click = ui.click().id("click");
click.rxy(0.5, 0.5).wh(CW, CH + PAL_H + 50).anchor(0.5).updateDelay(0);
// Butonlar
var ty = -CH/2 - TOOL_H + 4;
ui.icon("edit").id("kalem").rx(0.5, -CW/2 + 10).ry(0.5, ty).wh(26, 26);
ui.icon("remove").id("silgi").rx(0.5, -CW/2 + 42).ry(0.5, ty).wh(26, 26);
ui.icon("refresh").id("temizle").rx(0.5, -CW/2 + 74).ry(0.5, ty).wh(26, 26);
// Size Butonları
ui.button("S").id("size_s").rx(0.5, -CW/2 + 130).ry(0.5, ty).wh(28, 26);
ui.button("M").id("size_m").rx(0.5, -CW/2 + 162).ry(0.5, ty).wh(28, 26);
ui.button("L").id("size_l").rx(0.5, -CW/2 + 194).ry(0.5, ty).wh(28, 26);
ui.button("XL").id("size_x").rx(0.5, -CW/2 + 228).ry(0.5, ty).wh(32, 26);
// Close
ui.icon("close").id("kapat").rx(0.5, CW/2 - 30).ry(0.5, ty).wh(26, 26);
```