La TNT pour certains, se sera ça

Partagez votre expérience de PureBasic avec les autres utilisateurs.
Avatar de l’utilisateur
falsam
Messages : 7324
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

La TNT pour certains, se sera ça

Message par falsam »

Code : Tout sélectionner

#filter=0.2       ; Filter parameter for the FPS-calculation
#UpdateFreq=100   ; How often to update the FPS-display
 
OpenWindow(0,400,300,320,240,"PureBasic")
Define w=WindowWidth(0), h=WindowHeight(0)
Define x, y, T, TOld, FloatingMedium.f, cnt
InitSprite()
OpenWindowedScreen(WindowID(0),0,0,w,h,1,0,0,#PB_Screen_NoSynchronization)
Repeat
  Event=WindowEvent()
  If Event=#PB_Event_CloseWindow
        End
  EndIf
  StartDrawing(ScreenOutput())
  For y=0 To h-1
    For x=0 To w-1
      If Random(1)
        Plot(x,y,#Black)
      Else
        Plot(x,y,#White)
      EndIf
    Next
  Next
  StopDrawing()
  FlipBuffers()
  cnt+1
  If cnt>=#UpdateFreq
    cnt =0
    TOld=T
    T=ElapsedMilliseconds()
    FloatingMedium*(1-#filter)+1000*#filter/(T-TOld)
    SetWindowTitle(0,"PureBasic: "+StrF(#UpdateFreq*FloatingMedium,2)+" FPS")
  EndIf
ForEver
Source : http://rosettacode.org/wiki/Image_noise#PureBasic
J'ai effectué une légère modification car le mode de sortie initiale étais pas génial.
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
Ar-S
Messages : 9540
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: La TNT pour certains, se sera ça

Message par Ar-S »

J'aime ! Image

64fps en 800x600
~~~~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
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: La TNT pour certains, se sera ça

Message par Backup »

pour info :

Code : Tout sélectionner

Define w=WindowWidth(0), h=WindowHeight(0)
Define x, y, T, TOld, FloatingMedium.f, cnt
Define ne sert pas a déclarer une variable , on est en basic, et dans ce language
on ne declare pas les variables

Define sert a déclarer un type , et dans ces 2 lignes , je n'en vois pas ! ;)

si tu ecris

Code : Tout sélectionner

define x, y, T, TOld
il te faut ecrire
define.l x, y, T, TOld
par exemple ;)

ça sert juste a éviter de préciser le type par la suite :)
mais a mon avis ça sert a rien, pour la lisibilité, il vaut mieux préciser le type
des qu'on le peux . :)
Avatar de l’utilisateur
SPH
Messages : 4947
Inscription : mer. 09/nov./2005 9:53

Re: La TNT pour certains, se sera ça

Message par SPH »

RIEN compris

!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
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: La TNT pour certains, se sera ça

Message par Backup »

SPH a écrit :RIEN compris
a partir d'ou ?
Répondre