'11/12/2024

% WindowStyle WS_POPUP
% ScaleUp
'% WindowOpacity 244
int width=640
int height=640
uses consoleG
BeginScript
procedure main()
================
  cls 0.1,0.1,0.2,0.5
  if bleft
    'MOVE AND RESIZE WINDOW
    static int bf
    static POINT sp,ep
    static RECT r,c
    GetCursorPos ep
    if bf=0
      GetWindowRect gwnd,r
      GetClientRect gwnd,c
      static int wx,wy
      wx=r.right-r.left
      wy=r.bottom-r.top
      sp=ep
      static int wf
      if mposy<25
        wf=1
      endif
      if c.right-mposx<25
        if c.right-mposx<25
          wf=2
        endif
      endif
      bf=1
    endif
    int rx,ry
    rx=ep.x-sp.x
    ry=ep.y-sp.y
    'MOVE WINDOW
    if wf=1
      MoveWindow gwnd , r.left+rx , r.top+ry , wx , wy , TRUE
    endif
    'RESIZE WINDOW
    if wf=2
      int sx=wx+ep.x-sp.x
      int sy=wy+ep.y-sp.y
      MoveWindow gwnd , r.left , r.top , sx , sy , TRUE
    endif
  else 'not bleft
    bf=0
    wf=0
  endif 'bleft
  '
  RECT t
  GetWindowRect gwnd,t
  'GetClientRect crect
  'aspect=crect.right/crect.bottom 'WIDTH/HEIGHT
  'setPerspective
  glpushmatrix
  'lock scaling
  scale width/crect.right*aspect, height/crect.bottom,0.0
  glpushmatrix
  '
  'BACKDROP
  color 0,.2,.7
  glbegin GL_QUADS
  float d=1
  glvertex3f -10,-.5,-d
  glvertex3f 100,-.5,-d
  glvertex3f 100,2,-d
  glvertex3f -10,2,-d
  glend
  '
  'MENU BUTTON
  pushstate
  shading
  color .8,.8,.0
  move .25,.25
  scale 0.5
  picklabel 1000
  go sphere
  picklabel 0
  popstate
  '
  'TITLE
  flat
  move 0.5
  'scale 1.25
  color .99,.8,.4,.99
  move 1.0
  print "Custom Window Demo"
  scale 0.8
  glpopmatrix
  '
  'EXAMPLE DATA
  move 0,-2
  color .99,.70,.10,.99
  print t.left "  " t.top "  " t.right "  " t.bottom
  glpopmatrix
end procedure
EndScript
