public void draw(SpriteBatch sprBatch,GraphicsDevice device, Shader shader,Light light) { Effect effect = shader.EFFECT; effect.CurrentTechnique = effect.Techniques["Simplest"]; effect.Parameters["xWorldViewProjection"].SetValue(Matrix.Identity * view * projection); effect.Parameters["xTexture"].SetValue(wallTexture); effect.Parameters["xWorld"].SetValue(Matrix.Identity); effect.Parameters["xLightPos"].SetValue(light.position); effect.Parameters["xLightPower"].SetValue(light.power); effect.Parameters["xAmbient"].SetValue(light.ambientPower); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); //draw the wall device.SetVertexBuffer(buffer); device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } //draw the combatants data.Value.model.Draw(device, world1, view, projection); sprBatch.Begin(); //draw the player index sprBatch.DrawString(font, "Player " + (playerIndex+1) + " choose your combatant.", new Vector2(parent.ScreenWidth / 2 - 85 - font.MeasureString("Player " + playerIndex + " choose your combatant.").X, parent.ScreenHeight / 2 - 32), Color.Yellow); //draw the selected character sprBatch.DrawString(font, "Selected character:"+ data.Value.name, new Vector2(parent.ScreenWidth / 2 + 85 , parent.ScreenHeight / 2 - 32), Color.Yellow); menu.draw(sprBatch); sprBatch.End(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here screenHeight = 1080; screenWidth = 1920; graphics.PreferredBackBufferHeight = screenHeight; graphics.PreferredBackBufferWidth = screenWidth; //never set fullscreen to true, dont do it. graphics.IsFullScreen = true; graphics.PreferMultiSampling = true; graphics.ApplyChanges(); light = new Light(); light.position = new Vector3(0, 12, 15); light.power = 1.0f; light.ambientPower = 1.2f; base.Initialize(); }