GithubHelp home page GithubHelp logo

monogame / monogame Goto Github PK

View Code? Open in Web Editor NEW
10.8K 469.0 2.8K 91.06 MB

One framework for creating powerful cross-platform games.

Home Page: http://www.monogame.net

License: Other

C# 97.61% XSLT 0.32% Smalltalk 0.45% Batchfile 0.01% HLSL 0.90% Rich Text Format 0.68% Shell 0.03% PowerShell 0.01%
xna monogame game-framework gamedev csharp cross-platform open-source graphics game-engine dotnet

monogame's Introduction

MonoGame

MonoGame is a simple and powerful .NET framework for creating games for desktop PCs, video game consoles, and mobile devices using the C# programming language. It has been successfully used to create games such as Streets of Rage 4, Carrion, Celeste, Stardew Valley, and many others.

It is an open-source re-implementation of the discontinued Microsoft's XNA Framework.

Join the chat at https://discord.gg/monogame

Build Status

We use GitHub Actions to automate builds and packages distribution of the latest MonoGame changes. We also rely on a build server to run tests in order to avoid regressions. The table below shows the current build status for the develop branch.

Name Status
Builds Build

Supported Platforms

We support a growing list of platforms across the desktop, mobile, and console space. If there is a platform we don't support, please make a request or come help us add it.

  • Desktop PCs
    • Windows 8.1 and up (OpenGL & DirectX)
    • Windows Store Apps (UWP)
    • Linux (OpenGL)
    • macOS 10.15 and up (OpenGL)
  • Mobile/Tablet Devices
    • Android 6.0 and up (OpenGL)
    • iPhone/iPad 10.0 and up (OpenGL)
  • Consoles (for registered developers)
    • PlayStation 4
    • PlayStation 5
    • Xbox One (both UWP and XDK)
    • Nintendo Switch
    • Google Stadia

Support and Contributions

If you think you have found a bug or have a feature request, use our issue tracker. Before opening a new issue, please search to see if your problem has already been reported. Try to be as detailed as possible in your issue reports.

If you need help using MonoGame or have other questions we suggest you post on our community forums. Please do not use the GitHub issue tracker for personal support requests.

If you are interested in contributing fixes or features to MonoGame, please read our contributors guide first.

Subscription

If you'd like to help the project by supporting us financially, consider supporting us via a subscription for the price of a monthly coffee.

Money goes towards hosting, new hardware and if enough people subscribe a dedicated developer.

There are several options on our Donation Page.

Source Code

The full source code is available here from GitHub:

  • Clone the source: git clone https://github.com/MonoGame/MonoGame.git
  • Set up the submodules: git submodule update --init
  • Open the solution for your target platform to build the game framework.
  • Open the Tools solution for your development platform to build the pipeline and content tools.

For the prerequisites for building from source, please look at the Requirements file.

A high level breakdown of the components of the framework:

Helpful Links

License

The MonoGame project is under the Microsoft Public License except for a few portions of the code. See the LICENSE.txt file for more details. Third-party libraries used by MonoGame are under their own licenses. Please refer to those libraries for details on the license they use.

monogame's People

Contributors

andreesteve avatar aranda avatar aristurtledev avatar cartblanche avatar chaosus avatar chris-chambers avatar danzel avatar dellis1972 avatar dneelyep avatar espes avatar flibitijibibo avatar hach-que avatar harry-cpp avatar jjagg avatar kaenage avatar kjpou1 avatar konajugames avatar michaeldepiazzi avatar mrhelmut avatar nezz avatar nkast avatar polsys avatar prollin avatar simondarksidej avatar thefiddler avatar tomspilman avatar totallyevil avatar totallyeviljake avatar tzenchor avatar zdman2022 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monogame's Issues

Compatibility with KryptonXNA

Tested KryptonXNA http://krypton.codeplex.com/ lighting engine with MonoGame and got some errors. Hope this helps.

Error 21 'Microsoft.Xna.Framework.Graphics.GraphicsDevice' does not contain a definition for 'GetRenderTargets' and no extension method 'GetRenderTargets' accepting a first argument of type 'Microsoft.Xna.Framework.Graphics.GraphicsDevice' could be found (are you missing a using directive or an assembly reference?) KryptonEngine.cs 263 52 Krypton
Error 17 Argument 1: cannot convert from 'ref var.Position' to 'ref Microsoft.Xna.Framework.Vector3' KryptonRenderHelper.cs 261 50 Krypton
Error 18 Argument 2: cannot convert from 'ref Microsoft.Xna.Framework.Matrix' to 'ref Microsoft.Xna.Framework.Quaternion' KryptonRenderHelper.cs 261 64 Krypton
Error 19 Argument 3: cannot convert from 'out var.Position' to 'out Microsoft.Xna.Framework.Vector3' KryptonRenderHelper.cs 261 78 Krypton
Error 16 The best overloaded method match for 'Microsoft.Xna.Framework.Vector3.Transform(ref Microsoft.Xna.Framework.Vector3, ref Microsoft.Xna.Framework.Quaternion, out Microsoft.Xna.Framework.Vector3)' has some invalid arguments KryptonRenderHelper.cs 261 21 Krypton
Error 1 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 154 28 Krypton
Error 2 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 156 21 Krypton
Error 3 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 162 21 Krypton
Error 4 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 168 21 Krypton
Error 5 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 174 21 Krypton
Error 6 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 182 53 Krypton
Error 7 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 206 17 Krypton
Error 8 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 209 32 Krypton
Error 9 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 211 21 Krypton
Error 10 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 217 21 Krypton
Error 11 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 223 21 Krypton
Error 12 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 229 21 Krypton
Error 13 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 235 21 Krypton
Error 14 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 241 21 Krypton
Error 15 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 247 21 Krypton
Error 20 The type or namespace name 'VertexPositionColorTexture' could not be found (are you missing a using directive or an assembly reference?) KryptonRenderHelper.cs 301 64 Krypton

iOS Won't Start In Landscape

Though rotation is now working correctly when iOS applications start in Portrait and are turned to other orientations, starting out in orientations that are not Portrait isn't working correctly in all cases.

XNA Project Conversion

A script to convert existing XNA projects to MonoGame projects would ease the transition for developers significantly.

FR: Define a conditional compilation symbol: #monogame

So basically, I've ported my 3d block engine (http://www.voxeliq.org/) to monogame and with a few glitches, it's all great. The problem is that as monogame isn't 100% compatible with XNA 4.0 yet, I hit spots where i need that #monogame symbol. Let me explain in details;

As I'm working on a block engine with millions of blocks in memory, I'm using other threads to generate, lighten and build vertices.

So within the last step my code creates new VertexBuffer's in those off-threads which at the moment seems MonoGame/develop3d branch doesn't support and throws;

throw new NotImplementedException("Threaded creation of GPU resources is not currently supported on this platform");

So a solution I came with is adding #monogame symbol to my block engine's monogame version project and using as;

            #if !MONOGAME
                        if (!this.CacheThreadStarted)
                        {
                            var cacheThread = new Thread(CacheThread) { IsBackground = true };
                            cacheThread.Start();

                            this.CacheThreadStarted = true;
                        }
            #else
                        this.Process();
            #endif

So wouldn't it be better if monogame framework project's define #monogame symbol on their own so for project that targets XNA and monogame together can differentiate the underlying framework?

Camera using UIImagePickerController on main UIViewController

I can`t use a UIImagePickerController on the;
game.Services.GetService(typeof(UIViewController)) as UIViewController
When I try to do so I get a:
Error while processing the main game loop: Object reference not set to an instance of an object
at Microsoft.Xna.Framework.iOSGameWindow.get_ClientBounds ()

On later versions of MonoGame, when game.Window was a UIWindow, I could do this just perfectly. I don`t want to use a UIPopoverController... I would if it was fullscreen. Anyone knows a solution for this?

RenderTarget - Matrix not applied

When using a RenderTarget and calling spriteBatch.Begin() with a matrix to handle rotation, the matrix is not applied, it is drawn without rotation.

Have tested this on iOS and Windows, but the problem seems to be only on iOS.

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

        Rectangle bound1 = new Rectangle (0, 0, width, height);

        GraphicsDevice.SetRenderTarget (render);
        GraphicsDevice.Clear (Color.CornflowerBlue);

        spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Matrix.CreateRotationZ ((float)gameTime.TotalGameTime.TotalSeconds * 4));
        spriteBatch.Draw (debug, bound1, new Color (1, 0, 0, 0.5f));
        spriteBatch.End ();

        GraphicsDevice.SetRenderTarget (null);
        GraphicsDevice.Clear (Color.CornflowerBlue);
        Texture2D final = (Texture2D)render;

        spriteBatch.Begin ();
        spriteBatch.Draw (final, bound1, Color.White);
        spriteBatch.End ();

        base.Draw (gameTime);
    }

Memory Leak on Android when Orientation Changes

There seems to be a big problem with the Orientation change stuff on Android. After reading the documentation the Activity is re-created each time the Orientation/Configuration changes. The means the Game object is being re-created each time, so all the assets are loaded again and again and again each time the orientation changes.

We need to figure out a way to detect this and keep the same game object/ content manager around and just swap out the Activity/ AndroidGameView.

This will not effect people who just use a fixed screen orientation for games as the orientation will not change. however this might be the cause of the Resume issue we have been seeing as well.

Android (Probably other platforms too) Gesture Drag vs Tap

Tapping the screen triggers the drag event and release and then a moment later the OnSingleTapConfirmed is thrown. I think this should be an either/or relationship. Also, the drag event should have a minimum movement requirement before triggering so just tapping the screen doesn't drag.

Followed Pre-Req guide and cannot compile.

Hello all, let me first say I am new to github and MonoGame so pardon my ignorance. If it helps, I am here for MonoGame and thank you for all your hard work. So sorry if this doesn't belong in "issues"

I have summarized my issue on pastebin: http://pastebin.com/sur9L8Ky

My platform details:
Windows 7 x64 with MonoDevelop 2.4

Guide Keyboard broken

JeRET over on the discussion forums ( http://monogame.codeplex.com/discussions/319657 ) , posted this...

" have another problem: when I call Guide.BeginShowKeyboard(), I see my Title three times, I can edit the top two fields and the ok-button is not at the correct position.

My Title is "Your Nickname" and my description is string.Empty. (another bug: while you can pass null on windows phone for one of these, it crashes under iOS).

When I managed to click the ok button (which doesn't work all the time), I receive a System.InvalidOperationException In Guide.ShowKeyboardInput():

result = ((UIAlertView) sender).Subviews.OfType<UITextField>().Single().Text;

here is an image of what i see before pressing ok:

Screenie
"

User fuleshu followed up with...

"
I ran into the same problem. Therefore I tried today's developer branch from GitHub, where there have been a lot of changes concerning this code.

But I found the following problem with the developer branch code:

When I open the Guide with Guide.BeginShowKeyboardInput I run into an exception thrown at:

iOSGameWindow - Line 94

It is where the ClientBounds property is requested and it runs into a null at _viewController.View.Window

I tried to find why Window is null, but I couldn't. I guess that probably when the text input view is opened, the main game window gets invalid. Unfortunately I have no understanding of iOS View, UI etc.

However, when I insert:

if (_viewController.View.Window == null)  
{
    return new Rectangle(0,0,0,0);
}

then everything runs fine.

I guess it is a hotfix that works fine for me now, but doesn't solve the bug at the right place.

"

StorageDevice/StorageContainer error on Device

When I try to use the StorageDevice/StorageContainer ON THE DEVICE it throws a ExecutionEngineException...

Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_object__this___Nullable`1_int_int (object,intptr,intptr,intptr)' while running with --aot-only.

[ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_object__this___Nullable`1_int_int (object,intptr,intptr,intptr)' while running with --aot-only.

This happens only when linking on the device.

First I tried to use the StorageDevice/StorageContainer on my game, then it didn't worked, so I tried running the AlienGame StarterKit, newest version, and it was also not as working, so the StarterKit also has this bug.

RenderTarget - Only last call to spritebatch is drawn

When setting RenderTarget and using more than one spriteBatch.Begin() and spriteBatch.End() call during Draw() only the last call is drawn to the RenderTarget.

This seems to happen on iOS but not on Windows, those are the only platforms I have tested.

      protected override void Draw (GameTime gameTime)
    {

        GraphicsDevice.Clear (Color.CornflowerBlue);

        Rectangle bound1 = new Rectangle (0, 0, width, height);
        Rectangle bound2 = new Rectangle (5, 5, width, height);

        GraphicsDevice.SetRenderTarget (render);
        GraphicsDevice.Clear (Color.CornflowerBlue);

        spriteBatch.Begin ();
        spriteBatch.Draw (debug, bound1, Color.White);
        spriteBatch.End ();

        spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Matrix.Identity);
        spriteBatch.Draw (debug, bound2, new Color (1, 0, 0, 0.5f));
        spriteBatch.End ();


        GraphicsDevice.SetRenderTarget (null);
        GraphicsDevice.Clear (Color.CornflowerBlue);
        Texture2D final = (Texture2D)render;

        spriteBatch.Begin ();
        spriteBatch.Draw (final, bound1, Color.White);
        spriteBatch.End ();

        base.Draw (gameTime);
    }

iOS Guide.BeginShowKeyboardInput

On iOS, the command Guide.BeginShowKeyboardInput doesn't work correctly.

A popup appears with 3 text fields that you can type, instead of one, and clicking on the "Done" button on the keyboard doesn't do anything.

RenderTarget gets cut off

I have an example where I basically load a texture that is 1024x768 and also create a RenderTarget that is 1024x768. I set the backbuffer to 768x1024 (iPad portrait) and then try to render the texture to the RenderTarget and rotating it to show.

This should display the complete texture, but it is cutoff at 768px width. So it seems the rendertarget cant be larger than the viewport.

/// <summary>
/// This is the main type for your game
/// </summary>
public class Game : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    int ScreenWidth = 768;
    int ScreenHeight = 1024;

    Texture2D debugTexture;
    Texture2D screenTexture;
    RenderTarget2D renderTarget;

    public Game ()
    {
        graphics = new GraphicsDeviceManager (this);
        Content.RootDirectory = "Content";

        // setting the backbuffer to 768 x 1024 (iPad Portrait)
        graphics.PreferredBackBufferWidth = ScreenWidth;
        graphics.PreferredBackBufferHeight = ScreenHeight;


        graphics.SupportedOrientations = DisplayOrientation.Portrait;
    }

    protected override void Initialize() {
        // TODO: Add your initialization logic here
        base.Initialize();
    }


    protected override void LoadContent ()
    {

        spriteBatch = new SpriteBatch (GraphicsDevice);

        // loading a texture that is 1024x768 with marked corners
        debugTexture = Content.Load<Texture2D> ("debug");

        // Setting the rendertarget to 1024x768 (iPad Landscape)
        renderTarget = new RenderTarget2D (GraphicsDevice, ScreenHeight, ScreenWidth);
    }


    protected override void UnloadContent() {

    }

    protected override void Update(GameTime gameTime) {
        base.Update(gameTime);
    }


    protected override void Draw (GameTime gameTime)
    {
        // Setting the rendertarget to our 1024x768
        GraphicsDevice.SetRenderTarget (renderTarget);
        GraphicsDevice.Clear (Color.Green);


        spriteBatch.Begin ();

        // Drawing our texture to the rendertarget (1024x768)
        spriteBatch.Draw (debugTexture, renderTarget.Bounds, Color.White);
        spriteBatch.End ();

        // Clearing the backbuffer
        GraphicsDevice.SetRenderTarget (null);
        GraphicsDevice.Clear (Color.Green);

        // Setting our temporary texture to the newly drawn rendertarget (1024x768)
        screenTexture = (Texture2D)renderTarget;

        spriteBatch.Begin ();

        // drawing the texture to screen and rotating it to show that it is cut off
        // this should show the complete texture when rotating, instead it only shows 768px of it
        spriteBatch.Draw (screenTexture, Vector2.Zero, null, Color.White, MathHelper.ToRadians ((float)gameTime.TotalGameTime.TotalSeconds), Vector2.Zero, Vector2.One, SpriteEffects.None, 0f);

        spriteBatch.End ();

        base.Draw (gameTime);
    }
}

IUpdateable defined differently from XNA 4.0

In porting the source for my new game to MonoGame I hit the following issue. In Microsoft XNA Game Studio 4.0
Build 4.0.30901.0 the IUpdateable interface has the EnabledChanged and UpdatedOrderChange events defined using EventHandler:

    event EventHandler<EventArgs> EnabledChanged;
    event EventHandler<EventArgs> UpdateOrderChanged;

in MonoGame's IUpdateable they are defined using the untemplated EventHandler class:

    event EventHandler EnabledChanged;
    event EventHandler UpdateOrderChanged;

This is a compilation error and prevents smooth porting. Is there any reason this cannot be fixed in the MonoGame sources?

UserDrawPrimitives no longer work on Android

Under the OpenGL ES 2.0 profile UserDrawPrimitives no longer work. As a result the Vector rumble SampleKit does not render.

The app does not crash but there are allot of Unsupported API call messages from OpenGL.

It is worth mentioning that it still works under the GL 1.1 profile.

Crashes when app is suspended in iOS

Hey guys,

When the app is suspended in iOS by hitting the home button, the app crashes. The reason is there are GL calls occurring in GraphicsDevice.Present() while the app is in the background.

I fixed it in my fork (with help from Andrew Russell), but I'm not sure how you guys would prefer to solve this issue. Still not a github pro so not sure if I can pull request a single commit

hexate@e55c93d

NOTE: This does not manifest in the simulator for me, it occurs on the device itself.

LZxDecoder error under android

There is a problem with the LZxDecode under android , Here is the stack trace and a link to the test project.

System.Diagnostics.Debugger.Mono_UnhandledException (Parameters=) in /home/jon/Development/xamarin/mono/mcs/class/corlib/System.Diagnostics/Debugger.cs:124
System.Object.817f673d-fa27-427f-bd3c-83536ddb0844 (Parameters=) in
Android.Runtime.InputStreamInvoker.get_Position (Parameters=) in /home/jpobst/Desktop/monodroid/Mono.Android/src/Runtime/InputStreamInvoker.cs:50
Microsoft.Xna.Framework.Content.LzxDecoder.Decompress (inData=, inLen=, outData=, outLen=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Content\LzxDecoder.cs:126
Microsoft.Xna.Framework.Content.ContentManager.ReadAsset (Parameters=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Content\ContentManager.cs:278
Microsoft.Xna.Framework.Content.ContentManager.Load (Parameters=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Content\ContentManager.cs:139
Test.Game1.LoadContent (Parameters=) in c:\Users\d_ellis\Desktop\Test\Game1.cs:22
Microsoft.Xna.Framework.Game.Initialize (Parameters=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Android\Game.cs:372
Microsoft.Xna.Framework.Game.DoUpdate (Parameters=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Android\Game.cs:200
Microsoft.Xna.Framework.AndroidGameWindow.OnUpdateFrame (Parameters=) in c:\Sandbox\Development\MonoGame\MonoGame.Framework\Android\AndroidGameWindow.cs:190
OpenTK.Platform.Android.AndroidGameView.RunIteration (Parameters=) in /home/jpobst/Desktop/monodroid/OpenGLES/OpenTK/Platform/Android/AndroidGameView.cs:1207
OpenTK.Platform.Android.RepeatTimerTask.Run (Parameters=) in /home/jpobst/Desktop/monodroid/OpenGLES/OpenTK/Platform/Android/AndroidGameView.cs:1668
Java.Util.TimerTask.n_Run (Parameters=) in /home/jpobst/Desktop/monodroid/Mono.Android/platforms/android-8/src/generated/Java.Util.TimerTask.cs:80
System.Object.817f673d-fa27-427f-bd3c-83536ddb0844 (Parameters=) in

http://liquidfirearts.com/download/Test.zip

Looks like the underlying Stream does not support the Position property.

Viewport Rendering Origin

Creating a Viewport at {0, 0} (other coordinates too, of course) and rendering into it in XNA results in the texture being rendered starting at {0, 0} (top-left). MonoGame currently renders to the lower-left (OpenGL's default origin?)

  1. Create a visual test from the attached code sample
  2. Make this test pass!

SpriteBatch.Draw not using specified transformation matrix

I use the crap out of the following in my game

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, myCamera.View);
spriteBatch.Draw(someStuff);

and the camera's view matrix is not being applied.

I'm pretty sure the fix is pretty trivial, i think you change this in SpriteBatch.UpdateWorldMatrixOrientation() ~ln 507

from this:
matViewScreen =
Matrix.CreateRotationZ((float)Math.PI) *
Matrix.CreateRotationY((float)Math.PI) *
Matrix.CreateTranslation(-viewport.Width / 2, viewport.Height / 2, 1);

to this:
matViewScreen =
_matrix *
Matrix.CreateRotationZ((float)Math.PI) *
Matrix.CreateRotationY((float)Math.PI) *
Matrix.CreateTranslation(-viewport.Width / 2, viewport.Height / 2, 1);

Problem when using DrawableGameComponent

When i create a new DrawableGameComponent Object and than add it to my SceneManager i always get an Exception in:

\MonoGame\MonoGame.Framework\Windows\Game.cs

    private void InitializeGameComponents()
    {
      foreach (GameComponent gc in _gameComponentCollection)
              {                
               gc.Initialize();
              }
    }

System.InvalidOperationException wurde nicht behandelt.
Message=Die Auflistung wurde geändert. Der Enumerationsvorgang kann möglicherweise nicht ausgeführt werden.
Source=mscorlib
StackTrace:
bei System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
bei System.Collections.Generic.List1.Enumerator.MoveNextRare() bei System.Collections.Generic.List1.Enumerator.MoveNext()
bei Microsoft.Xna.Framework.Game.InitializeGameComponents() in d:\GITs\MonoGame\monogame\MonoGame\MonoGame.Framework\Windows\Game.cs:Zeile 381.
bei Microsoft.Xna.Framework.Game.Update(GameTime gameTime) in d:\GITs\MonoGame\monogame\MonoGame\MonoGame.Framework\Windows\Game.cs:Zeile 405.
bei Microsoft.Xna.Framework.Game.DoUpdate(GameTime aGameTime) in d:\GITs\MonoGame\monogame\MonoGame\MonoGame.Framework\Windows\Game.cs:Zeile 194.
bei Microsoft.Xna.Framework.WindowsGameWindow.OnUpdateFrame(Object sender, FrameEventArgs e) in d:\GITs\MonoGame\monogame\MonoGame\MonoGame.Framework\Windows\WindowsGameWindow.cs:Zeile 561.
bei OpenTK.GameWindow.OnUpdateFrame(FrameEventArgs e)
bei OpenTK.GameWindow.OnUpdateFrameInternal(FrameEventArgs e)
bei OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch update_watch, Double& next_update, FrameEventArgs update_args)
bei OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e)
bei OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
bei OpenTK.GameWindow.Run(Double updateRate)
bei Microsoft.Xna.Framework.Game.Run() in d:\GITs\MonoGame\monogame\MonoGame\MonoGame.Framework\Windows\Game.cs:Zeile 184.
bei MemoryMadness.Program.Main(String[] args) in d:\GITs\MonoGame\monogame\EX1_BasicGameWithStateManagement\MemoryMadness\MemoryMadness\Program.cs:Zeile 26.
InnerException:

SampleCode:
Here is the Sample i used to convert it to Monogame. In XNA it works!

Level is an DrawableGameComponent Object.

    private void InitializeLevel()
    {
        currentLevel = new Level(ScreenManager.Game,
                     ScreenManager.SpriteBatch,
                     currentLevelNumber, movesPerformed, buttonsTexture);
        currentLevel.IsActive = true;

        ScreenManager.Game.Components.Add(currentLevel);
    }

download sample:
http://create.msdn.com/en-US/education/catalog/lab/memory_madness

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.drawablegamecomponent.aspx

Any hint how to fix this problem?

Retina Display

What happened to retina display (@2x) files? They are not loading anymore on newer versions?

Split out the dependency on Lidgren

We need to split out the Networking and GamerServices into seperate projects so that the code MonoGame.Framework does not have a direct dependency.

This will mean users not using networking will not need to reference the dlls.

Getting Started Guides

A pass through the current "Getting Started" materials is needed. Make sure all the material that exists is correct and applicable.

iOS - SpriceBatch.cs

I had problems building the iOS Fx. Looks like improper cast between OpenTK.Matrix4 and Xna.Matrix. Just added the extension method locally:

public static class MatrixConvert
{
public static Matrix ToXnaMatrix(this Matrix4 m)
{
return new Matrix(m.M11,m.M12,m.M13,m.M14,m.M21,m.M22,m.M23,m.M24,m.M31,m.M32,m.M33,m.M34,m.M41,m.M42,m.M43,m.M44);
}
}

And then corrected the multiplications to use it:

if ANDROID

            lastDisplayOrientation = DisplayOrientation.Unknown;
            UpdateWorldMatrixOrientation();

else

            lastDisplayOrientation = graphicsDevice.PresentationParameters.DisplayOrientation;
            matViewScreen = (Matrix4.CreateRotationZ((float)Math.PI)*
                    Matrix4.CreateRotationY((float)Math.PI)*
                    Matrix4.CreateTranslation(-this.graphicsDevice.Viewport.Width/2,
                        this.graphicsDevice.Viewport.Height/2,
                        1)).ToXnaMatrix(); // <---
            matViewFramebuffer = Matrix4.CreateTranslation(-this.graphicsDevice.Viewport.Width/2,
                        -this.graphicsDevice.Viewport.Height/2,
                        1).ToXnaMatrix(); // <--
            matProjection = Matrix4.CreateOrthographic(this.graphicsDevice.Viewport.Width,
                        this.graphicsDevice.Viewport.Height,
                        -1f,1f).ToXnaMatrix(); // <---

            matWVPScreen = matViewScreen * matProjection;
            matWVPFramebuffer = matViewFramebuffer * matProjection;

endif

LinearWrap doesn't work on iOS in GLES2

I've created a test case for LinearWrap:
https://github.com/danzel/WrapTest
(Do a checkout of MonoGame in MonoGame/)
(Press space or tap the screen to toggle between rendering scenes)

Sample screenshots are in output/

On MacOs and MS-XNA LinearWrap behaves as shown in the mac6[04].png screenshots.
On iOS LinearWrap works as shown in the ios6[04].png screenshots.

I sort of expect 60px images not to work as they are non power of 2 and get padded, but I'd expect 64px images to wrap correctly.

I'll take a look, but maybe someone who understands MonoGame better than me can find the issue :)

Expected:
Expected
Actual:
Actual

Monogame on iOS: different behavior when interpreting touches compared to Windows Phone

Just to do some tests I have exeuted Microsofts XNA sample "Shooter" on Windows 7, Windows Phone 7 and iPhone (using Monogame).

Besides the fact the Monogame runs the game in portrait instead of landscape, I have noticed that the movement of the player sprite behaves really different.

On Phone 7, you tap anywhere, keep your finger on the screen and while moving it, the sprite follows the movement relative to the finger.

On iPhone however, the sprite first doesn't move at all, then moves extremely fast and moves up to the screens bounds. This makes the player uncontrollable.

The code used is:

while ( TouchPanel.IsGestureAvailable )
{
GestureSample gesture = TouchPanel.ReadGesture();
if ( gesture.GestureType == GestureType.FreeDrag )
{
player.Position += gesture.Delta;
}
}

Does that have to be different for iOS?

Android Memory Leak

There's a massive memory leak when reloading textures after the context is lost. It seems that when the application is put into the background, it doesn't lose any memory consumption. But when returning and the opengl textures are recreated, the memory is added to the existing memory footprint. Eventually, the application crashes because it's consumed to much memory.

Game Load Time is extremely long and Textures invisible

Hi guys,
i am facing two problems with MonoGame for Android when deploying on a real device.

Development Device/Informations:

  • Visual Studio 2010, Monogame 2.5.0.0, Xamarin MonoDroid
  • The developement device i am using is a Samsung Galaxy W SGH-T679M (OS 2.3)
  • According to the informations i found on the web, the GPU is => Qualcomm Adreno (TM) 205 / OpenGL ES-CM 1.1
  • I develop on this device to have as much compatibility as possible with the different devices (old & new)

When porting a Windows Phone XNA game to Android using MonoDroid/MonoGame, the game is working fine, load quickly and everything works well in the emulator.

However, when deploying on a real device i am facing these two problems:

  1. Load Time:
  • The load time to launch my game vary between 90sec to 120sec. Even when removing any Assets Loading code, the game still take that long to launch.
  • I tried the CatapultWars Demo, it take really long to load but the game itself work flawlessly.
  • I tried to create an empty OpenGL project with MonoDroid and keep the spinning square demo and it is loading in ~2-3sec. and run really smooth.

  1. Textures invisible
  • Beside the load time problem, my textures are not visible on a real device, even tho everything works fine in the Emulator(OS 2.2). All i can see is the GraphicsDevice.Clear color.
  • I am using PNG, non power of 2(work in the emulator anyway). Even when using Power of 2 textures i have no success.

Thanks in advance!

Unable to compile because GamepadBridge.dll is not signed

I am trying to port a game to Linux but unable to successfully compile MonoGame because some assemblies in the ThirdParty/GamepadConfig folder in particular GamepadBridge are not signed with a strong name and is preventing me from compiling the dlls with Mono from Linux. In addition there is no source code for the assemblies in GamepadConfig in order to sign it.

Error CS1577: Referenced assembly `GamepadBridge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name (CS1577) (MonoGame.Framework.Linux)

Monogame templates for Monodevelop no longer work

Hi,

the README states to "Drag and Drop the directory MonoDevelop.MonoGame.1.6.0 into ~/.config/MonoDevelop/addins" to install the Monogame templates.
However, this no longer works.
Here's the reply from Xamarin regarding this issue:

The ~/.config/MonoDevelop was used for MD 2.4 and earlier, but we migrated to a new layout in 2.6 and later: http://monodevelop.com/Developers/Articles/User_Profiles. In particular, addins for MD 2.8 on Mac would go in ~/Library/Application Support/MonoDevelop-2.8/Addins. However, it would be better for MonoGame to convert their addin into an mpack package using "mdtool setup pack", so that it could be installed via the Addin Manager.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.