I have a working game where I am loading all the textures from a different class. It works perfectly fine for the PC version.
Now, I am trying to port it to win8 using Monogame.
If I load a texture from Game1.cs using .xnb file it works absolutely fine. However, when I try to load the same texture by using a different class, it doesn't. It gives me an NullReferenceException error on
GraphicsDevice.Clear(Color.Cornflowerblue);
HungryCoder:
I don't know how you are loading the texture from the class, however, right now MonoGame doesn't yet have a Content Pipeline like you were provided with in building and XNA Game for the PC (they are working on it), therefore, you cannot add graphic files in the same manner.
In my walkthrough of building a Windows 8 XNA game, I create my Shooter player graphic from my own Player class by passing into my Initialize function within the class the Content.Load<> with the Texture type and location:
player.Initialize(Content.Load("Graphics\player"), playerPosition);
Note the .xnb file is located in a folder Graphics within my project.
In my background, I have also created a parallaxing background from a my background class by passing in the full Content Manager to my Initialize method of my Background class as well.
bgLayer1 = new ParallaxingBackground();
bgLayer1.Initialize(Content, "Graphics\bgLayer1", GraphicsDevice.Viewport.Width, -1);
Both of these examples work within my project/game.
If you interested have posted the player code example as a part of blog tutorial series on MonoGame on Windows 8. As I complete the code for the background, I will also add the full code example for the background as well. Hope this helps.
http://blogs.msdn.com/tarawalker
Related
I've been trying to make a Unity game that uses the Xbox One Kinect (V2).
I followed the instructions in this tutorial:
http://www.imaginativeuniversal.com/blog/2015/03/27/unity-5-and-kinect-2-integration/
There are two sample scenes in this zip file: (1) KinectView and (2) GreenScreen.
When I run the first sample (KinectView), the image looks warped, like the right part of the screenshot below:
When I run the second sample (the GreenScreen scene) I get a Null frame error:
Now I'm not really concerned the warping issue in the first scene (KinectView). I am concerned with the Background Removal feature in the second scene (GreenScreen). All I need is to see myself clipped against a custom background.
Can anyone help me figure out how to fix this NULL MSFR Frame issue?
I have uploaded the zipped project in case anyone is interested:
https://www.sendspace.com/file/j2ftqz
Thank you very much.
Update:
I have been messing with some of the Shader options in the Inspector, and noticed that all shader options work except the DX11\GreenScreenShader one. Some of them look like a normal video capture; others are better lit (additive/multiply/alpha blend/etc...).
Why is it that the DX\GreenScreenShader option is the only one that does not work, and instead show nothing more than a pink square.
Screenshot below.
Open the shader in question on your favorite text editor and change these two lines:
1) Line 15. from Texture2D _MainTex; to UNITY_DECLARE_TEX2D(_MainTex);
2) Line 59. from o = _MainTex.Sample(SampleType, i.tex); to o = UNITY_SAMPLE_TEX2D( _MainTex, i.tex );
Updating the shaders as shown above will solve the issue you describe.
Secondary Reference/Source: https://forum.unity.com/threads/kinect-v2-0-sdk-green-screen-demo-for-unity-3d-not-working-why.467687/
I have three Qt 5 applications that work fine independently on the BeagleBone X-15 using the Qt 5 Wayland plugin on the TI SDK image.
When I launch them, they fill the whole screen so that the first app launched is covered by the second, and the second app is covered by the third.
How can I modify the transparency of the second and third app launched, so that I can see some of the view from the first app launched?
I tried modifying the window opacity with Qt’s setWindowOpacity, but the Wayland plugin says: “Window Opacity not supported by this Plugin.”
Qt 5 on Wayland page says:
Qt 5 is structured with the Lighthouse (or Qt Platform) Abstraction, which is the windowing system and device agnostic architecture. That means Qt can load in run-time different backend plugins for different window systems as desired. For instance, an application developed on Qt could be run using "-platform xcb" and "-platform wayland" for XCB or Wayland respectively (or set the QT_QPA_PLATFORM environment variable) and should have a similar behavior on both systems, without the need to recompile.
Qt abstraction exposes to applications developers two native resources of Wayland: wl_display and wl_surface. With those types, one could access Wayland internals to deal with special cases through the interface:
void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
Getting the display global handler is quite straightforward, as shown in the following example:
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
struct wl_display *wl_dpy = (struct wl_display *)
native->nativeResourceForWindow("display", NULL);
and for wl_surface:
QPlatformNativeInterface *native =
QGuiApplication::platformNativeInterface();
struct wl_surface *surface = static_cast<struct wl_surface *>(
native->nativeResourceForWindow("surface", this->windowHandle()));
If I get the handle to this wl_surface, how can I change the transparency directly?
I have an application that cover a wide number of use cases each with completely independent workflows but workflows are pretty static after installation.
I have therefore created an HBox placeholder that will load the workflow for an installation.
Is there a way to dynamically load a section of the fxml from a database or a separate file archive? This fpml will have to have its own set of images and resources needed to achieve the workflows functionality.
TBH, I don't know where to start on this one.
Regards
I do not quite understand your problem. You can modify the scene graph at any time you want. So, of course it is possible to load a part of the scene graph from an FXML file at any time and hook it up to the already existing part. In your controller you have access to your HBox placeholder and when you have loaded the second part of the scene graph you can just add it via hbox.getChildren().add(newpart), were newpart is the root node of your second scene graph part. Of course you have to make sure that the layout works correctly for your constellation.
Your question seems nonsense because the FXML is always loaded dynamically. My guess is you are confused because most of the examples use FXML in the same bundle as the classes and so are loaded trough the getResource method. But the FXML loader takes any kind of InputStream, so you can just open a database blob or a file as an InputStream and give that InputStream as an argument to the loader. Be sure to catch the runtime exceptions though :)
Hope this helps.
My project originated as the cocos2d Box2D template and I'm having issues as soon as I tried to create a world:
world = new b2World(gravity,doSleep);
Gives the error: No matching constructor for initialization of 'b2World'.
The file is .mm, I assume it's some issue about library linking maybe? If so I'm using xCode 4, how can I check the lib is properly linked?
Thanks.
You are using Box2D v2.2 or newer. The b2World constructor no longer takes two arguments, just one (gravity). You have to set doSleep separately:
world = new b2World(gravity);
world->SetAllowSleeping(doSleep);
This won't be the only change you'll need to make to transition from Box2D v2.1.x to v2.2.x. Kobold2D has a working Box2D 2.2.1 sample project, even if you don't use Kobold2D you can get updated source code for Box2D basics. In particular the GLESDebugDraw class and how to setup a screen bounding box with a body using multiple shapes.
Are there any libraries which
Allow to draw svg direct to a Windows Forms application
to a WPF application
I draw graphics and design everything with Inkscape, because I love that program.
Then I have those stunning svgs and have to either export them to png (WinForm) to use them or convert them to xaml-code (WPF) (Kaxaml helps me).
Is there a way to directly use my svgs?
Wow, I just read that Inkscape supports saving as XAML. I didn't realize that up to now shame.
But that still doesn't solve my problems with WinForms...
I personally hate how there's no native support for SVG in Microsoft's products/development tools. I've found two fairly complete but still immature SVG libraries that seem to be active as of this writing, definitely in need of contributors though.
WPF : Svg2Xaml (open source)
WinForms : SVG rendering engine (open source)
IIRC both libraries output a Drawing object which can be used directly through the Image class; You'll figure it out, they're both pretty straightforward to use.
If you want to load them directly into WPF,
I got better results from: https://github.com/ElinamLLC/SharpVectors
Yes, you can use ReaderSVG from AB4D to get WPF directly from XAML.
Regarding WinForms, removed a previous link to Kent Boogart's example as it was deleted sometime in 2019.
Copy below from this dotnetways post
To host a WPF control or WPF user control (wpfControl in this example) into Windows Form application, create an instance of ElementHost Class and add your WPF control/user control as child to the instance of ElementHost.
using System.Windows.Forms.Integration;
//Assembly: WindowsFormsIntegration (in WindowsFormsIntegration.dll)
//...
ElementHost elementHost = new ElementHost();
elementHost.Dock = DockStyle.None;
elementHost.Child = wpfControl;
Now, add the instance of ElementHost to a container control in your windows form (for instance containerPanel here)
containerPanel.Controls.Add(elementHost);