PB 5.43 x64 UBUNTU 16.04 LTS
Save the source code and any 640x480 .jpg into the same folder.
If you use http://www.bealecorner.com/trv900/testpat/MVC00002.JPG then the name is already setup in the source code.
The problem is that the first generated display does not show.
Swap move the 4 sections which are delimited by and include the lines ; VVVVVVVV and ; ^^^^^^^^^^.
Only the first one of the four sections in the source will not work.
(If you use the Esc key to exit the screen, then don't hold it down because there's no code to wait for the key release.)
Can anyone figure out a way to make the first built display show?
Perhaps another way to think of it, does anyone know what gets triggered to make the subsequent calls work properly?
As usual the program works fine in Windows®.
Code: Select all
UseJPEGImageDecoder()
Procedure UCLOWIN()
; Stay here until Esc key is depressed or window close icon is selected
BYEBYE= 0
Repeat
RELEASE= ElapsedMilliseconds()+ 20
Repeat
X= WindowEvent() : If X = #PB_Event_CloseWindow : BYEBYE+ 1 : EndIf
Until X = 0
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape) : BYEBYE+ 1 : EndIf
If ElapsedMilliseconds() < RELEASE
Repeat : Delay(2) : Until ElapsedMilliseconds() > RELEASE
EndIf
Until BYEBYE
EndProcedure
Z1= InitSprite()
Z2= OpenWindow(0,0,0,800,600,"PROGRAM",#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget)
Z3= OpenWindowedScreen(WindowID(0),0,0,800,600,#True,0,0)
Z4= InitKeyboard()
Z5= CreateSprite(0,800,600)
If (Z1<>0 And Z2<>0 And Z3<>0 And Z4<>0 And Z5<>0)
CatchImage(1,?BITMAP)
FlipBuffers()
; VVVVVVVVVVVVVVVVVVVVVVVV SPRITEOUTPUT() START VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
StartDrawing(SpriteOutput(0))
Box(0,0,800,600,RGB(0,63,0))
DrawText(50,30,"SPRITE OUT GREEN")
DrawImage(ImageID(1),80,60)
StopDrawing()
DisplaySprite(0,0,0)
FlipBuffers()
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UCLOWIN()
Delay(50)
; VVVVVVVVVVVVVVVVVVVVVVVV SCREENOUTPUT() START VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
StartDrawing(ScreenOutput())
Box(0,0,800,600,RGB(0,0,63))
DrawText(50,30,"SCREEN OUT BLUE")
DrawImage(ImageID(1),80,60)
StopDrawing()
FlipBuffers()
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UCLOWIN()
Delay(50)
; VVVVVVVVVVVVVVVVVVVVVVVV SCREENOUTPUT() START VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
StartDrawing(ScreenOutput())
Box(0,0,800,600,RGB(63,0,0))
DrawText(50,30,"SCREEN OUT RED")
DrawImage(ImageID(1),80,60)
StopDrawing()
FlipBuffers()
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UCLOWIN()
Delay(50)
; VVVVVVVVVVVVVVVVVVVVVVVV SPRITEOUTPUT() START VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
StartDrawing(SpriteOutput(0))
Box(0,0,800,600,RGB(63,63,63))
DrawText(50,30,"SPRITE OUT GRAY")
DrawImage(ImageID(1),80,60)
StopDrawing()
DisplaySprite(0,0,0)
FlipBuffers()
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UCLOWIN()
EndIf
DataSection
BITMAP: : IncludeBinary "MVC00002.JPG"
; http://www.bealecorner.com/trv900/testpat/MVC00002.JPG
EndDataSection But if you don't have the FlipBuffers() call there immediately preceding that inserted UCLOWIN() call, then things get decidedly ugly.




