PlayBASIC V1.56 BETA (Retail Compiler Only Beta)

Started by kevin, November 11, 2006, 02:27:07 PM

Previous topic - Next topic

kevin




PlayBASIC V1.56 BETA (Compiler Only Beta) - (Avail for Registered Users ONLY)
November 11, 2006



  PlayBASIC V1.56 is today's WIP beta of PB.    This update is another step towards rounding off the type collection / typed pointer features.  Which are fast becoming a very freeing (ie powerful) addition to the language.   This release was delayed, because i run into  a rather abstract bug relating to type pointers corrupting the local variable storage areas during compilation.  Took a while to work out what was happening, easy to fix though.  

 The biggest change relates to the the new addressing modes for type variables and arrays.  We now have three basic controls over addressing.  Those being "handle", "element" and "pointer".    While i would hope that's fairly self explanatory.  Here's a bit of run down on what each one is referring to.

Handles() -  Handles refer to the entire variable/array structure and ALL of the elements that this structure contains.  To address a Type variable/Array as a Handle i've added support for shorting cutting it with the () token, just like integer arrays.  

   ie.
 
Quote

  ; Array example
   Dim Table(100) as MyObject
   Old Method   =    Table().MYObject        
    new short cut    = Table()

; variables   example
Dim MyVariable as MyObject
 Old method   =  MyVariable.MyObject  
 New method  = MyVariable()

 
Elements Addressing  -  When we address the element were reading/writing into the types structure. Where not addressing the data fields of the type here, but the look up table (container) structure that holds them.  


Quote
   
; Array example
     Dim Table(100) as MyObject
    ; Manually create (allocate) a at element 50
    Table(50)  = new MYObject        
    print Table(50)

; variables   example
Dim MyVariable as MyObject
 MyVariable = new  MyObject
 Print MyVariable

;  You can Delete the type at an element by writing a NULL to it
  Table(50) = NULL
  MyVariable = NULL


You can query the type of any returned element, using the "TypeOF()" function.  This Function returns the Type INDEX of a queired element.  Both Type variables and arrays can house not only types of the parent structure declaration, but children also.  So you could store everything in the one array if you like !


I.e. Peudo code example

Quote
  Type BaseObject
        fields
  EndType

  Type Alien1 as BaseObject
  EndTYpe

  Type Player as BaseObject
  EndTYpe

 Dim Objects(100) as BaseObejct

 Object(1)=new player
 Object(2)=new Alien1

 For lp=0 to 100
       Select TypeOf(Object(lp))
              case Player
                   Print "Handle Player"
               case Alien1
                   Print "Handle Alien"
     end select
  Next



Pointer Addressing  -  Pointer gives the address in memory of a particular type instance.  The pointer points to the actual types field data, and not the structure if came from.  You can get a pointer to an instance by adding the ."TypeName"  after addressing the element.   You can also get the pointer to any nested types.  This allows us to copy type structures between instances directly.  Moreover you can now write totally generic functions that accept/return typed pointers.  Were previously we would have passed the type array/variable handle, which meant passing the entire structure rather than a single instance....  Which could be a little painful at times.    
   
 ie.
Quote
   type Pos
             x,y,z
  EndType

  Type BaseObject
           Misc Fields
           Position as Pos
  EndType

   Dim Me as BaseObject

   me= new BaseObject

;  pass the pointer the to nested position type within me
   SetPosition  Me.Position, 100,200,300

Function SetPosition(me as pos pointer,x,y,x)
  me.x=x
  me.y=y
  me.y=z
endfunction







Download

 Old Download removed.




kevin

#1



PlayBASIC V1.57 BETA (Compiler Only Beta) - (Avail for Registered Users ONLY)
November 18, 2006



 PB1.57 is today's WIP beta of PB.  This update features a various image and gfx engine tweaks, plus includes a FreeImage wrapper.  This wrapper allows you to save any PlayBASIC image as BMP,PNG and JPG.

 The wrapper includes most of the functions of the FreeDll DLL,  the developer documentation of the dll and it's license are included also.   FreeImage has various image processing effect built into it.  But you'll have to read the documentation to take advantage of those.   I've used the dll function names in the PB wrapper, so their nice and easy to look up in the SDK if need be.   It's just a matter of calling the right dll functions.   However, FreeImage is it's not designed as real time render engine.  But you could certainly do some interesting things with it.

 In the wrapper i've included a few extra helper functions for the Loading and Saving of images, so use these.

Loaders

Quote

Fx FLags
0= Video Memory Image
1= FX surface

ImageIndex= FreeImage_LoadImage(Filename$,FXFlag)



Savers

Quote

Save JPG
CompressionModes
 0= FreeIMageSaver_JPEG_QUALITY superb
 1= FreeIMageSaver_JPEG_QUALITY GOOD
 2= FreeIMageSaver_JPEG_QUALITY Normal
 3= FreeIMageSaver_JPEG_QUALITY Average
 4 =JPEG_QUALITY Poor
 FreeImage_SaveJPG(Filename$,ImageIndex,CompressionMode)

Save PNG
FreeImage_SavePNG(Filename$,ImageIndex)


Save Bitmap

CompressionModes
 0= Raw (no compression)
 1= Run Length Encoded  (seems a bit iffy when i tried it though..)
FreeImage_SaveBMP(Filename$,ImageIndex.CompressionMode)




Download

 Old Download removed.






kevin

#2



PlayBASIC V1.59 BETA (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)
November 25, 2006




   PlayBASIC V1.59 is today's WIP beta of PB.    This update includes one of the more noticeable changes i guess. Which is the addition of compiler status window to the launch process.  So now rather than using the default window/surface, it spits messages out to a little console window.   This saves any unnecessary screen mode changes when using a default full screen resolution.   If there's error just hit a key.  Most other additions revolve around the scene/camera buffers.  There's now have two sort methods to choose from, plus some controls to specify the Z range depth of scene elements.  Reducing the Max Z range can improve sorting performance.  


 And now for those curious here's some info the compilers raw performance.  

 Compile Speed done using  'Compiling Flexi Window Example'  see  Projects\Examples\Flexi\Basic_Window

Quote
Duron 800mhz
Total Compile Time: 2782 Milliseconds
Lines Per Second: 2218.55
Number of Lines: 6167

Quote
AMD 3000
Total Compile Time: 843 Milliseconds
Lines Per Second: 7315.54
Number of Lines: 6167

Note: Total Compile Time' represents the total time of the 3 passes !


New ClipBoard Slib

    This slib will allow you to post and read strings from the clip board.
     
Quote

   TextToClipboard(PostString$)      - Post a String to the Clipboard

    String$=GetTextFromClipboard()     - Get a String from the Clipboard (if any)





Download

 Old Download Removed.