Journée mondial pour la modernisation de PB

Vous avez une idée pour améliorer ou modifier PureBasic ? N'hésitez pas à la proposer.
Avatar de l’utilisateur
Guillot
Messages : 521
Inscription : jeu. 25/juin/2015 16:18

Journée mondial pour la modernisation de PB

Message par Guillot »

Ci dessous les image de la manif

PS: les explications dans les posts suivants

Code : Tout sélectionner

; manif - pf shadoko - 2017

EnableExplicit

Procedure ColorBlend(color1.l, color2.l, blend.f=0.5)
    Protected r.w,g.w,b.w,a.w
    r=  Red(color1) + (Red(color2)     - Red(color1)) * blend
    g=Green(color1) + (Green(color2) - Green(color1)) * blend
    b= Blue(color1) + (Blue(color2) -   Blue(color1)) * blend
    a=Alpha(color1) + (Alpha(color2) - Alpha(color1)) * blend
    ProcedureReturn  RGBA(r,g,b,a)
EndProcedure
;=======================================================================================

Structure spancarte
    ok.b
    bcolor.l
    fcolor.l
    slogan.s
EndStructure

Structure smanif
    x.f
    y.f
    z.f
    v.f
    pf.f
    pancarte.spancarte
EndStructure

Global nm=255,ns=6
Global Dim manif.smanif(nm)
Global Dim slogan.s(ns)

slogan(0)=~"Conversion automatique\ndes anciens codes"
slogan(1)=~"LES 'DECLARE'\nY'EN A MARRE !!!"
slogan(2)=~"InitMouse\nInitKeyboard\nInitSprite\nInit...\non en veut plus !"
slogan(3)=~"BYVAL / BYREF"
slogan(4)=~"Les énumérations\ncomme type\nde variable"
slogan(5)=~"Les procedures aussi\nont besoin des types:\nTableau\nListe\nMap\n et Structure !"
slogan(6)=~"DES VARIABLES\n POUR LES 'STEP'"

Procedure initmanif(i,z=100)
    With manif(i)
        \x=Random(400)-200
        \y=Random(20)
        \z=z
        \v=(Random(10)+50)/400
        \pf=Random(200,100)/1000
    EndWith
    With manif(i)\pancarte
        \ok=Bool(Random(32)=0)
        \bcolor=$ff<<24|Random($ffffff)
        \fcolor=$ff<<24|Random($ffffff)
        \slogan=slogan(Random(ns))
    EndWith
EndProcedure

Procedure affiche()
    Static c=1111:c+1
    Protected i,g.f,x.f,y.f,dx,dy
    StartVectorDrawing(CanvasVectorOutput(0))
    VectorFont(FontID(0),10)
    VectorSourceLinearGradient(0,0,0,600)
    VectorSourceGradientColor($ffffaaaa, 0.0)
    VectorSourceGradientColor($ffffaaaa, 0.5)
    VectorSourceGradientColor($ff888888, 1.0)
    FillVectorOutput()
    SortStructuredArray(manif(),#PB_Sort_Descending,OffsetOf(smanif\z), TypeOf(smanif\z))
    For i=0 To nm
        With manif(i)
            g=80/\z
            ResetCoordinates()
            TranslateCoordinates(400,300)
            ScaleCoordinates(g,g)
            x=\x
            y=-(\y-50+4*Abs(Sin(c*\pf)))
            If \pancarte\ok
                RotateCoordinates(x,y,5*Sin(c*\pf))
                dx= VectorTextWidth(\pancarte\slogan)+10
                dy= VectorTextHeight(\pancarte\slogan)+10
                AddPathBox(x-3,y-dy-70,  6,dy+100) 
                VectorSourceColor(ColorBlend($ff88aaaa,$ffffaaaa,\z/100))
                FillPath()
                AddPathBox(x-dx/2,y-dy-60,  dx,dy) 
                VectorSourceColor(ColorBlend(\pancarte\bcolor,$ffffaaaa,\z/100))
                FillPath()
                MovePathCursor(x-dx/2,y-dy-60+5)
                VectorSourceColor(ColorBlend(\pancarte\fcolor,$ffffaaaa,\z/100))
                DrawVectorParagraph(\pancarte\slogan,dx,dy,#PB_VectorParagraph_Center)
            EndIf
            x-20
            AddPathCircle(x,y, 20)
            VectorSourceColor(ColorBlend($ff888888,$ffffaaaa,\z/100))
            FillPath()
            \z-\v:If \z<1:initmanif(i):EndIf
        EndWith
    Next    
    StopVectorDrawing()
EndProcedure

Define i
OpenWindow(0, 0, 0, 800,600, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,800,600)
LoadFont(0, "Comic Sans MS", 10)

For i=0 To nm
initmanif(i,Random(100,10))
Next
AddWindowTimer(0, 0, 20):BindEvent(#PB_Event_Timer, @ affiche())

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Avatar de l’utilisateur
Micoute
Messages : 2522
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: Journée mondial pour la modernisation de PB

Message par Micoute »

Merci professeur Shadoko pour ce partage, j'ai bien aimé ce clin d'œil.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 5.73 PB 6.00 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Avatar de l’utilisateur
Zorro
Messages : 2185
Inscription : mar. 31/mai/2016 9:06

Re: Journée mondial pour la modernisation de PB

Message par Zorro »

Excellent !! :D
Image
Image
Site: http://michel.dobro.free.fr/
Devise :"dis moi ce dont tu as besoin, je t'expliquerai comment t'en passer"
Torp
Messages : 360
Inscription : lun. 22/nov./2004 13:05

Re: Journée mondial pour la modernisation de PB

Message par Torp »

Ah Ah TERRIBLE !
Avatar de l’utilisateur
TazNormand
Messages : 1294
Inscription : ven. 27/oct./2006 12:19
Localisation : Calvados (14)

Re: Journée mondial pour la modernisation de PB

Message par TazNormand »

Ah oui, je plussoie : Excellent !!!
Image
Image
Avatar de l’utilisateur
SPH
Messages : 4721
Inscription : mer. 09/nov./2005 9:53

Re: Journée mondial pour la modernisation de PB

Message par SPH »

Nial :mrgreen:
http://HexaScrabble.com/
!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.00 - 64 bits
Avatar de l’utilisateur
JohnJohnsonSHERMAN
Messages : 648
Inscription : dim. 13/déc./2015 11:05
Localisation : Allez, cherche...
Contact :

Re: Journée mondial pour la modernisation de PB

Message par JohnJohnsonSHERMAN »

Génial :) :mrgreen: Et tellement vrai pour le STEP sans VARIABLE.... :(
"Le bug se situe entre la chaise et le clavier"
Votre expert national en bogage et segfaults.

CPU : AMD A8 Quad core - RAM 8Gb - HDD 2To
  • Windows 10 x64 - PB 5.61 x64
  • Linux Ubuntu 16.04 LTS x64 (dual boot) - PB pas encore réinstallé
Patrick88
Messages : 1564
Inscription : mer. 21/janv./2004 18:24

Re: Journée mondial pour la modernisation de PB

Message par Patrick88 »

pas vu kcc avec sa pancarte : lecture des animations GIF en natif ... :roll:
Marc56
Messages : 2146
Inscription : sam. 08/févr./2014 15:19

Re: Journée mondial pour la modernisation de PB

Message par Marc56 »

Amusant pour l'idée et impressionnant par la petite taille du code. :P
118 lignes! quel langage moderne permet d'en faire autant ? 8O (aucun)
Chapeau pour la technique pf shadoko.

Cela dit, certaines revendications comme "supprimer les declare" pourraient se concevoir je pense, mais cela suppose que le compilateur fasse un premier passage pour lister toutes les procédures. Donc potentiellement plusieurs secondes à chaque compilation si le code devient volumineux ?

:wink:
Avatar de l’utilisateur
majikeyric
Messages : 602
Inscription : dim. 08/déc./2013 23:19
Contact :

Re: Journée mondial pour la modernisation de PB

Message par majikeyric »

C'est juste NAZE ! :)
Dernière modification par majikeyric le lun. 03/juil./2017 14:56, modifié 1 fois.
Avatar de l’utilisateur
venom
Messages : 3071
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Re: Journée mondial pour la modernisation de PB

Message par venom »

Le rendu est top, bravo 8)






@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Avatar de l’utilisateur
Ar-S
Messages : 9472
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Journée mondial pour la modernisation de PB

Message par Ar-S »

Je me joins à tes revendications et te félicite au passage pour le code qui m'a bien fait marrer. :P
~~~~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
Huitbit
Messages : 939
Inscription : jeu. 08/déc./2005 5:19
Localisation : Guadeloupe

Re: Journée mondiale pour la modernisation de PB

Message par Huitbit »

Superbe !
Y a pas une manif prévue pour Android Studio :mrgreen: !!!?
Elevé au MSX !
Avatar de l’utilisateur
ChrisR
Messages : 221
Inscription : sam. 14/févr./2015 16:20

Re: Journée mondial pour la modernisation de PB

Message par ChrisR »

Génial :D
Qui se lance dans une contre manif. 118 lignes de code a battre :wink:
Avatar de l’utilisateur
Cool Dji
Messages : 1126
Inscription : ven. 05/sept./2008 11:42
Localisation : Besançon
Contact :

Re: Journée mondial pour la modernisation de PB

Message par Cool Dji »

Magnifique, bravo pour le code !
Only PureBasic makes it possible
Répondre