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

New to MonoGame, struggling to get a font on iOS

$
0
0

@Russell wrote:

Hello,
I've just installed MonoGame with Visual Studio Mac and read some tutorials and unfortunately I can't seem to get the sample project to build a font.

The sample project has an empty Content.mgcb file for the pipeline tool. I've added a spritefont and attempted to build the mgcb file with the Pipeline tool. Something flashes in the Build Output window but disappears straight away.

Now when I build the monogame project, I have two errors.
I'm not really sure where to go from here. It looks like the pipeline tool doesn't work, but I dont think I'm doing anything wrong?

MonoGame project building Errors:


Project "monogametest2.iOS.csproj" (Build target(s)):

Target RunContentBuilder:
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono "/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/Tools/MGCB.exe" /@:"/Users/R/Development/Conspiracy/monogametest2/Content/Content.mgcb" /platform:iOS /outputDir:"/Users/R/Development/Conspiracy/monogametest2/Content/bin/iOS" /intermediateDir:"/Users/R/Development/Conspiracy/monogametest2/Content/obj/iOS" /quiet
/Users/R/Development/Conspiracy/monogametest2/Content/testfont.spritefont
Building Font /Library/Fonts/Arial.ttf
/Users/R/Development/Conspiracy/monogametest2/Content/testfont.spritefont : error : Processor 'FontDescriptionProcessor' had unexpected failure!
System.NullReferenceException: Object reference not set to an instance of an object
at (wrapper unknown) SharpFont.Internal.GlyphSlotRec.PtrToStructure(intptr,object)
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStructure(intptr,System.Type)
at SharpFont.PInvokeHelper.PtrToStructure[T] (System.IntPtr reference) [0x00000] in <1ab1c07fc69249aba62188cb35238785>:0
at SharpFont.GlyphSlot.set_Reference (System.IntPtr value) [0x00007] in <1ab1c07fc69249aba62188cb35238785>:0
at SharpFont.GlyphSlot..ctor (System.IntPtr reference, SharpFont.Face parentFace, SharpFont.Library parentLibrary) [0x00006] in <1ab1c07fc69249aba62188cb35238785>:0
at SharpFont.Face.get_Glyph () [0x0001b] in <1ab1c07fc69249aba62188cb35238785>:0
at Microsoft.Xna.Framework.Content.Pipeline.Graphics.SharpFontImporter.ImportGlyph (System.Char character, SharpFont.Face face) [0x00011] in :0
at Microsoft.Xna.Framework.Content.Pipeline.Graphics.SharpFontImporter.Import (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription options, System.String fontName) [0x00036] in :0
at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.ImportFont (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription options, System.Single& lineSpacing, System.Int32& yOffsetMin, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context, System.String fontName) [0x00059] in :0
at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.Process (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription input, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context) [0x00151] in :0
at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2[TInput,TOutput].Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process (System.Object input, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context) [0x00038] in :0
at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00163] in :0
/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/MonoGame.Content.Builder.targets(90,5): error MSB3073: The command "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono "/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/Tools/MGCB.exe" /@:"/Users/R/Development/Conspiracy/monogametest2/Content/Content.mgcb" /platform:iOS /outputDir:"/Users/R/Development/Conspiracy/monogametest2/Content/bin/iOS" /intermediateDir:"/Users/R/Development/Conspiracy/monogametest2/Content/obj/iOS" /quiet" exited with code 1.
Done building target "RunContentBuilder" in project "monogametest2.iOS.csproj" -- FAILED.

Done building project "monogametest2.iOS.csproj" -- FAILED.

Build FAILED.

/Users/R/Development/Conspiracy/monogametest2/Content/testfont.spritefont : error : Processor 'FontDescriptionProcessor' had unexpected failure!
/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/MonoGame.Content.Builder.targets(90,5): error MSB3073: The command "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono "/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/Tools/MGCB.exe" /@:"/Users/R/Development/Conspiracy/monogametest2/Content/Content.mgcb" /platform:iOS /outputDir:"/Users/R/Development/Conspiracy/monogametest2/Content/bin/iOS" /intermediateDir:"/Users/R/Development/Conspiracy/monogametest2/Content/obj/iOS" /quiet" exited with code 1.
0 Warning(s)
2 Error(s)

Posts: 2

Participants: 2

Read full topic


Smooth Parallax Scrolling for Low Res 2D Game

$
0
0

@mikehaggar wrote:

Is there a viable solution for this? Background parallax layers have a very small threshold for movement less than one pixel a frame before their scrolling becomes choppy (at 60fps). You can have the layer move 1px every 2, 3, or 4 frames and still sell the illusion of smooth movement, but any movement smaller than that (1px every 5 or more frames) and the illusion of smooth movement is broken. I've Google'd this pretty extensively and haven't come up with much...

Posts: 1

Participants: 1

Read full topic

Entity System

$
0
0

@dryhfth wrote:

Hello there!

At the moment, I'm trying to implement entity component system and getting the following error:

Error Component is not marked with EntityComponent Attribute

To begin with, I'm attempting to add CursorEntity which has following component:

[EntityComponent]
    class CursorComponent : EntityComponent
    {
        public Point Position { get; set; }
    }

Posts: 1

Participants: 1

Read full topic

Very new to game development/C# and I have some concerns regarding Monogame as an engine

$
0
0

@Ceemo wrote:

Hey guys, I'd like to start this topic off by introducing myself. My name is Chris. I currently own and operate my own business (oddly enough, related to the video game industry), but am ready for a career change. In about a years time, I'll be at a point in my life where I can finally sit down and begin the journey of developing my own game.

The sort of game I'd like to make would be something similar to Terraria (well, similar in block management only), but much more focused on action rather than building. I have been brainstorming for this game for about 6 years or so, and I know exactly what direction I'd like to take, and what systems I'd like to implement.

With that said, I do have some concerns...

Terraria was built using XNA. Monogame (so I've been told) expands upon that framework. It would seem like an obvious choice, but I have my doubts. I've been talking with a few people, and one of them had recommended Unity over Monogame, so I asked them why. He mentioned that Unity was a lot less work, but I'm not so convinced of that. There are a few threads here regarding Unity vs. Monogame, and I don't really want to spark another debate, other than to gain some insight into which engine would be more suited for what I'm trying to achieve.

I was taking a look at a game that was released in 2016 called "Enter the Gungeon". This game was developed in Unity, and has a few of the systems and graphics I'm interested in, so Unity may seem like the way to go. However, I'm almost certain (but not positive) that there are all kinds of custom shaders within that game, which makes things infinitely more complicated for me, having only coded for a few weeks 5 years ago. I'm just not so sure my math skills are up for that type of challenge (shaders).

Anyhow, most of the complaints I've seen surrounding Unity have to do with it's lack of user control of the low level stuff. Once I embark on this journey, I would much rather have as much control as possible, and not rely on pre-built tools that may accomplish what I'm after, but were built for a more "general" approach. For example, if I use a built-in tool to handle one system, and I'd like to add on to that system later, that specific tool may not be the best choice, but I'm left with no choice but to use what Unity has to offer, or build my own.

On the one hand, I want that low-level control of my own game. On the other, Unity has so many systems built in, that it's hard to discount it as a viable option. Monogame might be able to give me all the control I could ever want, but at the same time, with my limited skills (at least right now), I'm afraid I'd be wasting years of my life on a Monogame development, when I could have used Unity and saved myself a lot of time with it's pre-built tools.

As you can see, it's a very real concern for me. I know it may be much too early to be concerned about which engine to use, having not started learning C# seriously just yet, but I'd like to start thinking about these types of questions before things advance to a point of no return :wink:

I have always been the type of person that loves to know how things work. Ever since I was a young child, I was taking things apart, just to see how they worked. I got in trouble for doing this more often than not, but it helped me become the person I am today. Most of the time, if you put something mechanical in front of me, I'll more than likely figure out how it works. If that something has a problem, I can probably fix it. If I don't know how, I'll learn how. That's just my nature.

I would really like to hear some of your thoughts regarding the complexity of Monogame, and the amount of low-level work I'll have to put into a game that's similar to Terraria (again, mostly for block handling) vs. Unity and all the pre-built tools that may not work in my favor. Is it really just about how much control I'd like over my own systems? If it's that simple, perhaps Monogame is the right choice?

I know this thread was probably way too long, but if you made it this far, thank you for your time :wink:

Posts: 1

Participants: 1

Read full topic

Is it a bad design to use single BasicEffect/CustomFX for all game entities ?

$
0
0

@DexterZ wrote:

Mostly I have read that you should create each of game objects or entities it's own BasicEffect or Custom Effect as for example if I have 500 bullets as shown in the image below if I will create each of them it's own BasicFX/CustomFX when the bullets elapse it's life time I need to destroy 500 BasicFX/CustomFx ?

Against if I will only use single BasicFX/CustomFX and apply the appropriate properties on render time to the global single BasicFX/CustomFX then I don't need to destroy any effects.

But Is there any long run side effect if I will just use single BasicFX/CustomFX for all of my game objects ?

Posts: 3

Participants: 2

Read full topic

ECS and Screens

$
0
0

@Zach_Parks wrote:

I'm working on a game with multiple stages or "screens." Currently a screen manager handles the menus and game screens and the MonoGame.Extended.Entities ECS is being created in the first game screen. The game will change screens a limited number of times in sequential order: 1, 2, 3, 4, 5, 6, and then back to 1. (Note: I'm not using MonoGame.Extended.Screens, I'm using an XNA game state management project by Microsoft)

I've realized I have two options: Either 1) recreate an ECS inside each screen (but there's probably no way to differentiate between the ECS/Systems/Components of previous screens)
or 2) Just have a single gameplay screen with one ECS and write logic in the systems and components to handle creating different "screen" entities based on what gameplay is supposed to be happening. Because after all an ECS is just data+logic, right?

I'm thinking option 2 makes much more sense. Any advice? Thanks!

(Using an ECS and screen manager is the obvious choice for avoiding hard to write and maintain spaghetti code and it has already made it light years easier to plan out a game, so I know there's probably an easy answer here that I just have to find, probably by just trying to code it.)

Posts: 3

Participants: 2

Read full topic

We would like to help MonoGame next version MonoGame 4.0 ???

$
0
0

@Jens_Eckervogt wrote:

Hello everyone,

Do you like we have to use with GLFW ( include VulkanGL, OpenGL support )into MonoGame. If we use multiple windows

GLFW is easier than SDL.

Can we have to support with MonoGame? If you would like to improve advanced features of MonoGame 4.0

And we don't need support with x86 because I have generated dlls for Windows, so forLinux and dylib for macOS from vcpkg

Assimp 4.1.x
GLFW 3.2.x
OpenGL 0.0.5
and more are using only x64-window, x64-linux and x64-osx

I think better we use only x64 bit MonoGame because macOS and Linux are using only x64. No x86 apps. We should switch to x64 with windows.

PS: How do I find parameters from methods of dll, so or dylib?

How did you find parameters from sdl2.dll

I know that MonoGame's SDL from WindowsGL of Github. I saw why do you use "internal" I thought they are hidden and can't show to import...

Nice idea because linux and macOS are very same like LoadLibrary(). But I can't find google since I find....

We would like to improve directory for x64 with important dlls like sdl2, glfw3.dll etc ..

Before :
/x64 <- *.dll, *.so pr *.dylib

After:
/x64/bin <- *.dll, *.so pr *.dylib

Why do I want bin directory because they made Gtk Sharp 3 for example than it will copy to /x64/* whole Gtk 3 Runtime, Java Runtime or Lua Runtime etc if they use with MonoGame.

It looks better than before. Or You want unpack to temp directory with dlls, sos, dylibs and MonoGame will run. Like Lwjgl3 has embedded dynamic libraries and unpacks to temp directory.

Plea

For Pipeline:

We would like to add viewer if they know about which filename like Model-, Texture-, Effect-, Sound-, Text- or VideoViewer.

For models should not need to worry if you add model than model need to embed texture into packed model xnb - embed texture + model = single binary.

Please don't forget that:

    // Working directory for dynamic libraries like dll for Windows
    // so for Linux and dylib for macOS
    Type type = Type.GetType("Mono.Runtime");
    if (type != null)
    {
        Console.WriteLine(Path.Combine(Path.GetTempPath()));
        Environment.CurrentDirectory = Path.Combine(Path.GetTempPath());
    }
    else
    {
        Console.WriteLine(Path.Combine(Environment.CurrentDirectory, Path.GetTempPath()));
        Environment.CurrentDirectory = Path.Combine(Path.GetTempPath());
    }

Environment.CurrentDirectory It means working directory for dynamic libraries if MonoGame unpacks first dynamic libraries from memory into temp directory than MonoGame will run and it looks like fast.

Do you like my idea? It works like Lwjgl 3.x unpacks dynamic libraries from jar file into temp directory.

I am very hopeful that we can make safe with MonoGame.

Please accept my idea! And share my suggestion - if you love to listen me than you can replace SDL with GLFW. I hope something..

Thanks!

Posts: 7

Participants: 4

Read full topic

SDL - SwapChain - @MG Maintainers.

$
0
0

@SpiceyWolf wrote:

Hi, I was pondering what relevance making a GL control might have once again (After my return from the long break from the community) now that MonoGame runs on SDL. I remember back when TK controls were no longer usable something was being done around the Context handler in MG directly to use SwapChainRenderTarget from DirectX and to the best of my memory it wasnt able to streamline between DX and GL the same syntax utilizing it...

Somehow or another this ended up leading to a block on getting direct access to the context handlers without generation of more windows (Which breaks functionality of the controls as for some reason only 1 context would produce visual content after the change).

To my understanding if GL were capable of mixing in with the SwapChain API (I guess it required window information without pregeneration of a control as TK did?) then it wouldnt have been an issue...

Now that that background is out of the way, I have been looking into what SDL might offer as Im not sure the exact implementation MG went about getting SDL support and it is a behemoth that cant just be quickly skimmed through I leave this to those who might be more familiar with whats going on in the inner code who can possibly get something done... but I came accross this which appears to be recreating SwapChain functionality in SDL (To the best of my knowlege) which maybe someone might be interested in investigating and possibly translating to our MonoGame to have a GL based SwapChain and hopefully a lift on the ban for GL context access...

https://www.libsdl.org/tmp/SDL/src/render/direct3d11/SDL_render_d3d11.c

Side Note: I had 2 ideas of what exactly that was doing, it was either getting access to DirectX so SDL could use DX as a backend directly or recreating DX functionality within itself... either way I would think we can utilize that somehow to gain SwapChain API for GL. Thanks for your time.

Posts: 1

Participants: 1

Read full topic


Error message in a new MonoGame Android project

$
0
0

@Fox9 wrote:

I created a new MonoGame Android solution in Visual Studio Community on my Mac and I changed nothing in Activity1.cs, but I always get this error message:

LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
The type or namespace name 'Content' does not exist in the namespace 'androtest.Android' (are you missing an assembly reference?) (CS0234)

What is wrong? What should I change?

Full code of Activity1.cs:

using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;

namespace androtest.Android
{
[Activity(Label = "androtest.Android"
, MainLauncher = true
, Icon = "@drawable/icon"
, Theme = "@style/Theme.Splash"
, AlwaysRetainTaskState = true
, LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
, ScreenOrientation = ScreenOrientation.FullUser
, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)]
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var g = new Game1();
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run();
}
}
}

Posts: 1

Participants: 1

Read full topic

Update() is calling more time than Draw()

$
0
0

@sebx29 wrote:

Hello,
I'm beginner with Monogame but I know how it works, or I think I know =).

In Game class, the method Update() and Draw are called successively:
Update() -> Draw() -> Update() -> Draw() _> ...
Right ?

In my Program (my first "big" program) I noticed, in Game class, Update() method is called between 20 or 30 times before Draw() method.:

So I'm low in FPS, my program are freezing. Draw() is called every 220ms ='(

How I can fix that ? It's possible to call Draw() Method after every Update() method ? or my code is bullshit maybe ^^ ?

Posts: 2

Participants: 2

Read full topic

Custom ContentTypeReader: existingInstance

$
0
0

@gotji wrote:

Can someone explain usage of parameter ‘exisitng instance’ of this method:

public abstract class ContentTypeReader<T> : ContentTypeReader {
    protected internal abstract T Read(ContentReader input, T existingInstance);
}

I’ve several custom content readers in my project but I never use this parameter and it’s always null. I can’t find any info online(MSDN page for this method returns 404).

Posts: 2

Participants: 2

Read full topic

Smooth look at

$
0
0

@HarkBack wrote:

Hello.
I had no problems with sprite rotation at the specified point ... until I decided to make it smooth.
In the end, I got this result: Imgut gif

The sprite makes a full circular turn, and I don't know how to solve it. Tell me how to solve it, please.
Here is my example:

float AngleToTarget(float x1, float y1, float x2, float y2, float radian)
{
    var dX = x1 - x2;
    var dY = y1 - y2;
    return (float)(Math.Atan2(dY, dX) - radian);
}

void Update()
{
    Vector2 mp = Exts.GetMousePosOnMap();
    Vector2 cp = CenterPos;
    var target = AngleToTarget(cp.X, cp.Y, mp.X, mp.Y, DEMath.ANGLE_IN_RADIAN_90);
    Angle += (target - Angle) / 8f; // smooth
}

Posts: 3

Participants: 3

Read full topic

How do decide between 1x and 2x

$
0
0

@wmansfield wrote:

I've started using the nuget versions (1x) in my game, but have downloaded the develop branch which has 2x features in it. As I move along, some of the 2x features are appealing to me.

The problem I have is I am not sure which to use for the long term. Is there an ETA for when 2.0 will be stable? I don't want to start using the latest of 2.0 if it's timeline is way beyond my project timeline. I can always extract features from 2.0 that are missing in 1x, but would prefer to not.

Posts: 1

Participants: 1

Read full topic

What's wrong with this efect?

$
0
0

@TurboMaxGit wrote:

I took below effect code from a tutorial that I was recommended, gmjosack on GitHub. First test worked, after installing some DirectX libraries and compiling for a different version of DirectX. now what goes wrong, do I need different syntax for this version? Using MonoGame 3.6 and VS2017. Any help appreciated, as well as links to good tutorials on shaders in 2D. Thanks.

sampler s0;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
float4 color = tex2D(s0, coords);
return color;
}

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

Posts: 2

Participants: 2

Read full topic

Fullscreen mode changing the size of other application windows; help please?

$
0
0

@BlackholeMG wrote:

Heya.

I'm working on a game and am implementing toggles for fullscreen mode. So far, the actual fullscreen mode for my game works fine, just as I intended. However, whenever I turn on fullscreen mode, this has the side effect of changing the size of some of my other maximized windows on my desktop; namely, Chrome and Discord. Whenever I turn my application to fullscreen, these two windows (which I usually keep open and maximized) pop down into the default size for my MonoGame application.

This is very annoying, and besides is not something I want to happen in the final game build. At first I thought that activating fullscreen without first adjusting the PreferredBackbufferHeight was causing my screen resolution to be set smaller than it should be as it fullsized (windows was popping up a message to this effect also), thus causing the resizes. However, I've now set it up so that backbuffer is set to the monitor resolution before I turn on fullscreen, but the problem persists. Perhaps there's some other setting I need to change? I'm not as experienced with xna/monogame as some people here I'm sure, heh.

I really want to fix this, but I can't seem to find anyone having similar problems when I google the issue. Anyone have any pointers? Much obliged.

  • Julie

Posts: 4

Participants: 2

Read full topic


Couple of questions from a new user (About Game class)

$
0
0

@Neurological wrote:

I'm coming from Unity, wanted to drop it for something that let me some more freedom on how game work instead of having to rewrite whole systems and hack around the existing ones, so I thought was better to start from scratch then.

I'm getting around how MonoGame is structured and is pleasant to use. At the moment I have a doubt that I would like an input from someone experienced with the framework. Noticed that classes like GraphicsDeviceManager and GraphicsDevice are dependant from the base Game class, so referencing the two from outside it can be a bit problematic at times.

First try was to pass the Game class in the constructors of the classes that should use it, but it quickly become spaghetti code as not all components need that kind of info, so I thought to make a static class having both those other two in it for a global reference, but I'm unsure if is a good idea, this is what I do:

In the Game based class on Initialize I populate a static class called Display, with those simple lines:

            Display.SetDevice(GraphicsDevice);
            Display.SetScreen(graphics);

Then this is my static Display class:

public static class Display
{
    static public GraphicsDevice Device { get; private set; }
    static public GraphicsDeviceManager Screen { get; private set; }

    static public void SetDevice (GraphicsDevice device)
    {
        if (Device == null)
            Device = device;
    }

    static public void SetScreen (GraphicsDeviceManager screen)
    {
        if (Screen == null)
            Screen = screen;
    }
}

So can just cal lDisplay.Screen or Device from other classes and have it working, but would this be a good method in the long run, or what could be the alternatives?

Thanks.

Posts: 2

Participants: 2

Read full topic

Intellisense not working with shared project in Monodevelop

$
0
0

@Solar_Omni wrote:

So I'm really new to Monogame and Monodevelop and I read about this thing called a shared project and I've tried it out but there doesn't seem to be any intellisense working? This is Monodevelop 7.5 by the way, and Monogame 3.6. Any idea why? Or is this intentional? There was no references or way to add them, but I googled that was working as intended. So does that mean intellisense just won't work? Figuring that could be the case, I tried a shared library instead, but then my nuget packages wouldn't work with the portable version of .net that came with the template.

Posts: 2

Participants: 1

Read full topic

Change alpha value of Sprite when using AlphaTestEffect [Resolved]

$
0
0

@tval wrote:

I am using AlphaTestEffect in my Spritebatch.Begin method in order to layer the depth of my character sprite with various textures in the map. However, now I am now faced with the problem of adding an alpha value to my character sprite, but am unable to do so because the AlphaTestEffect renders the sprite texture to have an opacity of either 0 or 1, but never in-between. Perhaps I am using alpha blending inappropriately, but any help would be appreciated. Below is the essentials of my drawing methods:

       _alphaEffect = new AlphaTestEffect(Game.GraphicsDevice) { VertexColorEnabled = true };

        _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, _alphaEffect, viewMatrix);
        
      //Draw the sprite with an alpha of .5--However, this does not work because I am using AlphaTestEffect!!!
       Color spriteColor = animation.Sprite.Color * 0.5f;
        _spriteBatch.Draw(texureRegion.Texture, animation.Sprite.WorldPosition, texureRegion.Bounds, spriteColor, 0, animation.Sprite.Origin, animation.Sprite.WorldScale, animation.Sprite.Effect, depth);

        _spriteBatch.End();

        _map.Draw(ref viewMatrix, ref projectionMatrix);

Posts: 2

Participants: 1

Read full topic

Best practices with Update/Draw?

$
0
0

@Neurological wrote:

While I was porting and reorganizing code from Unity to fit my workflow into monogame started to think how to deal with Update/Draw methods and which is the best or more convenient method.

In Unity since I never liked the MonoBehaviour approach of having too many Update calls all over the palce, made a hub with one single Update call that calls virtual methods from component that would subscribe to it, with a simple for loop.

I see monogame has this sort of method in palce already having one Update and Draw call from the Game based class. So I reorganized my code one way, my Game class has also other classes in it with each their own function, for example I got a Rendering class that holds all the info regarding what to render and a collection of components that need to be drawn. So from the Game class in Draw I just call a method in Rendering that does a loop trough the active component and draw the stuff on screen.

Same goes for other things like audio, input and animation stuff. So in the end would have one Update and one Draw that calls methods in other classes that runs loops to do whatever it need to do.

My doubt is that maybe isn't the best approach to this and maybe I should have multiple Update calls using GameComponents, how do you guys organize your code with this? Also is a for or foreach loop to iterate trough the list of components to Draw/Update the right method to do so?

Thanks.

Posts: 2

Participants: 2

Read full topic

Miles & Kilo is out now on the Nintendo Switch!

$
0
0

@thatpixelguy wrote:

Hey all! Miles & Kilo just launched today on the Nintendo Switch. The game is a super tough retro-style platformer that I released awhile back on Steam and iOS, and the excellent Four Horses helped me bring it to the Switch. The game is also powered by MonoGame, so I thought you guys might be interested!

Links: Nintendo eShop page | Twitter | Website

Nintendo Switch Trailer:

We're already getting some really nice reviews from critics and YouTubers too, and we've received lots of compliments on how smooth and responsive the game is on Switch. MonoGame's performing on the Switch like an absolute champ, and we're super happy with how it turned out.

Reviews:

NintendoLife (8/10)

Nindie Spotlight (9/10)

We Podcast & We Know Things (9.75/10)

Jordan Fringe (YouTube)

I also want to give a huge "thank you" to everyone who's contributed to MonoGame over the years. It's such a fantastic framework and I absolutely love using it. Y'all are the best. <3

--Mike Burns

Posts: 4

Participants: 3

Read full topic

Viewing all 6821 articles
Browse latest View live