public ball(display d, int skipAmount, paddle pd) { this.d = d; this.pd = pd; skipCounter = skipAmount; randomizeBall(); }
public paddle(int width, display d, int skipAmount) { this.d = d; this.width = width; this.skipAmount = skipAmount; pos = d.xMax / 2; posCache = new vector2(pos, d.yMax); }
static void Main(string[] args) { i = new InputManager(); d = new display(); gb = new gameBoard(d); pd = new paddle(2, d, 1); b = new ball(d, 2, pd); //c = new Controllers.PlayerController(); //c = new Controllers.PerfectAI(); c = new Controllers.PerfectAiHybrid(); System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); int counter = 0; while (!i.IsKeyFalling(OpenTK.Input.Key.Escape)) { stopwatch.Start(); i.Update(); d.draw(true); doGameUpdate(); //System.Threading.Thread.Sleep(5); stopwatch.Stop(); counter++; fps = (int)(1.0 / ((double)stopwatch.ElapsedMilliseconds / (double)counter) * 1000.0); if (counter > 200) { stopwatch.Reset(); counter = 0; } } }
public gameBoard(display d) { this.d = d; isInitialized = false; }