Files

44 lines
1.4 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.
# Mayintarlasi.js — main() (satır 235)
[← Mayintarlasi.js](index.md) · [← Master](../../wiki.md)
```javascript
function main(c) {
var states = c.getSubject().getStates();
var grid = newGrid();
states.setString("grid", gridToString(grid));
states.setString("state", "play");
states.setString("flagMode", "off");
var ui = mappet.createUI(c, "handler").background();
var totalH = TOP_H + GAP + CH + GAP + BOT_H;
// Status bar
var statusBar = ui.graphics().id("statusBar");
statusBar.rx(0.5, -CW / 2).ry(0.5, -CH / 2 - GAP - TOP_H).wh(CW, TOP_H);
// Board
var board = ui.graphics().id("board");
board.rxy(0.5, 0.5).wh(CW, CH).anchor(0.5);
// Click layer
var click = ui.click().id("click");
click.rxy(0.5, 0.5).wh(CW, CH).anchor(0.5).updateDelay(0);
// Controls
var controls = ui.graphics().id("controls");
controls.rx(0.5, -CW / 2).ry(0.5, CH / 2 + GAP).wh(CW, BOT_H);
// Butonlar
var btnY = CH / 2 + GAP + 4;
ui.button("⚑ Flag").id("toggleFlag").rx(0.5, -CW / 2 + 4).ry(0.5, btnY).wh(64, 20).tooltip("Toggle flag mode", 1);
ui.button("New").id("newGame").rx(0.5, CW / 2 - 72).ry(0.5, btnY).wh(40, 20).tooltip("New game", 1);
ui.icon("close").id("kapat").rx(0.5, CW / 2 - 26).ry(0.5, btnY).wh(20, 20).tooltip("Close", 1);
// İlk çizim
c.getSubject().openUI(ui);
}
```