xna

Type initializer exception OpenTK and monogame

梦想的初衷 提交于 2021-02-10 22:30:02
问题 I just installed MonoGame and OpenTK 1.0 and in Visual Studio 2012 I made a new project of type 'Windows OpenGL Game`...but when I run the project I get the following error: The type initializer for 'OpenTK.Graphics.GraphicsMode' threw an exception. The error is right on this line (the consturctor, on the base()) public Game1() : base() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } My laptop has intel oboard graphics 3000 and I think it supports OpenGL..

Type initializer exception OpenTK and monogame

眉间皱痕 提交于 2021-02-10 22:29:14
问题 I just installed MonoGame and OpenTK 1.0 and in Visual Studio 2012 I made a new project of type 'Windows OpenGL Game`...but when I run the project I get the following error: The type initializer for 'OpenTK.Graphics.GraphicsMode' threw an exception. The error is right on this line (the consturctor, on the base()) public Game1() : base() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } My laptop has intel oboard graphics 3000 and I think it supports OpenGL..

Type initializer exception OpenTK and monogame

走远了吗. 提交于 2021-02-10 22:28:20
问题 I just installed MonoGame and OpenTK 1.0 and in Visual Studio 2012 I made a new project of type 'Windows OpenGL Game`...but when I run the project I get the following error: The type initializer for 'OpenTK.Graphics.GraphicsMode' threw an exception. The error is right on this line (the consturctor, on the base()) public Game1() : base() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } My laptop has intel oboard graphics 3000 and I think it supports OpenGL..

How to get display resolution (screen size)?

江枫思渺然 提交于 2021-02-07 14:14:16
问题 How to get display resolution in XNA/Monogame ? I tried these on my monitor (1600x900): The below give me 800,600 //1. GraphicsDevice.DisplayMode.Width GraphicsDevice.DisplayMode.Height //2. GraphicsDeviceManager graphics = new GraphicsDeviceManager(this); graphics.GraphicsDevice.DisplayMode.Width graphics.GraphicsDevice.DisplayMode.Height //3. GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height //4. foreach (DisplayMode dm in

Projection Matrix

假装没事ソ 提交于 2021-01-29 20:34:53
问题 I tried to understand the mathematics behind the projection matrix and I found this page. The matrix from this page: I found this matrix is similar to the matrix of Xna. I understood how they got to m33 and m44 columns of the matrix, but how they got to m11 and m22? And I didn't understand why I have to give the aspect ratio if I already give the field of view angle. The last thing I want to know is: what is the equation for transfaring from ndc space to window space and how they get to this

How to create a timer/counter in C# XNA

给你一囗甜甜゛ 提交于 2021-01-29 08:11:45
问题 I'm fairly new to C# programming, and this is my first time using it in XNA. I'm trying to create a game with a friend, but we're struggling on making a basic counter/clock. What we require is a timer that starts at 1, and every 2 seconds, +1, with a maximum capacity of 50. Any help with the coding would be great! Thanks. 回答1: To create a timer in XNA you could use something like this: int counter = 1; int limit = 50; float countDuration = 2f; //every 2s. float currentTime = 0f; currentTime +

How are multiple page views created in a game?

て烟熏妆下的殇ゞ 提交于 2021-01-27 14:31:39
问题 Many game examples/tutorials focus only on the rendering of the main game and don't show the rest of the game, like the first landing page, splash screen, high scores page, credits page and so on. For something like DirectX and XNA, how are these other screens created/rendered? 回答1: Alternatively to the Microsoft sample mentioned by Davidsbro, if you wanted to create your own basic game state management system you could do so through the use of an enum switch. For this approach you would

Invert Number in C#

拈花ヽ惹草 提交于 2020-12-08 05:45:37
问题 Is there an easy way to invert a number in C# with a function? I'm using XNA and i'd like to tell my program that if my 'variable' gets beyond a certain number it has to invert it's value. The whole point is to give a rebound effect. if (ballPosition.X >= screenWidth) { // Invert the ball Direction Vector.X } 回答1: Just whack a - sign in front of it: direction.X = -direction.X; 回答2: or you can try using Vector.X * -1 来源: https://stackoverflow.com/questions/9765317/invert-number-in-c-sharp

can't find references Microsoft.DirectX.AudioVideoPlayback and Microsoft.DirectX

邮差的信 提交于 2020-06-24 21:28:49
问题 I've installed .net 4.0 as well as XNA 4.0 . A while ago I used Microsoft.DirectX to play some music and now when I try to redo the work, I can't find the reference. Did the new changes on the platform modify or moved something in the references? 回答1: Visual Studio 2010: right click on project Menu select "Add reference..." select tab "Browse" select directory "C:\windows\assembly\ GAC\Microsoft.DirectX.AudioVideoPlayback The DLL to reference is in that folder. You will need to download and

Dealing with lag in XNA + lidgren

你离开我真会死。 提交于 2020-06-24 04:01:28
问题 I am experimenting with lidgren in XNA and I'm having some issues with the 'lag'. I've downloaded their XNA sample and noticed that even their sample lags. The thing is, the movement is not smooth on the other side, and I'm trying this on a LAN (on the same computer actually) not over the internet. Has any had the same issues as regards unsmooth movement due to a lagging connection with lidgren and XNA ? 回答1: The sample you linked directly sets the position to whatever it receives from the