You might want to use canvas's instead It will be more adaptable
Can anyone compile this for Mac or Lynx? Can you send me a copy? No changes please, just for my work (b)log
Can anyone compile this for Mac or Lynx? Can you send me a copy? No changes please, just for my work (b)log
Framework BRL.Win32MaxGUI Import BRL.FreeAudioAudio Import BRL.Retro Import BRL.Timer Import BRL.EventQueue Global Total_scans:Long,ts2:Int,ts3:Int Global Paddle:TGadget[2] Global Canvas:TGadget[2] Global Ssound:Float Global Sound_on:Int Global Ball:TGadget Global BExit:TGadget Global y:Int[2] Global Pdy:Float Global bx:Float,by:Float Global xpseed:Float=5.0 Global dx:Float=4.0,dy:Float=4.0 Global dw:Int = GadgetWidth( Desktop() ) Global dh:Int = GadgetHeight( Desktop() ) y[0]=50 y[1]=dh-200 bx=dw/2 by=dh/2 fr=10000 Global sample:TAudioSample=CreateAudioSample( 32,fr,SF_MONO8 ) For k=0 Until 32 f=0 If k>15 Then f=127 sample.samples[k]=f ''Sin(k*360/32)*127.5+127.5 Next Global sound:TSound=LoadSound( sample,True ) Global Sound_channel=CueSound(sound) SetChannelVolume sound_channel,0.2 AppTitle$="Cannot Run Application" Type TApplet Method OnEvent(Event:TEvent) Abstract Method New() AddHook EmitEventHook,eventhook,Self End Method Function eventhook:Object(id,data:Object,context:Object) Local event:TEvent Local app:TApplet event=TEvent(data) app=TApplet(context) app.OnEvent event End Function End Type Type CheckApplet Extends TApplet Field timer:TTimer Method OnEvent(Event:TEvent) Select event.id Case EVENT_GADGETACTION Select Event.Source Case BExit End End Select Case EVENT_WINDOWCLOSE End Case EVENT_TIMERTICK bx:+dx by:+dy If sound_on=True If MilliSecs()-100.0 > Ssound PauseChannel Sound_channel EndIf EndIf If bx<50 dx=xpseed ResumeChannel sound_channel Ssound=MilliSecs() Sound_on=True EndIf If bx>dw-70 dx=0.0-xpseed ResumeChannel sound_channel Ssound=MilliSecs() Sound_on=True EndIf If by<15 dy=0.0-dy ResumeChannel sound_channel Ssound=MilliSecs() Sound_on=True EndIf If by>dh-72 dy=0.0-dy ResumeChannel sound_channel Ssound=MilliSecs() Sound_on=True EndIf For i=0 To 1 If by>y[i] If dx>0.0 If i=0 Then Pdy=1.0 Else Pdy=5.0 If i=1 Then Pdy=5.0 Else Pdy=1.0 EndIf If dx<0.0 If i=1 Then Pdy=1.0 Else Pdy=5.0 If i=0 Then Pdy=5.0 Else Pdy=1.0 EndIf Else If dx>0.0 If i=0 Then Pdy=-1.0 Else Pdy=-5.0 If i=1 Then Pdy=-5.0 Else Pdy=-1.0 EndIf If dx<0.0 If i=1 Then Pdy=-1.0 Else Pdy=-5.0 If i=0 Then Pdy=-5.0 Else Pdy=-1.0 EndIf EndIf y[i]:+Pdy Next SetGadgetShape(Paddle[0],30,y[0]-50,20,100) SetGadgetShape(Paddle[1],dw-50,y[1]-50,20,100) SetGadgetShape(Ball,bx,by,20,20) ts2:+1 ts2:&7 End Select If ts2=1 ts2=2 ts3:+1 ts3:&15 If ts3<8 SetGadgetText(textareax,"Pong "+Left$(" ",ts3)+"+"+Right$(" ",7-ts3)+" Pong") EndIf If ts3>7 SetGadgetText(textareax,"Pong "+Left$(" ",7-(ts3-8))+"+"+Right$(" ",ts3-8)+" Pong") EndIf EndIf End Method Method Create:CheckApplet() Local a:TApplet timer=CreateTimer(100) Return Self End Method End Type Local system_check_hook:CheckApplet system_check_hook=New CheckApplet.Create() Global Tool:TGadget=CreateWindow("", Dw-170,20,88,41,,WINDOW_TOOL) Global linetop:TGadget=CreateWindow("", 10,12,dw-20,8,tool,WINDOW_TOOL) Global linemiddle:TGadget=CreateWindow("", Dw/2,12,8,dh-55,tool,WINDOW_TOOL) Global linebottom:TGadget=CreateWindow("",10,dh-50,dw-20,8,tool,WINDOW_TOOL) BExit=CreateButton("Exit",0,21,88,20,tool,BUTTON_OK) Global textareax=CreateTextArea(0-2,0-2,150,32,Tool) SetGadgetLayout textareax,1,1,1,1 SetTextAreaText textareax,Null SetGadgetColor(textareax,0,85,229) paddle[0]=CreateWindow("", 30,y[0]-50, 20,100,,WINDOW_TOOL) Global textareaa=CreateTextArea(0-2,0-2,30,120,paddle[0]) SetGadgetLayout textareaa,1,1,1,1 SetTextAreaText textareaa,Null SetGadgetColor(textareaa,0,255,0) paddle[1]=CreateWindow("", dw-50,y[1]-25, 20,100,,WINDOW_TOOL) Global textareab=CreateTextArea(0-2,0-2,30,120,paddle[1]) SetGadgetLayout textareab,1,1,1,1 SetTextAreaText textareab,Null SetGadgetColor(textareab,255,0,0) ball=CreateWindow("", bx-10,by-10, 20,20,,WINDOW_TOOL) ShowGadget(Tool) Repeat WaitSystem() Forever