package b4j.Valentin1;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.pc.*;

public class main_subs_0 {


public static RemoteObject  _appstart(RemoteObject _form1,RemoteObject _args) throws Exception{
try {
		Debug.PushSubsStack("AppStart (main) ","main",0,main.ba,main.mostCurrent,25);
if (RapidSub.canDelegate("appstart")) return main.remoteMe.runUserSub(false, "main","appstart", _form1, _args);
Debug.locals.put("Form1", _form1);
Debug.locals.put("Args", _args);
 BA.debugLineNum = 25;BA.debugLine="Sub AppStart (Form1 As Form, Args() As String)";
Debug.ShouldStop(16777216);
 BA.debugLineNum = 26;BA.debugLine="tmrBall.Initialize(\"tmrBall\", 20)";
Debug.ShouldStop(33554432);
main._tmrball.runVoidMethod ("Initialize",main.ba,(Object)(BA.ObjectToString("tmrBall")),(Object)(BA.numberCast(long.class, 20)));
 BA.debugLineNum = 28;BA.debugLine="MainForm = Form1";
Debug.ShouldStop(134217728);
main._mainform = _form1;
 BA.debugLineNum = 29;BA.debugLine="MainForm.RootPane.LoadLayout(\"Main\") 'Load the la";
Debug.ShouldStop(268435456);
main._mainform.runMethod(false,"getRootPane").runMethodAndSync(false,"LoadLayout",main.ba,(Object)(RemoteObject.createImmutable("Main")));
 BA.debugLineNum = 30;BA.debugLine="MainForm.Show";
Debug.ShouldStop(536870912);
main._mainform.runVoidMethodAndSync ("Show");
 BA.debugLineNum = 32;BA.debugLine="BallWidth = 8";
Debug.ShouldStop(-2147483648);
main._ballwidth = BA.numberCast(double.class, 8);
 BA.debugLineNum = 33;BA.debugLine="BallHeight = BallWidth";
Debug.ShouldStop(1);
main._ballheight = main._ballwidth;
 BA.debugLineNum = 34;BA.debugLine="BallLeft = 0";
Debug.ShouldStop(2);
main._ballleft = BA.numberCast(double.class, 0);
 BA.debugLineNum = 35;BA.debugLine="BallTop = cvsGame.Height / 2 - BallHeight / 2";
Debug.ShouldStop(4);
main._balltop = RemoteObject.solve(new RemoteObject[] {main._cvsgame.runMethod(true,"getHeight"),RemoteObject.createImmutable(2),main._ballheight,RemoteObject.createImmutable(2)}, "/-/",1, 0);
 BA.debugLineNum = 36;BA.debugLine="BallMaxTop = cvsGame.Height - BallHeight";
Debug.ShouldStop(8);
main._ballmaxtop = RemoteObject.solve(new RemoteObject[] {main._cvsgame.runMethod(true,"getHeight"),main._ballheight}, "-",1, 0);
 BA.debugLineNum = 37;BA.debugLine="BallRacketLeft = RacketLeft - BallWidth";
Debug.ShouldStop(16);
main._ballracketleft = RemoteObject.solve(new RemoteObject[] {main._racketleft,main._ballwidth}, "-",1, 0);
 BA.debugLineNum = 38;BA.debugLine="BallDeltaXMin = 3";
Debug.ShouldStop(32);
main._balldeltaxmin = BA.numberCast(double.class, 3);
 BA.debugLineNum = 39;BA.debugLine="BallDeltaXMax = 20";
Debug.ShouldStop(64);
main._balldeltaxmax = BA.numberCast(double.class, 20);
 BA.debugLineNum = 40;BA.debugLine="BallDeltaX0 = 6";
Debug.ShouldStop(128);
main._balldeltax0 = BA.numberCast(double.class, 6);
 BA.debugLineNum = 41;BA.debugLine="BallDeltaX = BallDeltaX0";
Debug.ShouldStop(256);
main._balldeltax = main._balldeltax0;
 BA.debugLineNum = 42;BA.debugLine="SgnX = 1";
Debug.ShouldStop(512);
main._sgnx = BA.numberCast(double.class, 1);
 BA.debugLineNum = 44;BA.debugLine="InitScreen";
Debug.ShouldStop(2048);
_initscreen();
 BA.debugLineNum = 46;BA.debugLine="DrawBall(200, 200)";
Debug.ShouldStop(8192);
_drawball(BA.numberCast(double.class, 200),BA.numberCast(double.class, 200));
 BA.debugLineNum = 47;BA.debugLine="End Sub";
Debug.ShouldStop(16384);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _btnstart_mouseclicked(RemoteObject _eventdata) throws Exception{
try {
		Debug.PushSubsStack("btnStart_MouseClicked (main) ","main",0,main.ba,main.mostCurrent,100);
if (RapidSub.canDelegate("btnstart_mouseclicked")) return main.remoteMe.runUserSub(false, "main","btnstart_mouseclicked", _eventdata);
Debug.locals.put("EventData", _eventdata);
 BA.debugLineNum = 100;BA.debugLine="Sub btnStart_MouseClicked (EventData As MouseEvent";
Debug.ShouldStop(8);
 BA.debugLineNum = 101;BA.debugLine="If btnStart.Text = \"GO\" Then";
Debug.ShouldStop(16);
if (RemoteObject.solveBoolean("=",main._btnstart.runMethod(true,"getText"),BA.ObjectToString("GO"))) { 
 BA.debugLineNum = 102;BA.debugLine="btnStart.Text = \"STOP\"";
Debug.ShouldStop(32);
main._btnstart.runMethod(true,"setText",BA.ObjectToString("STOP"));
 BA.debugLineNum = 103;BA.debugLine="pnlRacket.MouseCursor = fx.Cursors.NONE";
Debug.ShouldStop(64);
main._pnlracket.runMethod(false,"setMouseCursor",main._fx.getField(false,"Cursors").getField(false,"NONE"));
 BA.debugLineNum = 104;BA.debugLine="tmrBall.Enabled = True";
Debug.ShouldStop(128);
main._tmrball.runMethod(true,"setEnabled",main.__c.getField(true,"True"));
 }else {
 BA.debugLineNum = 106;BA.debugLine="btnStart.Text = \"GO\"";
Debug.ShouldStop(512);
main._btnstart.runMethod(true,"setText",BA.ObjectToString("GO"));
 BA.debugLineNum = 107;BA.debugLine="pnlRacket.MouseCursor = fx.Cursors.DEFAULT";
Debug.ShouldStop(1024);
main._pnlracket.runMethod(false,"setMouseCursor",main._fx.getField(false,"Cursors").getField(false,"DEFAULT"));
 BA.debugLineNum = 108;BA.debugLine="InitScreen";
Debug.ShouldStop(2048);
_initscreen();
 BA.debugLineNum = 109;BA.debugLine="tmrBall.Enabled = False";
Debug.ShouldStop(4096);
main._tmrball.runMethod(true,"setEnabled",main.__c.getField(true,"False"));
 };
 BA.debugLineNum = 111;BA.debugLine="End Sub";
Debug.ShouldStop(16384);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _drawball(RemoteObject _x,RemoteObject _y) throws Exception{
try {
		Debug.PushSubsStack("DrawBall (main) ","main",0,main.ba,main.mostCurrent,59);
if (RapidSub.canDelegate("drawball")) return main.remoteMe.runUserSub(false, "main","drawball", _x, _y);
Debug.locals.put("X", _x);
Debug.locals.put("Y", _y);
 BA.debugLineNum = 59;BA.debugLine="Private Sub DrawBall(X As Double, Y As Double)";
Debug.ShouldStop(67108864);
 BA.debugLineNum = 60;BA.debugLine="cvsGame.DrawRect(BallLeft - 2, BallTop - 2, BallW";
Debug.ShouldStop(134217728);
main._cvsgame.runVoidMethod ("DrawRect",(Object)(RemoteObject.solve(new RemoteObject[] {main._ballleft,RemoteObject.createImmutable(2)}, "-",1, 0)),(Object)(RemoteObject.solve(new RemoteObject[] {main._balltop,RemoteObject.createImmutable(2)}, "-",1, 0)),(Object)(RemoteObject.solve(new RemoteObject[] {main._ballwidth,RemoteObject.createImmutable(4)}, "+",1, 0)),(Object)(RemoteObject.solve(new RemoteObject[] {main._ballheight,RemoteObject.createImmutable(4)}, "+",1, 0)),(Object)(main._fx.getField(false,"Colors").getField(false,"Black")),(Object)(main.__c.getField(true,"True")),(Object)(BA.numberCast(double.class, 1)));
 BA.debugLineNum = 61;BA.debugLine="BallLeft = X";
Debug.ShouldStop(268435456);
main._ballleft = _x;
 BA.debugLineNum = 62;BA.debugLine="BallTop = Y";
Debug.ShouldStop(536870912);
main._balltop = _y;
 BA.debugLineNum = 63;BA.debugLine="cvsGame.DrawRect(BallLeft, BallTop, BallWidth, Ba";
Debug.ShouldStop(1073741824);
main._cvsgame.runVoidMethod ("DrawRect",(Object)(main._ballleft),(Object)(main._balltop),(Object)(main._ballwidth),(Object)(main._ballheight),(Object)(main._fx.getField(false,"Colors").getField(false,"White")),(Object)(main.__c.getField(true,"True")),(Object)(BA.numberCast(double.class, 1)));
 BA.debugLineNum = 64;BA.debugLine="End Sub";
Debug.ShouldStop(-2147483648);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
public static RemoteObject  _initscreen() throws Exception{
try {
		Debug.PushSubsStack("InitScreen (main) ","main",0,main.ba,main.mostCurrent,49);
if (RapidSub.canDelegate("initscreen")) return main.remoteMe.runUserSub(false, "main","initscreen");
 BA.debugLineNum = 49;BA.debugLine="Private Sub InitScreen";
Debug.ShouldStop(65536);
 BA.debugLineNum = 50;BA.debugLine="cvsGame.DrawRect(0, 0, cvsGame.Width, cvsGame.Hei";
Debug.ShouldStop(131072);
main._cvsgame.runVoidMethod ("DrawRect",(Object)(BA.numberCast(double.class, 0)),(Object)(BA.numberCast(double.class, 0)),(Object)(main._cvsgame.runMethod(true,"getWidth")),(Object)(main._cvsgame.runMethod(true,"getHeight")),(Object)(main._fx.getField(false,"Colors").getField(false,"Black")),(Object)(main.__c.getField(true,"True")),(Object)(BA.numberCast(double.class, 1)));
 BA.debugLineNum = 57;BA.debugLine="End Sub";
Debug.ShouldStop(16777216);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}

private static boolean processGlobalsRun;
public static void initializeProcessGlobals() {
    
    if (main.processGlobalsRun == false) {
	    main.processGlobalsRun = true;
		try {
		        main_subs_0._process_globals();
main.myClass = BA.getDeviceClass ("b4j.Valentin1.main");
		
        } catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
}public static RemoteObject  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 7;BA.debugLine="Private fx As JFX";
main._fx = RemoteObject.createNew ("anywheresoftware.b4j.objects.JFX");
 //BA.debugLineNum = 8;BA.debugLine="Private MainForm As Form";
main._mainform = RemoteObject.createNew ("anywheresoftware.b4j.objects.Form");
 //BA.debugLineNum = 10;BA.debugLine="Private btnStart As Button";
main._btnstart = RemoteObject.createNew ("anywheresoftware.b4j.objects.ButtonWrapper");
 //BA.debugLineNum = 11;BA.debugLine="Private cvsGame As Canvas";
main._cvsgame = RemoteObject.createNew ("anywheresoftware.b4j.objects.CanvasWrapper");
 //BA.debugLineNum = 12;BA.debugLine="Private pnlRacket As Pane";
main._pnlracket = RemoteObject.createNew ("anywheresoftware.b4j.objects.PaneWrapper.ConcretePaneWrapper");
 //BA.debugLineNum = 13;BA.debugLine="Private sldSpeed, sldRacketHeight As Slider";
main._sldspeed = RemoteObject.createNew ("anywheresoftware.b4j.objects.SliderWrapper");
main._sldracketheight = RemoteObject.createNew ("anywheresoftware.b4j.objects.SliderWrapper");
 //BA.debugLineNum = 15;BA.debugLine="Private RacketLeft, RacketTop, RacketMaxTop, Rack";
main._racketleft = RemoteObject.createImmutable(0);
main._rackettop = RemoteObject.createImmutable(0);
main._racketmaxtop = RemoteObject.createImmutable(0);
main._racketwidth = RemoteObject.createImmutable(0);
main._racketheight = RemoteObject.createImmutable(0);
main._racketheightmin = RemoteObject.createImmutable(0);
main._racketheightmax = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 17;BA.debugLine="Private BallLeft, BallTop, BallMaxTop, BallWidth,";
main._ballleft = RemoteObject.createImmutable(0);
main._balltop = RemoteObject.createImmutable(0);
main._ballmaxtop = RemoteObject.createImmutable(0);
main._ballwidth = RemoteObject.createImmutable(0);
main._ballheight = RemoteObject.createImmutable(0);
main._ballracketleft = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 18;BA.debugLine="Private BallDeltaXMin, BallDeltaXMax, BallDeltaX0";
main._balldeltaxmin = RemoteObject.createImmutable(0);
main._balldeltaxmax = RemoteObject.createImmutable(0);
main._balldeltax0 = RemoteObject.createImmutable(0);
main._balldeltax = RemoteObject.createImmutable(0);
main._balldeltay = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 19;BA.debugLine="Private SgnX As Double";
main._sgnx = RemoteObject.createImmutable(0);
 //BA.debugLineNum = 21;BA.debugLine="Private tmrBall As Timer";
main._tmrball = RemoteObject.createNew ("anywheresoftware.b4a.objects.Timer");
 //BA.debugLineNum = 23;BA.debugLine="End Sub";
return RemoteObject.createImmutable("");
}
public static RemoteObject  _tmrball_tick() throws Exception{
try {
		Debug.PushSubsStack("tmrBall_Tick (main) ","main",0,main.ba,main.mostCurrent,66);
if (RapidSub.canDelegate("tmrball_tick")) return main.remoteMe.runUserSub(false, "main","tmrball_tick");
RemoteObject _x = RemoteObject.createImmutable(0);
RemoteObject _y = RemoteObject.createImmutable(0);
 BA.debugLineNum = 66;BA.debugLine="Private Sub tmrBall_Tick";
Debug.ShouldStop(2);
 BA.debugLineNum = 67;BA.debugLine="Private X, Y As Double";
Debug.ShouldStop(4);
_x = RemoteObject.createImmutable(0);Debug.locals.put("X", _x);
_y = RemoteObject.createImmutable(0);Debug.locals.put("Y", _y);
 BA.debugLineNum = 69;BA.debugLine="Y = BallTop + BallDeltaY";
Debug.ShouldStop(16);
_y = RemoteObject.solve(new RemoteObject[] {main._balltop,main._balldeltay}, "+",1, 0);Debug.locals.put("Y", _y);
 BA.debugLineNum = 70;BA.debugLine="If Y <= 0 Then";
Debug.ShouldStop(32);
if (RemoteObject.solveBoolean("k",_y,BA.numberCast(double.class, 0))) { 
 BA.debugLineNum = 71;BA.debugLine="Y = 0";
Debug.ShouldStop(64);
_y = BA.numberCast(double.class, 0);Debug.locals.put("Y", _y);
 BA.debugLineNum = 72;BA.debugLine="BallDeltaY = - BallDeltaY";
Debug.ShouldStop(128);
main._balldeltay = BA.numberCast(double.class, -main._balldeltay.<Double>get().doubleValue());
 }else 
{ BA.debugLineNum = 74;BA.debugLine="Else If Y >= BallMaxTop Then";
Debug.ShouldStop(512);
if (RemoteObject.solveBoolean("g",_y,main._ballmaxtop)) { 
 BA.debugLineNum = 75;BA.debugLine="Y = BallMaxTop";
Debug.ShouldStop(1024);
_y = main._ballmaxtop;Debug.locals.put("Y", _y);
 BA.debugLineNum = 76;BA.debugLine="BallDeltaY = - BallDeltaY";
Debug.ShouldStop(2048);
main._balldeltay = BA.numberCast(double.class, -main._balldeltay.<Double>get().doubleValue());
 }};
 BA.debugLineNum = 79;BA.debugLine="X = BallLeft + BallDeltaX";
Debug.ShouldStop(16384);
_x = RemoteObject.solve(new RemoteObject[] {main._ballleft,main._balldeltax}, "+",1, 0);Debug.locals.put("X", _x);
 BA.debugLineNum = 81;BA.debugLine="If X <= 0 Then";
Debug.ShouldStop(65536);
if (RemoteObject.solveBoolean("k",_x,BA.numberCast(double.class, 0))) { 
 BA.debugLineNum = 82;BA.debugLine="X = 0";
Debug.ShouldStop(131072);
_x = BA.numberCast(double.class, 0);Debug.locals.put("X", _x);
 BA.debugLineNum = 83;BA.debugLine="BallDeltaX = BallDeltaX0";
Debug.ShouldStop(262144);
main._balldeltax = main._balldeltax0;
 BA.debugLineNum = 84;BA.debugLine="SgnX = 1";
Debug.ShouldStop(524288);
main._sgnx = BA.numberCast(double.class, 1);
 }else 
{ BA.debugLineNum = 85;BA.debugLine="Else If X >= BallRacketLeft And Y >= RacketTop An";
Debug.ShouldStop(1048576);
if (RemoteObject.solveBoolean("g",_x,main._ballracketleft) && RemoteObject.solveBoolean("g",_y,main._rackettop) && RemoteObject.solveBoolean("k",_y,RemoteObject.solve(new RemoteObject[] {main._rackettop,main._racketheight,main._ballheight}, "+-",2, 0))) { 
 BA.debugLineNum = 86;BA.debugLine="X = BallRacketLeft - 5";
Debug.ShouldStop(2097152);
_x = RemoteObject.solve(new RemoteObject[] {main._ballracketleft,RemoteObject.createImmutable(5)}, "-",1, 0);Debug.locals.put("X", _x);
 BA.debugLineNum = 87;BA.debugLine="BallDeltaX = - BallDeltaX0";
Debug.ShouldStop(4194304);
main._balldeltax = BA.numberCast(double.class, -main._balldeltax0.<Double>get().doubleValue());
 BA.debugLineNum = 88;BA.debugLine="SgnX = -1";
Debug.ShouldStop(8388608);
main._sgnx = BA.numberCast(double.class, -(double) (0 + 1));
 }else 
{ BA.debugLineNum = 89;BA.debugLine="Else If X > cvsGame.Width Then";
Debug.ShouldStop(16777216);
if (RemoteObject.solveBoolean(">",_x,main._cvsgame.runMethod(true,"getWidth"))) { 
 BA.debugLineNum = 90;BA.debugLine="X = - BallWidth";
Debug.ShouldStop(33554432);
_x = BA.numberCast(double.class, -main._ballwidth.<Double>get().doubleValue());Debug.locals.put("X", _x);
 BA.debugLineNum = 91;BA.debugLine="Y = (cvsGame.Height - BallHeight) / 2";
Debug.ShouldStop(67108864);
_y = RemoteObject.solve(new RemoteObject[] {(RemoteObject.solve(new RemoteObject[] {main._cvsgame.runMethod(true,"getHeight"),main._ballheight}, "-",1, 0)),RemoteObject.createImmutable(2)}, "/",0, 0);Debug.locals.put("Y", _y);
 BA.debugLineNum = 93;BA.debugLine="tmrBall.Enabled = False";
Debug.ShouldStop(268435456);
main._tmrball.runMethod(true,"setEnabled",main.__c.getField(true,"False"));
 }}};
 BA.debugLineNum = 97;BA.debugLine="DrawBall(X, Y)";
Debug.ShouldStop(1);
_drawball(_x,_y);
 BA.debugLineNum = 98;BA.debugLine="End Sub";
Debug.ShouldStop(2);
return RemoteObject.createImmutable("");
}
catch (Exception e) {
			Debug.ErrorCaught(e);
			throw e;
		} 
finally {
			Debug.PopSubsStack();
		}}
}