Created on 14th April 2007 EsseEmmeErreSoftwareSolutions.jpg Updated on 24th March 2008

My first (running!) PureBasic program for AMIGA

;-> PrimaFinestra by Stefano Maria
;d> 4 gennaio 2007 da Window.pb
;m> 7 marzo 2007
;m> 10,14 aprile 2007
;---------------------
#PrimaFinestra=0
#TipoFinestra=#WFLG_CLOSEGADGET+#WFLG_ACTIVATE+#WFLG_WBENCHWINDOW+#WFLG_GIMMEZEROZERO
#SchermoWorkbench=0
TitoloSchermoWorkbench$="My first PureBasic try!"
TitoloPrimaFinestra$="My Window!"
WBStartup()
InitScreen(1)
FindScreen(#SchermoWorkbench,"Workbench")
XLunSchermoWorkbench.w=ScreenWidth()
YLunSchermoWorkbench.w=ScreenHeight()
XLunPrimaFin.w=XLunSchermoWorkbench/4
YLunPrimaFin.w=YLunSchermoWorkbench/4
XPosPrimaFin.w=(XLunSchermoWorkbench-XLunPrimaFin)/2
YPosPrimaFin.w=(YLunSchermoWorkbench-YLunPrimaFin)/2
ListaParametri.l=InitTagList(3)
ResetTagList(#WA_DetailPen,2)
ResetTagList(#WA_BlockPen,3)
ResetTagList(#WA_ScreenTitle,TitoloSchermoWorkbench$)
SetWindowTagList(ListaParametri)
If OpenWindow(#PrimaFinestra,XPosPrimaFin,YPosPrimaFin,XLunPrimaFin,YLunPrimaFin,#TipoFinestra,TitoloPrimaFinestra$)
 XLunPrimaFin=WindowWidth()
 YLunPrimaFin=WindowHeight()
 DrawingOutput(WindowRastPort())
 FrontColour(1):BackColour(0)
 Locate(0,0):PrintText("WBXLen="+Str(XLunSchermoWorkbench))
 Locate(0,8):PrintText("WBYLen="+Str(YLunSchermoWorkbench))
 Locate(0,16):PrintText("MyWinXLen="+Str(XLunPrimaFin))
 Locate(0,24):PrintText("MyWinYLen="+Str(YLunPrimaFin))
 Locate(0,32):PrintText("Press LeftMB...")
 MouseWait()
 Cls(0)
 FineDelProgramma.b=False:XIncPrimaFin.b=1:YIncPrimaFin.b=1
 Repeat
  If XPosPrimaFin+XLunPrimaFin=XLunSchermoWorkbench
   XIncPrimaFin=-1
  EndIf
  If XPosPrimaFin=0
   XIncPrimaFin=1
  EndIf
  XPosPrimaFin+XIncPrimaFin
  If YPosPrimaFin+YLunPrimaFin=YLunSchermoWorkbench
   YIncPrimaFin=-1
  EndIf
  If YPosPrimaFin=0
   YIncPrimaFin=1
  EndIf
  YPosPrimaFin+YIncPrimaFin
  MoveWindow(XPosPrimaFin,YPosPrimaFin)
  Locate(0,0)
  PrintText(Str(XPosPrimaFin))
  PrintText("-")
  PrintText(Str(XPosPrimaFin+XLunPrimaFin-1))
  PrintTextN(" ")
  Locate(0,8)
  PrintText(Str(YPosPrimaFin))
  PrintText("-")
  PrintText(Str(YPosPrimaFin+YLunPrimaFin-1))
  PrintText(" ")
  Repeat
   Delay(5)
   EventoPrimaFinestra.l=WindowEvent()
  Until EventoPrimaFinestra>0
 Until EventoPrimaFinestra=#IDCMP_CLOSEWINDOW
EndIf
CloseWindow(#PrimaFinestra)
End