IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

SpiderBasic Discussion :

SpiderBasic 4.00 beta 1 est disponible sur votre compte


Sujet :

SpiderBasic

  1. #1
    Responsable Purebasic

    Avatar de comtois
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    1 345
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 1 345
    Billets dans le blog
    8
    Par défaut SpiderBasic 4.00 beta 1 est disponible sur votre compte
    Je ne traduis pas, votre anglais est meilleur que le mien.

    Hi folks,

    Here is the new 3.30 beta version of SpiderBasic introducing a nice new feature we wanted to implement since a while: async/await support. What does it means for you ? Less callbacks ! The commands can finally wait for there execution to finish and you can code in a more linear fashion.

    For example, using the OpenFileRequester() to display a local image was looking like that:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    Procedure Loaded(Type, Filename$, ObjectId)
      Static x = 200, y = 200
     
      OpenWindow(#PB_Any, x, y, 300, 300, Filename$, #PB_Window_TitleBar | #PB_Window_SizeGadget)
        ImageGadget(#PB_Any, 0, 0, ImageWidth(ObjectId), ImageHeight(ObjectId), ImageID(ObjectId))
     
      ; Shift the next opened window
      ;
      x + 40 
      y + 40
    EndProcedure
     
     
    Procedure LoadingError(Type, Filename$)
      Debug Filename$ + ": loading error"
    EndProcedure
     
     
    Procedure RequesterSuccess()
     
      ; Process all the selected filename
      ;
      While NextSelectedFile()
        LoadImage(#PB_Any, SelectedFileID(), #PB_LocalFile) ; when using #PB_LocalFile, all files selected with OpenFileRequester() are directly available
        Filename$ = SelectedFileName()
      Wend
     
    EndProcedure
     
    Procedure ButtonEvent()
      OpenFileRequester("image/*", @RequesterSuccess(), #PB_Requester_MultiSelection)
    EndProcedure
     
     
    OpenWindow(0, 100, 100, 200, 45, "Image viewer", #PB_Window_TitleBar)
    ButtonGadget(0, 10, 10, 180, 25, "Open local image...")
    BindGadgetEvent(0, @ButtonEvent())
     
    ; Register the loading event before calling any resource load command
    BindEvent(#PB_Event_Loading, @Loaded())
    BindEvent(#PB_Event_LoadingError, @LoadingError())
    Now, the same code using async under the loop makes the code easier to follow and more PureBasic-like
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    Procedure ButtonEvent()
      x = 200
      y = 200
     
      Filename$ = OpenFileRequester("image/*", #PB_Requester_MultiSelection)
     
      ; Process all the selected filename
      ;
      While Filename$
        Image = LoadImage(#PB_Any, Filename$, #PB_LocalFile) ; when using #PB_LocalFile, all files selected with OpenFileRequester() are directly available
        If Image
     
          OpenWindow(#PB_Any, x, y, 300, 300, Filename$, #PB_Window_TitleBar | #PB_Window_SizeGadget)
            ImageGadget(#PB_Any, 0, 0, ImageWidth(Image), ImageHeight(Image), ImageID(Image))
     
          ; Shift the next opened window
          ;
          x + 40 
          y + 40
        EndIf
     
        Filename$ = NextSelectedFilename()
      Wend
    EndProcedure
     
    OpenWindow(0, 100, 100, 200, 45, "Image viewer", #PB_Window_TitleBar)
    ButtonGadget(0, 10, 10, 180, 25, "Open local images...")
    BindGadgetEvent(0, @ButtonEvent())
    This is early work on this and if it works well it be done for the whole commandset. I tested on cordova and it works as expected, but feel free to test and see if it is OK.

    The modified affected commands which now uses await:

    • CaptureImage()
    • CloseFile()
    • CopyFile()
    • CreateDirectory()
    • DeleteDirectory()
    • DeleteFile()
    • ExamineDirectory()
    • FetchData()
    • FileSize()
    • GetFileAttributes()
    • GetFileDate()
    • HTTPRequest()
    • LoadImage()
    • LoadJSON()
    • LoadScript()
    • LoadSound()
    • LoadSprite()
    • LoadXML()
    • OpenFileRequester()
    • ReadFile()
    • RequestFileSystem()
    • SetCurrentDirectory()


    That means that these commands doesn't need a callback anymore and will returns the result directly when the processing is done, actually blocking the program flow.

    Here is the change list for this version:

    • Added: async/await support for most of the commands, callbacks are now optionals and program flow easier to follow !
    • Added: FileSystem library to easily act on local files (iOS, Android only)
    • Added: Preference library using local storage based on Peter's work (Thanks ! https://github.com/spiderbytes/Preferences)
    • Added: CaptureImage() to get an image from the camera (iOS, Android only)
    • Added: CreatePasswordHash() and VerifyPasswordHash() based on bcrypt
    • Optimized: Splitted the system library to not have all cordova libs included when using a single command
    • Optimized: Android app creation should be much faster on Windows
    • Changed: NextSelectedFile() to NextSelectedFileName()
    • Removed SelectedFileName() and SelectedFileID()


    Have fun !

    The Fantaisie Software team
    Source de l'information
    Vous souhaitez participer à la rubrique PureBasic (tutoriels, FAQ, sources) ? Contactez-moi par MP.

  2. #2
    Responsable Purebasic

    Avatar de comtois
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    1 345
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 1 345
    Billets dans le blog
    8
    Par défaut SpiderBasic 3.30 beta 2 est disponible sur votre compte.
    2026-05-27: beta 2 is out, with some bug fixes, and a new DateUTC() function.
    Vous souhaitez participer à la rubrique PureBasic (tutoriels, FAQ, sources) ? Contactez-moi par MP.

  3. #3
    Responsable Purebasic

    Avatar de comtois
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    1 345
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 1 345
    Billets dans le blog
    8
    Par défaut SpiderBasic 4.00 beta 1 est disponible sur votre compte
    Finalement la version 3.30 devient la version 4.00 en raison des incompatibilités avec la version 3.20.
    - 2026-06-22: 4.00 beta 1 is out, with the whole doc finished, and full local file support on Android and iOS. Bumped to 4.00 due to heavy syntax changed and more BASIC like program flow without relying on callbacks.

    - Android Cordova updated to v15 and Android SDK to v36
    Source de l'information
    Vous souhaitez participer à la rubrique PureBasic (tutoriels, FAQ, sources) ? Contactez-moi par MP.

Discussions similaires

  1. SpiderBasic 2.22 beta 1 est disponible sur votre compte
    Par comtois dans le forum SpiderBasic
    Réponses: 1
    Dernier message: 13/09/2019, 17h50
  2. SpiderBasic 2.21 beta 1 est disponible sur votre compte
    Par comtois dans le forum SpiderBasic
    Réponses: 3
    Dernier message: 04/02/2019, 21h46
  3. SpiderBasic 2.10 beta 1 est disponible sur votre compte
    Par comtois dans le forum SpiderBasic
    Réponses: 3
    Dernier message: 26/06/2017, 20h58
  4. SpiderBasic 2.0 beta 1 est disponible sur votre compte
    Par comtois dans le forum SpiderBasic
    Réponses: 13
    Dernier message: 02/12/2016, 12h30
  5. SpiderBasic 1.40 beta 1 est disponible sur votre compte
    Par comtois dans le forum SpiderBasic
    Réponses: 2
    Dernier message: 19/08/2016, 20h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo