NewWorld
WorldIndex = NewWorld()
 
Parameters: NONE
Returns:

    WorldIndex = The Index of the newly created world
 
     The NewWorld() function dynamically initializes an empty world space where you can capture gfx commands to. Unlike CreateWorld, NewWorld will return this new worlds index for you.

      To Learn more about worlds, please see the CreateWorld command.





Mini Tutorial:


      This example first creates a world, then fills this world buffer full of static stars. During the main loop it then grabs a camera full of this world data and places it into the scenebuffer for drawing. Next it calls the camera to render it. This allows us to mix data from different worlds, through different cameras, and maintain the scenes depth.


  
; Tell PB to create a New World for us
  MyWorld=NewWorld()
  
  
; Tell PB to Capture the following graphics
; commands to this world buffer
  CaptureToWorld MyWorld
  
; Plot 1000 Stars into this world buffer
  
  Stars=1000
  W=GetScreenWidth()
  H=GetScreenHeight()
  
  For lp =0 To Stars
     X=Rnd(w)
     y=Rnd(h)
     c=RndRGB()
     DotC x,y,c
     DotC x+w,y,c
  Next
  
; Create camera
  MyCamera=NewCamera()
  
  
; Start of DO/LOOP
  Do
     
   ; Enable Capture to Scene Buffer
     CaptureToScene
     
   ; Clear the scene buffer
     ClsScene
     
   ; Transfer the data from the World buffer
   ; to the scene buffer
     CameraGrabWorld 1,MyCamera
     
   ; Draw Camera #1
     DrawCamera MyCamera
     
   ; MOve the camera
     x#=x#+1
     PositionCameraX MyCamera,X#
     If x#=>Then x#=x#-w
     
   ; Display the screen
     Sync
     
   ; Loop back to the DO
  Loop
  
  





 
Related Info: CreateWorld | DeleteWorld | GetFreeWorld | GetWorldStatus :
 


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