Hello Minimy. I figured out, that the 2d drawing commands are the ones, that slightly work differently. That's why the sprite was black in your example with the newest beta.
This code works with either the old versions or the newest 6.21 beta4. (sprite draw modes are changed)
Code: Select all
fnt1= LoadFont(#PB_Any,"Arial",12)
fnt2= LoadFont(#PB_Any,"Arial",20)
fnt3= LoadFont(#PB_Any,"Impact",40)
Global camara
Procedure iniDX(title.s="")
Protected w,h
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,800,600,title,#PB_Window_ScreenCentered|#PB_Window_BorderLess|#PB_Window_Maximize);|#PB_Window_Invisible)
SetWindowColor(0,$444444)
w= WindowWidth(0):h=WindowHeight(0)
AntialiasingMode(#PB_AntialiasingMode_None)
OpenWindowedScreen(WindowID(0), 0, 0, w,h, 0,0,0,#PB_Screen_NoSynchronization)
KeyboardMode(#PB_Keyboard_International)
s=128
; WorldShadows(#PB_Shadow_Modulative, -1, RGB(s,s,s), 2048)
EnableWorldPhysics(1)
EnableWorldCollisions(1)
EndProcedure
Procedure eventos3D()
Protected.f speed=0.1, mouseSpd=0.05
Protected.f KeyX,KeyY, MouseX,MouseY
If KeyboardPushed(#PB_Key_A)
KeyX= -speed
ElseIf KeyboardPushed(#PB_Key_D)
KeyX= speed
Else
KeyX= 0
EndIf
If KeyboardPushed(#PB_Key_W)
KeyY= -speed
ElseIf KeyboardPushed(#PB_Key_S)
KeyY= speed
Else
KeyY= 0
EndIf
If KeyboardPushed(#PB_Key_LeftShift)
keyY * 10
keyX * 10
EndIf
MouseX = -MouseDeltaX() * mouseSpd
MouseY = -MouseDeltaY() * mouseSpd
RotateCamera(camara, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (camara, KeyX, 0, KeyY)
EndProcedure
Procedure creaSuelo(size=50, col1.l=$0,col2.l=$aaaaaa, res=256)
Protected.i suelo_tx3D, suelo_mate, suelo_mesh, suelo
suelo_tx3D= CreateTexture(#PB_Any,res,res)
StartDrawing(TextureOutput(suelo_tx3D))
Box(0,0,OutputWidth(),OutputHeight(),col1)
Box(2,2,OutputWidth()-4,OutputHeight()-4,col2)
StopDrawing()
suelo_mesh= CreatePlane(#PB_Any,size,size,1,1,1,1)
suelo_mate= CreateMaterial(#PB_Any,TextureID(suelo_tx3D))
ScaleMaterial(suelo_mate,1/size,1/size)
suelo= CreateEntity(#PB_Any, MeshID(suelo_mesh), MaterialID(suelo_mate),0,0,0,0,1<<1)
ProcedureReturn suelo
EndProcedure
iniDX("Test Overlay")
creaSuelo()
Macro tabla(x,y,w,h)
Box(x,y,w-4,h-4,$8899aa)
Box(x+4,y+4,w-4,h-4,$112233)
Box(x+2,y+2,w-4,h-4,$556677)
EndMacro
tx3d= CreateTexture(#PB_Any,200,200)
im3d= CreateImage(#PB_Any,200,200)
StartDrawing(ImageOutput(im3d))
w= OutputWidth()/5
For p=0 To 4
tabla(w*p,0,w,OutputHeight())
Next p
tabla(0,w/2,OutputWidth(),w)
tabla(0,w*3.5,OutputWidth(),w)
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
DrawingFont(FontID(fnt3))
txt.s="ARMY"
DrawText((OutputWidth()-TextWidth(txt))/2,(OutputHeight()-TextHeight(txt))/2,txt,$55ffffff)
StopDrawing()
StartDrawing(TextureOutput(tx3d))
DrawAlphaImage(ImageID(im3d),0,0)
StopDrawing()
cubo_mesh= CreateCube(#PB_Any,2)
cubo_verd= CreateMaterial(#PB_Any, TextureID(tx3d))
; cubo_verd= CreateMaterial(#PB_Any, #Null,$00ff00)
cubo_rojo= CreateMaterial(#PB_Any, #Null,$0000ff)
cubo_entR= CreateEntity(#PB_Any, MeshID(cubo_mesh), MaterialID(cubo_rojo),0,1,0,0,1<<1)
cubo_entV= CreateEntity(#PB_Any, MeshID(cubo_mesh), MaterialID(cubo_verd),50,1,0,0,1<<2)
luz= CreateLight(#PB_Any,$ffffff,10,30,30,#PB_Light_Point)
camara= CreateCamera(#PB_Any,0,0,100,100,1 << 1)
MoveCamera(camara,10,10,10)
CameraLookAt(camara,0,0,0)
CameraRange(camara, 0.1, 999999)
CameraBackColor(camara,$555555)
camMenu= CreateCamera(#PB_Any,40,30,20,50,1 << 2)
MoveCamera(camMenu,40,1,0)
CameraLookAt(camMenu,50,1,0)
CameraBackColor(camMenu,$007700)
imgDeco= CreateImage(#PB_Any,16+WindowWidth(0)*0.2,16+WindowHeight(0)*0.5,32,#PB_Image_Transparent)
sprDeco= CreateSprite(#PB_Any,ImageWidth(imgDeco),ImageHeight(imgDeco),#PB_Sprite_AlphaBlending)
StartDrawing(ImageOutput(imgDeco))
DrawingMode(#PB_2DDrawing_AllChannels)
DrawingMode(#PB_2DDrawing_AlphaBlend)
RoundBox(0,0,OutputWidth(),OutputHeight(),25,25,$ff000000)
DrawingMode(#PB_2DDrawing_AllChannels)
RoundBox(16,16,OutputWidth()-32,OutputHeight()-32,15,15,$00000000)
StopDrawing()
StartDrawing(SpriteOutput(sprDeco))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,OutputWidth(),OutputHeight(),RGBA(0,0,0,0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
DrawAlphaImage(ImageID(imgDeco),0,0)
DrawingFont(FontID(fnt2))
DrawText(20,20,"Box",$ff00ffff,$00000000)
DrawingFont(FontID(fnt1))
DrawText(20,OutputHeight()-80,"This is a box",$ff00ffff,$00000000)
DrawText(20,OutputHeight()-60,"Simple box of wood",$ff00ffff,$00000000)
StopDrawing()
sprDecoX= -8+WindowWidth(0)*0.4
sprDecoY= -8+WindowHeight(0)*0.3
Repeat
contador+ 1
;{ WINDOWS Y GADGETS
Repeat : event= WindowEvent()
Until event= 0
;}
ExamineKeyboard() : ExamineMouse()
eventos3D()
RotateEntity(cubo_entV,0.25,1,0.5,#PB_Relative)
If KeyboardPushed(#PB_Key_Escape) : sal= 1: EndIf
RenderTime = RenderWorld()
DisplayTransparentSprite(sprDeco, sprDecoX,sprDecoY)
FlipBuffers()
Delay(1)
Until sal=1