Page 1 of 1

Why everything is drawn on the Debugwindow

Posted: Mon Dec 27, 2021 9:33 pm
by FetzMR
Hi there,
why is the following Code draw the Circle on the Debugwindow?
(Spiderbasic 2.31 (x64) Linux)

Code: Select all

InitSprite()

OpenScreen(1000, 1000, 0, "TEST")
ClearScreen(RGB(0, 0, 255))

ImageGadget(1,10,10,900,900,0)

CreateImage(0, 800, 800)
If StartDrawing(ImageOutput(0))
  Circle(100, 100, 100, RGB(255, 0, 0))
  StopDrawing()    
EndIf

SetGadgetState(1, ImageID(0))

FlipBuffers()
  

Re: Why everything is drawn on the Debugwindow

Posted: Mon Dec 27, 2021 9:53 pm
by Peter
If you use a gadget (here: ImageGadget()), then you must use OpenWindow() and OpenWindowedScreen().

See also: SpiderBasic - Screen

Re: Why everything is drawn on the Debugwindow

Posted: Tue Dec 28, 2021 6:18 am
by FetzMR
Thanks for your reply
I have seen this example.
What i want to reach is to draw something like boxes and text on an Screen. Not on a Window.
I only found a way to print Sprites on an screen that is started with openscreen().

Re: Why everything is drawn on the Debugwindow

Posted: Tue Dec 28, 2021 6:44 am
by Paul
If you want to use "Screen" you need to use Sprites, not Images.

Code: Select all

InitSprite()

Procedure RenderFrame()
  ClearScreen(RGB(0, 0, 255))
  DisplayTransparentSprite(1,0,0)
  FlipBuffers()
EndProcedure

OpenScreen(640, 480, 0, "TEST")
CreateSprite(1, 100, 100,#PB_Sprite_AlphaBlending)
If StartDrawing(SpriteOutput(1))
  Circle(50,50,50, RGB(255, 0, 0))
  StopDrawing()    
EndIf

BindEvent(#PB_Event_RenderFrame, @RenderFrame())
FlipBuffers()