30 lines
1.0 KiB
Markdown
30 lines
1.0 KiB
Markdown
# Mayintarlasi.js — drawStatus() (satır 193)
|
||
|
||
[← Mayintarlasi.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function drawStatus(uiContext, states, grid) {
|
||
var bar = uiContext.get("statusBar");
|
||
bar.removeAll();
|
||
bar.rect(0, 0, CW, TOP_H, PANEL);
|
||
bar.rect(0, TOP_H - 1, CW, 1, LINE);
|
||
|
||
var gameState = states.getString("state"); // play, dead, win
|
||
var flagMode = states.getString("flagMode");
|
||
var flags = countFlags(grid);
|
||
|
||
bar.text("Minesweeper", 8, 7, TEXT, 0.0, 0.0);
|
||
|
||
var mineInfo = "Mines: " + MINES + " Flags: " + flags;
|
||
if (gameState === "dead") mineInfo = "BOOM! Game Over";
|
||
else if (gameState === "win") mineInfo = "YOU WIN!";
|
||
bar.text(mineInfo, CW / 2, 7, gameState === "win" ? CELL_WIN : (gameState === "dead" ? CELL_MINE : TEXT_DIM), 0.5, 0.0);
|
||
|
||
// Bayrak modu göstergesi
|
||
if (flagMode === "on") {
|
||
bar.rect(CW - 40, 4, 34, 16, CELL_FLAG);
|
||
bar.text("FLAG", CW - 23, 7, PANEL, 0.5, 0.0);
|
||
}
|
||
}
|
||
```
|