Page 1 of 1

2DDrawing Box

Posted: Wed Apr 30, 2025 8:32 am
by rndrei
How to draw an unnecessary square?
You can draw lines, but I think maybe there is a built -in solution?

Code: Select all

#canvas=1
If Not OpenWindow(0, 0, 0, 1900, 900, "Gadget BOX", #PB_Window_SystemMenu)
   End
EndIf
CanvasGadget(#canvas, 0, 0, 1000, 900)  
If StartDrawing(CanvasOutput(#canvas))
    Box(0,0,100,200,#Black) 
    StopDrawing()
EndIf
Repeat 
   Gadget = EventGadget()
Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: 2DDrawing Box

Posted: Wed Apr 30, 2025 8:37 am
by jacdelad

Code: Select all

DrawingMode(#PB_2DDrawing_Outlined)

Re: 2DDrawing Box

Posted: Wed Apr 30, 2025 8:40 am
by miso

Code: Select all

#canvas=1
If Not OpenWindow(0, 0, 0, 1900, 900, "Gadget BOX", #PB_Window_SystemMenu)
   End
EndIf
CanvasGadget(#canvas, 0, 0, 1000, 900)  
If StartDrawing(CanvasOutput(#canvas))
  Box(0,0,100,200,#Black) 
  Box(10,10,80,180,#White)
  StopDrawing()
EndIf

If StartDrawing(CanvasOutput(#canvas))
  DrawingMode(#PB_2DDrawing_Outlined)
  Box(300,300,100,200,#Black) 
  StopDrawing()
EndIf

Repeat 
   Gadget = EventGadget()
Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: 2DDrawing Box

Posted: Wed Apr 30, 2025 8:54 am
by threedslider

Code: Select all

#canvas=1
If Not OpenWindow(0, 0, 0, 1900, 900, "Gadget BOX", #PB_Window_SystemMenu)
   End
EndIf
CanvasGadget(#canvas, 0, 0, 1000, 900)  
If StartDrawing(CanvasOutput(#canvas))
  ;Box(0,0,100,200,#Black) 
  For y=0 To 200
    For x=0 To 100
      If y = 0
        Plot(x+50, y+50, #Black)
      ElseIf y <= 200 And x=0
        Plot(x+50, y+50, #Black)
      ElseIf y<= 200 And x=100
        Plot(x+50, y+50, #Black)
      ElseIf y=200
        Plot(x+50, y+50, #Black)
      EndIf      
    Next
  Next
  
  StopDrawing()
EndIf
Repeat 
   Gadget = EventGadget()
Until WaitWindowEvent() = #PB_Event_CloseWindow
I make the extra position for seeing the box in lines :)