public MainWindow() { InitializeComponent(); int frameHeight = 900; int frameWidth = 1600; int bytesPerPixel = 4; game objGame = new game(); Thread gameManager = new Thread(new ThreadStart(objGame.gameLoop)); gameManager.Start(); rayCaster objRaycaster = new rayCaster(frameHeight, frameWidth, bytesPerPixel, ref viewPort, ref objGame); Thread renderManager = new Thread(new ThreadStart(objRaycaster.renderLoop)); renderManager.Start(); /* * Trace.Write("BeginDispatch"); * viewPort.Dispatcher.BeginInvoke( * DispatcherPriority.Normal, * new rayCasterDelegate(objRaycaster.beginRender) * ); * * Trace.Write("EndDispatch"); */ }
public rayCaster(int inputHeight, int inputWidth, int inputBytesPerPixel, ref Image inputViewPort, ref game inputGame) { frameWidth = inputWidth; frameHeight = inputHeight; bytesPerPixel = inputBytesPerPixel; viewPort = inputViewPort; game = inputGame; frameStride = frameWidth * bytesPerPixel; frameBuffer = new byte[frameWidth * frameHeight * bytesPerPixel]; }