Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all 6821 articles
Browse latest View live

Simple sprite moving causes stuttering

$
0
0

@Rasenshurikenbum wrote:

Hello guys,

this problem gave me a massive headache and I'm just completely lost.
After migrating from XNA to MonoGame everything works fine except for random image stuttering. I thought it might be the case of too many sprites to draw, so I made a simple test. I created a new project, loaded some 48x48 png image, made an update method (arrow keys increase postition by 1) and draw method (which just displays that image at position updated in update method). NOTE: I'm drawing image to RenderTarget, then to the screen (I have to use RenderTarget in my project). Unfortunately the effect was the same. I read a massive amount of tutorials and yet nothing seemed to work (for example this: https://github.com/MonoGame/MonoGame/issues/4202). This is what I tried to do to fix this:

MonoGame DIRECTX:
1. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = true
The stuttering occurs about 1 time per 3 seconds.
2. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = false
Effect same as in 1.
3. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = true
(of course i considered the position update by gameTime.ElapsedGameTime factor)
Here stuttering is really hard, about 2 times per second.
4. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = false
(of course i considered the position update by gameTime.ElapsedGameTime factor)
Here stuttering occurs rarely (sometimes i get 30 seconds without any stuttering, but sometimes i have 1 time per 3 seconds). It's really weird, doesn't seem to be stuttering consistently.

MonoGame DESKTOP GL:
1. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = true
A little more often than DirectX, probably about 1 time per 2 seconds.
2. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = false
Effect same as in 1.
3. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = true
(of course i considered the position update by gameTime.ElapsedGameTime factor)
Here stuttering is the highest, probably 5-6 times per second.
4. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = false
(of course i considered the position update by gameTime.ElapsedGameTime factor)
Here stuttering occurs rarely but definitely more often than DirectX. Probably 1 time per 5 seconds and it's pretty consistent in comparison to DirectX.

Just to be 100% sure I made the same test in XNA:
1. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = true
No stuttering here. It's smooth and perfect.
2. IsFixedTimeStep = true, graphics.SynchronizeWithVerticalRetrace = false
Here stuttering occurs 1 time per 2-3 seconds. Pretty much same result as MonoGame.
3. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = true
(of course i considered the position update by gameTime.ElapsedGameTime factor)
Very similar stuttering to MonoGame, occurs pretty often.
4. IsFixedTimeStep = false, graphics.SynchronizeWithVerticalRetrace = false
(of course i considered the position update by gameTime.ElapsedGameTime factor)
To my surprise it stutters here (!!!) but very rarely and inconsistently, same result as MonoGame DirectX.

Out of those 12 options only one is acceptable but I'd rather use MonoGame over XNA. I'm using the latest version of MonoGame (3.7.1) and XNA (4.0). I also tried to measure the system timer resolution (in every case i had constant 1ms).

Any help would be greatly appreciated because I can't think of anything else.

Posts: 2

Participants: 1

Read full topic


DesktopGL template missing on MacOs?

$
0
0

@Kay wrote:

Hi !
I just installed monogame 3.7.1, and i wanted to create a Cross-platform project with the DesktopGL template. But it turns out that i don't have that option anymore on MacOs. I do still see it on my windows computer. Did i do something wrong or is it just removed?

Posts: 1

Participants: 1

Read full topic

Large Frame Rate Drop in 3D project converted from XNA

$
0
0

@Auric wrote:

So I have my game fully ported over. Thanks to those that have helped with various questions I've had recently... Now it's down to performance. The game is up and running fairly fine on my PC (usually 60fps), but there is a noticeable different in frame rate when testing on various hardware. The XNA version can maintain 60fps with no issues whereas the MG version can drop to as low as 5fps. Any graphicsDevice tuning or settings that needs to be done in MG as part of the conversion? I'm on 3.7.1

Posts: 6

Participants: 3

Read full topic

SpriteFont rendering - Can't seem to disable smoothing

$
0
0

@Trinith wrote:

Happy New Year, all!

I'm trying to get a pixelated text look in something I'm playing around with and noticing an issue when it comes to SpriteFont rendering. I always seem to get some smoothing when I draw, even though I've set SamplerState to PointClamp in my SpriteBatch.Begin. I also tried setting it on the graphics device (per a similar thread), as well as setting PreferMultiSampling to false, though I think the latter has more to do with 3D geometry instead of SpriteBatch drawing.

Anyway, the result is always the same... I can't seem to make it not render without what appears to be an aliasing effect. It's generally pretty easy to reproduce... simply start a new project, add a sprite font to whatever (ie, Consolas), and set the size to whatever you want (I've tested with 12, 14, and 18). Using some appropriately contrasting colours, render some text (ensuring your SpriteBatch.Begin uses SamplerState.PointClamp). To inspect, screen cap your window and paste into MSPaint, then zoom in.

I would expect the only colours used to be the text colour, or the background colour, but it definitely appears to do some smoothing on the text rendering.

Anybody else experienced this, or know of something I might be missing?

Thanks!

Posts: 1

Participants: 1

Read full topic

2D Animator

[SOLVED] PixelShader for replacing colors not working as expected

$
0
0

@eriju wrote:

Hey,

I'm writing a pixel shader for replacing colors in a texture.
I have a grayscale texture with 4 colors. (source)
Then I have a texture which is 4x1 pixels and it contains the colors of the grayscale texture. (palette_source)
The third texture, which is 4x1 pixels too, has the actual colors to replace the grayscale colors with. (palette)

texture source;
sampler source_sampler = sampler_state
{
    Texture = (source);
};
texture palette_source;
sampler palette_source_sampler = sampler_state
{
    Texture = (palette_source);
};
texture palette;
sampler palette_sampler = sampler_state
{
    Texture = (palette);
};

float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
{
    float4 color = tex2D(source_sampler, coords);
    
    if (color.r == tex2D(palette_source_sampler, float2(0, 0)).r)
    {
        return tex2D(palette_sampler, float2(0, 0));
    }
    else if (color.r == tex2D(palette_source_sampler, float2(1, 0)).r)
    {
        return tex2D(palette_sampler, float2(1, 0));
    }
    else if (color.r == tex2D(palette_source_sampler, float2(2, 0)).r)
    {
        return tex2D(palette_sampler, float2(2, 0));
    }
    else if (color.r == tex2D(palette_source_sampler, float2(3, 0)).r)
    {
        return tex2D(palette_sampler, float2(3, 0));
    }

    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

Above is my shader script. It takes the three textures and looks up the target color for the pixel and then returns it.
As I am new to shaders, this looks pretty simple and theoretically working to me.
In my "sprite class", I execute the following in the Draw method:

			Shader.Parameters["source"].SetValue(texture);
			Shader.Parameters["palette"].SetValue(palette);
			Shader.Parameters["palette_source"].SetValue(paletteSource);
			Shader.CurrentTechnique.Passes[0].Apply();

The texture is drawn afterwards with:

spriteBatch.Draw(texture, new Rectangle(x - GameManager.Instance.CurrentRoom.XView, y - GameManager.Instance.CurrentRoom.YView, (int)Math.Round(keyframeWidth * xScale), (int)Math.Round(keyframeHeight * yScale)), new Rectangle(keyframeX, keyframeY, keyframeWidth, keyframeHeight), blend * alpha, angle, new Vector2(xOffset, yOffset), SpriteEffects.None, 0f);

Now, instead of a train I drew, it looks like this:

Also, for reference, here are my textures I created:

(source) Scaled 2x

(palette_source) Scaled 4x

(palette) Scaled 4x

Can anyone point out what I am doing wrong here?

Thanks in advance!

Posts: 10

Participants: 2

Read full topic

Type initializer for 'Sdl' threw an exception (macOS)

$
0
0

@Timothy_Findling wrote:

System.TypeInitializationException: The type initializer for 'Sdl' threw an exception. ---> System.Exception: Failed to load SDL library.
at Sdl.GetNativeLibrary () [0x00117] in :0
at Sdl..cctor () [0x00000] in :0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GamePlatform.PlatformCreate (Microsoft.Xna.Framework.Game game) [0x00000] in :0
at Microsoft.Xna.Framework.Game..ctor () [0x00213] in :0
at DigitalJigsawPuzzleSteam.Game1..ctor () [0x0000b] in /Users/Findling/Projects/DigitalJigsawPuzzle/DigitalJigsawPuzzle/Game1.cs:21
at DigitalJigsawPuzzleSteam.Program.Main (System.String[] args) [0x00001] in /Users/Findling/Projects/DigitalJigsawPuzzle/DigitalJigsawPuzzle/Main.cs:24

Can anyone give me advice on how to fix this? Trying to port game to macOS and encountered this error. It is failing on my public Game1: Game { } class in Game1.cs.

Is there something about the use of "Game" on macOS I'm not aware of?

Posts: 2

Participants: 2

Read full topic

13 Ronin, first public build, check it out

$
0
0

@eraserheadstudio wrote:

I'm happy to have reached my 1st big milestone for samurai retro fighter 13 RONIN. The milestone is having a game with enough content to be actually playable. It's far from being finished, but for anyone interested in playing or building a retro fighter similiar to classics like The way of the exploding fist, IK+ and Barbarian it might be worth checking out my blog at www.eraserheadstudio.com where I write about the project, share code and executables.

Happy coding!
/jan.

Posts: 2

Participants: 2

Read full topic


Building Directory contains space

$
0
0

@Terte wrote:

Hello

I have a problem with building/running a monogame cross platform desktop application. I am using monodevelop 7.7 (1869) on ubuntu 18.04.1 and when i'm trying to run it with the default settings of monodevelop it says this:

Cannot open assembly '.../bin/DesktopGL/Any CPU/Debug/TutorialCrossPlatform.Desktop.exe': No such file or directory.

Also there is no such file under that directory. But when I simply build the solution (build all with F6) it tells me that the build is successful. But there is no such file generated anywhere in that solution.

I assume it's the space in the directory but unfortunately I have not found yet where I could change the directory.
I already asked in the MonoDevelop Gitter but they pointed me to this forum.

I would be grateful if someone could help me.

Posts: 1

Participants: 1

Read full topic

How to open a filedialog on Windows?

$
0
0

@dmanning23 wrote:

I've been building a bunch of little tools & editors in MonoGame.WindowsDX, is there a way to pop open a filedialog to save/load files? Preferably without importing another entire widget library?

Cheers!

Posts: 3

Participants: 3

Read full topic

Why is Game a partial class?

$
0
0

@Spool wrote:

Is there a reason for the Game class to be partial? Is there other implementation files?

Posts: 3

Participants: 2

Read full topic

Issue with weird lines on textures

$
0
0

@elzabbul wrote:

Hello, I have a problem with weird lines that appear on some textures when filtering in shader is set either to LINEAR or ANISOTROPIC on Android. When I change it to POINT, the lines disappear, but quality takes a large hit, especially when camera is close to the textures. Do you know how to fix this issue?

Relevant lines from shader code:

Texture xTexture;
sampler TextureSampler = sampler_state { texture = <xTexture>; magfilter = POINT; minfilter = POINT; mipfilter=POINT; AddressU = WRAP; AddressV = WRAP;};

I've marked these strange lines with arrows on the screen below.

Posts: 1

Participants: 1

Read full topic

New MonoGame project, OpenAL could not be initialized

$
0
0

@mos wrote:

I just installed MonoGame 3.7.1 for Visual Studio 2017 and after creating a new cross platform project and trying to debug it, I get the error mentioned in the title. Here is a screenshot:

However, looking at the solution explorer, I see that the libraries for OpenAL are there:

I tried going to the OpenAL website and installed the binary they give, but I still get the same error. What am I doing wrong?

Posts: 1

Participants: 1

Read full topic

Why this example do not work in monogame?

Just a hotdog post.

$
0
0

@willmotil wrote:

So i been working on this for like a couple weeks and i just want to show it off because its sooo un-rewarding.

So this is my prototype pure monogame textbox.

The debuging view is on here the bright white text in the box is what is visible when that is off.

There are basically 5 drawstring type methods i created to do it and a assortment of helper methods.

The class file is as fat as a pregnant cow but it works.

I modeled the behavior off the vs editing window.
It selects a character with the mouse.
It scrolls up or down with the mouse without changing the character index.
Lines up or down changing the character index with the arrow keys.
Left right increments decrements characters with the arrow keys.
Enters and Deletes and of course edits when typing.
It single keys then speeds up when a key is held using text input.
It's able to re-wrap text to fit the window or any width that is set.
It doesn't use drawstring instead it buffers all the text into a growable pooled vertice buffer.
It only rebuilds the buffer if editing occurs so it just keeps drawing the same buffered text till something changes.
I put scrollbars in it too.

Posts: 1

Participants: 1

Read full topic


New Mod SDK for Physics Based Rube Goldberg Game [Chaotic Workshop]

How to create basic shapes without getting sharp edges ?

$
0
0

@Patapits wrote:

I'm working on a game with the Monogame engine and I can't find a proper way to generate basic shapes with smooth edges, even after trying to dug all the Internet...

Currently, I'm generating all my shapes at runtime by creating and setting some vertices with some additionnal informations (color, texture, ...). I'm doing this (instead of importing some sprites, for instance) because I want the game to be as independant as possible from screen specs (resolution, refresh rate, ...), while being able to manipulate the shapes geometry if I need to.

Each shape has its own BasicEffect which is used to draw it every time a Draw() is called.
The problem is that when rendered, these shapes have "sharp" edges, like below :

Sharp edges

Instead of what I want, which is :

Smooth edges

This last screenshot was taken after I tried MSAA in my game (MultiSampleCount at maximum level) :

Graphics.GraphicsProfile = GraphicsProfile.HiDef;
Graphics.PreferMultiSampling = true;

But here is the new problem : on my Intel Integrated Graphic Card, when there are more shapes (with around 1000 vertices), FPS start to drop at ~40fps, which is not acceptable to me for a game with simple shapes like these. If I decrease the MultiSampleCount, FPS are better, but the result is not that good.

I looked into generating simple shapes textures at runtime and then drawing them with some SamplerState.LinearWrap to smooth edges, but it seems like a "wobbly" solution to me, because I'm then losing the possibility to tweak the geometry of my shapes if needed.

So my question is :

Is there a way to generate "smooth" simple but flexible shapes to create a game which is playable at minimum 144fps even on Integrated Graphic Cards ? Is there a "cheap" antialiasing algorithm that can run properly on low-end graphic cards ? Or do I already have the answer (turning on MSAA) but the FPS drop comes for another problem in my code ?


Example of drawing 100 squares with MSAA on (~90fps on my Intel Integrated Graphic Card) :

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Patapits.Framework.RawTests
{
    public class Square
    {
        VertexBuffer _vertexBuffer;
        IndexBuffer _indexBufer;

        BasicEffect _basicEffect;
        private Matrix _view;
        private Matrix _projection;

        private Vector2 _position;

        public Square(GraphicsDevice device, int screenWidth, int screenHeight)
        {
            Generate(device, screenWidth, screenHeight);
        }

        public void MoveTo(Vector2 position)
        {
            _position = position;
        }
        
        public void Generate(GraphicsDevice device, int screenWidth, int screenHeight)
        {
            VertexPositionColor[] vertices = new VertexPositionColor[4];

            vertices[0] = new VertexPositionColor(new Vector3(-0.5f, 0.5f, 0.0f), Color.Red);
            vertices[1] = new VertexPositionColor(new Vector3(0.5f, 0.5f, 0.0f), Color.Red);
            vertices[2] = new VertexPositionColor(new Vector3(0.5f, -0.5f, 0.0f), Color.Red);
            vertices[3] = new VertexPositionColor(new Vector3(-0.5f, -0.5f, 0.0f), Color.Red);

            short[] indexes = new short[6];

            indexes[0] = 0;
            indexes[1] = 1;
            indexes[2] = 2;
            indexes[3] = 0;
            indexes[4] = 2;
            indexes[5] = 3;

            _vertexBuffer = new VertexBuffer(device, typeof(VertexPositionColor), vertices.Length,
                BufferUsage.WriteOnly);
            _vertexBuffer.SetData(vertices);
            _indexBufer = new IndexBuffer(device, typeof(short), indexes.Length, BufferUsage.WriteOnly);
            _indexBufer.SetData(indexes);

            _basicEffect = new BasicEffect(device);

            _view = Matrix.CreateLookAt(new Vector3(0, 0, 1), Vector3.Zero, Vector3.Up);
            _projection = Matrix.CreateOrthographic(screenWidth, screenHeight, 0, 1);
        }

        public void Draw(GraphicsDevice device)
        {
            _basicEffect.World = Matrix.CreateRotationZ(MathHelper.Pi / 3) *
                                 Matrix.CreateScale(100.0f, 100.0f, 1.0f) *
                                 Matrix.CreateTranslation(new Vector3(_position, 0.0f));
            _basicEffect.View = _view;
            _basicEffect.Projection = _projection;
            _basicEffect.VertexColorEnabled = true;

            device.BlendState = BlendState.AlphaBlend;
            device.RasterizerState = RasterizerState.CullNone;
            device.DepthStencilState = DepthStencilState.Default;

            device.SetVertexBuffer(_vertexBuffer);
            device.Indices = _indexBufer;

            foreach (EffectPass pass in _basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, _indexBufer.IndexCount / 3);
            }
        }
    }
    
    public class Game1 : Game
    {
        GraphicsDeviceManager _graphics;

        private Square[] _squares;

        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this) {SynchronizeWithVerticalRetrace = false};
            _graphics.PreferredBackBufferWidth = 1500;
            _graphics.PreferredBackBufferHeight = 500;
            
            IsFixedTimeStep = false;
            Content.RootDirectory = "Content";

            Window.AllowUserResizing = true;
        }

        protected override void Initialize()
        {
            _graphics.GraphicsProfile = GraphicsProfile.HiDef;
            _graphics.PreferMultiSampling = true;
            _graphics.ApplyChanges();

            base.Initialize();
        }

        protected override void LoadContent()
        {
            int squaresCount = 100;
            _squares = new Square[squaresCount];

            Random rand = new Random();

            for (int i = 0; i < squaresCount; i++)
            {
                _squares[i] = new Square(GraphicsDevice, _graphics.PreferredBackBufferWidth,
                    _graphics.PreferredBackBufferHeight);
                _squares[i].MoveTo(
                    new Vector2(
                        rand.Next(-_graphics.PreferredBackBufferWidth / 2, _graphics.PreferredBackBufferWidth / 2),
                        rand.Next(-_graphics.PreferredBackBufferHeight / 2, _graphics.PreferredBackBufferHeight / 2)));
            }
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            for (int i = 0; i < _squares.Length; i++)
            {
                _squares[i].Draw(GraphicsDevice);
            }

            base.Draw(gameTime);
        }
    }
}

Updated version with all Squares sharing the same VertexBuffer and IndexBuffer (but still ~90FPS) :

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Patapits.Framework.RawTests
{
    public class Square
    {
        private static VertexBuffer _vertexBuffer;
        private static IndexBuffer _indexBufer;

        BasicEffect _basicEffect;
        private Matrix _view;
        private Matrix _projection;

        private Vector2 _position;

        public Square(GraphicsDevice device, int screenWidth, int screenHeight)
        {
            Generate(device, screenWidth, screenHeight);
        }

        public void MoveTo(Vector2 position)
        {
            _position = position;
        }
        
        public void Generate(GraphicsDevice device, int screenWidth, int screenHeight)
        {
            if (_vertexBuffer == null)
            {
                VertexPositionColor[] vertices = new VertexPositionColor[4];

                vertices[0] = new VertexPositionColor(new Vector3(-0.5f, 0.5f, 0.0f), Color.Red);
                vertices[1] = new VertexPositionColor(new Vector3(0.5f, 0.5f, 0.0f), Color.Red);
                vertices[2] = new VertexPositionColor(new Vector3(0.5f, -0.5f, 0.0f), Color.Red);
                vertices[3] = new VertexPositionColor(new Vector3(-0.5f, -0.5f, 0.0f), Color.Red);

                short[] indexes = new short[6];

                indexes[0] = 0;
                indexes[1] = 1;
                indexes[2] = 2;
                indexes[3] = 0;
                indexes[4] = 2;
                indexes[5] = 3;

                _vertexBuffer = new VertexBuffer(device, typeof(VertexPositionColor), vertices.Length,
                    BufferUsage.WriteOnly);
                _vertexBuffer.SetData(vertices);
                _indexBufer = new IndexBuffer(device, typeof(short), indexes.Length, BufferUsage.WriteOnly);
                _indexBufer.SetData(indexes);
            }

            _basicEffect = new BasicEffect(device);

            _view = Matrix.CreateLookAt(new Vector3(0, 0, 1), Vector3.Zero, Vector3.Up);
            _projection = Matrix.CreateOrthographic(screenWidth, screenHeight, 0, 1);
        }

        public void Draw(GraphicsDevice device)
        {
            _basicEffect.World = Matrix.CreateRotationZ(MathHelper.Pi / 3) *
                                 Matrix.CreateScale(100.0f, 100.0f, 1.0f) *
                                 Matrix.CreateTranslation(new Vector3(_position, 0.0f));
            _basicEffect.View = _view;
            _basicEffect.Projection = _projection;
            _basicEffect.VertexColorEnabled = true;

            device.BlendState = BlendState.AlphaBlend;
            device.RasterizerState = RasterizerState.CullNone;
            device.DepthStencilState = DepthStencilState.Default;

            device.SetVertexBuffer(_vertexBuffer);
            device.Indices = _indexBufer;

            foreach (EffectPass pass in _basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, _indexBufer.IndexCount / 3);
            }
        }
    }
    
    public class Game1 : Game
    {
        GraphicsDeviceManager _graphics;

        private Square[] _squares;

        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this) {SynchronizeWithVerticalRetrace = false};
            _graphics.PreferredBackBufferWidth = 1500;
            _graphics.PreferredBackBufferHeight = 500;
            
            IsFixedTimeStep = false;
            Content.RootDirectory = "Content";

            Window.AllowUserResizing = true;
        }

        protected override void Initialize()
        {
            _graphics.GraphicsProfile = GraphicsProfile.HiDef;
            _graphics.PreferMultiSampling = true;
            _graphics.ApplyChanges();

            base.Initialize();
        }

        protected override void LoadContent()
        {
            int squaresCount = 100;
            _squares = new Square[squaresCount];

            Random rand = new Random();

            for (int i = 0; i < squaresCount; i++)
            {
                _squares[i] = new Square(GraphicsDevice, _graphics.PreferredBackBufferWidth,
                    _graphics.PreferredBackBufferHeight);
                _squares[i].MoveTo(
                    new Vector2(
                        rand.Next(-_graphics.PreferredBackBufferWidth / 2, _graphics.PreferredBackBufferWidth / 2),
                        rand.Next(-_graphics.PreferredBackBufferHeight / 2, _graphics.PreferredBackBufferHeight / 2)));
            }
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            for (int i = 0; i < _squares.Length; i++)
            {
                _squares[i].Draw(GraphicsDevice);
            }

            base.Draw(gameTime);
        }
    }
}

Posts: 21

Participants: 3

Read full topic

[Solved]How can I smooth it out ?

Loading all files from the content folder instead of one by one.

$
0
0

@LEM wrote:

I'm having some difficulty doing that. When I deploy this code on Windows it works fine:

public static void LoadContent(ContentManager theContentManager)
{
   DirectoryInfo dir = new DirectoryInfo(theContentManager.RootDirectory + "/Music");               
   FileInfo[] files = dir.GetFiles("*.xnb"); 
   ...
}

However when I deploy it on an Android device, I get the exception

System.IO.DirectoryNotFoundException: Could not find a part of the path '/Content/Music'

when GetFiles is called.

Any ideas what I may be missing?

Thanks

Posts: 5

Participants: 3

Read full topic

Cross-Platform?

$
0
0

@TagGamesDavie wrote:

I'm starting a new MonoGame project which is to be (eventually) deployed to Switch, PS4, Xbox One, PC, Linux and Mac.
Yes I am a glutton for punishment.

I've read some old threads, and I see that the general wisdom is to create separate visual studio projects for each platform, and this video: https://youtu.be/WonVmlpPBuU shows that I should have separate MonoGame projects.

It's all a bit old, though. is that video still good? Does anyone have any new advice?

Thanks

Posts: 3

Participants: 2

Read full topic

Viewing all 6821 articles
Browse latest View live