November 28, 2020, 02:01:19 PM

Author Topic: [bb] Types for newbies by Filax [ 1+ years ago ]  (Read 383 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Types for newbies by Filax [ 1+ years ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : Types for newbies
Author : Filax
Posted : 1+ years ago

Description : How make simple windows using types

Code :
Code: BlitzBasic
  1. Graphics3D 640,480,32,2
  2. SetBuffer BackBuffer()
  3.  
  4. Global Name$
  5.  
  6. Type OpenWindow
  7.         Field Px
  8.         Field Py
  9.         Field Tx
  10.         Field Ty
  11. End Type
  12.  
  13. Procedure_OpenWindow(50,50,300,200)
  14. Procedure_OpenWindow(150,300,200,150)
  15. Procedure_OpenWindow(250,200,200,50)
  16.  
  17. While KeyDown(1)<>1
  18.         Procedure_RefreshWindow()
  19.         Flip
  20. Wend
  21.  
  22.  
  23. Function Procedure_OpenWindow(Px,Py,Tx,Ty)
  24.         Gui.OpenWindow=New OpenWindow
  25.         GuiPx=Px
  26.         GuiPy=Py
  27.         GuiTx=Tx
  28.         GuiTy=Ty
  29.  
  30.         Procedure_DrawWindow(GuiPx,GuiPy,GuiTx,GuiTy)
  31. End Function
  32.  
  33. Function Procedure_DrawWindow(Px,Py,Tx,Ty)
  34.         Color 100,100,100
  35.         Rect Px,Py,Tx,Ty,1
  36.        
  37.         Color 19,66,117
  38.         Rect Px,Py,Tx,20,1
  39.        
  40.         Procedure_DrawCloseGadget(Px+Tx-17,Py+3,0)
  41.        
  42.         Color 200,200,200
  43.         Line Px,Py,Px+Tx,Py
  44.         Line Px,Py,Px,Py+Ty
  45.        
  46.         Color 50,50,50
  47.         Line Px+Tx,Py,Px+Tx,Py+Ty
  48.         Line Px,Py+Ty,Px+Tx,Py+Ty
  49. End Function
  50.  
  51. Function Procedure_DrawCloseGadget(Px,Py,Flag)
  52.         If Flag=0 Then
  53.                 Color 100,10,10
  54.                 Rect Px,Py,15,15,1
  55.         EndIf
  56.        
  57.         If Flag=1 Then
  58.                 Color 10,10,100
  59.                 Rect Px,Py,15,15,1
  60.         EndIf
  61. End Function
  62.  
  63. Function Procedure_RefreshWindow()
  64.         For Gui.OpenWindow = Each OpenWindow
  65.                 Procedure_DrawWindow(GuiPx,GuiPy,GuiTx,GuiTy)
  66.                
  67.                 If MouseX()>GuiPx+GuiTx-17 And MouseX()<GuiPx +GuiTx-2 And MouseY()>GuiPy+3 And MouseY()<GuiPy+18 And MouseDown(1)=1           
  68.                         Procedure_DrawCloseGadget(GuiPx+GuiTx-17,GuiPy+3,1):Flip :Cls
  69.                        
  70.                         While MouseDown(1)=1
  71.                         Wend
  72.                        
  73.                          Delete Gui
  74.                 EndIf
  75.         Next
  76. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal