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

Vorn's Adventure

$
0
0

@elzabbul wrote:

Hi guys,

Just wanted to drop a message that my first game is available on Windows Store for both WP 8.1 and 10. Yep, these ones that are gathering dust. :wink: We worked on it for quite some time starting with an XNA 4.0 project. The game itself is in style of oldies such as Crash Bandicoot. There are a couple of levels and the game ends up with a boss fight - what would you expect? :wink: Obviously, since it's our first game it's 'a little' rough around the edges. It is completely free and has no ads - we treated it as a 'hobby project'. Hope you will like it!
You can find it here

The game shall soon be ported to Android, I need to find some time - currently crunching hard at work. :frowning: If you want to follow what happens with the project please give us a like on our FB page.

Posts: 2

Participants: 2

Read full topic


Copy/Paste cross platform

$
0
0

@tval wrote:

I am looking for a way to copy/paste to and from the clipboard. I know with windows I can use: System.Windows.Forms.Clipboard.SetText(""). But what options do I have for Android, ios, linux etc. Is it something simple where I can use preprocessor directives like below? Or is there a simpler catch all solution?

#if Windows
System.Windows.Forms.Clipboard.SetText(textbox1.text);
#end if

#if Android
...???
#end if

Posts: 2

Participants: 2

Read full topic

[solved] Monogame HLSL Shader how to use other version than 4_0_level_9_X ?

$
0
0

@TheNightglow wrote:

I m trying to make a Point Light Shader, though:

With the versions 4_0_level_9_1 and 4_0_level_9_3 I m running into this error in the MonoGame Content Pipeline:

"Invalid const register num: 42 max allowed 31"

In my Shader I have Arrays of LightPositions, Colors etc with Array Size being the max amount of Lights I might need

with my max Lights being higher than 5, I run into this problem above (<=5 no issue)

I looked for a solution and found out that depending on the version, you can use a different number of constants...

v_4_0 or v_5_0 should give me enough, though MonoGame Content Pipeline throws an Error, saying wrong Parameter for this:

technique Shader1
{
pass P0
{
VertexShader = compile vs_5_0 VertexShaderFunction();
PixelShader = compile ps_5_0 PixelShaderFunction();
}
};

Posts: 6

Participants: 2

Read full topic

RenderTarget2D.Dispose errors.

$
0
0

@Green127_Studio wrote:

Hi,

So here I have a DesktopGL project with MonoGame 3.6.0

In my project I use RenderTarget2D one can everywhere for various use.

I get some NullReferenceException here is the stacktrace:

NullReferenceException: 
  Module "Microsoft.Xna.Framework.Graphics.RenderTarget2D", line 0, col 0, in Dispose { <lambda> }
	Void <Dispose>b__c()
  Module "Microsoft.Xna.Framework.Threading+<>c__DisplayClass1", line 0, col 0, in BlockOnUIThread { <lambda> }
	Void <BlockOnUIThread>b__0()
  Module "Microsoft.Xna.Framework.Threading", line 42, col 0, in Run
	Void Run()
  Module "Microsoft.Xna.Framework.SdlGamePlatform", line 33, col 0, in RunLoop
	Void RunLoop()
  Module "Microsoft.Xna.Framework.Game", line 139, col 0, in Run
	Void Run(Microsoft.Xna.Framework.GameRunBehavior)
  File "Program.cs", line 439, col 21, in ‮‫‌‍‎‌‍‪‏‎‎‎‎‮‌‪‎‪​‍‍​‭‮
	Int32 ‮‫‌‍‎‌‍

I think it's due to the GC trying to Dispose a RenderTarget2D, or something like that.

So I created a class to manage my RenderTarget2Ds.

Here is the class:

// ==========================================================================================================================================
//  ♦ Buffer2D.cs
// ------------------------------------------------------------------------------------------------------------------------------------------
//
// ==========================================================================================================================================

using Microsoft.Xna.Framework.Graphics;
using System;
using System.Drawing;
using Color = Microsoft.Xna.Framework.Color;
using Rectangle = Microsoft.Xna.Framework.Rectangle;

namespace Engine127 {
	// ==========================================================================================================================================
	//  o class Buffer2D
	// ==========================================================================================================================================
	public class Buffer2D : IDisposable {
		private RenderTarget2D _buffer;
		private readonly RenderTargetUsage _usage;
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Constructors
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		public Buffer2D(int width, int height, RenderTargetUsage usage = RenderTargetUsage.DiscardContents) {
			this._usage = usage;
			this._buffer = GetNewRenderTarget(width, height, usage);
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Destructor
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		~Buffer2D() => Dispose(false);
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • GetRenderTarget : RenderTarget2D
		// ------------------------------------------------------------------------------------------------------------------------------------------
		// 
		private static RenderTarget2D GetNewRenderTarget(int width, int height, RenderTargetUsage usage) => new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Color, GraphicsDevice.PresentationParameters.DepthStencilFormat, GraphicsDevice.PresentationParameters.MultiSampleCount, usage);
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Reset : void
		// ------------------------------------------------------------------------------------------------------------------------------------------
		// 
		public void Reset(int width, int height) {
			DisposeTextureAsync(this._buffer); // Add the buffer in a List<Texture2D> so the Main thread can dispose it
			this._buffer = GetNewRenderTarget(width, height, this._usage);
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Draw : void
		// ------------------------------------------------------------------------------------------------------------------------------------------
		// 
		public void Draw(Rectangle past, Rectangle? copy = null, Color? color = null) {
			CheckDisposed();
			DrawOnScreen(this._buffer, past, copy ?? this._buffer.Bounds, color ?? Color.White);
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • SetAsRenderTarget : void
		// ------------------------------------------------------------------------------------------------------------------------------------------
		// 
		public void SetAsRenderTarget(Color? color = null) {
			CheckDisposed();
			GraphicsDevice.SetRenderTarget(this._buffer);
			if (this._usage == RenderTargetUsage.DiscardContents) GraphicsDevice.Clear(color ?? Color.Transparent);
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • CheckDisposed : void
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		private void CheckDisposed() {
			if (this._buffer?.IsDisposed ?? true) throw new AccessViolationException("Buffer2D disposed");
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Properties
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		public int Width => this._buffer.Width;
		public int Height => this._buffer.Height;
		public Rectangle Bounds => this._buffer.Bounds;
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Dispose : void
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		public void Dispose() {
			Dispose(true);
			GC.SuppressFinalize(this);
		}
		//
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//  • Dispose *internal*
		// ------------------------------------------------------------------------------------------------------------------------------------------
		//
		private void Dispose(bool notCalledFromGc) {
			if (!this._buffer?.IsDisposed ?? false) DisposeTextureAsync(this._buffer); // Add the buffer in a List<Texture2D> so the Main thread can dispose it
		}
	}
	// --- END namespace ---
}

The main thread diposing:

        lock (TexturesToDisposeLock) {
            int dispNum = this.TexturesToDispose.Count;
            while (dispNum > 0) {
                Texture2D texture = this.TexturesToDispose.First();
                this.TexturesToDispose.RemoveAt(0);
                //
                if (texture != null) {
                    try {
                        if (!texture.IsDisposed) texture.Dispose();
                    } catch (Exception exception) {
                        Log("Disposing error");
                        Log(exception.ToString());
                    }
                }
                //
                dispNum--;
            }
        }

The problem is that I still get NullReferenceException type error by RenderTarget2D.Dispose ...
An idea of where that might come from?

Posts: 5

Participants: 2

Read full topic

Encoding problem

Skinned FBX - A noob's nightmare

$
0
0

@AlienScribble wrote:

Using:
- Tutorial for Skinned Sample in MonoGame (found in here)
- Visual Studio 2017 and MonoGame 3.6
- FBX export (2012) - baked animation - resample (2 of 3 objects have no UV cords)
Noticed when building Content Pipeline Extension, by default it shows Content.Pipeline reference but indicates it can't actually find it --- so I add it with browse - C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MonoGame.Framework.Content.Pipeline.dll
So I fixed that problem - builds fine.
Trouble:
Added the pipeline .dll to Content and set file to process using it. Build it and it says Failed showing no error int the MG Content Pipeline - but in VStudio console it does show this:
Error
The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"C:\Users\JEI\Documents\Visual Studio 2017\Projects\Game3D\Game3D\Content\Content.mgcb" /platform:DesktopGL /outputDir:"C:\Users\JEI\Documents\Visual Studio 2017\Projects\Game3D\Game3D\Content\bin\DesktopGL" /intermediateDir:"C:\Users\JEI\Documents\Visual Studio 2017\Projects\Game3D\Game3D\Content\obj\DesktopGL" /quiet" exited with code 1.
I was careful to ensure everything in the models are simple and "zeroed-out" properly.
2 of mine don't work and 2 from 2 other ppl also don't work. I can't figure out if it's the code or the FBX that has issues.

*** Even any ideas at all would be helpful - I'm wondering about what I might code to check for problems in the pipeline extension? (ie: perhaps it just doesn't like the FBX or isn't interpreting correctly for some reason)?

[ps: If I ever do figure this out I'd like to create a set of concrete steps that anyone can follow from versions vs version, to modeling to animating to exporting to importing and to programming to make sure it all works fine - cuz holy crap it seems a lot of ppl struggle a lot with this. XD ]

Posts: 2

Participants: 1

Read full topic

Inconsistency between SpriteBatch DrawString and Graphics.DrawString

$
0
0

@Trinith wrote:

Hey,

So I've noticed that there's an inconsistency between SpriteBatch.DrawString font rendering and WinForms Graphics.DrawString rendering, specifically in the spacing between the text. Here's an image showing the issue...

The left side is rendered with MonoGame, the right side is rendered with WinForms. Notice that the text is wider in the WinForms version than it is in the MonoGame version. The WinForms version also has slightly larger line spacing. Each side is 650x600 pixels.

The WinForms version is rendered using a font loaded from the values found in the spritefont file..

public static Win32SpriteFont FromFile(string contentPath, string assetName, Graphics graphics)
{
    string file = Path.Combine(contentPath, assetName);

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(File.ReadAllText(file));
    var fontNameNode = xmlDoc.SelectSingleNode("//XnaContent/Asset/FontName");
    var sizeNode = xmlDoc.SelectSingleNode("//XnaContent/Asset/Size");

    if (fontNameNode == null || sizeNode == null)
        throw new ArgumentException("The specified file does not contain a FontName and/or Size node at the expected XML path.", "file");

    Font internalFont = new Font(fontNameNode.InnerXml, float.Parse(sizeNode.InnerXml));

    return new Win32SpriteFont(internalFont, graphics) { SpriteFontAsset = Path.GetFileNameWithoutExtension(assetName) };
}

I'm wondering if anybody knows a way to get these two rendering closer to each other. I don't need it to be super exact, just closer. I would actually prefer to have the WinForms version render the same as the MonoGame version.

The context for what I'm doing is that I'm using the WinForms editor to block out UI with text and image elements. I've created simple controls that mimic my MonoGame ones so that I can just drag/arrange them around the editor, then spit out some auto-generated code that I can import into my game to create all the things I need.

I've prototyped the concept and it's working quite well; however, the MonoGame version isn't rendering the same as my WinForms version, which causes me to set the text incorrectly. I know that I can have MonoGame render inside a Form, but this approach was intended to save time and to utilize the existing functionality of the WinForms editor :wink:

Anyway, any help would be greatly appreciated!

Posts: 1

Participants: 1

Read full topic

Camera Motion Blur and Track Level Editor in Metric Racer

$
0
0

@rtroe wrote:

I posted a video a week ago showing the results of our track editor. After a lot of great feedback towards track variability, along with racer speed and acceleration, we've made a few changes and mods.

We slowed the racer down, but added a motion blur HLSL shader, along with tempering the acceleration to be more realistic. We've also added a number of different track sections variations, so that you can modify and change the track type for each straight, curve and bend. We've added some turn arrows and indicators as well. We'll post a video of the track editor in action later this week.

We'd love some further feedback! I'll be posting a Camera Motion Blur tutorial in the coming week.

And give us a like or follow on instagram or twitter to keep up with what we're doing.

Posts: 2

Participants: 2

Read full topic


Delta time not working properly

$
0
0

@Sylent wrote:

I'm trying to make my game use delta time so it becomes independent of FPS. I had a go at doing it and compared them side-by-side:

But the player on the 144fps one still goes faster. My code:

https://pastebin.com/AHvUUdhE

What did I do wrong?

P.S: I'm positive it's not just my eyes playing with me. I can see the player going faster on 144fps than the one on 60fps.

Posts: 13

Participants: 2

Read full topic

Exit game

$
0
0

@bunnyboonet wrote:

Hi,

I used game.Exit method for close the application and it goes to background. When i click icon again, application not start. I'm using monogame 3.6

Any idea?

Thanks

Posts: 4

Participants: 3

Read full topic

GameWindow Transparency

$
0
0

@dryhfth wrote:

Hello!
I'm developing a simple game app, I've started with coding a splash screen (short scene on startup) & trying to make GameWindow form fully transparent, but not content of that form.

Basically, trying to show image and some text on top of transparent window before running the game.

I've read few articles about WindowsExtendedStyles & DesktopWindowsManager & DirectComposition. WsExStyles set transparency to entire window, while DWM seem to work fine, except that GameWindow flickers on Loading event. Tried also setting TransparentKey value, but it leave ugly edges on a picture. I don't quite understand how MonoGame engine managing windows (is it drawing backbuffer to winForm?? and what is blinking is the form that renders?).

I suppose, it will be easier to create wpf for this purpose, just want to be able to use Conent pipeline and not connecting many libraries.

Is it possible to achieve this goal not trying to connect MonoGame/WPF or MonoGame/WinForm, using default Game class?

Attaching Code

using System;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace xProject
{
    class SplashScreen : Game
    {
        [DllImport("user32.dll")]
        static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

        [DllImport("user32.dll")]
        static extern int GetWindowLong(IntPtr hWnd, int nIndex);

        [DllImport("user32.dll")]
        static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte bAlpham, int dwFlags);

        [DllImport("dwmapi.dll")]
        static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);

        struct Margins
        {
            public int left, right, top, bottom;
        }
        Margins marg;

        GraphicsDeviceManager GDM;
        SpriteBatch sBatch;
        Texture2D txr;
        SpriteFont sFont;
        Vector2 wndSz, txrOrig, strSz, AdRes;
        int x;
        float trKey, tmElapsed;
        string greetings;
        enum Fade { txrIn, txrOut, strIn, strOut, finish }
        Fade fState;
        System.Windows.Forms.Form f;

        public SplashScreen()
        {
            GDM = new GraphicsDeviceManager(this);
            AdRes = new Vector2(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
            wndSz = AdRes / 2;
            GDM.PreferredBackBufferWidth = (int)wndSz.X;
            GDM.PreferredBackBufferHeight = (int)wndSz.Y;
            Content.RootDirectory = "Content";

            IntPtr hWnd = Window.Handle;
            f = System.Windows.Forms.Control.FromHandle(hWnd).FindForm();
            f.TopMost = true;
            Window.IsBorderless = true;
            Window.Position = ((AdRes - wndSz) / 2).ToPoint();

            //Setting margins to extend frame
            marg.left = marg.top = 0;
            marg.right = (int)wndSz.X;
            marg.bottom = (int)wndSz.Y;

            DwmExtendFrameIntoClientArea(hWnd, ref marg);

            //Setting ExStyle to Layered & Transparent
            SetWindowLong(hWnd, -20, GetWindowLong(hWnd, -20) | 0x20 | 0x8000);
            SetLayeredWindowAttributes(hWnd, 0, 128, 0x2);

            greetings = "xProject";
            trKey = 0;
            fState = 0;
            x = 2;
        }
        protected override void Initialize()
        {

            base.Initialize();
        }

        protected override void LoadContent()
        {
            sBatch = new SpriteBatch(GraphicsDevice);
            txr = Content.Load<Texture2D>("Wolf");
            sFont = Content.Load<SpriteFont>("SpF");
            txrOrig = new Vector2(txr.Width, txr.Height) / 2;
            strSz = sFont.MeasureString(greetings);
            base.LoadContent();
        }

        protected override void UnloadContent()
        {
            base.UnloadContent();
        }

        protected override void Update(GameTime gameTime)
        {
            tmElapsed = (float)gameTime.ElapsedGameTime.TotalSeconds / x;
            if (Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit();
            switch ((int)fState)
            {
                case 0: if (trKey < 1) trKey += tmElapsed; else fState++; break;
                case 1: if (trKey > 0) trKey -= tmElapsed; else fState++; break;
                case 2: if (trKey < 1) trKey += tmElapsed; else fState++; break;
                case 3: if (trKey > 0) trKey -= tmElapsed; else fState++; break;
                case 4: break;
            }
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Transparent);
            sBatch.Begin();
            switch ((int)fState)
            {
                case 0:
                case 1:
                    sBatch.Draw(txr, wndSz / 2 - txrOrig, Color.White * trKey); break;
                case 2:
                case 3:
                    sBatch.DrawString(sFont, greetings, (wndSz - strSz) / 2, Color.White * trKey); break;
            }
            sBatch.End();
            base.Draw(gameTime);
        }
    }
}

^ Drawing some image and text in SpriteBatch ^

Flickering_gif

I hope I make it clear, any advice with be appreciated... Thank you :open_mouth:

Posts: 1

Participants: 1

Read full topic

Teamcity site appears to be unreachable

Strange Android Emulator Behavior

$
0
0

@Paul_Crawley wrote:

Heres a puzzle for the smart people amongst you, damned if I can figure it out.

I'm using the latest Hyper-V Android emulators to test some stuff before publishing and i'm getting an exception when I do this:

string name = "abc1";
// NOTE PROPERTIES ARE "AndroidAsset"
texture = sContent.Load(name);

I know right, works fine on a real android device, fine in win32, UWP all devices, just causes a crash in the new emulators, now i do know they have changed the new Hyper-V version it's almost the same but now won't load a texture.

I understand that basically this is NOT monogame but i was interested if anyone has ever come across this, if you need more info let me know

Paul

Posts: 3

Participants: 2

Read full topic

Attempting to use Entity.Attach Errors On for all classes

$
0
0

@inuasha880 wrote:

I have been trying to replicate some of the code from the platformer demo in the GitHub and in particular I wanted to get an animated sprite from a sprite sheet. When I use the block of code below after creating the appropriate classes from the demo I get an error for every instance of entity.Attach

entity.Attach<AnimatedSprite>(new AnimatedSprite(animationFactory, "idle"));
entity.Attach(transform);
entity.Attach(new Body { Position = position, Size = new Vector2(32, 64), BodyType = BodyType.Dynamic });
entity.Attach<Player>();

For the first line I get "cannot convert from MonoGame.Extended.Animations.AnimatedSprite to System.Action
The next two say they cannot infer the type argument for Attach(Action configure)
The last gives me an error that says Player cannot be used in place of because it is never explicitly named an EntityComponent even though I have the [EntityComponent] above the class declaration.
Any advice?

Posts: 2

Participants: 2

Read full topic

Windows 10 (Core project) No fullscreen

$
0
0

@Diego wrote:

Seems that fullscreen is not working on my game when using a Windows 10 Core project. Same code works fine in a Windows 10 (AXML) project.

Any idea? Any important difference between these types of projects?

Thanks

Posts: 3

Participants: 2

Read full topic


Latest available dev build for windows

$
0
0

@xdeadmonkx wrote:

Hello, can anyone give me the latest dev installer for windows please? :slight_smile:
Can't connect to teamcity server but want to download latest monogame instead of stable (2017)

Posts: 2

Participants: 2

Read full topic

Chaining Post Effects

$
0
0

@SquareJAO wrote:

I've been working on a deferred rendering system for my game but I'm having trouble with some of the effects. Ideally the user would be able to enable/disable some of them (SSAO, FXAA, etc.) but I've been stuck for the best way to achieve this.

My current code runs a pixel shader on each stage using a sprite batch:

_effect.CurrentTechnique = _effect.Techniques["Shadows"];
GraphicsDevice.SetRenderTarget(_renderTarget);

SpriteBatch.Begin(effect: _effect, samplerState: _samplerState, rasterizerState: _rasterizerState);
SpriteBatch.Draw(_dataRenderImage, new Rectangle(0, 0, width, height), Color.White);
SpriteBatch.End();

_renderImage = (Texture2D)_renderTarget;

if (FXAA)
{
    _effect.CurrentTechnique = _effect.Techniques["FXAA"];

    SpriteBatch.Begin(effect: _effect, samplerState: _samplerState, rasterizerState: _rasterizerState);
    SpriteBatch.Draw(_renderImage, new Rectangle(0, 0, width, height), Color.White);
    SpriteBatch.End();

    _renderImage = (Texture2D)_renderTarget;
}

GraphicsDevice.SetRenderTarget(null);
_effect.CurrentTechnique = _effect.Techniques["Final"];

SpriteBatch.Begin(effect: _effect, samplerState: _samplerState, rasterizerState: _rasterizerState);
SpriteBatch.Draw(_renderImage, new Rectangle(0, 0, width, height), Color.White);
SpriteBatch.End();

This works when FXAA is disabled:

But applying FXAA produces a black screen

(Yes, the screenshot was necessary, shut up)

I'm guessing that this is because I am trying to render to the same buffer that I'm reading from which probably isn't a great thing to do. If it's not, and I'm doing something else wrong, disregard below.

I have a few potential fixes in mind, but none work particularly well:

  1. Create a new buffer for every pass. This would take up far more VRAM than I need and it would be a hassle to select the last buffer for my 'final' pass anyway
  2. Create a set of techniques for each option and select the one that fits the options. This grows exponentially and is pretty repetitive so I can't see this being the standard
  3. create 'dud' passes where the shader just passes on the value in the pixel if the option hasn't been enabled. Although this runs less code than number 1, I feel like there's probably a way to not run the pass at all if it isn't needed

What is normally done?

Posts: 2

Participants: 2

Read full topic

How to use VertexPositionTexture correctly?

$
0
0

@MatX wrote:

Hi, I'm trying to manipulate Texture2D objects as triangles, and it seems to me that using VertexPositionTexture objects would be the solution to this. However, when I try to map a red rectangle - as a Texture2D - to a triangle, I don't see it. My code is this:

`protected override void Draw(GameTime gameTime)
    {
    this.GraphicsDevice.Clear(Color.White);
        if (_basicEffect.Texture == null || _basicEffect.Texture.Width != 50)
        {
            var rectangleColorData = new Color[50 * 50];
            for (int i = 0; i < 50; i++)
            {
                for (int j = 0; j < 50; j++)
                {
                    rectangleColorData[i * 50 + j] = Color.Red;
                }
            }

            var rectangleTexture = new Texture2D(this.GraphicsDevice, 50, 50);
            rectangleTexture.SetData(rectangleColorData);
            _basicEffect.Texture = rectangleTexture;
        }

        var vertices = new VertexPositionTexture[]
        {
            new VertexPositionTexture(new Vector3(-1, 0, 0), new Vector2(0, 0)),
            new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 50)),
            new VertexPositionTexture(new Vector3(0, 0, 0), new Vector2(25F, 25)),
        };

        _basicEffect.World = _basicEffect.View = _basicEffect.Projection = Matrix.Identity;
        _basicEffect.TextureEnabled = true;
        var buffer = new VertexBuffer(this.GraphicsDevice, typeof(VertexPositionTexture), vertices.Length, BufferUsage.WriteOnly);
        buffer.SetData(vertices);
        this.GraphicsDevice.SetVertexBuffer(buffer);
        this.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
        foreach (var pass in _basicEffect.CurrentTechnique.Passes)
        {
            pass.Apply();               
            this.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1);
        }
    base.Draw(gameTime);
    }`

And I see this:

What am I doing wong?

Posts: 6

Participants: 3

Read full topic

Childfriendly interactive crayon scene for kids aged 5 or less

$
0
0

@Heiko wrote:

Hi everyone,

it started as a project for my daughter (at the age of about 2). She loved two apps I had on my old iPad - it was an animated/interactive scene. Just tap somewhere and see what happens.

On my way to find more apps like that, I had a hard time, so I decided to try to make one myself.

So, this is it. I did some research, found Monogame, found Spriter, and the great SpriterDotNet implementation from loodakrawa. Altogether, it's a pleasure to with all those.
And although I am not a great artist, I tried my best.

As my daughter liked the result much, I decided to publish the app now for Android and even iOS lately.
I am really amazed by the ease a game can be ported nowadays.

In case you want to have a look (all animations and sound-triggers were done using Spriter), here are the links to the screencast-movie and store-links:

Youtube:

Google PlayStore

Apple AppStore

Please consider: the game aims kids aged 4 or less.
So don't expect fancy achievements or other goals.
I didn't even implement any menu, options, or text to read. Kids at that age usually can't read yet.

Also, I didn't add any in-App-Purchases or advertising. I really dislike that myself and rather pay for an app.
But also I was shocked, that other apps targeting kids claim to be free and are full of that stuff.

So, no wonder that nobody really finds my app in the stores - everybody just scans the "for free"-stuff.
But that's ok. It was fun making it anyway.

In case you're interested, have a look.
I'm pleased if I was able to make someone happy.

You all have a great day! And thanks for the great and so easly portable Monogame and as well as the great community! The forum helped a lot whenever I had trouble.

Heiko

PS: Happy to ready what you think.

PPS: Also available at Amazon AppStore... but as my forum user is new I am limited to two links per post only.

Posts: 2

Participants: 2

Read full topic

Shaders

$
0
0

@Mattlekim wrote:

Hello everyone.

Now IV noticed that one area where monogame is week is the fact at we need to make our own shaders for any good effect. As such I have been thinking of creating a section on my website where I can host shaders that are free for ppl to use. They will be user friendly and have demos for each shader.

I would also add a search function so we can search for shaders

What do I guys think?
Would any of u guys be able to help out by donating shaders? My knowledge of shaders isn't amazing.
I also think that we should focus on 2d shaders at first as I believe that more people use monogame for 2d than 3d and that people who do do 3d are more experience with shaders. (I could be wrong though)

Your thoughts are most welcome.

Posts: 1

Participants: 1

Read full topic

Viewing all 6822 articles
Browse latest View live