Raven wrote: "
Now keep in mind IF you use DrawSprite( ) it REMOVES it from the Draw Queue for that Frame., so when you call Render( ) or Render2D( ) it won't be Redrawn.
Note that the Render Commands will ONLY Render what has NOT YET been Drawn that Frame... thus anything you use DrawSprite( ) on will be ignored. "
Sorry but you are wrong....if you call DrawSprite(), that sprite is still rendered if you call Render() or Sync() etc...
Heres some sample code to show it....there are two red squares drawn but only one red sprite - proving that render() does still draw any sprites that have had drawsprite()used on them
// Project: SpriteTest
// Created: 2019-04-28
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "SpriteTest" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
//SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetVsync(1)
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// Red square
spr1 = CreateSprite(0)
SetSpriteSize(spr1,100,100)
SetSpriteColor(spr1,255,0,0,255)
SetSpriteDepth(spr1,10)
// blue square
spr2 = CreateSprite(0)
SetSpritePosition(spr2,50,50)
SetSpriteSize(spr2,300,300)
SetSpriteColor(spr2,0,0,255,255)
SetSpriteDepth(spr2,15)
do
SetSpritePosition(spr1,0,0)
drawsprite(spr1)
SetSpritePosition(spr1,300,300)
Print( ScreenFPS() )
//Sync()
Render()
swap()
loop
Raven wrote: "
Render2DBack( ) Draws 2D Sprites with Depth > MaxDepth / 2 (Max Depth can be 5000 or 10000 and switched based upon what you set)
Render2DFront( ) Draws 2D Sprites with Depth < MaxDepth / 2
"
This is not quite correct either.... (I dont think you meant Maxdepth
/ 2)
Render2DBack( ) draws any sprites/text that are behind the global 3d depth
SetGlobal3DDepth() is used to control that depth and is 5000 by default but can be anything from 0-10,000
Render2DFront( ) draws any sprites/text that are in front of the global 3d depth as well as boxes, elipses etc... (any line based item)
So the screen is drawn as layers, from back to front they are...
1) BackgroundSprites/text/particles
2) 3d objects
3) Front Sprites/text/particles
4) Any DrawBox,DrawEllipse or DrawLine commands
5) Print commands
(3,4,5 are all done in Render2dfront())