Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialisation du moniteur
- local mon = peripheral.wrap("top")
- mon.setBackgroundColor(colors.black)
- mon.clear()
- -- Détection de la taille du moniteur
- local monWidth, monHeight = mon.getSize()
- local centerX, centerY = math.floor(monWidth / 2), math.floor(monHeight / 2)
- -- Fonction pour dessiner un disque rempli centré
- local function drawFilledCircle(x, y, radius, color)
- mon.setBackgroundColor(color)
- for i = -radius, radius do
- for j = -radius, radius do
- if i * i + j * j <= radius * radius then
- local drawX, drawY = x + i, y + j
- if drawX >= 1 and drawX <= monWidth and drawY >= 1 and drawY <= monHeight then
- mon.setCursorPos(drawX, drawY)
- mon.write(" ")
- end
- end
- end
- end
- end
- -- Fonction pour dessiner le logo nucléaire
- local function drawNuclearSymbol()
- -- Couleurs
- local yellow = colors.yellow
- local black = colors.black
- -- Taille ajustée en fonction de la hauteur du moniteur pour occuper plus de surface
- local outerRadius = math.floor(monHeight / 2) - 1
- -- Fond jaune circulaire pour le logo
- drawFilledCircle(centerX, centerY, outerRadius, yellow)
- -- Sections noires pour les "pales" du symbole nucléaire
- mon.setBackgroundColor(black)
- -- Section 1 (haut)
- for i = 0, outerRadius - 1 do
- mon.setCursorPos(centerX, centerY - i)
- mon.write(" ")
- end
- -- Section 2 (bas gauche)
- for i = 0, outerRadius - 1 do
- mon.setCursorPos(centerX - i, centerY + i)
- mon.write(" ")
- mon.setCursorPos(centerX - i, centerY + i + 1)
- mon.write(" ")
- end
- -- Section 3 (bas droite)
- for i = 0, outerRadius - 1 do
- mon.setCursorPos(centerX + i, centerY + i)
- mon.write(" ")
- mon.setCursorPos(centerX + i, centerY + i + 1)
- mon.write(" ")
- end
- -- Petit cercle noir au centre
- drawFilledCircle(centerX, centerY, math.floor(outerRadius / 3), black)
- end
- -- Effacer l'écran et dessiner le logo
- mon.clear()
- drawNuclearSymbol()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement