I have solved this by adding the Tao.sdl.dll file to the project and adding in a .net reference for the project. Thanks for the help ...
LoadContent is called by XNA after your MainMenuScreen is initialized. You may have to defer the usage of your playGame object to the moment when the texture is loaded or initialize your MenuEntries in the LoadContent.
Try moving a camera instead of moving your tiles. The camera can move a floating point values, and your tiles will not have tearing because the are a fixed positions. Here's an example of how I render a tilemap in an old game of mine. I haven't posted every structure...
xamarin,xna,cross-platform,monogame
Monogame is an open source implementation of the XNA API. It uses the same classes and namespace than XNA but it is a new implementation that is cross-platform. It used to require the XNA framework for its content pipeline tool. But since version 3.3, Monogame provides its own tool so...
Answer: in the new Vector2(x, y) I just had to set x and y values that are within the image.
c#,monogame,procedural-generation,simplex-noise
Check line 133 in the SimplexNoise you are using: // The result is scaled to return values in the interval [-1,1]. After you divide it by 10, the result would be in range from -0.1 to +0.1 You need a range from 0 to 1, so instead of dividing by...
How about something like this: // For N waypoints between a start and end, we need N+1 segments segments = WaypointAmount + 1; xSeg = (end.x - start.x) / segments; ySeg = (end.y - start.y) / segments; // even though we have N+1 segments, adding the last segment would take...
The resolution of your RenderTarget2D may be the problem. I have noticed this needs to be a multiple of 4 when using SharpDX but I can't find any documentation to back this up. Try using 1280x720 rather than 1281x721....
c#,monogame,alphablending,spritebatch
Try this: spriteBatch.Draw(Tex2D, TargetRec, new Color(Color.White) * weight[x,y]); This is the proper way to draw things transparently when SpriteBatch is using premultiplication. The alpha channel works differently when drawing with premultiplication. The basic change you need to make is to multiply the color by the transparency instead of setting the...
You can render different textures into one using RenderTarget2D _renderTarget = new RenderTarget2D(GraphicsDevice, (int)size.X, (int)size.Y); GraphicsDevice.SetRenderTarget(_renderTarget); GraphicsDevice.Clear(Color.Transparent); SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque); //draw some stuff. SpriteBatch.End() GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Clear(Color.Blue); SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque); SpriteBatch.Draw(_renderTarget, Vector2.Zero, Color.white);...
Fixed by adding: value.Replace("\n", "") in temp = parseText(value, Size.Width); I was doing that before the while loop, but not inside it. Therefore, the text was getting a bunch of new lines, and when it got called again, the new lines disappeared before the while loop. It should look like...
c#,xna,visual-studio-2013,monogame
Another rather classic solution is to install XNA framework included in Windows Phone SDK 7, create a separate XNA solution just for the purpose of building XNB files. To get XNA working on your computer (for VS2010 - VS2013) first download Windows Phone SDK 7 and 8 (both of them)...
Accordingly to the source code of MonoGame linked by Dylan Wilson, the Update and Draw methods from the base class Game just called Update(...) and Draw(...) on a each element of a filtered GameComponentCollection, a Collection of IGameComponent. IGameComponent is an interface that show how XNA and Monogame want you...
c#,collision,monogame,enumerator
The error is because paddle1 is of type Player, not an IEnumerable. If you only have two players, you shouldn't have to loop and can just implement your function like this: public void CollisionDetection(Player firstPlayer, Player secondPlayer) { firstPlayer.Update(gameTime); secondPlayer.Update(gameTime); if (firstPlayer.CollisionSprite(secondPlayer)) { firstPlayer.Velocity = -firstPlayer.Velocity; secondPlayer.Velocity = -secondPlayer.Velocity; }...
ubuntu,graphics,monodevelop,viewport,monogame
So, I still don't know what was causing the problem, but I managed to avoid it. I was trying to get graphics.Viewport.Width graphics.Viewport.Height in a protected override void LoadContent() function. That's where the values were wrong. I tested some options and it came out that in the game class constructor,...
c#,xaml,windows-store-apps,monogame
You can set multiple render targets to draw to for your sprite batch. I would make your entire gameplay logic or area be drawn as or return a Texture2D at the desired size. Then in your Game1.cs or where ever, you position that texture accordingly in additional to the UI...
You can find the latest built DLLs at: http://teamcity.monogame.net/viewType.html?buildTypeId=MonoGame_DevelopMac Just open the latest build and navigate to "Artifacts" tab....
monogame,drawstring,spritebatch
You should start by removing any other draw calls. If you can then see the string, it means that the string is being rendered behind something else. Then you need to play with layerDepth values (from 0.0 to 1.0 where 1.0 is the front)
[EDITED] try using this. import android.util.DisplayMetrics; DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int screen_width = metrics.widthPixels; int screen_height = metrics.heightPixels; float density = metrics.density; OR like this import android.util.DisplayMetrics; public class Resolution() { int screen_width; int screen_height; float density; public Resolution(Activity activity) { DisplayMetrics metrics = new DisplayMetrics();...
visual-studio,visual-studio-2013,nuget,monogame,opentk
The MonoGame.Binaries NuGet package adds a reference to OpenTK.dll from its MonoGame.Binaries.targets that it adds to your project. This .targets file is in one of the packages\MonoGame.Binaries.3.2.0\build subdirectories depending on the project's target framework which in your case is net40. If you remove the following section from the MonoGame.Binaries.targets file...
You can do this with Actions. In the PopupDialog class, add private Action<int> Callback; to the properties and this code to the constructor: public PopupDialog(Action<int> callback /*, rest of constructor parameters if any */) { /* Rest of constructor code, if any */ if (callback == null) throw new ArgumentNullException();...
So I made a new project and copied all the old files from the old project into the new, then I build the solution in "release" mode as I did before, I linked "SDK assemblies only" just like in the screenshot above, and then I debugged the project, and the...
Basically, you have 2 options: Use a pixel shader to render the lighting sprite only on the desired area or Use the stencil buffer and render the pillar into it before you aplly the lighting sprite. I won't explain this in detail because both ways are explained extensively at this...
c#,collision,detection,monogame
SOLVED: turns out that it was no the collision that was the problem, but what occured inside the if-statements :)
android,visual-studio-2013,xamarin,monogame
So it turns out this was nothing to do with the signing or building of the release mode apk, it was actually down to an exception which was only being thrown when the app was built in release mode (I have no idea why this was the case). The thing...
If you want to use a specific spritebatch begin call for some drawing calls only, you can start a new one as needed. for example SpriteBatch.Begin(...matrix); //Draw stuff with matrix SpriteBatch.End(); SpriteBatch.Begin(); //do the rest of the drawing SpriteBatch.End(); this is commonly used to draw a bunch of objects with...
using System; namespace TestOfFunctions; { public class Game1 { private static int _someVariable = 15; public static int SomeVariable { get { return _someVariable; } set { _someVariable = value; } } } public class MainClass { public static void Main() { Console.WriteLine (Game1.SomeVariable); Game1.SomeVariable = 30; Console.WriteLine (Game1.SomeVariable); }...
c#,xna,mouse,monogame,win-universal-app
You have various solutions, depends of what you want to do : You can add a try-catch around this.IsMouseVisible. If you get a exception, you know for sure that the mouse is unavailable. You have conditional compilation symbols with XNA. Use #if !WINDOWS_PHONE to prevent phones to check the mouse....
Well, I found an answer! It appears VS2013 doesn't allow .wav files as songs, so I had to make it a soundeffect, or something like that (I still don't fully get it). It works now though, and I'll keep this post up for reference!
c#,windows-phone-8.1,windows-8.1,monogame
Thanks to thumbmunkeys, the problem is fixed. The debugger makes the game very slow, so not attaching the debugger brings the game back to 30fps. This can be tested by deploying the app using Visual Studio, then stopping the debugger and starting the game on the device....
Based on your code example, it appears that the only thing you have left remaining to do is to shift the 8-bit samples left 8 bits, so that the data occupies the most-significant-bits of the 16-bit sample. I.e.: Dim buffer((44100 * 2) - 1) As Byte ' place to dump...
Can you use a list? You may need to include this: using System.Collections.Generic; //Somewhere in the class List<Wheel> myWheels = new List<Wheel>(); // In your method var _wheel = new Wheel(); // Set your properties myWheels.Add(_wheel); //Then when needed, you can loop like this: foreach(var wheel in myWheels) { //...
The Rectangle class in XNA has 4 properties that can be of use here: Left, Top, Right and Bottom. You can use these to determine which side(s) the collision took place from. For example, consider the Player.Rectangle.Left > Map.Rectangle.Left. If this is true, then the collision could have ocurred on...
Fixed the issue by taking a different approach. Instead of trying to reposition the rectangle to the opposite side of the mouse, I totally stop the rectangle from leaving the screen. When trying to set the Vector2 Position of the tooltip, it checks if it leaves the borders. Like this:...
I don't think it's a duplicate because if you look closely at the error messages, they're different. The Tao.Sdl.dll.config file is present in the /bin/Debug folder. As suggested in http://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/ I typed MONO_LOG_LEVEL=debug mono /home/stefan/Downloads/LinuxMonoGameMovingTeddyBears/bin/Debug/MovingTeddyBears.exe and I got Mono: Assembly Loader probing location: '/usr/lib/mono/4.5/mscorlib.dll'. Mono: Image addref mscorlib[0x1620550] -> /usr/lib/mono/4.5/mscorlib.dll[0x161fad0]:...
Keep the old position of mouse.Y in a variable then check if mouse.Y is less than the variable. If it is less than the variable then the scroll is moving upwards. Else it is moving down.
Try this: GraphicsDevice newGraphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, new PresentationParameters()); Texture2D texture = new Texture2D(newGraphicsDevice, 1, 1) Keep in mind that the width and height of the Texture2D must be > 0....
c#,visual-studio-2013,xna-4.0,monogame,content-pipeline
In case you're still having this problem, or someone else finds the question (like I did trying to solve this a little while ago): for me, the problem was that my windows/system32 directory wasn't in my 'path' environment variable. That's where the setx.exe program resides, and the XNA content project...
movement,monogame,side-scroller
There are many ways of programming a sidescroller. I recommend you google around for examples before you begin coding you own. As you have suggested, one of the best (or atleast most common) ways of programming a side scroller is by storing an offset variable which is added to the...
Unfortunately, this is surprisingly difficult to do with Box2D. The best I could manage when I tried, was to record the velocity of the ball when the contact started, and then when the contact ends, manually set the velocity to what I wanted. That works fine when the ball only...
Ok, I finally realized what the problem was... my drawing code was incorrect. I tried https://msdn.microsoft.com/en-us/library/bb197293(v=xnagamestudio.31).aspx code from msdn website and it all worked out. I am stupid. Also, downloading https://msxna.codeplex.com/releases/view/117230 and installing all the files in the correct order (following the instructions .txt) fixed the monogame content project error...
c#,circle,monogame,rectangles,drawrectangle
EDIT You can learn basic things for MonoGame with tutorials I've put on GitHub : https://github.com/aybe/MonoGameSamples Use 3D primitives and a 2D projection Here's a simple example with explanations I define a 10x10 rectangle and set the world matrix to make it look like a 2D projection : Note :...
c#,gesture,multi-touch,monogame
That feature is not built in to MonoGame, as it is not part of original XNA. Essentially you'd want more than one 'logical' TouchPanel defined by its sub-rectangle of the window. However TouchPanel is static, hence there is only one for the whole game in default XNA. The good news...
windows,xaml,windows-store-apps,monogame
After some researched I think I've figured it out thanks to this blog post. To those who are in a similar situation, here's what I did. The beauty of the solution is that the letterboxing is automatically managed by the Resolution class. All I have to do is update the...
Annoyed about what happen i spent a few hours tracking it down. I had MonoGame 3.0.1 installed. When i downloaded the 3.2 windows installation file some or all of the DLL's for the framework where throwing the errors. I did complete uninstall and re-installs but the 3.2 version never works....
c#,visual-studio,visual-studio-2013,visual-studio-debugging,monogame
No. Visual Studio requires a successful compilation to enable stepping through code.
_ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; _ScreenHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; extra references: System.Drawing , System.Windows.Forms...
c#,.net,visual-studio,windows-store-apps,monogame
No, there isn't any direct retargeting. You'll need to create a new project and then copy code over. How difficult that will be will depend on the specific code. Windows Store apps use a limited set of the .Net Framework (see .NET for Windows Runtime apps). The bulk of the...
@Shiro If you have APK file (Android Package executable file) then you can directly copy it on your phone and install it.
Texture border colors were created for precisely this sort of situation. The basic idea is that you can replace certain texel fetch operations (those outside the normalized range [0.0,1.0]) with a constant color. Border colors work for texture filtering too, which may implicitly fetch a neighbor texel outside the normalized...
The thing i needed to to whas scale the images in PS and then draw them using linear
The formula for a circle area is x^2 + y^2 <= r^2 Given a x you can calculate y like this y <= +/-sqrt( r^2 - x^2 ) By applying different scaling factors to the axis you can create an ellipse. Another possibility is to generate points in a rectangle...
Those two lines of code you indicated are missing the 'new' operator, which is required to instantiate the Vector2 (or any) class. ballSprite = new SpriteObject(texBall, new Vector2(200, 0), new Vector2(10.0f, 0.0f)); starSprite = new SpriteObject(texStar, Vector2.Zero, new Vector2(10.0f, 10.0f)); ...
c++,graphics,programming-languages,monogame
As well as the truly graphical options like Qt, it is also worth considering a simpler one - ncurses. This essentially allows you to create GUI-like interfaces in a terminal and is supported on both Linux and Windows (via Cygwin/MinGW). This is an example that I made back in university...
c#,windows-phone-8,orientation,monogame
Finally I was able to solve the issue: MonoGame 3.2.2. installer has corrupted template, so I deleted the old project that was created from the template and targeted Windows Phone 8.1, then created a new project, added MonoGame 3.2.2. libraries through NuGet, copied the MonoGame.dll into an 'Externals' folder and...
I have just got this working, you have to create a new thread, then call Run, then listen for an event to be raised by WebCore which will have created a new SynchronizationContext by then. You then want to keep a reference to that context on your main thread... Thread...
c#,build,xna,visual-studio-2013,monogame
MonoGame is most likely referencing a different version of XNA, or has used the same namespace for an alternate implementation to minimize code impact to end developers. See @ayls answer to this similar question Monogame Ambiguous Vector2 for an approach. Actually, this answer from @Andrew Russell looks even more authoritative...