Advertisement
BigBlow_

Untitled

Nov 11th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. -- Initialisation du moniteur
  2. local mon = peripheral.wrap("top")
  3. mon.setBackgroundColor(colors.black)
  4. mon.clear()
  5.  
  6. -- Détection de la taille du moniteur
  7. local monWidth, monHeight = mon.getSize()
  8. local centerX, centerY = math.floor(monWidth / 2), math.floor(monHeight / 2)
  9.  
  10. -- Fonction pour dessiner un disque rempli centré
  11. local function drawFilledCircle(x, y, radius, color)
  12. mon.setBackgroundColor(color)
  13. for i = -radius, radius do
  14. for j = -radius, radius do
  15. if i * i + j * j <= radius * radius then
  16. local drawX, drawY = x + i, y + j
  17. if drawX >= 1 and drawX <= monWidth and drawY >= 1 and drawY <= monHeight then
  18. mon.setCursorPos(drawX, drawY)
  19. mon.write(" ")
  20. end
  21. end
  22. end
  23. end
  24. end
  25.  
  26. -- Fonction pour dessiner le logo nucléaire
  27. local function drawNuclearSymbol()
  28. -- Couleurs
  29. local yellow = colors.yellow
  30. local black = colors.black
  31.  
  32. -- Taille ajustée en fonction de la hauteur du moniteur pour occuper plus de surface
  33. local outerRadius = math.floor(monHeight / 2) - 1
  34.  
  35. -- Fond jaune circulaire pour le logo
  36. drawFilledCircle(centerX, centerY, outerRadius, yellow)
  37.  
  38. -- Sections noires pour les "pales" du symbole nucléaire
  39. mon.setBackgroundColor(black)
  40.  
  41. -- Section 1 (haut)
  42. for i = 0, outerRadius - 1 do
  43. mon.setCursorPos(centerX, centerY - i)
  44. mon.write(" ")
  45. end
  46.  
  47. -- Section 2 (bas gauche)
  48. for i = 0, outerRadius - 1 do
  49. mon.setCursorPos(centerX - i, centerY + i)
  50. mon.write(" ")
  51. mon.setCursorPos(centerX - i, centerY + i + 1)
  52. mon.write(" ")
  53. end
  54.  
  55. -- Section 3 (bas droite)
  56. for i = 0, outerRadius - 1 do
  57. mon.setCursorPos(centerX + i, centerY + i)
  58. mon.write(" ")
  59. mon.setCursorPos(centerX + i, centerY + i + 1)
  60. mon.write(" ")
  61. end
  62.  
  63. -- Petit cercle noir au centre
  64. drawFilledCircle(centerX, centerY, math.floor(outerRadius / 3), black)
  65. end
  66.  
  67. -- Effacer l'écran et dessiner le logo
  68. mon.clear()
  69. drawNuclearSymbol()
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement