Advertisement
OgreVorbis

PB Image Button

Mar 18th, 2024
1,097
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; This code is automatically generated by the FormDesigner.
  3. ; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
  4. ; Event procedures needs to be put in another source file.
  5. ;
  6.  
  7. Global Window_0
  8.  
  9. Global ButtonImage_0, RenderedImage_0, ImgGadget_0, ButtonImage_1, ImgGadget_1, RenderedImage_1
  10.  
  11. #BtnTxtString1 = "Testing 1"
  12. #BtnTxtString2 = "Testing 2"
  13.  
  14. UsePNGImageDecoder()
  15.  
  16. RenderedImage_0 = CreateImage(#PB_Any, 128, 32, 32, #PB_Image_Transparent)
  17. RenderedImage_1 = CreateImage(#PB_Any, 128, 32, 32, #PB_Image_Transparent)
  18. ButtonImage_0 = CatchImage(#PB_Any, ?ChkImage, ?XImage - ?ChkImage)
  19. ButtonImage_1 = CatchImage(#PB_Any, ?XImage, ?EndPtr - ?XImage)
  20.  
  21.  
  22. Procedure DrawGoodlyButton(rndImg, btnImg, txtCaption.s)
  23.     If StartDrawing(ImageOutput(rndImg))
  24.         DrawingMode(#PB_2DDrawing_AlphaBlend | #PB_2DDrawing_Transparent)
  25.         ;DrawingFont(FontID(#Font_Window_0_0))
  26.         DrawAlphaImage(ImageID(btnImg), 0, 0)
  27.         DrawText(ImageWidth(btnImg) + 5, (ImageHeight(btnImg) / 2) - (TextHeight(txtCaption) / 2), txtCaption, RGBA(0, 0, 0, 255))
  28.         StopDrawing()
  29.   EndIf
  30. EndProcedure
  31.  
  32. Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  33.   Window_0 = OpenWindow(#PB_Any, x, y, width, height, "Testing Native Graphic Buttons", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  34.   DrawGoodlyButton(RenderedImage_0, ButtonImage_0, #BtnTxtString1)
  35.   DrawGoodlyButton(RenderedImage_1, ButtonImage_1, #BtnTxtString2)
  36.   ImgGadget_0 = ButtonImageGadget(#PB_Any, 320, 260, 160, 60, ImageID(RenderedImage_0))
  37.   ImgGadget_1 = ButtonImageGadget(#PB_Any, 240, 170, 128, 32, ImageID(RenderedImage_1))
  38. EndProcedure
  39.  
  40. Procedure Window_0_Events(event)
  41.   Select event
  42.     Case #PB_Event_CloseWindow
  43.       ProcedureReturn #False
  44.  
  45.     Case #PB_Event_Menu
  46.       Select EventMenu()
  47.       EndSelect
  48.  
  49.     Case #PB_Event_Gadget
  50.       Select EventGadget()
  51.       EndSelect
  52.   EndSelect
  53.   ProcedureReturn #True
  54. EndProcedure
  55.  
  56. OpenWindow_0()
  57.  
  58. Repeat
  59.     Event = WaitWindowEvent(100)
  60.    
  61.     Window_0_Events(Event)
  62. Until Event = #PB_Event_CloseWindow
  63.  
  64. DataSection
  65. ChkImage:
  66. Data.b $89,$50,$4E,$47,$0D,$0A,$1A,$0A,$00,$00,$00,$0D,$49,$48,$44,$52
  67. Data.b $00,$00,$00,$20,$00,$00,$00,$20,$08,$06,$00,$00,$00,$73,$7A,$7A
  68. Data.b $F4,$00,$00,$00,$01,$73,$52,$47,$42,$00,$AE,$CE,$1C,$E9,$00,$00
  69. Data.b $00,$04,$67,$41,$4D,$41,$00,$00,$B1,$8F,$0B,$FC,$61,$05,$00,$00
  70. Data.b $00,$09,$70,$48,$59,$73,$00,$00,$0E,$C3,$00,$00,$0E,$C3,$01,$C7
  71. Data.b $6F,$A8,$64,$00,$00,$01,$0B,$49,$44,$41,$54,$58,$47,$E5,$96,$D1
  72. Data.b $0E,$83,$20,$0C,$45,$61,$3F,$8E,$7C,$79,$C7,$65,$E8,$10,$2B,$50
  73. Data.b $6D,$63,$B2,$9D,$8C,$E8,$1E,$D6,$73,$AD,$95,$E9,$89,$C8,$3D,$C9
  74. Data.b $AB,$1C,$1F,$E3,$F7,$03,$78,$E7,$29,$AF,$E8,$D9,$7B,$6D,$3A,$03
  75. Data.b $10,$E7,$93,$98,$D6,$B2,$E0,$93,$09,$21,$F8,$CF,$99,$61,$07,$76
  76. Data.b $F2,$0E,$26,$01,$66,$E5,$40,$3D,$00,$2B,$5F,$7B,$CF,$A0,$1A,$A0
  77. Data.b $27,$3F,$CB,$A0,$16,$E0,$8A,$1C,$A8,$04,$90,$C8,$EB,$27,$00,$B0
  78. Data.b $01,$50,$70,$B7,$4E,$9E,$61,$70,$47,$0E,$D8,$7D,$20,$17,$6D,$0A
  79. Data.b $12,$31,$3F,$BE,$29,$07,$87,$0E,$6C,$45,$1B,$62,$8C,$84,$55,$BE
  80. Data.b $F2,$F2,$C2,$AC,$1C,$F0,$33,$C0,$14,$AD,$39,$95,$B7,$E6,$44,$4F
  81. Data.b $0E,$C4,$43,$38,$92,$D7,$19,$46,$72,$20,$0A,$B0,$84,$52,$7D,$42
  82. Data.b $3E,$CB,$61,$08,$F3,$15,$72,$B7,$20,$94,$E3,$A4,$7C,$E6,$EA,$C1
  83. Data.b $7C,$00,$8E,$9B,$72,$20,$9E,$81,$0D,$05,$39,$B8,$16,$40,$49,$0E
  84. Data.b $E4,$01,$14,$E5,$40,$16,$40,$59,$0E,$0E,$01,$C8,$A5,$ED,$7F,$9D
  85. Data.b $F8,$1A,$03,$39,$60,$3B,$90,$43,$D4,$26,$23,$39,$E8,$BE,$94,$7A
  86. Data.b $FF,$DD,$FB,$2D,$E4,$60,$F8,$56,$5C,$FF,$01,$AD,$68,$C9,$C1,$70
  87. Data.b $08,$5B,$99,$A6,$1C,$0C,$3B,$60,$8D,$7C,$1F,$50,$E6,$DF,$03,$38
  88. Data.b $F7,$06,$2E,$CD,$8E,$A8,$CB,$01,$14,$B6,$00,$00,$00,$00,$49,$45
  89. Data.b $4E,$44,$AE,$42,$60,$82
  90.  
  91. XImage:
  92. Data.b $89,$50,$4E,$47,$0D,$0A,$1A,$0A,$00,$00,$00,$0D,$49,$48,$44,$52
  93. Data.b $00,$00,$00,$20,$00,$00,$00,$20,$08,$06,$00,$00,$00,$73,$7A,$7A
  94. Data.b $F4,$00,$00,$00,$01,$73,$52,$47,$42,$00,$AE,$CE,$1C,$E9,$00,$00
  95. Data.b $00,$04,$67,$41,$4D,$41,$00,$00,$B1,$8F,$0B,$FC,$61,$05,$00,$00
  96. Data.b $00,$09,$70,$48,$59,$73,$00,$00,$0E,$C3,$00,$00,$0E,$C3,$01,$C7
  97. Data.b $6F,$A8,$64,$00,$00,$01,$4D,$49,$44,$41,$54,$58,$47,$ED,$96,$E1
  98. Data.b $8E,$84,$20,$0C,$84,$E1,$5E,$1C,$79,$72,$96,$D9,$85,$4B,$ED,$52
  99. Data.b $3A,$DD,$3D,$E3,$9F,$FB,$12,$A3,$26,$38,$33,$54,$8A,$E6,$D6,$5A
  100. Data.b $BA,$93,$9F,$71,$BE,$8D,$FF,$00,$D7,$04,$C8,$B9,$3D,$0F,$02,$7F
  101. Data.b $11,$4A,$A1,$D6,$F2,$B8,$B2,$19,$E3,$EB,$F3,$26,$A5,$E2,$3C,$63
  102. Data.b $57,$40,$CC,$02,$62,$38,$B2,$37,$2B,$65,$0E,$BC,$67,$EC,$00,$23
  103. Data.b $B9,$14,$03,$B5,$D6,$B5,$E0,$C2,$FC,$18,$67,$F3,$99,$4E,$68,$0D
  104. Data.b $40,$F0,$38,$8E,$77,$C1,$8D,$39,$C6,$03,$2B,$C4,$3E,$40,$AF,$42
  105. Data.b $19,$97,$26,$84,$F9,$8E,$70,$17,$9C,$AA,$10,$30,$2F,$A5,$2C,$17
  106. Data.b $23,$B7,$15,$77,$23,$BD,$16,$66,$65,$BE,$31,$07,$E1,$0A,$4C,$60
  107. Data.b $AC,$43,$81,$88,$39,$E0,$02,$10,$6B,$E1,$6C,$FB,$C2,$33,$07,$1F
  108. Data.b $57,$40,$B2,$2A,$3D,$63,$0E,$FE,$24,$00,$D0,$A5,$67,$E1,$02,$8C
  109. Data.b $D5,$CE,$C2,$CE,$1E,$F8,$01,$16,$AD,$A6,$C1,$DC,$67,$05,$22,$E6
  110. Data.b $60,$DF,$86,$84,$B9,$04,$11,$BA,$5E,$28,$80,$5D,$81,$A0,$39,$40
  111. Data.b $00,$F7,$83,$A5,$D8,$BE,$82,$65,$9F,$8F,$C3,$22,$1A,$62,$1D,$C0
  112. Data.b $10,$98,$C6,$78,$DF,$DE,$BE,$C0,$86,$30,$2B,$A0,$67,$2F,$CD,$41
  113. Data.b $35,$42,$C8,$71,$BB,$CF,$F0,$C4,$EF,$82,$8E,$36,$FF,$45,$ED,$90
  114. Data.b $AB,$71,$5E,$08,$2A,$00,$D0,$E6,$BA,$DD,$AC,$90,$5E,$5B,$BA,$01
  115. Data.b $CE,$72,$2F,$4E,$A2,$A2,$0A,$51,$73,$B0,$DD,$07,$E6,$42,$92,$C2
  116. Data.b $96,$A8,$2E,$35,$63,$0E,$B6,$01,$56,$EF,$6F,$27,$3C,$C7,$B3,$E6
  117. Data.b $80,$FA,$21,$F9,$44,$98,$85,$FB,$23,$BA,$10,$BA,$0B,$AE,$E2,$E6
  118. Data.b $00,$29,$3D,$00,$51,$D5,$A9,$B6,$7A,$BC,$6F,$57,$00,$00,$00,$00
  119. Data.b $49,$45,$4E,$44,$AE,$42,$60,$82
  120.  
  121. EndPtr:
  122. EndDataSection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement