And absolutely simple 9 minute code project that uses the Magic 8 Ball idea but with a screwed up emo twist!
Code: Select all
; ***************************************
; ** EMO BALL 1.0 **
; * With extreme thanks to Kaeru Gaman! *
; * (he heled me make is shake!!! ) *
; ** (c) 2009 Ralph W Dunn **
; ***************************************
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Image_0
#Text_0
#Button_SHAKE
EndEnumeration
;- Fonts
Define.l Shaker, EXIT
Define.l WinX, WinY
Define.i Event, EvGad
Global FontID1
FontID1=LoadFont(1, "Arial", 10, #PB_Font_Bold)
;- Image Plugins
Global Dim whine$(18)
whine$(0) = "Like I care..."
whine$(1) = "42"
whine$(2) = "Your village called, they miss their idiot and want you BACK!"
whine$(3) = "Whatever!"
whine$(4) = "WTF!, OMG!, Um... what was the question?"
whine$(5) = "You are really creeping me out so... NO!"
whine$(6) = "Absolutely.. Positivley... MAYBE!"
whine$(7) = "Oh GIVE IT UP!!!"
whine$(8) = "Didn't I tell you NO already?"
whine$(9) = "Signs point to: FORGETABOUTIT!!!"
whine$(10) = "OK! (like I care...)"
whine$(11) = "SURE (Whatever bakes your brownies!)"
whine$(12) = "Ask me l8r when I have had my nap!"
whine$(13) = "QUIT BOTHERING ME... I don't know!"
whine$(14) = "I don't know... I make this crap up!"
whine$(15) = "YES, now quit whining!"
whine$(16) = "YOU DON'T UNDERSTAND... NOBODY DOES!!!"
whine$(17) = "I need a popsicle before I answer that!"
whine$(18) = "You are Skanky Twisted!!!"
UseJPEGImageDecoder()
;- Image Globals
Global Image0
;- Catch Images
Image0=CatchImage(0, ?Image0)
;- Images
DataSection
Image0 :
IncludeBinary "MEB001.jpg"
EndDataSection
Procedure Open_Window_0()
If OpenWindow(#Window_0, 254, 87, 440, 533, "MAGIC EMO BALL 0.1a", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
;WindowBounds(0, 200, 200, 400, 400)
ImageGadget(#Image_0, 10, 10, 420, 420, Image0, #PB_Image_Border)
TextGadget(#Text_0, 10, 440, 420, 30, "Ask your question and then click SHAKE THE BALL!", #PB_Text_Center | #PB_Text_Border)
SetGadgetFont(#Text_0, FontID1)
ButtonGadget(#Button_SHAKE, 10, 480, 420, 50, "ASK YOUR QUESTION and SHAKE THE BALL")
EndIf
EndProcedure
Open_Window_0()
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #Button_SHAKE
Shaker = 100
WinX = WindowX(0)
WinY = WindowY(0)
pickit = Random(18)
reply$ = whine$(pickit)
SetGadgetText(#Text_0, reply$)
EndIf
EndIf
If Shaker > 1
ResizeWindow( 0, WinX + Random(10) -5, WinY + Random(10) -5, #PB_Ignore,#PB_Ignore )
Shaker -1
ElseIf Shaker = 1
ResizeWindow( 0, WinX, WinY, #PB_Ignore,#PB_Ignore )
Shaker = 0
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;
Thanks Kaeru and Idle that showed me great ways to shake a window in a nother thread!!!