Hello again

When you open a windowed screen together with the OGRE, it does not stretch sprites with window resize, only the 3d render.
However, there are two options:
1, Correct aspect ratio for the 3d scene too by calling resizecamera:
Code: Select all
Enumeration
#MainWindow
EndEnumeration
InitEngine3D() : InitSprite() : InitKeyboard() : ExamineDesktops()
WindowWidth = 600 : WindowHeight = 600
nFlags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Invisible
If OpenWindow(#MainWindow, 0, 0, WindowWidth, WindowHeight, "Include 2D sprites within a 3D environment", nFlags)
SetWindowColor(#MainWindow, RGB(0, 0, 0))
WindowBounds(#MainWindow, WindowWidth, WindowHeight, #PB_Default, #PB_Default)
If OpenWindowedScreen(WindowID(#MainWindow), 0, 0, WindowWidth, WindowHeight, #True, 0, 0)
SetFrameRate(60) : SpriteQuality(#PB_Sprite_BilinearFiltering)
CreateSprite(0, 20, 20, #PB_Sprite_AlphaBlending)
If StartDrawing(SpriteOutput(0))
Box(0, 0, 20, 20, RGB(255, 0, 155))
Box(5, 5, 10, 10, RGB(155, 0, 255))
StopDrawing()
EndIf
direction = 2
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 5, 0)
CameraLookAt(0, 2, 5, 10)
TextureSky = LoadTexture(#PB_Any, "sky.png")
SkyDome(TextureID(TextureSky), $cc6600, $0088ff, 3, 400, -0.5, 0)
CreateLight(0, $ff88ff, 20000, 40000, 20000)
AmbientColor($010101)
Fog($554488,1, 0, 1024 * 4)
HideWindow(#MainWindow, #False)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Select EventWindow()
Case #MainWindow : Break 2
EndSelect
Case #PB_Event_SizeWindow
ResizeCamera(0,0,0,100,100) ; this way it does not stretch 3D render
EndSelect
Until Not Event
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Break : EndIf
RenderWorld()
DisplayTransparentSprite(0, x, x)
x + direction
If x > WindowWidth - 20 : direction = -2 : EndIf
If x < 0 : direction = 2 : EndIf
FlipBuffers()
ForEver
EndIf
EndIf
2. Manually size all the sprites to the new aspect ratio using zoomsprite:
Code: Select all
Enumeration
#MainWindow
EndEnumeration
InitEngine3D() : InitSprite() : InitKeyboard() : ExamineDesktops()
WindowWidth = 600 : WindowHeight = 600
nFlags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_Invisible
If OpenWindow(#MainWindow, 0, 0, WindowWidth, WindowHeight, "Include 2D sprites within a 3D environment", nFlags)
SetWindowColor(#MainWindow, RGB(0, 0, 0))
WindowBounds(#MainWindow, WindowWidth, WindowHeight, #PB_Default, #PB_Default)
If OpenWindowedScreen(WindowID(#MainWindow), 0, 0, WindowWidth, WindowHeight, #True, 0, 0)
SetFrameRate(60) : SpriteQuality(#PB_Sprite_BilinearFiltering)
CreateSprite(0, 20, 20, #PB_Sprite_AlphaBlending)
If StartDrawing(SpriteOutput(0))
Box(0, 0, 20, 20, RGB(255, 0, 155))
Box(5, 5, 10, 10, RGB(155, 0, 255))
StopDrawing()
EndIf
direction = 2
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 5, 0)
CameraLookAt(0, 2, 5, 10)
TextureSky = LoadTexture(#PB_Any, "sky.png")
SkyDome(TextureID(TextureSky), $cc6600, $0088ff, 3, 400, -0.5, 0)
CreateLight(0, $ff88ff, 20000, 40000, 20000)
AmbientColor($010101)
Fog($554488,1, 0, 1024 * 4)
HideWindow(#MainWindow, #False)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Select EventWindow()
Case #MainWindow : Break 2
EndSelect
Case #PB_Event_SizeWindow
ZoomSprite(0,20*WindowWidth(#MainWindow)/windowwidth,20*WindowHeight(#MainWindow)/windowheight)
EndSelect
Until Not Event
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Break : EndIf
RenderWorld()
DisplayTransparentSprite(0, x, x)
x + direction
If x > WindowWidth - 20 : direction = -2 : EndIf
If x < 0 : direction = 2 : EndIf
FlipBuffers()
ForEver
EndIf
EndIf
PS:I think you just found a bug, as it seems at the old window size the sprites are clipped at least with PB 6.21 beta 9
Never seen this, as I don't allow resizing my 3d screened apps.