SPH Forum
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Le Deal du moment : -39%
Ordinateur portable ASUS Chromebook Vibe CX34 Flip
Voir le deal
399 €

screen open

Aller en bas

screen open Empty screen open

Message par Admin Lun 6 Mai - 7:45

Code:
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  MessageRequester("Erreur", "Impossible d'initialiser l'écran.")
  End
EndIf

ExamineDesktops()
xxx=DesktopWidth(0)
yyy=DesktopHeight(0)

;Ouverture de l'écran
If OpenScreen(xxx,yyy,32,"Exemple OpenScreen") = 0
  MessageRequester("Erreur", "Impossible d'ouvrir l'écran.")
  End
EndIf

Dim stars_x1(100)
Dim stars_y1(100)
For i=0 To 100
  stars_x1(i)=Random(xxx-1)
  stars_y1(i)=Random(yyy-1)
Next
Dim stars_x2(80)
Dim stars_y2(80)
For i=0 To 80
  stars_x2(i)=Random(xxx-1)
  stars_y2(i)=Random(yyy-1)
Next
Dim stars_x3(60)
Dim stars_y3(60)
For i=0 To 60
  stars_x3(i)=Random(xxx-1)
  stars_y3(i)=Random(yyy-1)
Next
Dim stars_x4(40)
Dim stars_y4(40)
For i=0 To 40
  stars_x4(i)=Random(xxx-1)
  stars_y4(i)=Random(yyy-1)
Next
Dim stars_x5(20)
Dim stars_y5(20)
For i=0 To 20
  stars_x5(i)=Random(xxx-1)
  stars_y5(i)=Random(yyy-1)
Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Boucle principale
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
timer=ElapsedMilliseconds()

Repeat
  
  ;Effacer complètement l'écran et afficher un fond gris
  ClearScreen(0)
  
  ;On lit les évènements clavier et souris
  ExamineKeyboard()
  
  StartDrawing(ScreenOutput())
  For i=0 To 100
    stars_x1(i)+1
    If stars_x1(i)>xxx-1
      stars_x1(i)-xxx
      stars_y1(i)=Random(yyy-1)
    EndIf
    Plot(stars_x1(i),stars_y1(i),RGB(80,80,80))
  Next
  For i=0 To 80
    stars_x2(i)+2
    If stars_x2(i)>xxx-1
      stars_x2(i)-xxx
      stars_y2(i)=Random(yyy-1)
    EndIf
    Plot(stars_x2(i),stars_y2(i),RGB(120,120,120))
  Next
  For i=0 To 60
    stars_x3(i)+3
    If stars_x3(i)>xxx-1
      stars_x3(i)-xxx
      stars_y3(i)=Random(yyy-1)
    EndIf
    Plot(stars_x3(i),stars_y3(i),RGB(160,160,160))
  Next
  For i=0 To 40
    stars_x4(i)+4
    If stars_x4(i)>xxx-1
      stars_x4(i)-xxx
      stars_y4(i)=Random(yyy-1)
    EndIf
    Plot(stars_x4(i),stars_y4(i),RGB(200,200,200))
  Next
  For i=0 To 20
    stars_x5(i)+5
    If stars_x5(i)>xxx-1
      stars_x5(i)-xxx
      stars_y5(i)=Random(yyy-1)
    EndIf
    Plot(stars_x5(i),stars_y5(i),RGB(240,240,240))
  Next  

  StopDrawing()
  
  FlipBuffers()
  
Until KeyboardPushed(#PB_Key_Escape) ;On quitte

Admin
Admin

Messages : 66
Date d'inscription : 04/09/2015

https://sphforum.kanak.fr

Revenir en haut Aller en bas

Revenir en haut


 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum