package kc.jeu;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.debug.*;

public class main extends javafx.application.Application{
public static main mostCurrent = new main();

public static BA ba;
static {
		ba = new  anywheresoftware.b4j.objects.FxBA("kc.jeu", "kc.jeu.main", null);
		ba.loadHtSubs(main.class);
        if (ba.getClass().getName().endsWith("ShellBA")) {
			
			ba.raiseEvent2(null, true, "SHELL", false);
			ba.raiseEvent2(null, true, "CREATE", true, "kc.jeu.main", ba);
		}
	}
    public static Class<?> getObject() {
		return main.class;
	}

 
    public static void main(String[] args) {
    	launch(args);
    }
    public void start (javafx.stage.Stage stage) {
        try {
            if (!false)
                System.setProperty("prism.lcdtext", "false");
            anywheresoftware.b4j.objects.FxBA.application = this;
		    anywheresoftware.b4a.keywords.Common.setDensity(javafx.stage.Screen.getPrimary().getDpi());
            anywheresoftware.b4a.keywords.Common.LogDebug("Program started.");
            initializeProcessGlobals();
            anywheresoftware.b4j.objects.Form frm = new anywheresoftware.b4j.objects.Form();
            frm.initWithStage(ba, stage, 900, 600);
            ba.raiseEvent(null, "appstart", frm, (String[])getParameters().getRaw().toArray(new String[0]));
        } catch (Throwable t) {
            BA.printException(t, true);
            System.exit(1);
        }
    }
public static anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4j.objects.JFX _fx = null;
public static anywheresoftware.b4j.objects.Form _mainform = null;
public static anywheresoftware.b4j.objects.ButtonWrapper _btnstart = null;
public static anywheresoftware.b4j.objects.CanvasWrapper _cvsgame = null;
public static anywheresoftware.b4j.objects.PaneWrapper.ConcretePaneWrapper _pnlracket = null;
public static anywheresoftware.b4j.objects.SliderWrapper _sldspeed = null;
public static anywheresoftware.b4j.objects.SliderWrapper _sldracketheight = null;
public static anywheresoftware.b4j.objects.LabelWrapper _lblcounter = null;
public static anywheresoftware.b4j.objects.LabelWrapper _lblspeed = null;
public static anywheresoftware.b4j.objects.LabelWrapper _lblracketheight = null;
public static kc.jeu.callsubutils _csu = null;
public static anywheresoftware.b4a.objects.Timer _tmrball = null;
public static double _racketleft = 0;
public static double _rackettop = 0;
public static double _racketmaxtop = 0;
public static double _racketwidth = 0;
public static double _racketheight = 0;
public static double _racketheightmin = 0;
public static double _racketheightmax = 0;
public static double _ballleft = 0;
public static double _balltop = 0;
public static double _ballmaxtop = 0;
public static double _ballwidth = 0;
public static double _ballheight = 0;
public static double _ballracketleft = 0;
public static double _balldeltaxmin = 0;
public static double _balldeltaxmax = 0;
public static double _balldeltax0 = 0;
public static double _balldeltax = 0;
public static double _balldeltay = 0;
public static double _sgnx = 0;
public static int _counter = 0;
public static anywheresoftware.b4j.objects.JFX.PaintWrapper _colorgamebackground = null;
public static anywheresoftware.b4j.objects.JFX.PaintWrapper _colorformbackground = null;
public static anywheresoftware.b4j.objects.JFX.PaintWrapper _colorball = null;
public static anywheresoftware.b4j.objects.JFX.PaintWrapper _colorracket = null;
public static anywheresoftware.b4j.objects.JFX.PaintWrapper _colortext = null;
public static b4j.example.cssutils _cssutils = null;
public static String  _appstart(anywheresoftware.b4j.objects.Form _form1,String[] _args) throws Exception{
 //BA.debugLineNum = 32;BA.debugLine="Sub AppStart (Form1 As Form, Args() As String)";
 //BA.debugLineNum = 33;BA.debugLine="CSU.Initialize";
_csu._initialize(ba);
 //BA.debugLineNum = 35;BA.debugLine="tmrBall.Initialize(\"tmrBall\", 20)";
_tmrball.Initialize(ba,"tmrBall",(long) (20));
 //BA.debugLineNum = 37;BA.debugLine="MainForm = Form1";
_mainform = _form1;
 //BA.debugLineNum = 38;BA.debugLine="MainForm.RootPane.LoadLayout(\"Main\") 'Load the la";
_mainform.getRootPane().LoadLayout(ba,"Main");
 //BA.debugLineNum = 40;BA.debugLine="MainForm.Show";
_mainform.Show();
 //BA.debugLineNum = 42;BA.debugLine="RacketWidth = 12";
_racketwidth = 12;
 //BA.debugLineNum = 43;BA.debugLine="RacketHeight = 50";
_racketheight = 50;
 //BA.debugLineNum = 44;BA.debugLine="RacketLeft = cvsGame.Width - RacketWidth";
_racketleft = _cvsgame.getWidth()-_racketwidth;
 //BA.debugLineNum = 45;BA.debugLine="RacketTop = cvsGame.Height / 2 - RacketHeight / 2";
_rackettop = _cvsgame.getHeight()/(double)2-_racketheight/(double)2;
 //BA.debugLineNum = 46;BA.debugLine="RacketMaxTop = cvsGame.Height - RacketHeight";
_racketmaxtop = _cvsgame.getHeight()-_racketheight;
 //BA.debugLineNum = 48;BA.debugLine="RacketHeightMin = 30";
_racketheightmin = 30;
 //BA.debugLineNum = 49;BA.debugLine="RacketHeightMax = 100";
_racketheightmax = 100;
 //BA.debugLineNum = 50;BA.debugLine="sldRacketHeight.MinValue = RacketHeightMin";
_sldracketheight.setMinValue(_racketheightmin);
 //BA.debugLineNum = 51;BA.debugLine="sldRacketHeight.MaxValue = RacketHeightMax";
_sldracketheight.setMaxValue(_racketheightmax);
 //BA.debugLineNum = 52;BA.debugLine="sldRacketHeight.Value = RacketHeight";
_sldracketheight.setValue(_racketheight);
 //BA.debugLineNum = 54;BA.debugLine="BallWidth = 8";
_ballwidth = 8;
 //BA.debugLineNum = 55;BA.debugLine="BallHeight = BallWidth";
_ballheight = _ballwidth;
 //BA.debugLineNum = 56;BA.debugLine="BallLeft = 0";
_ballleft = 0;
 //BA.debugLineNum = 57;BA.debugLine="BallTop = cvsGame.Height / 2 - BallHeight / 2";
_balltop = _cvsgame.getHeight()/(double)2-_ballheight/(double)2;
 //BA.debugLineNum = 58;BA.debugLine="BallMaxTop = cvsGame.Height - BallHeight";
_ballmaxtop = _cvsgame.getHeight()-_ballheight;
 //BA.debugLineNum = 59;BA.debugLine="BallRacketLeft = RacketLeft - BallWidth";
_ballracketleft = _racketleft-_ballwidth;
 //BA.debugLineNum = 60;BA.debugLine="BallDeltaXMin = 3";
_balldeltaxmin = 3;
 //BA.debugLineNum = 61;BA.debugLine="BallDeltaXMax = 20";
_balldeltaxmax = 20;
 //BA.debugLineNum = 62;BA.debugLine="BallDeltaX0 = 6";
_balldeltax0 = 6;
 //BA.debugLineNum = 63;BA.debugLine="BallDeltaX = BallDeltaX0";
_balldeltax = _balldeltax0;
 //BA.debugLineNum = 64;BA.debugLine="SgnX = 1";
_sgnx = 1;
 //BA.debugLineNum = 65;BA.debugLine="sldSpeed.MinValue = BallDeltaXMin";
_sldspeed.setMinValue(_balldeltaxmin);
 //BA.debugLineNum = 66;BA.debugLine="sldSpeed.MaxValue = BallDeltaXMax";
_sldspeed.setMaxValue(_balldeltaxmax);
 //BA.debugLineNum = 67;BA.debugLine="sldSpeed.Value = BallDeltaX0";
_sldspeed.setValue(_balldeltax0);
 //BA.debugLineNum = 69;BA.debugLine="BallDeltaY = 10";
_balldeltay = 10;
 //BA.debugLineNum = 71;BA.debugLine="InitColors";
_initcolors();
 //BA.debugLineNum = 72;BA.debugLine="InitScreen";
_initscreen();
 //BA.debugLineNum = 73;BA.debugLine="End Sub";
return "";
}
public static String  _btnstart_mouseclicked(anywheresoftware.b4j.objects.NodeWrapper.MouseEventWrapper _eventdata) throws Exception{
 //BA.debugLineNum = 151;BA.debugLine="Sub btnStart_MouseClicked (EventData As MouseEvent";
 //BA.debugLineNum = 152;BA.debugLine="If btnStart.Text = \"GO\" Then";
if ((_btnstart.getText()).equals("GO")) { 
 //BA.debugLineNum = 153;BA.debugLine="btnStart.Text = \"STOP\"";
_btnstart.setText("STOP");
 //BA.debugLineNum = 154;BA.debugLine="pnlRacket.MouseCursor = fx.Cursors.NONE";
_pnlracket.setMouseCursor(_fx.Cursors.NONE);
 //BA.debugLineNum = 155;BA.debugLine="tmrBall.Enabled = True";
_tmrball.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 156;BA.debugLine="Counter = 0";
_counter = (int) (0);
 //BA.debugLineNum = 157;BA.debugLine="lblCounter.Text = Counter";
_lblcounter.setText(BA.NumberToString(_counter));
 }else {
 //BA.debugLineNum = 159;BA.debugLine="btnStart.Text = \"GO\"";
_btnstart.setText("GO");
 //BA.debugLineNum = 160;BA.debugLine="pnlRacket.MouseCursor = fx.Cursors.DEFAULT";
_pnlracket.setMouseCursor(_fx.Cursors.DEFAULT);
 //BA.debugLineNum = 161;BA.debugLine="InitScreen";
_initscreen();
 //BA.debugLineNum = 162;BA.debugLine="tmrBall.Enabled = False";
_tmrball.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 };
 //BA.debugLineNum = 164;BA.debugLine="End Sub";
return "";
}
public static String  _drawball(double _x,double _y) throws Exception{
 //BA.debugLineNum = 144;BA.debugLine="Private Sub DrawBall(X As Double, Y As Double)";
 //BA.debugLineNum = 145;BA.debugLine="cvsGame.DrawRect(BallLeft - 2, BallTop - 2, BallW";
_cvsgame.DrawRect(_ballleft-2,_balltop-2,_ballwidth+4,_ballheight+4,(javafx.scene.paint.Paint)(_colorgamebackground.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 146;BA.debugLine="BallLeft = X";
_ballleft = _x;
 //BA.debugLineNum = 147;BA.debugLine="BallTop = Y";
_balltop = _y;
 //BA.debugLineNum = 148;BA.debugLine="cvsGame.DrawRect(BallLeft, BallTop, BallWidth, Ba";
_cvsgame.DrawRect(_ballleft,_balltop,_ballwidth,_ballheight,(javafx.scene.paint.Paint)(_colorball.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 149;BA.debugLine="End Sub";
return "";
}
public static String  _drawracket(double _top) throws Exception{
 //BA.debugLineNum = 138;BA.debugLine="Private Sub DrawRacket(Top As Double)";
 //BA.debugLineNum = 139;BA.debugLine="cvsGame.DrawRect(RacketLeft, RacketTop - 1, Racke";
_cvsgame.DrawRect(_racketleft,_rackettop-1,_racketwidth,_racketheight+2,(javafx.scene.paint.Paint)(_colorgamebackground.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 140;BA.debugLine="RacketTop = Top";
_rackettop = _top;
 //BA.debugLineNum = 141;BA.debugLine="cvsGame.DrawRect(RacketLeft, RacketTop, RacketWid";
_cvsgame.DrawRect(_racketleft,_rackettop,_racketwidth,_racketheight,(javafx.scene.paint.Paint)(_colorracket.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 142;BA.debugLine="End Sub";
return "";
}
public static String  _initcolors() throws Exception{
 //BA.debugLineNum = 120;BA.debugLine="Private Sub InitColors";
 //BA.debugLineNum = 121;BA.debugLine="CSSUtils.SetBackgroundColor(MainForm.RootPane, Co";
_cssutils._setbackgroundcolor((anywheresoftware.b4j.objects.NodeWrapper.ConcreteNodeWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.objects.NodeWrapper.ConcreteNodeWrapper(), (javafx.scene.Node)(_mainform.getRootPane().getObject())),_colorformbackground);
 //BA.debugLineNum = 122;BA.debugLine="lblCounter.TextColor = ColorText";
_lblcounter.setTextColor((javafx.scene.paint.Paint)(_colortext.getObject()));
 //BA.debugLineNum = 123;BA.debugLine="lblRacketHeight.TextColor = ColorText";
_lblracketheight.setTextColor((javafx.scene.paint.Paint)(_colortext.getObject()));
 //BA.debugLineNum = 124;BA.debugLine="lblSpeed.TextColor = ColorText";
_lblspeed.setTextColor((javafx.scene.paint.Paint)(_colortext.getObject()));
 //BA.debugLineNum = 125;BA.debugLine="End Sub";
return "";
}
public static String  _initscreen() throws Exception{
 //BA.debugLineNum = 127;BA.debugLine="Private Sub InitScreen";
 //BA.debugLineNum = 128;BA.debugLine="cvsGame.DrawRect(0, 0, cvsGame.Width, cvsGame.Hei";
_cvsgame.DrawRect(0,0,_cvsgame.getWidth(),_cvsgame.getHeight(),(javafx.scene.paint.Paint)(_colorgamebackground.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 130;BA.debugLine="BallTop = Rnd(0, BallMaxTop)	'set the ball top to";
_balltop = anywheresoftware.b4a.keywords.Common.Rnd((int) (0),(int) (_ballmaxtop));
 //BA.debugLineNum = 131;BA.debugLine="BallDeltaX = BallDeltaX0";
_balldeltax = _balldeltax0;
 //BA.debugLineNum = 132;BA.debugLine="BallDeltaY = Rnd(1, 10)";
_balldeltay = anywheresoftware.b4a.keywords.Common.Rnd((int) (1),(int) (10));
 //BA.debugLineNum = 133;BA.debugLine="BallLeft = -BallLeft 					'puts the ball out of t";
_ballleft = -_ballleft;
 //BA.debugLineNum = 135;BA.debugLine="DrawRacket(RacketTop)";
_drawracket(_rackettop);
 //BA.debugLineNum = 136;BA.debugLine="End Sub";
return "";
}
public static String  _pnlracket_mousemoved(anywheresoftware.b4j.objects.NodeWrapper.MouseEventWrapper _eventdata) throws Exception{
double _y = 0;
 //BA.debugLineNum = 166;BA.debugLine="Private Sub pnlRacket_MouseMoved (EventData As Mou";
 //BA.debugLineNum = 167;BA.debugLine="Private Y As Double";
_y = 0;
 //BA.debugLineNum = 169;BA.debugLine="If btnStart.Text = \"STOP\" Then";
if ((_btnstart.getText()).equals("STOP")) { 
 //BA.debugLineNum = 170;BA.debugLine="Y = EventData.Y -RacketHeight / 2";
_y = _eventdata.getY()-_racketheight/(double)2;
 //BA.debugLineNum = 171;BA.debugLine="Y = Max(0, Y)";
_y = anywheresoftware.b4a.keywords.Common.Max(0,_y);
 //BA.debugLineNum = 172;BA.debugLine="y = Min(RacketMaxTop, Y)";
_y = anywheresoftware.b4a.keywords.Common.Min(_racketmaxtop,_y);
 //BA.debugLineNum = 173;BA.debugLine="DrawRacket(Y)";
_drawracket(_y);
 };
 //BA.debugLineNum = 175;BA.debugLine="End Sub";
return "";
}

private static boolean processGlobalsRun;
public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        b4j.example.cssutils._process_globals();
main._process_globals();
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 7;BA.debugLine="Private fx As JFX";
_fx = new anywheresoftware.b4j.objects.JFX();
 //BA.debugLineNum = 8;BA.debugLine="Private MainForm As Form";
_mainform = new anywheresoftware.b4j.objects.Form();
 //BA.debugLineNum = 10;BA.debugLine="Private btnStart As Button";
_btnstart = new anywheresoftware.b4j.objects.ButtonWrapper();
 //BA.debugLineNum = 11;BA.debugLine="Private cvsGame As Canvas";
_cvsgame = new anywheresoftware.b4j.objects.CanvasWrapper();
 //BA.debugLineNum = 12;BA.debugLine="Private pnlRacket As Pane";
_pnlracket = new anywheresoftware.b4j.objects.PaneWrapper.ConcretePaneWrapper();
 //BA.debugLineNum = 13;BA.debugLine="Private sldSpeed, sldRacketHeight As Slider";
_sldspeed = new anywheresoftware.b4j.objects.SliderWrapper();
_sldracketheight = new anywheresoftware.b4j.objects.SliderWrapper();
 //BA.debugLineNum = 14;BA.debugLine="Private lblCounter, lblSpeed, lblRacketHeight As";
_lblcounter = new anywheresoftware.b4j.objects.LabelWrapper();
_lblspeed = new anywheresoftware.b4j.objects.LabelWrapper();
_lblracketheight = new anywheresoftware.b4j.objects.LabelWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Private CSU As CallSubUtils";
_csu = new kc.jeu.callsubutils();
 //BA.debugLineNum = 17;BA.debugLine="Private tmrBall As Timer";
_tmrball = new anywheresoftware.b4a.objects.Timer();
 //BA.debugLineNum = 19;BA.debugLine="Private RacketLeft, RacketTop, RacketMaxTop, Rack";
_racketleft = 0;
_rackettop = 0;
_racketmaxtop = 0;
_racketwidth = 0;
_racketheight = 0;
_racketheightmin = 0;
_racketheightmax = 0;
 //BA.debugLineNum = 21;BA.debugLine="Private BallLeft, BallTop, BallMaxTop, BallWidth,";
_ballleft = 0;
_balltop = 0;
_ballmaxtop = 0;
_ballwidth = 0;
_ballheight = 0;
_ballracketleft = 0;
 //BA.debugLineNum = 22;BA.debugLine="Private BallDeltaXMin, BallDeltaXMax, BallDeltaX0";
_balldeltaxmin = 0;
_balldeltaxmax = 0;
_balldeltax0 = 0;
_balldeltax = 0;
_balldeltay = 0;
 //BA.debugLineNum = 23;BA.debugLine="Private SgnX As Double";
_sgnx = 0;
 //BA.debugLineNum = 24;BA.debugLine="Private Counter = 0 As Int";
_counter = (int) (0);
 //BA.debugLineNum = 25;BA.debugLine="Private ColorGameBackground  = fx.Colors.Black As";
_colorgamebackground = new anywheresoftware.b4j.objects.JFX.PaintWrapper();
_colorgamebackground.setObject((javafx.scene.paint.Paint)(_fx.Colors.Black));
 //BA.debugLineNum = 26;BA.debugLine="Private ColorFormBackground = fx.Colors.Blue As P";
_colorformbackground = new anywheresoftware.b4j.objects.JFX.PaintWrapper();
_colorformbackground.setObject((javafx.scene.paint.Paint)(_fx.Colors.Blue));
 //BA.debugLineNum = 27;BA.debugLine="Private ColorBall = fx.Colors.White As Paint";
_colorball = new anywheresoftware.b4j.objects.JFX.PaintWrapper();
_colorball.setObject((javafx.scene.paint.Paint)(_fx.Colors.White));
 //BA.debugLineNum = 28;BA.debugLine="Private ColorRacket = fx.Colors.White As Paint";
_colorracket = new anywheresoftware.b4j.objects.JFX.PaintWrapper();
_colorracket.setObject((javafx.scene.paint.Paint)(_fx.Colors.White));
 //BA.debugLineNum = 29;BA.debugLine="Private ColorText = fx.Colors.White As Paint";
_colortext = new anywheresoftware.b4j.objects.JFX.PaintWrapper();
_colortext.setObject((javafx.scene.paint.Paint)(_fx.Colors.White));
 //BA.debugLineNum = 30;BA.debugLine="End Sub";
return "";
}
public static String  _restart() throws Exception{
 //BA.debugLineNum = 110;BA.debugLine="Private Sub Restart 'ignore";
 //BA.debugLineNum = 111;BA.debugLine="BallTop = Rnd(0, BallMaxTop)";
_balltop = anywheresoftware.b4a.keywords.Common.Rnd((int) (0),(int) (_ballmaxtop));
 //BA.debugLineNum = 112;BA.debugLine="BallDeltaX = BallDeltaX0";
_balldeltax = _balldeltax0;
 //BA.debugLineNum = 113;BA.debugLine="BallDeltaY = Rnd(1, 10)";
_balldeltay = anywheresoftware.b4a.keywords.Common.Rnd((int) (1),(int) (10));
 //BA.debugLineNum = 114;BA.debugLine="BallLeft = -BallLeft";
_ballleft = -_ballleft;
 //BA.debugLineNum = 115;BA.debugLine="tmrBall.Enabled = True";
_tmrball.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 116;BA.debugLine="Counter = 0";
_counter = (int) (0);
 //BA.debugLineNum = 117;BA.debugLine="lblCounter.Text = Counter";
_lblcounter.setText(BA.NumberToString(_counter));
 //BA.debugLineNum = 118;BA.debugLine="End Sub";
return "";
}
public static String  _sldracketheight_valuechange(double _value) throws Exception{
double _middle = 0;
 //BA.debugLineNum = 189;BA.debugLine="Sub sldRacketHeight_ValueChange (Value As Double)";
 //BA.debugLineNum = 190;BA.debugLine="Dim Middle As Double";
_middle = 0;
 //BA.debugLineNum = 192;BA.debugLine="cvsGame.DrawRect(RacketLeft, 0, RacketWidth, cvsG";
_cvsgame.DrawRect(_racketleft,0,_racketwidth,_cvsgame.getHeight(),(javafx.scene.paint.Paint)(_colorformbackground.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 194;BA.debugLine="Middle = RacketTop + RacketHeight / 2";
_middle = _rackettop+_racketheight/(double)2;
 //BA.debugLineNum = 195;BA.debugLine="RacketHeight = Value";
_racketheight = _value;
 //BA.debugLineNum = 196;BA.debugLine="RacketMaxTop = cvsGame.Height - RacketHeight";
_racketmaxtop = _cvsgame.getHeight()-_racketheight;
 //BA.debugLineNum = 197;BA.debugLine="RacketTop = Min(RacketMaxTop, Middle - RacketHeig";
_rackettop = anywheresoftware.b4a.keywords.Common.Min(_racketmaxtop,_middle-_racketheight/(double)2);
 //BA.debugLineNum = 198;BA.debugLine="cvsGame.DrawRect(RacketLeft, RacketTop, RacketWid";
_cvsgame.DrawRect(_racketleft,_rackettop,_racketwidth,_racketheight,(javafx.scene.paint.Paint)(_colorracket.getObject()),anywheresoftware.b4a.keywords.Common.True,1);
 //BA.debugLineNum = 199;BA.debugLine="End Sub";
return "";
}
public static String  _sldspeed_valuechange(double _value) throws Exception{
double _scale = 0;
 //BA.debugLineNum = 177;BA.debugLine="Sub sldSpeed_ValueChange (Value As Double)";
 //BA.debugLineNum = 178;BA.debugLine="Private Scale As Double";
_scale = 0;
 //BA.debugLineNum = 180;BA.debugLine="If BallLeft < 2 Then";
if (_ballleft<2) { 
 //BA.debugLineNum = 181;BA.debugLine="SgnX = 1";
_sgnx = 1;
 };
 //BA.debugLineNum = 183;BA.debugLine="BallDeltaX0 = SgnX * Value";
_balldeltax0 = _sgnx*_value;
 //BA.debugLineNum = 184;BA.debugLine="Scale = Value / BallDeltaX0";
_scale = _value/(double)_balldeltax0;
 //BA.debugLineNum = 185;BA.debugLine="BallDeltaX = BallDeltaX0";
_balldeltax = _balldeltax0;
 //BA.debugLineNum = 186;BA.debugLine="BallDeltaY = BallDeltaY * Scale";
_balldeltay = _balldeltay*_scale;
 //BA.debugLineNum = 187;BA.debugLine="End Sub";
return "";
}
public static String  _tmrball_tick() throws Exception{
double _x = 0;
double _y = 0;
 //BA.debugLineNum = 75;BA.debugLine="Private Sub tmrBall_Tick";
 //BA.debugLineNum = 76;BA.debugLine="Private X, Y As Double";
_x = 0;
_y = 0;
 //BA.debugLineNum = 78;BA.debugLine="Y = BallTop + BallDeltaY";
_y = _balltop+_balldeltay;
 //BA.debugLineNum = 79;BA.debugLine="If Y <= 0 Then";
if (_y<=0) { 
 //BA.debugLineNum = 80;BA.debugLine="Y = 0";
_y = 0;
 //BA.debugLineNum = 81;BA.debugLine="BallDeltaY = - BallDeltaY";
_balldeltay = -_balldeltay;
 }else if(_y>=_ballmaxtop) { 
 //BA.debugLineNum = 83;BA.debugLine="Y = BallMaxTop";
_y = _ballmaxtop;
 //BA.debugLineNum = 84;BA.debugLine="BallDeltaY = - BallDeltaY";
_balldeltay = -_balldeltay;
 };
 //BA.debugLineNum = 86;BA.debugLine="X = BallLeft + BallDeltaX";
_x = _ballleft+_balldeltax;
 //BA.debugLineNum = 88;BA.debugLine="If X <= 0 Then";
if (_x<=0) { 
 //BA.debugLineNum = 89;BA.debugLine="X = 0";
_x = 0;
 //BA.debugLineNum = 90;BA.debugLine="BallDeltaX = BallDeltaX0";
_balldeltax = _balldeltax0;
 //BA.debugLineNum = 91;BA.debugLine="SgnX = 1";
_sgnx = 1;
 }else if(_x>=_ballracketleft && _y>=_rackettop && _y<=_rackettop+_racketheight-_ballheight) { 
 //BA.debugLineNum = 93;BA.debugLine="X = BallRacketLeft - 5";
_x = _ballracketleft-5;
 //BA.debugLineNum = 94;BA.debugLine="BallDeltaX = - BallDeltaX0";
_balldeltax = -_balldeltax0;
 //BA.debugLineNum = 95;BA.debugLine="SgnX = -1";
_sgnx = -1;
 //BA.debugLineNum = 96;BA.debugLine="Counter = Counter + 1";
_counter = (int) (_counter+1);
 //BA.debugLineNum = 97;BA.debugLine="lblCounter.Text = Counter";
_lblcounter.setText(BA.NumberToString(_counter));
 }else if(_x>_cvsgame.getWidth()) { 
 //BA.debugLineNum = 99;BA.debugLine="X = - BallWidth";
_x = -_ballwidth;
 //BA.debugLineNum = 100;BA.debugLine="Y = (cvsGame.Height - BallHeight) / 2";
_y = (_cvsgame.getHeight()-_ballheight)/(double)2;
 //BA.debugLineNum = 101;BA.debugLine="tmrBall.Enabled = False";
_tmrball.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 102;BA.debugLine="CSU.CallSubPlus(Me, \"Restart\", 500)";
_csu._callsubplus(main.getObject(),"Restart",(int) (500));
 //BA.debugLineNum = 103;BA.debugLine="Counter = 0";
_counter = (int) (0);
 //BA.debugLineNum = 104;BA.debugLine="lblCounter.Text = Counter";
_lblcounter.setText(BA.NumberToString(_counter));
 };
 //BA.debugLineNum = 107;BA.debugLine="DrawBall(X, Y)";
_drawball(_x,_y);
 //BA.debugLineNum = 108;BA.debugLine="End Sub";
return "";
}
}
