static void Main(string[] args) { var gameWidth = 800; var gameHeight = 600; var pong = Game.CreateGame("Pong", gameWidth, gameHeight, true); var world = new World("Pong World"); pong.CurrentWorld = world; SetupInput(pong.InputManager); var camera = new SimpleControllableCamera(objectName: "Camera") { Location = Vector3.BackwardRH * 100, }; camera.CameraComponent.IsPerspective = false; camera.CameraComponent.OrthoWidth = gameWidth; camera.CameraComponent.OrthoHeight = gameHeight; var gameField = new GameField(gameWidth, gameHeight); var gameState = new GameState(gameField) { BallSpeed = 750.0f, }; var playerController = new PongPlayerController(gameField, new Vector3(350, 0, 0)) { ExitAction = "Exit", UpAxis = "Up", }; var compController = new PontAIController(gameField, gameState.Ball, new Vector3(-350, 0, 0)); pong.StartGame(); pong.Dispose(); Console.WriteLine(); Console.WriteLine("Game finished. Press Enter."); Console.ReadLine(); }
static void Main(string[] args) { var gameWidth = 800; var gameHeight = 600; var solarSystemGame = Game.CreateGame("Space", gameWidth, gameHeight, true); var testModel = MeshImporter.ImportModelFromFile("Models/Earth/Earth.obj"); var planet = testModel[0]; var tableMesh = MeshImporter.ImportModelFromFile("Models/Table/table.obj")[0]; solarSystemGame.CurrentWorld = new World("Solar System"); SetupInput(solarSystemGame.InputManager); var center = new WorldObject(objectName: "System center") { WorldLocation = Vector3.Up * 400 }; var CameraLocation = new Vector3(0, 1000, 2000); var camera = new SimpleControllableCamera(objectName: "Camera") { ForwardAxis = "Forward", RightAxis = "Right", UpAxis = "Up", TurnRightAxis = "Turn Right", TurnUpAxis = "Turn Up", WorldLocation = CameraLocation, WorldRotation = Quaternion.Invert(Quaternion.LookAtRH(CameraLocation, center.WorldLocation, Vector3.Up)), }; var table = new WorldObject(objectName: "Table mesh"); var tableComponent = new StaticMeshComponent(table) { Mesh = tableMesh, DefaultShader = new PhongVertexColorShader() { AmbientReflection = .23125f, DiffuseReflection = 0.2775f, SpecularReflection = .1f, Shininess = 6.0f, }, }; var sun = new Planet(0, planet, center, "Sun") { PlanetSize = 100, RotationAngularSpeed = 0.0f, TurningAngularSpeed = 1.0f, }; var mercury = new Planet(400, planet, center, "Mercury") { PlanetSize = 9, RotationAngularSpeed = 5.0f, TurningAngularSpeed = 2.0f, }; var venus = new Planet(700, planet, center, "Venus") { PlanetSize = 27, RotationAngularSpeed = 3.0f, TurningAngularSpeed = -1.0f, }; var earth = new Planet(1000, planet, center, "Earth") { PlanetSize = 30, RotationAngularSpeed = 1.0f, TurningAngularSpeed = 1.0f, }; var moon = new Planet(6, planet, earth.PlanetCenter, "Moon") { PlanetSize = 6, RotationAngularSpeed = 2.0f, TurningAngularSpeed = 1.0f, }; var mars = new Planet(1500, planet, center, "Mars") { PlanetSize = 15, RotationAngularSpeed = 1.0f, TurningAngularSpeed = 0.8f, }; var directionalLight = new DirectionalLightComponent(center) { Direction = Vector3.Normalize(Vector3.Down + Vector3.Right), Intensity = 3, }; var moonPointLight = new PointLightComponent(moon.PlanetCenter) { Intensity = 2 }; var sunPointLight = new PointLightComponent(sun) { Intensity = 10, }; solarSystemGame.GameRenderer.LightingModel.AddDirectionalLight(directionalLight); solarSystemGame.GameRenderer.LightingModel.AddPointLight(sunPointLight); solarSystemGame.GameRenderer.LightingModel.AddPointLight(moonPointLight); solarSystemGame.StartGame(); solarSystemGame.Dispose(); Console.WriteLine(); Console.WriteLine("Game finished. Press Enter."); Console.ReadLine(); }