private void playGame(object sender, RoutedEventArgs e) { GameBuilder gb = GameBuilder.create(); gb.player1(this.P1Name.Text, (string)((ListBoxItem)this.P1Race.SelectedValue).Content); gb.player2(this.P2Name.Text, (string)((ListBoxItem)this.P2Race.SelectedValue).Content); int sm = GameBuilder.LitMap; if ((string)((ListBoxItem)this.Board.SelectedValue).Tag == "0") { sm = GameBuilder.LitMap; } else if ((string)((ListBoxItem)this.Board.SelectedValue).Tag == "1") { sm = GameBuilder.MidMap; } else if ((string)((ListBoxItem)this.Board.SelectedValue).Tag == "2") { sm = GameBuilder.BigMap; } gb.board(sm); Game gamu = gb.build(); Window old = App.Current.MainWindow; GameWindow megastrat = new GameWindow(gamu, this.allowCheat.IsChecked.Value); App.Current.MainWindow = megastrat; App.Current.MainWindow.Show(); old.Close(); }
private void btnStart_Click(object sender, RoutedEventArgs e) { GameWindow game = new GameWindow(); Application.Current.MainWindow = game; this.Close(); game.Show(); }
protected override void Initialize() { graphics.PreferredBackBufferHeight = height; graphics.PreferredBackBufferWidth = width; graphics.IsFullScreen = false; graphics.ApplyChanges(); /*========================================*/ MenuItemComponent menuItems = new MenuItemComponent(this, new Vector2(30, 290), Color.Black, Color.Yellow, 56); menuItems.AddItem("START"); menuItems.AddItem("INSTRUCTIONS"); menuItems.AddItem("AUTHORS"); menuItems.AddItem("\nEND"); MenuComponent menu = new MenuComponent(this, menuItems); LevelComponent level = new LevelComponent(this); HUD hud = new HUD(this); mainMenu = new GameWindow(this, menu, menuItems); gameLevel = new GameWindow(this, level, hud); /*========================================*/ foreach (GameComponent komponenta in Components) { SwitchComponent(komponenta, false); } // switch window to main menu SwitchWindow(mainMenu); base.Initialize(); }
private void StartGame() { Setup.SetupGameState(); //show player windows foreach (HumanPlayer p in Game.Instance.HumanPlayers) { GameWindow w = new GameWindow(p); p.Window = w; w.Show(); if (PlayerWindows.Count > 0) PlayerWindows.AddAfter(PlayerWindows.Last, w); else PlayerWindows.AddFirst(w); } if (Game.Instance.HumanPlayers.Count() < 1) { foreach (ComputerPlayer cp in Game.Instance.ComputerPlayers) { AIWindow w = new AIWindow(cp); cp.Window = w; w.Show(); } } //Give each ComputerPlayer an AI Provider instance and utility functions Setup.SetupComputer(); //Call this to give each player tiles, and ask the first player for a move. Game.Instance.Start(); }
private void btnNewGame_Click(object sender, RoutedEventArgs e) { GameWindow gameWindow = new GameWindow(this); gameWindow.Show(); Hide(); }
public void Start() { hasClosed = false; gameLoop = new DispatcherTimerGameLoop(1000 / 100); gameLoop.Update += Update; gameWindow = new GameWindow(settings); gameWindow.Closed += (sender, args) => Stop(); SocketFactory socketGame = new SocketFactory(settings); socketGame.Cancel += Stop; socketManager = socketGame.CreateSocketManager(); GraphicManager graphicManager = new GraphicManager(gameWindow.Canvas); InputFactory inputFactory = new InputFactory(gameWindow.Canvas, socketManager); if (hasClosed) return; world = new World(settings, inputFactory, graphicManager); CompositionTarget.Rendering += (sender, args) => world.Draw(); world.Start(); gameWindow.Show(); gameLoop.Start(); }
public Game(GameWindow gWindow) { gameWindow = gWindow; Network = gWindow.getNetwork(); Network.NetClientEvent +=new NetCore.NetClientEventHandler(NetClientEventHandler); Network.ReceiveObservers += new NetCore.NetPackageReceiveHandler(NetPackageReceiveHandler); }
public MainWindow(MapCompiled map) { this.map = map; GameWindow = new GameWindow(800, 600); GameWindow.Title = "Rimbazlo"; //var graphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8)); //GameWindow = new GameWindow(640, 480, graphicsMode, "Rimbalzo", GameWindowFlags.Default, DisplayDevice.Default, 3, 1, GraphicsContextFlags.Default); //GameWindow = new GameWindow(640, 480); //GameWindow.TargetRenderPeriod = 0f; zoom = 80f; rotate = 0f; minZoom = 2f; maxZoom = 1000f; xPos = 0f; yPos = 0f; isOrtho = false; showNebula = false; GameWindow.Resize += HandleWindowResize; GameWindow.Keyboard.KeyDown += HandleWindowKeyboardKeyDown; GameWindow.Keyboard.KeyUp += HandleGameWindowKeyboardKeyUp; GameWindow.Mouse.WheelChanged += HandleWindowMouseWheelChanged; GameWindow.Mouse.ButtonDown += HandleGameWindowMouseButtonDown; GameWindow.Mouse.ButtonUp += HandleGameWindowMouseButtonUp; GameWindow.Load += HandleLoad; GameWindow.RenderFrame += HandleRenderFrame; GameWindow.UpdateFrame += HandleUpdateFrame;; }
/* Call GameCreator.Framework.Game.Run after all of the reasources are created using the GameCreator.Framework namespace */ public static void Run() { /* Load all the sprites */ foreach (int ind in Sprite.Manager.Resources.Keys) { Sprite s = Sprite.Manager.Resources[ind] as Sprite; for (int i = 0; i < s.SubImagesCount; i++) s.SubImages[i] = ResourceManager.GetObject(string.Format("spr_{0}_{1}", s.Id, i), null) as System.Drawing.Bitmap; } // Check if there are any rooms if (Room.Manager.Count == 0) { System.Windows.Forms.MessageBox.Show("Error loading: Game has no rooms?"); System.Environment.Exit(1); } /* Create & show the main game form and enter the main program loop */ System.Windows.Forms.Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); roomwindow = new GameWindow(LibraryContext.Current.Resources.Rooms.Values.First()); roomwindow.Run(30.0, 30.0); //roomform = new GameForm((Room)e.Current.Value); // gets the first room available //roomform.Show(); //while (roomform.Created) System.Windows.Forms.Application.DoEvents(); }
public RunningKeyboardHandler(GameWindow window, IGameEngine engine) { m_window = window; m_engine = engine; m_lock = new object(); m_dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); }
//public Player player; //public Ai ai; #endregion public GameWindow() { instance = this; InitializeFileWatcher(); InitializeComponent(); // initialize Board and custom UserControls InitializeGUIPins(); // If we have a saved game state then load from that instead of starting from scratch if ( DoesFileExist(filesavelocation) ) { GameData gameData = JsonConvert.DeserializeObject<GameData>(File.ReadAllText(filesavelocation)); engine = new GameEngine(gameData.WhosCodeMaker); engine.CurrentLevel = gameData.CurrentLevel; engine.createdCode = gameData.createdCode; engine.GuessesLeft = gameData.GuessesLeft; engine.IsGameOver = gameData.IsGameOver; LoadGameAtStartup(gameData); } else { engine = new GameEngine("Ai"); } rules = new RulesEngine(); #region context setting for properties GuessesLeft.DataContext = engine; WhosCodeMaker.DataContext = engine; WhosCodeBreaker.DataContext = engine; GuessButton.DataContext = engine; #endregion DetermineStartGUILayout(); }
public WindowInfo(GameWindow window) { if (window == null) throw new ArgumentException("GameWindow cannot be null."); this.CopyInfoFrom(window.WindowInfo); }
protected void OpenExampleClick(object senderObj, EventArgs eArgs) { using (var game = new GameWindow()) { game.Load += (sender, e) => { // setup settings, load textures, sounds game.VSync = VSyncMode.On; }; game.Resize += (sender, e) => { GL.Viewport(0, 0, game.Width, game.Height); }; game.KeyDown += (sender, e) => { if(e.Key == OpenTK.Input.Key.Escape) { game.Exit(); } }; game.UpdateFrame += (sender, e) => { // // add game logic, input handling // if (game.Keyboard[OpenTK.Input.Key.Escape]) // { // game.Exit(); // } }; game.RenderFrame += (sender, e) => { // render graphics GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 4.0); GL.Begin(PrimitiveType.Triangles); GL.Color3(Color.MidnightBlue); GL.Vertex2(-1.0f, 1.0f); GL.Color3(Color.SpringGreen); GL.Vertex2(0.0f, -1.0f); GL.Color3(Color.Ivory); GL.Vertex2(1.0f, 1.0f); GL.End(); game.SwapBuffers(); }; // Run the game at 60 updates per second game.Run(60.0); } }
public void OnKeyboardDown(MagecrawlKey key, Map map, GameWindow window, IGameEngine engine) { switch (key) { case MagecrawlKey.Enter: { ICharacter possiblyTargettedMonster = engine.Map.Monsters.Where(x => x.Position == map.TargetPoint).FirstOrDefault(); // Rememeber last targetted monster so we can target them again by default next turn. if (m_targettingType == TargettingType.Monster && possiblyTargettedMonster != null) m_lastTargetted = possiblyTargettedMonster; if (m_action != null) { m_action(window, engine, map.TargetPoint); m_action = null; } Escape(map, window); break; } case MagecrawlKey.Escape: { Escape(map, window); break; } case MagecrawlKey.v: { Escape(map, window); break; } case MagecrawlKey.Left: HandleDirection(Direction.West, map, window, engine); break; case MagecrawlKey.Right: HandleDirection(Direction.East, map, window, engine); break; case MagecrawlKey.Down: HandleDirection(Direction.South, map, window, engine); break; case MagecrawlKey.Up: HandleDirection(Direction.North, map, window, engine); break; case MagecrawlKey.Insert: HandleDirection(Direction.Northwest, map, window, engine); break; case MagecrawlKey.Delete: HandleDirection(Direction.Southwest, map, window, engine); break; case MagecrawlKey.PageUp: HandleDirection(Direction.Northeast, map, window, engine); break; case MagecrawlKey.PageDown: HandleDirection(Direction.Southeast, map, window, engine); break; default: break; } }
public BetaVerification(GameWindow parent) { mainLabel = new Label(); mainLabel.Location = new Vector(350, 180); mainLabel.Text = "Please enter your open beta key."; nameBox = new TextBox(); nameBox.Location = new Vector(325, 220); nameLabel = new Label(); nameLabel.Location = new Vector(315, 200); nameLabel.Text = "Name:"; keyLabel = new Label(); keyLabel.Location = new Vector(325, 240); keyLabel.Text = "Beta key:"; keyBox = new TextBox(); keyBox.Location = new Vector(300, 260); keyBox.Size.X = 200; verifyButton = new Button(); verifyButton.Location = new Vector(335, 290); verifyButton.ApplyStylishEffect(); verifyButton.Image = "data/img/bck.bmp"; verifyButton.Text = "Verify"; verifyButton.MouseClick += (pos) => { if (OpenBetaFunctions.VerifyBetaKey(nameBox.Text, keyBox.Text)) { Parent.Children.Remove(nameBox); Parent.Children.Remove(nameLabel); Parent.Children.Remove(keyBox); Parent.Children.Remove(keyLabel); Parent.Children.Remove(verifyButton); Parent.Children.Remove(wrongKeyMessage); Parent.Children.Remove(mainLabel); Settings.Default.CredentialsVerified = true; Settings.Default.Save(); if (Settings.Default.MusicStatus) BackgroundMusic.StartPlayback(); Parent.Menu = new MainMenu(Parent); } else wrongKeyMessage.Visible = true; }; wrongKeyMessage = new Label(); wrongKeyMessage.Text = "The key and username do not match."; wrongKeyMessage.Location = new Vector(340, 310); wrongKeyMessage.Visible = false; Parent = parent; Parent.AddChildren(nameLabel, nameBox, mainLabel, keyLabel, keyBox, verifyButton, wrongKeyMessage); }
private void GameStart(object sender, RoutedEventArgs e) { player.Stop(); GameWindow gw = new GameWindow(s, r); this.Close(); gw.Show(); }
public InputManager(GameField field, GameManager gameManager, GameWindow gameWindow) { _field = field; _gameManager = gameManager; gameWindow.KeyDown += KeyDown; gameWindow.KeyUp += KeyUp; }
public Input(GameWindow ctx) { Ctx = ctx; Update(true); Ctx.MouseEnter += delegate { _mouseInside = true; }; Ctx.MouseLeave += delegate { _mouseInside = false; }; Ctx.MouseWheel += Ctx_MouseWheel; }
public OneButtonDialog(GameWindow window, string text) { InitializeComponent(); window.DisableFocusPopup(); Title = ""; Text.Text = text; Closing += (o, e) => window.EnableFocusPopup(); }
public CorrectWindow(GameWindow game, Question question) { this.game = game; this.question = question; InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; Start(); }
public Renderer() { int sw = 1024; int sh = 768; Window = new GameWindow(sw,sh,OpenTK.Graphics.GraphicsMode.Default,"Client",GameWindowFlags.Default,DisplayDevice.Default, 2, 1, OpenTK.Graphics.GraphicsContextFlags.Default); //Window.VSync = VSyncMode.On; Window.UpdateFrame += HandleWindowUpdateFrame; Window.RenderFrame += HandleWindowRenderFrame; Tilemaps = new Dictionary<string, Tilemap> (); Backgrounds = new Dictionary<int, Background> (); ShaderCache = new Dictionary<int, int>(); Materials = new Dictionary<string, Material>(); _drawList = new List<Drawable> (); _vb = new VertexBuffer(); GL.ShadeModel (ShadingModel.Smooth); GL.Disable (EnableCap.CullFace); GL.Enable (EnableCap.Texture2D); GL.Disable (EnableCap.DepthTest); GL.DepthMask(false); GL.Enable (EnableCap.Blend); GL.BlendFunc (BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha); //GL.Enable (EnableCap.LineSmooth); //GL.Hint (HintTarget.LineSmoothHint, HintMode.Nicest); GL.PixelStore (PixelStoreParameter.UnpackAlignment, 1); GL.ClearColor (0.3f, 0.3f, 0.3f, 1f); GL.CullFace (CullFaceMode.Back); GL.Disable(EnableCap.AlphaTest); _rtt = new RenderToTexture(Width, Height); _compositingMaterial = GetMaterial("distort"); ZoomLevel = 1.0f; Window.Resize += (sender, e) => { GL.Viewport (0, 0, Window.ClientSize.Width, Window.ClientSize.Height); GL.MatrixMode (MatrixMode.Projection); GL.LoadIdentity (); GL.Ortho (0, Window.ClientSize.Width*ZoomLevel, Window.ClientSize.Height*ZoomLevel, 0, -100.0, 100.0); }; Window.Unload += (sender, e) => { var textures = (from t in Tilemaps.Values select t.Texture).ToArray(); GL.DeleteTextures(textures.Length, textures); foreach(var m in Materials.Values) m.Dispose(); _rtt.Dispose(); _compositingMaterial.Dispose(); }; }
private void button3_Click(object sender, RoutedEventArgs e) { game = new GameWindow(); game.Show(); BoardSerializable gameData = EditorPanel.GetSaveData(); game.LoadData(gameData); game.StartGame(); }
public App() { this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; InitializeComponent(); m_window = new GameWindow(); this.RootVisual = m_window; }
public WpfGameRenderer(Canvas canvas) { this.canvas = canvas; this.gameWindow = (this.canvas.Parent as GameWindow); this.isAllowedToFire = true; this.randomGenerator = new Random(); this.GameoverLeft = (this.Width / 2) - (GameoverWidth / 2); this.GameoverTop = (this.Height / 2) - (GameoverHeight / 2); }
public WindowInfo(GameWindow window) { if (window == null) throw new ArgumentException("GameWindow cannot be null."); /* this.Handle = window.WindowInfo.Handle; this.Parent = window.WindowInfo.Parent; */ this.CopyInfoFrom(window.WindowInfo); }
private void CreateGameWindow() { Player.PlayerScore.ClearScore(); GameViewModel gameViewModel = new GameViewModel(Player); GameWindow window = new GameWindow() { DataContext = gameViewModel }; window.Show(); }
public FieldLogic(GameWindow window, FieldRenderer field, CoordinatedInputManager.PlayerNumber player) : base(window) { this.field = field; this.manager = new TetraminoManager(); this.dropTimer = dropSpeed; this.rand = new RandomGenerator(); this.player = player; this.leftDAR = this.rightDAR = this.initialDAR; }
/// <summary> /// Factory that spews out poison! /// </summary> /// <param name="position"></param> /// <param name="game"></param> public DeathFactory(GameWindow game) { FactorySprite.Initialize(); FactorySprite.Texture = FactoryTexture; FactorySprite.Scale = new Vector2(0.5f, 0.5f); this.game = game; nextCloudTime = GetNextCloudTime(); }
private void StartButtonClick(object sender, RoutedEventArgs e) { if (_wordList != null) { var gameWindow = new GameWindow(); gameWindow.Picker = _wordList.WordPicker; gameWindow.ShowActivated = true; gameWindow.Show(); } }
/// <summary> /// Creates the game's window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NextButtonClick(object sender, RoutedEventArgs e) { _builder.SetSize(_mapSize.Text); _builder.UseDefaultFrequencies(); var main = Application.Current.MainWindow; var game = new GameWindow(_builder.Build()); Application.Current.MainWindow = game; main.Close(); game.Show(); }
static int Execute(GameWindow window) { DebugOutputGL _ = new(); return(0); }
public PlayerSystem(World world, GameWindow window) : base(world.GetEntities().With <PlayerInput>().With <DrawInfo>().AsSet()) { _window = window; }
private void StartRendering() { if (_isRendering) { return; } var editor = Editor.Instance; // Check if save the asset before rendering if (_window.IsEdited) { var result = MessageBox.Show("Save scene animation asset to file before rendering?", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) { _window.Save(); } else if (result != DialogResult.No) { return; } } // Update UI _isRendering = true; _presenter.Panel.Enabled = false; _presenter.BuildLayoutOnUpdate(); // Start rendering Editor.Log("Starting scene animation rendering " + _options.Animation); _dt = 1.0f / _options.FrameRate; _player = new SceneAnimationPlayer { Animation = _options.Animation, HideFlags = HideFlags.FullyHidden, RestoreStateOnStop = true, PlayOnStart = false, RandomStartTime = false, StartTime = _options.StartTime, UpdateMode = SceneAnimationPlayer.UpdateModes.Manual, }; FlaxEngine.Scripting.Update += Tick; _wasGamePaused = Time.GamePaused; Time.GamePaused = false; Time.SetFixedDeltaTime(true, _dt); Time.UpdateFPS = Time.DrawFPS = _options.FrameRate; if (!Editor.IsPlayMode) { Time.PhysicsFPS = 0; } Level.SpawnActor(_player); var gameWin = editor.Windows.GameWin; var resolution = _options.GetResolution(); gameWin.Viewport.CustomResolution = resolution; gameWin.Viewport.BackgroundColor = Color.Black; gameWin.Viewport.KeepAspectRatio = true; gameWin.Viewport.Task.PostRender += OnPostRender; if (!gameWin.Visible) { gameWin.Show(); } else if (!gameWin.IsFocused) { gameWin.Focus(); } _gameWindow = gameWin; _warmUpTimeLeft = _options.WarmUpTime; _animationFrame = 0; var stagingTextureDesc = GPUTextureDescription.New2D(resolution.X, resolution.Y, gameWin.Viewport.Task.Output.Format, GPUTextureFlags.None); stagingTextureDesc.Usage = GPUResourceUsage.StagingReadback; for (int i = 0; i < _stagingTextures.Length; i++) { _stagingTextures[i].Texture = new GPUTexture(); _stagingTextures[i].Texture.Init(ref stagingTextureDesc); _stagingTextures[i].AnimationFrame = -1; _stagingTextures[i].TaskFrame = -1; } _player.Play(); if (!_player.IsPlaying) { Editor.LogError("Scene Animation Player failed to start playing."); CancelRendering(); return; } if (_warmUpTimeLeft > 0.0f) { // Start warmup time _player.Tick(0.0f); _player.Pause(); _state = States.Warmup; } else { // Render first frame _state = States.Render; } if (!Editor.IsPlayMode) { _editorState = new RenderEditorState(editor, this); editor.StateMachine.AddState(_editorState); editor.StateMachine.GoToState(_editorState); } _progress = new RenderProgress(); editor.ProgressReporting.RegisterHandler(_progress); _progress.Start(); }
static void Main(string[] args) { GameWindow.PrepTestWindow().Run(60, 60); }
public void Disable(GameWindow window) { window.UpdateFrame -= UpdateFrame; window.Mouse.Move -= MouseMove; window.Mouse.WheelChanged -= MouseWheelChanged; }
public override void SetSizeToWindow(GameWindow window) { base.SetSizeToWindow(window); this.spawnPoint.Y = (this.spawnPoint.Y / (float)this.lastWindowHeight) * (float)window.ClientBounds.Height; this.spawnPoint.X = (this.spawnPoint.X / (float)this.lastWindowHeight) * (float)window.ClientBounds.Height; }
public TCamera(TypeOfView typeOfView, Volume target, GameWindow game) : base(typeOfView, target, game) { }
public SkillBox(ContentManager Content, GraphicsDevice graphics, GameWindow Window) { this.Content = Content; this.graphics = graphics; this.Window = Window; }
public OpenTKInputSystem(World world, GameWindow window) : base(world) { this.window = window; }
// Constructor with scalar values public Camera(GameWindow window, float posX, float posY, float posZ, float upX, float upY, float upZ, float yaw, float pitch) : this(window, new Vector3(posX, posY, posZ), new Vector3(upX, upY, upZ), yaw, pitch) { }
public MenuScreen(ContentManager Content, GraphicsDevice graphicsDevice, GameWindow Window, GraphicsDeviceManager graphics) { }
public static void Init(GameWindow window) { keyboardDispatcher = new KeyboardDispatcher(window); }
/// <summary> /// 结算游戏 /// </summary> private void CalGame() { GameWindow.CalCurrentGame(); //MessageBox.Show("yztxdy"); //MessageBox.Show("YZTXDY"); ; }
public TCamera(Volume target, GameWindow game) : base(target, game) { }
public override void Update(Matrix4 ViewMatrix, Matrix4 ProjectionMatrix, Dictionary <string, Shape3D> shapes3D, Camera mainCamera, GameWindow gameWindow) { Tick(); //send to shader GL.UseProgram(Shader.Program); //will return -1 without useprogram /* * int mvp_matrix_location = GL.GetUniformLocation(Shader.Program, "mvp_matrix"); * GL.UniformMatrix4(mvp_matrix_location, false, ref MVP_Matrix); */ int ModelviewMatrix_location = GL.GetUniformLocation(Shader.Program, "modelview_matrix"); GL.UniformMatrix4(ModelviewMatrix_location, false, ref ViewMatrix); int ProjectionMatrix_location = GL.GetUniformLocation(Shader.Program, "projection_matrix"); GL.UniformMatrix4(ProjectionMatrix_location, false, ref ProjectionMatrix); /* * int NormalMatrix_location = GL.GetUniformLocation(cube.Shader.Program, "normal_matrix"); * GL.UniformMatrix4(NormalMatrix_location, false, ref NormalMatrix); */ float[] LightPosition = new float[4] { 100f, 100f, 100f, 0f }; int light_position_location = GL.GetUniformLocation(Shader.Program, "light_position"); GL.Uniform1(light_position_location, 1, LightPosition); float[] Kd = new float[3] { 0.9f, 0.5f, 0.3f }; int Kd_location = GL.GetUniformLocation(Shader.Program, "kd"); GL.Uniform1(Kd_location, 1, Kd); float[] Ld = new float[3] { 0.5f, 0.0f, 0.5f }; int Ld_location = GL.GetUniformLocation(Shader.Program, "ld"); GL.Uniform1(Ld_location, 1, Ld); GL.UseProgram(0); }
public static void GameWindowRender() { gameWindow = new GameWindow(); gameWindow.Render(); }
public virtual void Update(GameTime gameTime, GameWindow gameWindow, Platforms platforms, ref int shift, Player Player, ContentManager content) { }
public MyGameLevel(int id, string name, GameWindow gameWindow, Vector2 targetPosition, MyPlayer player) : base(id, name, gameWindow) { aspectRatio = (float)GameWindow.Width / GameWindow.Height; oldMouseState = OpenTK.Input.Mouse.GetCursorState(); TargetPosition = targetPosition; Camera = new Camera(); Camera.Position = new Vector3(0, -150, 0); Camera.Rotate(new Vector3(Camera.CameraUVW.Row0), MathHelper.PiOver2); Camera.Update(); TextRenderClock = new TextRender(150, 100, new Vector2(GameWindow.Width - 160 - 100, 10), FontFamily.Families[19], 52); TextRenderClock.BackgroundColor = Color.FromArgb(0, 0, 0, 0); TextRenderClock.FontStyle = FontStyle.Bold; TextRenderClock.Load(GameWindow.Width, GameWindow.Height); DateTimeClock = DateTime.Now; PointLight = new PointLight { Position = new Vector3(-30f, 5f, -30f), Color = new Vector3(0.9f, 0.9f, 0.9f), //Intensity = 0.2f Intensity = 1 }; SpotLight = new SpotLight { Position = new Vector3(30f, 6f, -30f), Color = new Vector3(0.9f, 0.9f, 0.8f), //Intensity = 0.2f, Intensity = 1, ConeAngle = 0.5f, ConeDirection = new Vector3(0f, -1f, 0f) }; CubesHaveNormalMap = true; Load(); ballUpdateOldPosition = Shapes3D["sphereEnvCubeMap"].Position; SunLightPosition = new Vector3(68, 200, -18); //SunLightPosition = -ShadowMap.LightView.Position; CurrentState = State.Running; FinishCamera = new Camera(); }
/// <summary> /// Initializes a new instance of the <see cref="WindowsSpaceMouseInputDeviceImp" /> class. /// </summary> /// <param name="gameWindow">The game window to hook on to receive /// <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/hh454904(v=vs.85).aspx">WM_POINTER</a> messages.</param> public WindowsSpaceMouseInputDeviceImp(GameWindow gameWindow) { _gameWindow = gameWindow; _handle = new HandleRef(_gameWindow, _gameWindow.WindowInfo.Handle); try { _current3DConnexionDevice = new _3DconnexionDevice(_handle.ToString()); _current3DConnexionDevice.InitDevice((IntPtr)_handle); _current3DConnexionDevice.Motion += HandleMotion; ConnectWindowsEvents(); } catch (Exception ex) { Diagnostics.Warn("Trouble initializing the SpaceMouse. Probably due to missing driver.\n" + ex); _current3DConnexionDevice = null; } _TX = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation X", Id = (int)SixDOFAxis.TX, Direction = AxisDirection.X, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _TY = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation Y", Id = (int)SixDOFAxis.TY, Direction = AxisDirection.Y, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _TZ = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Translation Z", Id = (int)SixDOFAxis.TZ, Direction = AxisDirection.Z, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RX = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation Y", Id = (int)SixDOFAxis.RX, Direction = AxisDirection.Y, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RY = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation X", Id = (int)SixDOFAxis.RY, Direction = AxisDirection.X, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; _RZ = new AxisImpDescription { AxisDesc = new AxisDescription { Name = "Rotation Z", Id = (int)SixDOFAxis.RZ, Direction = AxisDirection.Z, Nature = AxisNature.Position, Bounded = AxisBoundedType.Unbound }, PollAxis = false }; }
internal static void Main(string[] args) { CurrentHost = new Host(); LibRender.Renderer.currentHost = CurrentHost; commandLineArguments = args; // platform and mono CurrentlyRunOnMono = Type.GetType("Mono.Runtime") != null; // file system FileSystem = FileSystem.FromCommandLineArgs(args); FileSystem.CreateFileSystem(); Sounds = new Sounds(); Plugins.LoadPlugins(); // command line arguments SkipArgs = new bool[args.Length]; if (args.Length != 0) { string File = System.IO.Path.Combine(Application.StartupPath, "ObjectViewer.exe"); if (System.IO.File.Exists(File)) { int Skips = 0; System.Text.StringBuilder NewArgs = new System.Text.StringBuilder(); for (int i = 0; i < args.Length; i++) { if (args[i] != null && System.IO.File.Exists(args[i])) { if (System.IO.Path.GetExtension(args[i]).Equals(".csv", StringComparison.OrdinalIgnoreCase)) { string Text = System.IO.File.ReadAllText(args[i], System.Text.Encoding.UTF8); if (Text.Length == 0 || Text.IndexOf("CreateMeshBuilder", StringComparison.OrdinalIgnoreCase) >= 0) { if (NewArgs.Length != 0) { NewArgs.Append(" "); } NewArgs.Append("\"" + args[i] + "\""); SkipArgs[i] = true; Skips++; } } } else { SkipArgs[i] = true; Skips++; } } if (NewArgs.Length != 0) { System.Diagnostics.Process.Start(File, NewArgs.ToString()); } if (Skips == args.Length) { return; } } } Options.LoadOptions(); var options = new ToolkitOptions(); options.Backend = PlatformBackend.PreferX11; Toolkit.Init(options); string folder = Program.FileSystem.GetDataFolder("Languages"); Translations.LoadLanguageFiles(folder); Interface.CurrentOptions.ObjectOptimizationBasicThreshold = 1000; Interface.CurrentOptions.ObjectOptimizationFullThreshold = 250; // application currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel); currentGameWindow = new RouteViewer(LibRender.Screen.Width, LibRender.Screen.Height, currentGraphicsMode, "Route Viewer", GameWindowFlags.Default); currentGameWindow.Visible = true; currentGameWindow.TargetUpdateFrequency = 0; currentGameWindow.TargetRenderFrequency = 0; currentGameWindow.Title = "Route Viewer"; processCommandLineArgs = true; currentGameWindow.Run(); //Unload Sounds.Deinitialize(); }
private void _initWindow() { _window = new GameWindow( 800, 600, GraphicsMode.Default, "Space Station 14", GameWindowFlags.Default, DisplayDevice.Default, 4, 1, #if DEBUG GraphicsContextFlags.Debug | GraphicsContextFlags.ForwardCompatible #else GraphicsContextFlags.ForwardCompatible #endif ) { Visible = true }; _windowSize = new Vector2i(_window.Width, _window.Height); _mainThread = Thread.CurrentThread; _window.KeyDown += (sender, eventArgs) => { _gameController.GameController.KeyDown((KeyEventArgs)eventArgs); }; _window.KeyUp += (sender, eventArgs) => { _gameController.GameController.KeyUp((KeyEventArgs)eventArgs); }; _window.Closed += (sender, eventArgs) => { _gameController.GameController.Shutdown("Window closed"); }; _window.Resize += (sender, eventArgs) => { var oldSize = _windowSize; _windowSize = new Vector2i(_window.Width, _window.Height); GL.Viewport(0, 0, _window.Width, _window.Height); OnWindowResized?.Invoke(new WindowResizedEventArgs(oldSize, _windowSize)); }; _window.MouseDown += (sender, eventArgs) => { var mouseButtonEventArgs = (MouseButtonEventArgs)eventArgs; _gameController.GameController.MouseDown(mouseButtonEventArgs); if (!mouseButtonEventArgs.Handled) { _gameController.GameController.KeyDown((KeyEventArgs)eventArgs); } }; _window.MouseUp += (sender, eventArgs) => { var mouseButtonEventArgs = (MouseButtonEventArgs)eventArgs; _gameController.GameController.MouseUp(mouseButtonEventArgs); if (!mouseButtonEventArgs.Handled) { _gameController.GameController.KeyUp((KeyEventArgs)eventArgs); } }; _window.MouseMove += (sender, eventArgs) => { MouseScreenPosition = new Vector2(eventArgs.X, eventArgs.Y); _gameController.GameController.MouseMove((MouseMoveEventArgs)eventArgs); }; _window.MouseWheel += (sender, eventArgs) => { _gameController.GameController.MouseWheel((MouseWheelEventArgs)eventArgs); }; _window.KeyPress += (sender, eventArgs) => { // If this is a surrogate it has to be specifically handled and I'm not doing that yet. DebugTools.Assert(!char.IsSurrogate(eventArgs.KeyChar)); _gameController.GameController.TextEntered(new TextEventArgs(eventArgs.KeyChar)); }; _initOpenGL(); }
public Player(Texture2D aSprite, Vector2 aPosition, Texture2D aBullet1Sprite, Texture2D aBullet2Sprite, GameWindow aWindow, float someSpeed = 0.6f, float someSize = 10f) { myBullet1sprite = aBullet1Sprite; myBullet2sprite = aBullet2Sprite; mySpeed = someSpeed; mySprite = aSprite; myPosition = aPosition; myStartPosition = aPosition; mySpriteOrigin = new Vector2(mySprite.Width / 2f, mySprite.Height / 2f); myBullet1List = new List <Bullet1>(); myBullet2List = new List <Bullet2>(); myWindow = aWindow; mySize = someSize; myCollisionBox = new Rectangle(myPosition.ToPoint(), new Point(aSprite.Width, aSprite.Height)); }
public void OpenWindow(GameWindow gameWindow) { MovePointer(_hWnd, gameWindow.X, gameWindow.Y); _input.Mouse.LeftButtonClick(); }
// ========================================================== // Update(), abstrakt metod som måste implementeras i alla // härledda fiender. Används för att uppdatera fiendernas // position. // ========================================================== public abstract void Update(GameWindow window);
public WindowViewportAdapter(GameWindow window, GraphicsDevice graphicsDevice) : base(graphicsDevice) { Window = window; window.ClientSizeChanged += OnClientSizeChanged; }
public LoadingScreen(GraphicsDevice graphicsDevice, GameWindow window) : base(graphicsDevice, window) //end bit here calls the base constructor. { //add extra constructor business here //though now we have graphicsDevice is most likely unnecessary }
public static void Start() { Bitmap bMap = new Bitmap(@"Textures/bricks.jpg"); using (var w = new GameWindow(720, 480, null, "ComGr", GameWindowFlags.Default, DisplayDevice.Default, 4, 0, OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible)) { int hProgram = 0; int hTxtr = 0; float alpha = 0f; int vaoTriangle = 0; int[] triangleIndices = null; int vboTriangleIndices = 0; w.Load += (o, ea) => { //set up opengl GL.Enable(EnableCap.FramebufferSrgb); GL.ClearColor(0.5f, 0.5f, 0.5f, 0); GL.ClearDepth(1f); GL.Enable(EnableCap.DepthTest); GL.DepthFunc(DepthFunction.Less); //load, compile and link shaders //see https://www.khronos.org/opengl/wiki/Vertex_Shader var VertexShaderSource = @" #version 400 core in vec3 pos; in vec2 textureCoordinates; in vec3 normals; uniform mat4 m; uniform mat4 proj; out vec2 txtCoords; out vec3 norms; out vec3 point; void main() { gl_Position = proj * vec4(pos,1); txtCoords = textureCoordinates; vec4 hNorm = vec4(normals, 0); vec4 hPos = vec4(pos,1); norms = (m * hNorm).xyz; point = (m * hPos).xyz; } "; var hVertexShader = GL.CreateShader(ShaderType.VertexShader); GL.ShaderSource(hVertexShader, VertexShaderSource); GL.CompileShader(hVertexShader); GL.GetShader(hVertexShader, ShaderParameter.CompileStatus, out int status); if (status != 1) { throw new Exception(GL.GetShaderInfoLog(hVertexShader)); } //see https://www.khronos.org/opengl/wiki/Fragment_Shader var FragmentShaderSource = @" #version 400 core in vec2 txtCoords; in vec3 norms; in vec3 point; uniform sampler2D bricks; out vec4 color; void main() { vec4 txtColor = texture(bricks, txtCoords); vec4 col = vec4(txtColor.b, txtColor.g, txtColor.r, 1); vec3 lPos = vec3(0, 0, 5); vec4 lCol = vec4(1); vec3 eye = vec3(0, 0, 0); vec3 PL = normalize(lPos - point); vec3 diff = vec3(0); float nL = dot(norms, PL); if(nL >= 0) { diff = lCol.xyz * col.xyz * nL; } vec3 viewDir = normalize(eye - point); vec3 reflectDir = reflect(-PL, norms); float fSpec = pow(max(dot(viewDir, reflectDir), 0.0), 128); vec3 spec = 0.5 * fSpec * lCol.rgb; color = vec4(diff, 1) + vec4(spec, 1); } "; var hFragmentShader = GL.CreateShader(ShaderType.FragmentShader); GL.ShaderSource(hFragmentShader, FragmentShaderSource); GL.CompileShader(hFragmentShader); GL.GetShader(hFragmentShader, ShaderParameter.CompileStatus, out status); if (status != 1) { throw new Exception(GL.GetShaderInfoLog(hFragmentShader)); } //link shaders to a program hProgram = GL.CreateProgram(); GL.AttachShader(hProgram, hFragmentShader); GL.AttachShader(hProgram, hVertexShader); GL.LinkProgram(hProgram); GL.GetProgram(hProgram, GetProgramParameterName.LinkStatus, out status); if (status != 1) { throw new Exception(GL.GetProgramInfoLog(hProgram)); } //upload model vertices to a vbo var triangleVertices = OpenGLArrays.TriangleVertices(); var vboTriangleVertices = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, vboTriangleVertices); GL.BufferData(BufferTarget.ArrayBuffer, triangleVertices.Length * sizeof(float), triangleVertices, BufferUsageHint.StaticDraw); // upload model indices to a vbo triangleIndices = OpenGLArrays.TriangleIndices(); vboTriangleIndices = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ElementArrayBuffer, vboTriangleIndices); GL.BufferData(BufferTarget.ElementArrayBuffer, triangleIndices.Length * sizeof(int), triangleIndices, BufferUsageHint.StaticDraw); // upload texture coords to a vbo var textureCoords = OpenGLArrays.TextureCoords(); var vboTexCoords = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, vboTexCoords); GL.BufferData(BufferTarget.ArrayBuffer, textureCoords.Length * sizeof(float), textureCoords, BufferUsageHint.StaticDraw); // upload normals to a vbo var normals = OpenGLArrays.Normals(); var vboNormals = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ArrayBuffer, vboNormals); GL.BufferData(BufferTarget.ArrayBuffer, normals.Length * sizeof(float), normals, BufferUsageHint.StaticDraw); //set up a vao vaoTriangle = GL.GenVertexArray(); GL.BindVertexArray(vaoTriangle); var posAttribIndex = GL.GetAttribLocation(hProgram, "pos"); if (posAttribIndex != -1) { GL.EnableVertexAttribArray(posAttribIndex); GL.BindBuffer(BufferTarget.ArrayBuffer, vboTriangleVertices); GL.VertexAttribPointer(posAttribIndex, 3, VertexAttribPointerType.Float, false, 0, 0); } var txtAttribIndex = GL.GetAttribLocation(hProgram, "textureCoordinates"); if (txtAttribIndex != -1) { GL.EnableVertexAttribArray(txtAttribIndex); GL.BindBuffer(BufferTarget.ArrayBuffer, vboTexCoords); GL.VertexAttribPointer(txtAttribIndex, 2, VertexAttribPointerType.Float, false, 0, 0); } var normAttribIndex = GL.GetAttribLocation(hProgram, "normals"); if (normAttribIndex != -1) { GL.EnableVertexAttribArray(normAttribIndex); GL.BindBuffer(BufferTarget.ArrayBuffer, vboNormals); GL.VertexAttribPointer(normAttribIndex, 3, VertexAttribPointerType.Float, false, 0, 0); } // Setup Texture GL.GenTextures(1, out hTxtr); GL.BindTexture(TextureTarget.Texture2D, hTxtr); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat); // Copy bitmapdata into a byte array BitmapData data = bMap.LockBits(new Rectangle(0, 0, bMap.Width, bMap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); int bLen = Math.Abs(data.Stride) * data.Height; byte[] imgData = new byte[bLen]; Marshal.Copy(data.Scan0, imgData, 0, bLen); bMap.UnlockBits(data); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Srgb8, bMap.Width, bMap.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Rgb, PixelType.UnsignedByte, imgData); GL.GenerateMipmap(GenerateMipmapTarget.Texture2D); //check for errors during all previous calls var error = GL.GetError(); if (error != ErrorCode.NoError) { throw new Exception(error.ToString()); } }; w.UpdateFrame += (o, fea) => { //perform logic alpha += 0.5f * (float)fea.Time; }; w.RenderFrame += (o, fea) => { //clear screen and z-buffer GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); //switch to our shader GL.UseProgram(hProgram); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, hTxtr); var txtrUniformIndex = GL.GetUniformLocation(hProgram, "bricks"); if (txtrUniformIndex != -1) { GL.Uniform1(txtrUniformIndex, 0); } var scale = Matrix4.CreateScale(0.5f); var rotateY = Matrix4.CreateRotationY(alpha); var rotateX = Matrix4.CreateRotationX(alpha); var modelView = //model Matrix4.Identity //view * Matrix4.LookAt(new Vector3(0, 0, -10), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); //view var projection = //projection Matrix4.CreatePerspectiveFieldOfView(45 * (float)(Math.PI / 180d), w.ClientRectangle.Width / (float)w.ClientRectangle.Height, 0.1f, 100f); var M = rotateX * rotateY * modelView; var mAttribIndex = GL.GetUniformLocation(hProgram, "m"); if (mAttribIndex != -1) { GL.UniformMatrix4(mAttribIndex, false, ref M); } var MVP = M * projection; var projAttribIndex = GL.GetUniformLocation(hProgram, "proj"); if (projAttribIndex != -1) { GL.UniformMatrix4(projAttribIndex, false, ref MVP); } //render our model GL.BindVertexArray(vaoTriangle); GL.BindBuffer(BufferTarget.ElementArrayBuffer, vboTriangleIndices); GL.DrawElements(PrimitiveType.Triangles, triangleIndices.Length, DrawElementsType.UnsignedInt, 0); //display w.SwapBuffers(); var error = GL.GetError(); if (error != ErrorCode.NoError) { throw new Exception(error.ToString()); } }; w.Resize += (o, ea) => { GL.Viewport(w.ClientRectangle); }; w.Run(); } }
public static TouchPanelState GetState(GameWindow window) { return(window.TouchPanelState); }
public Game(GameWindow wnd) { p_Window = wnd; /*hook crash events at the first opportunity.*/ Application.ThreadException += handleCrash; /*fullscreen*/ p_Window.Shown += delegate(object s, EventArgs e) { //p_Window.ToggleFullscreen(); p_Window.Focus(); p_Window.BringToFront(); cmd("warp 0 0"); cmd("zoom 0 0"); cmd("toggle debug"); cmd("toggle debug full"); cmd("toggle fog"); cmd("toggle los"); testCode(); }; /*initialize hotloader*/ p_Hotloader = new Hotloader(); /*initialize the camera*/ p_Camera = new Camera(this); /*initialize map*/ p_Map = new Map(this, 1000, 1000); p_MapRenderer = new MapRenderer(this, p_Map, p_Camera); /*setup camera position*/ p_Camera.ZoomAbs(32); p_Camera.MoveCenter(250, 250); /*init sub-systems*/ initUI(); initMouse(); initPlayers(); initLogic(); initDebug(); initDraw(); /*hook events*/ p_Cursor.HookEvents(); wnd.Click += handleMouseClick; wnd.MouseWheel += handleMouseScroll; wnd.MouseMove += handleMouseMove; wnd.MouseUp += handleMouseUp; wnd.KeyDown += handleKeyDown; wnd.KeyUp += handleKeyUp; wnd.Resize += handleResize; wnd.GotFocus += handleFocusChanged; wnd.LostFocus += handleFocusChanged; unsafe { IPathfinderContext ctx = Pathfinder.ASCreateContext(p_Map.Width, p_Map.Height); while (true) { break; int time = Environment.TickCount; //break; List <Point> lol = Pathfinder.ASSearch( ctx, Point.Empty, new Point(p_Map.Width - 1, p_Map.Height - 1), p_Map.GetConcreteMatrix(true)); Console.WriteLine((Environment.TickCount - time) + "ms for " + lol.Count + " items"); } } wnd.HookCoreEvents(); p_Camera.EnableMargin = true; p_Camera.SetMargin(10, 10); }
public void Draw(SpriteBatch spriteBatch, GameWindow Window) { spriteBatch.Begin(); background.Draw(spriteBatch); resume.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 - 400); resume.Draw(spriteBatch); if (pauseMenuChosen == PauseMenuChosen.RESUME) { resumeChosen.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 - 400); resumeChosen.Draw(spriteBatch); } save.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 - 200); save.Draw(spriteBatch); if (pauseMenuChosen == PauseMenuChosen.SAVE) { saveChosen.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 - 200); saveChosen.Draw(spriteBatch); } options.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2); options.Draw(spriteBatch); if (pauseMenuChosen == PauseMenuChosen.BACKGROUND_MUSIC_VOLUME) { optionsChosen.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2); optionsChosen.Draw(spriteBatch); for (int i = 0; i < 10; i++) { volumeLvlOff.setPosition(Window.ClientBounds.Width / 4 + 300 + i * 50, Window.ClientBounds.Height / 2 + 25); volumeLvlOff.Draw(spriteBatch); } for (int i = 0; i < (int)(Game1.Instance.musicVolume * 10); i++) { volumeLvlOn.setPosition(Window.ClientBounds.Width / 4 + 300 + i * 50, Window.ClientBounds.Height / 2 + 25); volumeLvlOn.Draw(spriteBatch); } } if (pauseMenuChosen == PauseMenuChosen.SOUNDEFFECTS_VOLUME) { optionsChosen.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2); optionsChosen.Draw(spriteBatch); for (int i = 0; i < 10; i++) { volumeLvlOff.setPosition(Window.ClientBounds.Width / 4 + 300 + i * 50, Window.ClientBounds.Height / 2 + 25); volumeLvlOff.Draw(spriteBatch); } for (int i = 0; i < (int)(Game1.Instance.spriteEffectVolume * 10); i++) { volumeLvlOn.setPosition(Window.ClientBounds.Width / 4 + 300 + i * 50, Window.ClientBounds.Height / 2 + 25); volumeLvlOn.Draw(spriteBatch); } } exit.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 + 200); exit.Draw(spriteBatch); if (pauseMenuChosen == PauseMenuChosen.EXIT) { exitChosen.setPosition(Window.ClientBounds.Width / 4 - 100, Window.ClientBounds.Height / 2 + 200); exitChosen.Draw(spriteBatch); } spriteBatch.End(); }