static M_Rectangle GetScreenView() { M_Rectangle rect = new M_Rectangle(0, 0, G.ResX, G.ResY); rect.Transform(screenMatrix); return(rect); }
public TuningScreen(float height, int index) { if (instance != null) { throw new Exception(); } instance = this; this.height = height; screenView = new M_Rectangle(0, 0, G.ResX, G.ResY); screenMatrix = Matrix.CreateScale(G.ResY / 1080f * 4f); screenMatrixInverse = Matrix.Invert(screenMatrix); screenView.Transform(screenMatrixInverse); stateMachine = new UpdrawEnumerator(StateMachine()); playerPos = screenView.BottomLeft + new Vector2(225, 0); friendPos = screenView.BottomLeft + new Vector2(350, 0); friendPos.X -= index * 25f; if (index >= 2) { offsets[0].X = -10000; } if (index >= 3) { offsets[1].X = -10000; } }
public Race(List <Entity> entities, bool[,] street) { this.Entities = entities; this.street = street; width = street.GetLength(0); height = street.GetLength(1); tiles = new Tile[width, height]; player = entities.Find(f => f is Player) as Player; friend = entities.Find(f => f is Friend) as Friend; PlayerCar playerCar = entities.Find(f => f is PlayerCar) as PlayerCar; player.Pos = playerCar.Pos; for (int i = 0; i < entities.Count; i++) { OnAfterAddEntity(entities[i]); } if (instance != null) { throw new Exception(); } instance = this; camera = new Camera() { moveSpeed = 0.1f, }; #if DEBUG camera.zoomControl = true; #endif camera.zoom = camera.targetZoom = G.ResY / 1080f * 4f; camera.targetPos = player.Pos; camera.JumpToTarget(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tiles[x, y] = new Tile() { indexX = 3, indexY = 2 }; } } UpdateTiles(0, width, 0, height); screenMatrixInverse = Matrix.Invert(screenMatrix); screenView = new M_Rectangle(0, 0, G.ResX, G.ResY); screenView.Transform(screenMatrixInverse); gameState = new UpdrawEnumerator(GetRaceEnumerable(Ingame.instance.level)); }