Why everything is drawn on the Debugwindow

Just starting out? Need help? Post your questions and find answers here.
FetzMR
Posts: 2
Joined: Mon Dec 27, 2021 9:19 pm

Why everything is drawn on the Debugwindow

Post 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()
  
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Why everything is drawn on the Debugwindow

Post by Peter »

If you use a gadget (here: ImageGadget()), then you must use OpenWindow() and OpenWindowedScreen().

See also: SpiderBasic - Screen
FetzMR
Posts: 2
Joined: Mon Dec 27, 2021 9:19 pm

Re: Why everything is drawn on the Debugwindow

Post 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().
User avatar
Paul
Posts: 195
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Why everything is drawn on the Debugwindow

Post 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()
Post Reply