LoadShape
LoadShape Filename$, ShapeIndex
 
Parameters:

    Filename$ = The Filename of the shape you wish to load
    ShapeIndex = The Index of the shape y
Returns: NONE
 

      LoadShape reads an shape file from disc into PlayBASIC's shape memory. You must provide this command with the full folder path and filename of the shape you wish to load, as well as a free (not currently in use) shape index.



FACTS:


      * Load + Save Shape are part of the Shape extension Library. In order to use them, make sure you include the shape extension library at the top of your program if you need them. Eg. #include "Shape"



Mini Tutorial:


      This example creates a convex shape, saves it disc and the reloads it using the Load and save shape commands

  
; Include the Shape extension library
  #Include "Shape"
  
; Create a convert shape.
  CreateConvexShape 1,50,7
  
; The Filename of our test load/save file
  Filename$="C:Test_PlayBasic_LoadAndSaveShape.Dat"
  
  
; Save the shape to the C: drive
  SaveShape Filename$,1
  
  
; ReLoad the shape file as shape 2
  LoadShape Filename$,2
  
  
; Display the shapes
  DrawShape 1,100,100,2
  DrawShape 2,300,100,2
  
  
; Delete the temp file,
  DeleteFile Filename$
  
  
; Refresh the screen abnd wait for a key press
  Sync
  WaitKey
  



This example would output.

  
  no Text output
  




Example:


      This example loads a premade shape from the MEDIA folder. The shape was created as collision outline for the ship.bmp picture in the help media folder also. The Shape was created using PlaySHAPE. It's FREE and can be found on the PlayBASIC.com web site under the tools section.


 
Example Source: Download This Example
; -------------------------------------------------
; include the Shape 'extras' library in our program
; -------------------------------------------------
  #Include "shape"
  
; ------------------------------------------------
; request a free shape index from playbasic
; ------------------------------------------------
  ShipShape=GetFreeShape()
  
  
; ------------------------------------------------
; Load the shap into memory, the shape file is located
; in the MEDIA folder of the help system, so we're looked
; back two folder from where this example is saved,
; ------------------------------------------------
  
  LoadShape "..\../Media/ship.Shape",ShipShape
  
  
; ------------------------------------------------
; Offset the verts in the shape so it's centered around a centeral point
; ------------------------------------------------
  ShiftShape ShipShape,-32,-32
  
  
; ------------------------------------------------
; Main Loop of Program
; ------------------------------------------------
  
  Do
     
   ; clear the screen to black
     Cls
     
   ; Rotate the shapes
     Angle#=WrapAngle(Angle#,1)
     RotateShape ShipShape,Angle#,1
     
     
   ; Draw this vector shape on screen (Dot Mode)
     DrawShape ShipShape,100,100,0
     
   ; Draw this vector shape on screen (Line Mode)
     DrawShape ShipShape,200,100,1
     
   ; Draw this vector shape on screen (Filled)
     DrawShape ShipShape,300,100,2
     
     
   ; show the screen
     Sync
     
   ; loop back to the Do, to keep program running until
   ; a key is pressed
  Loop ScanCode()<>0
  
  
  
 
Related Info: #Include | CopyShape | CreateConvexShape | CreateShape | LoadNewShape | NewConvexShape | NewShape | SaveShape | ShiftShape :
 


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