Nuée d'oiseaux

Programmation d'applications complexes
Avatar de l’utilisateur
SPH
Messages : 4942
Inscription : mer. 09/nov./2005 9:53

Nuée d'oiseaux

Message par SPH »

Salut,

Voici en OpenGL un code qui montre une nuée d'oiseaux comme on en vois parfois dans le ciel. Ils volent mais essaient de rester groupé.
Enjoy : :wink:

Code : Tout sélectionner

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flock of birds ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; SPH 2022 - PB6.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;-CONSTANTS
Enumeration
  #MainWindow
  #OpenGLGadget
EndEnumeration

;These two GL constants are used for texture creation. Don't change their values.
#GL_BGR = $80E0
#GL_BGRA = $80E1

If ExamineDesktops()
  ddw=DesktopWidth(0)
  ddh=DesktopHeight(0)
Else
  ddw=1024
  ddh=768
EndIf

;-********************* DPI *********************
dpix.f=DesktopResolutionX()
dpiy.f=DesktopResolutionY()

ech_xf.f=(1920/ddw);*DesktopResolutionX()
ech_yf.f=(1080/ddh);*DesktopResolutionY()
;**********************************************


;-STRUCTURES
Structure Integer2
  X.i
  Y.i
EndStructure
Global.Integer2 WindowDim
WindowDim\X = ddw
WindowDim\Y = ddh


;-DEFINES
Define.i Event
Define.i WindowFlags = #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget


;-DECLARES
Declare Render()
Declare Render2DQuad(OGLTexture.i, StartX.d, StartY.d, Width.i, Height.i, Z.d)
Declare SetupOpenGL()
Declare SetupGLTexture(ImageHandle.i)


;-MAIN WINDOW
win=OpenWindow(#MainWindow, 0, 0,ddw,ddh, "Flock of birds",#PB_Window_Maximize|#PB_Window_BorderLess)
If win=0
  ;  Beep_(500,250) : Delay(150) : Beep_(500,250)
  MessageRequester("Erreur","OpenWindow() impossible")
  End
EndIf

screenGL=OpenGLGadget(#OpenGLGadget,0,0,ddw,ddh)
If screenGL=0
  ;  Beep_(500,250) : Delay(150) : Beep_(500,250)
  MessageRequester("Erreur","OpenGLGadget() impossible")
  End
EndIf


SetupOpenGL()

AddKeyboardShortcut(0,  #PB_Shortcut_Escape, 666) ; quitter


glOrtho_(0,ddw,ddh,0,-1,1)
glMatrixMode_(#GL_MODELVIEW)
glLoadIdentity_()
glClear_(0)

;;;;;;;;;;;
timer=ElapsedMilliseconds()

glClearColor_(0.6,0.6,1,0.8)
;ShowCursor_(0)
;- **********************************************
;- **********************************************
;- **********************************************
;- **********************************************

nb=1000

Dim couleur.f(nb)
Dim sph_x1.f(nb)
Dim sph_y1.f(nb)
Dim sph_x2.f(nb)
Dim sph_y2.f(nb)
Dim sph_xx2.f(nb)
Dim sph_yy2.f(nb)

Dim sph_rx.f(nb)

Dim sph_x3.f(nb)
Dim sph_y3.f(nb)

group.f=3
xx3.f=(100+Random(900))/100000
yy3.f=(100+Random(900))/100000

;;
For i=0 To nb
  
  sph_x1.f(i)=0.001+Random(100000)/1000000
  sph_y1.f(i)=0.001+Random(100000)/1000000
  sph_x2.f(i)=0.001+Random(100000)/1000000
  sph_y2.f(i)=0.001+Random(100000)/1000000
  
  sph_x3.f(i)=0.001+Random(100000)/1000000
  sph_y3.f(i)=0.001+Random(100000)/1000000
  
  sph_rx.f(i)=0.005+Random(100)/20000
  couleur(i)=Random(Random(255))/255
Next


;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#################**********************************************
;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#################**********************************************
;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;##  D E B U T  ##**********************************************
;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#################**********************************************
;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;#################**********************************************

Repeat
  
  For i=0 To nb
    
    ddw21=Sin(sph_x1(i)+sph_x2(i))*ddw/5
    ddh21=Cos(sph_y1(i)+sph_y2(i))*ddh/5
    ddw22=ddw/5-ddw21
    ddh22=ddh/5-ddh21
    
    sph_xx=Cos(sph_x1(i))*ddw21
    sph_yy=Sin(sph_y1(i))*ddh21
    sph_xx+Cos(sph_x2(i)+sph_x3(i))*ddw22;+Cos(sph_x3(i))*120
    sph_yy+Cos(sph_y2(i)+sph_y3(i))*ddh22;+Sin(sph_y3(i))*120
    
    sph_xx2(i)+(sph_xx-sph_xx2(i))/(i/group)
    sph_yy2(i)+(sph_yy-sph_yy2(i))/(i/group)
    
    ;===========
    
    sph_x1(i)+sph_rx(i)
    sph_y1(i)+sph_rx(i)
    
    sph_x3(i)+xx3
    sph_y3(i)+yy3
  Next
  
  
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
  
  
  ;*****
  Repeat
    Event = WindowEvent()
    
    Select Event
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 1
            Resx = GetGadgetAttribute(1, #PB_OpenGL_MouseX)
            Resy = GetGadgetAttribute(1, #PB_OpenGL_MouseY)
            ;;;;;;;         
            Select EventType()
                ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;             
            EndSelect
        EndSelect
      Case #PB_Event_Menu
        Select EventMenu()
          Case 666
            timer=ElapsedMilliseconds()-timer
            ;MessageRequester("Timer", Str(timer)+" ms - "+Str(scene)+" frames",2)
            ;           Debug scene
            ;           Debug timer
            ;ShowCursor_(1)
            End
        EndSelect
    EndSelect
    
  Until Event = 0
  
  
  ;##############################################
  ;##############################################
  ;############    polygones :   ################
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.05)
  glVertex2f_(0/ech_xf/dpix,200/ech_yf/dpiy)
  glVertex2f_(0/ech_xf/dpix,400/ech_yf/dpiy)
  glVertex2f_(300/ech_xf/dpix,450/ech_yf/dpiy)
  glVertex2f_(700/ech_xf/dpix,400/ech_yf/dpiy)
  glVertex2f_(720/ech_xf/dpix,350/ech_yf/dpiy)
  glVertex2f_(680/ech_xf/dpix,250/ech_yf/dpiy)
  glVertex2f_(300/ech_xf/dpix,180/ech_yf/dpiy)
  glEnd_()
  
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.05)
  glVertex2f_(350/ech_xf/dpix,300/ech_yf/dpiy)
  glVertex2f_(320/ech_xf/dpix,400/ech_yf/dpiy)
  glVertex2f_(360/ech_xf/dpix,500/ech_yf/dpiy)
  glVertex2f_(900/ech_xf/dpix,550/ech_yf/dpiy)
  glVertex2f_(1200/ech_xf/dpix,500/ech_yf/dpiy)
  glVertex2f_(1220/ech_xf/dpix,450/ech_yf/dpiy)
  glVertex2f_(1180/ech_xf/dpix,350/ech_yf/dpiy)
  glVertex2f_(800/ech_xf/dpix,280/ech_yf/dpiy)
  glEnd_()
  
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.05)
  glVertex2f_(1150/ech_xf/dpix,800/ech_yf/dpiy)
  glVertex2f_(1100/ech_xf/dpix,900/ech_yf/dpiy)
  glVertex2f_(1160/ech_xf/dpix,1000/ech_yf/dpiy)
  glVertex2f_(2000/ech_xf/dpix,1050/ech_yf/dpiy)
  glVertex2f_(2700/ech_xf/dpix,1000/ech_yf/dpiy)
  glVertex2f_(2720/ech_xf/dpix,950/ech_yf/dpiy)
  glVertex2f_(2480/ech_xf/dpix,850/ech_yf/dpiy)
  glVertex2f_(2100/ech_xf/dpix,780/ech_yf/dpiy)
  glEnd_()
  
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.04)
  glVertex2f_(800/ech_xf/dpix,500/ech_yf/dpiy)
  glVertex2f_(750/ech_xf/dpix,600/ech_yf/dpiy)
  glVertex2f_(805/ech_xf/dpix,800/ech_yf/dpiy)
  glVertex2f_(1800/ech_xf/dpix,850/ech_yf/dpiy)
  glVertex2f_(2400/ech_xf/dpix,800/ech_yf/dpiy)
  glVertex2f_(2490/ech_xf/dpix,650/ech_yf/dpiy)
  glVertex2f_(2380/ech_xf/dpix,550/ech_yf/dpiy)
  glVertex2f_(1550/ech_xf/dpix,440/ech_yf/dpiy)
  glEnd_()
  
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.05)
  glVertex2f_(1400/ech_xf/dpix,0/ech_yf/dpiy)
  glVertex2f_(1300/ech_xf/dpix,75/ech_yf/dpiy)
  glVertex2f_(1420/ech_xf/dpix,150/ech_yf/dpiy)
  glVertex2f_(1800/ech_xf/dpix,168/ech_yf/dpiy)
  glVertex2f_(2400/ech_xf/dpix,150/ech_yf/dpiy)
  glVertex2f_(2490/ech_xf/dpix,0/ech_yf/dpiy)
  glEnd_()
  
  glBegin_(#GL_POLYGON)
  glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
  glColor4f_(1,1,1,0.05)
  glVertex2f_(0/ech_xf/dpix,800/ech_yf/dpiy)
  glVertex2f_(0/ech_xf/dpix,1200/ech_yf/dpiy)
  glVertex2f_(420/ech_xf/dpix,1000/ech_yf/dpiy)
  glVertex2f_(600/ech_xf/dpix,868/ech_yf/dpiy)
  glVertex2f_(580/ech_xf/dpix,750/ech_yf/dpiy)
  glVertex2f_(50/ech_xf/dpix,800/ech_yf/dpiy)
  glEnd_()
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;  glVertex2f_(1150*ech_xf,800*ech_yf)
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  If 1=0
    glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
    glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
    glColor4f_(1,0,0,0.3)
    glVertex2f_(0,0)
    glVertex2f_(ddw/dpix,ddh/dpiy)
    glEnd_()
    glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
    glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
    glColor4f_(0,0,0,0.3)
    glVertex2f_(0,ddh/dpiy)
    glVertex2f_(ddw/dpix,0)
    glEnd_()
    
    ;-polyline      
    glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
    glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
    glColor4f_(0,0,0,1)
    glVertex2f_((ddw/2)/dpix-5,(ddh/2)/dpiy);*ech_yf)
    glVertex2f_((ddw/2)/dpix+5,(ddh/2)/dpiy);*ech_yf)
    glEnd_()
  EndIf
  ;=====
  ;=====
  ;=====
  For i=0 To nb
    If Random(3)>0
      rand=Random(1)*2
      glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
      glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
      glColor4f_(couleur(i),couleur(i),couleur(i),0.6)
      glVertex2f_(((ddw/2)/dpix+sph_xx2(i))-rand,((ddh/2)/dpiy+sph_yy2(i)))
      glVertex2f_(((ddw/2)/dpix+sph_xx2(i))+4+rand,((ddh/2)/dpiy+sph_yy2(i)))
      glEnd_()
    Else
      rand2=Random(1)*2-1
      glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
      glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
      glColor4f_(couleur(i),couleur(i),couleur(i),0.6)
      glVertex2f_((ddw/2)/dpix+sph_xx2(i)-1,(ddh/2)/dpiy+sph_yy2(i)+rand2)
      glVertex2f_((ddw/2)/dpix+sph_xx2(i)+2,(ddh/2)/dpiy+sph_yy2(i))
      glEnd_()
      glBegin_(#GL_LINES);glBegin_(#GL_POLYGON)
      glBlendFunc_(#GL_SRC_ALPHA,#GL_ONE_MINUS_SRC_ALPHA)
      glColor4f_(couleur(i),couleur(i),couleur(i),0.6)
      glVertex2f_((ddw/2)/dpix+sph_xx2(i)+2,(ddh/2)/dpiy+sph_yy2(i))
      glVertex2f_((ddw/2)/dpix+sph_xx2(i)+5,(ddh/2)/dpiy+sph_yy2(i)+rand2)
      glEnd_()
    EndIf
    
    
  Next
  
  SetGadgetAttribute(#OpenGLGadget, #PB_OpenGL_FlipBuffers, #True)
  
ForEver


Procedure Render()
  
  ;Clearing buffers and resetting clear color to remove old graphics from the last frame.
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
  ;  glClearColor_(0.2, 0.2, 0.2, 1.0)
  glClearColor_(0,0,0,1)
  
  ;## DRAWING TEXTURES/IMAGES
  ;First enable the Texture system.
  glEnable_(#GL_TEXTURE_2D)
  
  ;This procedure will create a quad and apply a texture to it.
  ;The Texture variable contains the texture created earlier using SetupGLTexture().
  Render2DQuad(Texture1, 0, 0, ImageWidth(Image1), ImageHeight(Image1), -2)
  ; Render2DQuad(Texture2, 0, 0, ImageWidth(Image2), ImageHeight(Image2), -1)
  
  ;After all the textures have been displayed disable the texture system.
  ;Otherwise it will conflict with the non texture graphics.
  glDisable_(#GL_TEXTURE_2D)
  
EndProcedure

Procedure Render2DQuad(OGLTexture.i, StartX.d, StartY.d, Width.i, Height.i, Z.d)
  
  ;The texture is first bound which tells OpenGL to use this texture for any future rendering.
  glBindTexture_(#GL_TEXTURE_2D, OGLTexture)
  glBegin_(#GL_QUADS)
  glColor4f_   (1,1,1,1)
  glNormal3f_  (0,0,1.0)
  glTexCoord2f_(1.0,1.0)
  glVertex3f_  (StartX+Width,StartY,Z)
  glTexCoord2f_(0.0,1.0)
  glVertex3f_  (StartX,StartY,Z)
  glTexCoord2f_(0.0,0.0)
  glVertex3f_  (StartX,StartY+Height,Z)
  glTexCoord2f_(1.0,0.0)
  glVertex3f_  (StartX+Width,StartY+Height,Z)
  glEnd_()
  
EndProcedure

Procedure SetupOpenGL()
  
  glMatrixMode_(#GL_PROJECTION)
  
  glOrtho_(0.0, WindowDim\X, WindowDim\Y, 0.0, -1000.0, 1000.0)
  
  glMatrixMode_(#GL_MODELVIEW)
  
  ; glEnable_(#GL_DEPTH_TEST)
  
  glEnable_(#GL_BLEND)
  glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA)
  
EndProcedure


Dernière modification par SPH le lun. 01/août/2022 11:51, modifié 7 fois.

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
Ar-S
Messages : 9539
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Nuée d'oiseaux

Message par Ar-S »

C'est pas mal du tout. Entre poissons et oiseaux effectivement.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Avatar de l’utilisateur
SPH
Messages : 4942
Inscription : mer. 09/nov./2005 9:53

Re: Nuée d'oiseaux

Message par SPH »

LOL, j'ai jamais vu des poissons se déplacer comme ça 😄

Bon, je suis ravis. Ce petit code m'a redonné le moral ! 😎
Je m'adresse a ceux qui sont en 4K : votre DPI est de combien ? 200% ? +?

Merci pour vos encouragements... :wink:
Dernière modification par SPH le ven. 29/juil./2022 17:37, modifié 3 fois.

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
Ar-S
Messages : 9539
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Nuée d'oiseaux

Message par Ar-S »

~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Avatar de l’utilisateur
threedslider
Messages : 452
Inscription : dim. 01/juil./2018 22:38

Re: Nuée d'oiseaux

Message par threedslider »

Cool comme effet de particules, j'aime bien ce mouvement 8O

Et merci pour le code, ça va me servir ^^
Avatar de l’utilisateur
GallyHC
Messages : 1708
Inscription : lun. 17/déc./2007 12:44

Re: Nuée d'oiseaux

Message par GallyHC »

Bonjour,

Vraiment sympa, j'aime beaucoup.

Cordialement,
GallyHC
Configuration : Tower: Windows 10 (Processeur: i7 "x64") (Mémoire: 16Go) (GeForce GTX 760 - 2Go) - PureBasic 5.72 (x86 et x64)
Avatar de l’utilisateur
falsam
Messages : 7323
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: Nuée d'oiseaux

Message par falsam »

WhaouuUUUUUuu j'aime beaucoup SPH et en plus tu utilises les procédures (Lui seul comprendra).
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Avatar de l’utilisateur
SPH
Messages : 4942
Inscription : mer. 09/nov./2005 9:53

Re: Nuée d'oiseaux

Message par SPH »

falsam a écrit : mar. 19/juil./2022 10:56 ... en plus tu utilises les procédures
Il s'agit de tes procedures. A l'époque (il y a 3 ans env), on avait discuté d'OpenGL et tu m'avais pondu un truc de base.

... Et voilà ce que j'en fait... Des zozio volants 😋

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
SPH
Messages : 4942
Inscription : mer. 09/nov./2005 9:53

Re: Nuée d'oiseaux

Message par SPH »

Salut,
J'ai modifié mon code. Il est plus beau et plus court.
Le DPI fonctionne enfin !!
J'attends vos retours...

Ha oui, est ce que vous pensez qu'il y a des situation où le ExamineDesktops() ne fonctionne pas ?
Dans ce code :

Code : Tout sélectionner

If ExamineDesktops()
  ddw=DesktopWidth(0)
  ddh=DesktopHeight(0)
Else
  ddw=1024
  ddh=768
EndIf
Que pourrais je mettre a la place de 1024 / 768 ?
Existe il une instruction qui trouve la plus grosse résolution ?

On m'a répondu sur le forum US ceci :

Code : Tout sélectionner

InitSprite()

If ExamineScreenModes()
     While NextScreenMode()
          Debug Str(ScreenModeWidth())+"x"+Str(ScreenModeHeight())+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
     Wend
EndIf
Thx

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Intel Core i7 4770 64 bits - GTX 650 Ti
Version de PB : 6.12LTS- 64 bits
Avatar de l’utilisateur
Kwai chang caine
Messages : 6989
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Re: Nuée d'oiseaux

Message par Kwai chang caine »

C'est chouette et élégant :wink:
Merci du partage 8)
ImageLe bonheur est une route...
Pas une destination

PureBasic Forum Officiel - Site PureBasic
Répondre