MonoGame | One framework for creating powerful cross-platform games | Game Engine library

 by   MonoGame C# Version: v3.8.1_HOTFIX License: Non-SPDX

kandi X-RAY | MonoGame Summary

kandi X-RAY | MonoGame Summary

MonoGame is a C# library typically used in Telecommunications, Media, Media, Entertainment, Gaming, Game Engine, Framework applications. MonoGame has no bugs, it has no vulnerabilities and it has medium support. However MonoGame has a Non-SPDX License. You can download it from GitHub.

One framework for creating powerful cross-platform games. The spiritual successor to XNA with thousands of titles shipped across desktop, mobile, and console platforms. MonoGame is a fully managed .NET open source game framework without any black boxes. Create, develop and distribute your games your way.

            kandi-support Support

              MonoGame has a medium active ecosystem.
              It has 9513 star(s) with 2701 fork(s). There are 471 watchers for this library.
              It had no major release in the last 12 months.
              There are 710 open issues and 2828 have been closed. On average issues are closed in 933 days. There are 103 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of MonoGame is v3.8.1_HOTFIX

            kandi-Quality Quality

              MonoGame has 0 bugs and 0 code smells.

            kandi-Security Security

              MonoGame has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              MonoGame code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              MonoGame has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              MonoGame releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.
              MonoGame saves you 825 person hours of effort in developing the same functionality from scratch.
              It has 1893 lines of code, 0 functions and 1311 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of MonoGame
            Get all kandi verified functions for this library.

            MonoGame Key Features

            No Key Features are available at this moment for MonoGame.

            MonoGame Examples and Code Snippets

            No Code Snippets are available at this moment for MonoGame.

            Community Discussions


            How to structure a project in Monogame
            Asked 2022-Mar-14 at 17:18

            I'm trying to create a PC version of a cord-driven turn-based boardgame. I went for the Monogame framework in c#. I'm still learning C# and Monogame and I'm reading all about how it is important to "split" the code in the data/game engine part and the graphics/GUI part. So trying to pursue this, I have the following in mind.


            Here I define all the classes relative to the screens (game - menus), GUI components like labels and buttons and possibly even mouse and keyboard inputs (the logic being the user has to click on something in the gui in order to perform an action).

            Data or Game logic/Engine

            Still not even sure on how I should call this part of the project, here I would put all the logic of the game. The classes of player, cards, "IA", rules etc... would be defined here.

            My difficulty is now to understand how to connect this two parts but still maintain the "loosely coupled" approach. I was thinking that maybe the objects or better the instances of the game logic part would have to subscribe to events (such as button_click) defined in the GUI part...but can I even subscribe to events of another class? Is this the correct way?

            I admit I'm still trying to fully understand the event driven concept, but is this the right way of doing stuff in c# and Monogame? I apologize for the vague topic/question but thanks in advance.



            Answered 2022-Mar-14 at 17:18

            I don't know anything about Monogame, but generally it's a good idea to organise any kind of application into layers like this, as long as you don't make the code overly complicated by doing so. Your idea to separate the UI code from the game logic sounds like a good start.

            First, think of your application as an onion, with a series of concentric layers. Your proposed structure has only two layers, but that's OK. A larger application may benefit from more layers, e.g. a data access layer if you were to store the state of the game in a database, but there's no need to add extra layers just for the sake of having more layers.

            Your outermost layer would contain the UI code, typically this is known as the presentation layer.

            Your innermost layer would contain the game logic, typically this is known as the domain layer. A good rule of thumb for whether something belongs in the domain layer is to ask, does this represent something that a user of your application (or a player of your game) who's not a developer would recognise?

            Second, remember that each layer can make calls to code in the same layer, or to code in in other layers inside it, but not to code in layers outside it. So projects in the presentation layer can have references to projects in the domain layer, but projects in the domain layer can't have references to projects in the presentation layer. If you've got circular references between the two layers then it's a sign that something in one of the layers actually belongs in the other layer.

            Here's another answer to a similar question about layering an application, albeit not in the context of a game:

            On the second part of the question, if you want to use events then it's probably best to handle any events in the presentation layer and have the event handlers make calls into the domain layer (but disclaimer, I don't know Monogame).



            Monogame Content not building from VS
            Asked 2022-Jan-29 at 09:34

            I was working on a game on my laptop which I now copied to my desktop (on which I installed Monogame 3.7.1). I can run the build from my laptop on my desktop, but when building it on my desktop (from Visual Studio 2019) it gives the error underneath.

            I tried:

            • When I double click the Content file it opens up the MGCB tool and I can see the content tree fine and modify it. When I click Build it simply does absolutely nothing (output windows stays blank, like I didn't click, same for clean).

            • When I open the MGCB application and then open the Content file from within the application I can build it just fine (all successful, also when cleaning and rebuilding, everything works fine it seems).

            • When copied the command from the Visual Studio error in CMD I got a message that FreeType6.dll couldn't be loaded (a lot of people got this error). The DLL is in the same folder as MGCB (so it's there). I installed VC++ redis 2012, 2013 and 2015 (as people suggested and which worked sometimes), but that didn't help (I rebooted every time).

            • I installed all fonts I used for both the current (only) user on that pc and for all users, but that didn't help.

            A lot of people seem to get stuck with the content build. I don't know where to look anymore. Does anyone have an idea on how to (try to) fix this in a systematical way? It's annoying this error keeps popping up stalling projects.

            Thanks for borrowing you brain!



            Answered 2022-Jan-29 at 09:34

            It's working! :)

            I followed the migration guide for MonoGame 3.7.1 to 3.8 and now it works again :).



            Monogame-uwp package can´t be published to the Windows Store because it still targets Windows.Mobile and can´t be enrypted because of that
            Asked 2021-Dec-28 at 01:08

            I´m trying to publish a package (which is build with the normal uwp-template from monogame) to the Windows Store and it shows the following message:



            Answered 2021-Dec-28 at 01:08

            Please change the minversion in the project file to the version the error message mentioned.

            Like this:



            How to draw on the fly 2D pixel-by-pixel in MonoGame/XNA?
            Asked 2021-Nov-22 at 15:50

            I was wondering how to draw on the fly pixel by pixel in XNA/MonoGame and could only find this. Problem is, the question wasn't centered about how to actually draw pixel by pixel but rather manage resources and updating stuff.

            Because I couldn't find any simple and short answer and was wondering how to do for some time now, I'll share a snippet I stumbled upon (see answer).

            NB: If anyone having a better approach or an alternative method to do it, feel free to post or comment!



            Answered 2021-Nov-22 at 15:45

            You need to use the SetData() method of a Texture2D object you previously initialized with a 1 by 1 size.

            Here's the code:



            Where did these borders come from in Monogame Android?
            Asked 2021-Nov-22 at 03:09

            Even when I use GraphicsDevice.ToggleFullScreen() or GraphicsDevice.IsFullScreen = true; followed by GraphicsDevice.ApplyChanges() as described in this post, I still seem to have this border on both edges of the screen, shown in classic CornflowerBlue for contrast in this screenshot. The background image is anchored at 0,0 with width and height set to the dimensions of the screen. The "borders" seem to be about 10 or 20px from what I can guess, and not at the top or bottom, only at the left and right edges. I can't understand where this is coming from.



            Answered 2021-Nov-22 at 03:09

            If you want your game to be at full screen of every device:



            C# cannot convert from 'float' to 'Microsoft.Xna.Framework.Point'
            Asked 2021-Nov-18 at 07:14

            I'm Trying to make a rougelike in C# using Monogame and RogueSharp.

            here is some of the code I have in Draw()



            Answered 2021-Nov-18 at 07:14

            The Rectangle constructor either takes (Point location, Point size) or (Int32 x, Int32 y, Int32 width, Int32 height) but not (Float, Float) (what would that even mean?) - See docs.

            So, two issues here:

            • You need four values to uniquely specify a rectangle in 2D space, not two. Rectangle does that using X and Y of the top-left corner as well as width and height.
            • The Rectangle constructor expects those values as integers and not floats.

            Looking at your code, I'm guessing that you want to create a rectangle that has sizeOfSprites * scale as length of both sides, in which case you'd need to specify the size as follows:



            My ball and my rectangle wont collide properly (Monogame)
            Asked 2021-Nov-12 at 07:37

            I am currently coding an arkanoid type game for my school project and just started out on monogame. I encountered a collision problem on the big red rectangle and the ball. I just cant figure out what is wrong with my code I appreciate all of your help in advance.

            Collision Video:




            Answered 2021-Nov-12 at 07:37

            This method is missing the necessary code to function properly to approach the block from any side:



            Monogame not drawing png images
            Asked 2021-Oct-20 at 23:24

            I'm trying to draw a sprite to the screen in monogame but does not work. Does not give any errors. I've tried other images and it works with them. Maybe it has something to do with the image being .png? Please help me I can't figure this out




            Answered 2021-Oct-20 at 23:24

            It is easier to use the Monogame Pipline tool to process the PNG file into an XNB file first. Best cross-platform solution.

            There may be times you need to load a PNG directly.

            Add an existing file to the project in Visual Studio. Select the PNG file. Copy it.

            Under properties in Visual Studio, set "Build type to none" and "Copy to output if newer".

            Note this only works on Desktop platforms.



            Monogame buttons
            Asked 2021-Oct-11 at 19:09

            I have been trying to make a clicker game in monogame, But I can't figure out how to make a button. I've tried countless tutorials and none of them seem to work. What is the simplest way to make a button in monogame?



            Answered 2021-Oct-11 at 19:09

            Drawing is usually done with a single function call assuming you want to simply draw a image into the screen without any shader(s) or magic stuff:



            c# monogame gradually rotate camera behind a player
            Asked 2021-Sep-17 at 13:57

            Hello i'm developing a game in c# monogame and having issues with resetting the camera back to behind the player.

            When the player holds left click he's able to orbit the camera around his character. When he moves forward the camera resets back behind him slowly. The rotation should decide whether it should rotate left or right around the player to behind the player (the shortest path). At the moment it sometimes orbits the long way around the player and worst of all the currentY will be stuck in-between 1 and -1 and keep moving back and forth really quick like its stuck.



            Answered 2021-Sep-17 at 13:57

            I solved the problem the code below will rotate between 360 degrees and 0 degrees, it also rotates between 170 degrees to 160 degrees, only posting incase it helps someone else.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install MonoGame

            Our build server builds, tests, and packages the latest MonoGame changes. The table below shows the current build status for the develop branch.


            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.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link