ShapeQuantity
ShapeQuantity NumberOfShapes
 
Parameters:

    NumberOfShapes = The max number of Shapes that PB should handle
Returns: NONE
 

     ShapeQuantity lets you expand the max number Shapes available. So if you ever run out of shapes, you can request more at any time.

      It's worth knowing that the dynamic commands such as GetFreeShape, NewShape etc will automatically expand the shape table for you.




FACTS:


     * Shape quantity indexes is limited to 2^24 (over 16 million).

     * use ShapeQuantity 1 to shrink the shape table to it's smallest size, if minimizing memory is absolutely required.





Mini Tutorial:


      This example runs through and creates all available banks (the default limit),it then resizes then internal max and displays the info back to the user.

  
  
; Read and display the current Max number of Shapes
  quantity=GetShapeQuantity()
  Print "Starting Number of Memory Shapes:"+Str$(quantity)
  Print "press any key"
  
; run through and create all the available Shapes
  For lp =1 To quantity
     CreateShape lp,10+lp,5
  Next
  
; Show the user the screen and wait for a key to be pressed
  Sync
  WaitKey
  WaitNoKey
  
  
; Tell PB to expand the number of available memory Shapes
  ShapeQuantity quantity+2000
  
; read and display the number of memory Shapes after expansion
  quantity=GetShapeQuantity()
  Print "Starting Number of Memory Shapes:"+Str$(quantity)
  Print "press any key"
  
  
; This code this loops and displays the status and size of
  y=0
  For lp =1 To quantity
     If GetShapeStatus(lp)
        Edges=GetShapeEdges(lp,0)
        Print "Shape Status:"+Str$(lp)+"   Edges:"+Str$(Edges)
     Else
        Print "Shape Status:"+Str$(lp)+" Doesn't Exist Yet"
        
     EndIf
     
     If GetCursorY()> 440
        Print "Press Any Key to Show next page"
        SetCursorY 0
        Sync
        WaitKey
        WaitNoKey
        Cls RGB(0,0,0)
     EndIf
  Next
  
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitNoKey
  



This example would output (This depends upno what version of PB your running, so the result may differ).

  
  Starting Number of Shapes:500
  press any key
  Starting Number of Memory Banks:2500
  press any key
  
  Shape Status:1   Size:5
  Shape Status:2   Size:5
  Shape Status:3   Size:5
  Shape Status:4   Size:5
  Shape Status:5   Size:5
  etc
  etc etc
  
  
  

 
Related Info: GetFreeShape :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com