Found an issue in SpiderBasic ? Please report it here !
tj1010
 
Posts: 186
Joined: Wed May 27, 2015 1:36 pm

Debug window breaks #PB_Window_Background

by tj1010 Tue Apr 11, 2017 6:37 pm

#PB_Window_Background seems to have a layout bug when debug output is to the right of the window while vertical orientation after coming from landscape. You can actually drag it left to fix it. In landscape if you drag it far enough right it zooms the window..

Built on up to date W10 64bit Pro using JDK 1.8.0.121, Android 5.1.1

Code: Select all
Declare drawspecs()
Declare timer()
Declare.l RDesktopHeight()
Declare.l RDesktopWidth()
Global width.l
Global height.l
Global accell.l
Global geol.l
accell=StartAccelerometer(3000)
geol=StartGeolocation()

If OpenWindow(0,0,0,RDesktopWidth(),RDesktopHeight(),"",#PB_Window_Background)
  CanvasGadget(0,0,0,WindowWidth(0),WindowHeight(0),#PB_Canvas_Keyboard)
  AddWindowTimer(0,33,2000)
  BindEvent(#PB_Event_Timer,@timer())
  drawspecs()
EndIf

Procedure timer()
  If EventTimer()=33
    If RDesktopWidth()<>width Or RDesktopHeight()<>height
      width=RDesktopWidth()
      height=RDesktopHeight()
      ResizeGadget(0,0,0,width,height)
      drawspecs()
    EndIf
  EndIf
EndProcedure

;draw HTTP GET results
Procedure httpevent(Success, Result$, UserData)
  Protected draw.l
  draw=StartDrawing(CanvasOutput(0))
  DrawingMode(#PB_2DDrawing_Transparent)
  If Success
    DrawText(1,65,"Network: Connected",RGB(255,255,255))
  Else
    DrawText(1,65,"Network: Disconnected",RGB(255,255,255))
  EndIf
  If draw : StopDrawing() : EndIf
EndProcedure

;draw some data
Procedure drawspecs()
  Protected aspect$
  ;get aspect/rotation
  If RDesktopWidth()>RDesktopHeight()
    aspect$="Landscape"
  Else
    aspect$="Verticle"
  EndIf
  StartDrawing(CanvasOutput(0))
  DrawingMode(#PB_2DDrawing_Transparent)
  Box(0,0,WindowWidth(0),WindowHeight(0),RGB(0,0,0))
  ;draw resolution
  DrawText(1,1,"Resolution: "+Str(RDesktopWidth())+"x"+Str(RDesktopHeight()),RGB(255,255,255))
  ;draw aspect/rotation
  DrawText(1,33,"Aspect: "+aspect$,RGB(255,255,255))
  ;draw accelerometer sensor data
  If accell<>0
    DrawText(1,97,"Accelorometer X: "+AccelerometerX(),RGB(255,255,255))
    DrawText(1,129,"Accelorometer Y: "+AccelerometerY(),RGB(255,255,255))
    DrawText(1,161,"Accelorometer Z: "+AccelerometerZ(),RGB(255,255,255))
    DrawText(1,193,"Accelorometer Time: "+AccelerometerTime(),RGB(255,255,255))
  Else
    DrawText(1,97,"Accelorometer: N/A",RGB(255,255,255))
  EndIf
  ;draw gps chip data
  If geol<>0
    DrawText(1,225,"GPS Long: "+GeolocationLongitude(),RGB(255,255,255))
    DrawText(1,257,"GPS Lat: "+GeolocationLatitude(),RGB(255,255,255))
    DrawText(1,289,"GPS Alt: "+GeolocationAltitude(),RGB(255,255,255))
    DrawText(1,321,"GPS Deg: "+GeolocationHeading(),RGB(255,255,255))
    DrawText(1,353,"GPS Speed: "+GeolocationSpeed(),RGB(255,255,255))
  Else
    DrawText(1,225,"GPS: N/A",RGB(255,255,255))
  EndIf
  StopDrawing()
  HTTPRequest(#PB_HTTP_Get,"https://www.google.com","",@httpevent())
EndProcedure

;real width
Procedure.l RDesktopWidth()
  Protected pixels.f
  EnableJS
  v_pixels=window.devicePixelRatio.toPrecision(21);
  DisableJS
  ExamineDesktops()
  ProcedureReturn Val(StrF(pixels * ValF(Str(DesktopWidth(0)))))
EndProcedure

;real height
Procedure.l RDesktopHeight()
  Protected pixels.f
  EnableJS
  v_pixels=window.devicePixelRatio.toPrecision(21);
  DisableJS
  ExamineDesktops()
  ProcedureReturn Val(StrF(pixels * ValF(Str(DesktopHeight(0)))))
EndProcedure
Return to Bugs Reports

Who is online

Users browsing this forum: No registered users and 1 guest