How to use an .xnb file in MonoGame on Windows 8? - xna

I've got an .xnb file from a Windows Phone project made on Windows 7. I'd like to use the same asset in a Windows 8 Metro app. I've got MSVS 2012 RC on Windows 8 with a project from the MonoGameWindowsMetroApplication template. I put the .xnb file in the project Assets folder and tried to load it, but I get an exception telling me that the asset can't be loaded. What properties or configuration do I need to be able to use the .xnb file?

While MonoGame is working on the Content Pipeline piece of the framework, you can simply use the same Content Pipeline engine that you used for the Windows Phone 7 game to create a Content Pipeline and use the associated .xnb files in your Windows 8 XNA MonoGame project.
I have a blog tutorial series on building XNA games with MonoGame for Windows 8, and if you look at Part 3, I provide a step-by-stepy walkthrough of accomplishing this. My hands-on lab and information on my blog was reviewed and approved by the MonoGame team.
See info here: http://blogs.msdn.com/b/tarawalker/archive/2013/01/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-3-updating-graphics-using-content-pipeline-with-monogame.aspx

The runtime Xna framework has many type reader objects that read the various xnb files. Some of the type readers are for xnb files that were processed from fbx models, others are xnb files processed from 2d image files, etc.
When you call content.Load<T>(xnb file name), The content manager uses the appropriate reader to read the byte information of the xnb file into the appropriate Xna class. The byte information in an xnb file is designed to be used in a specific Xna class, no other. There are no Xna classes in metro.
All this to say there are no type readers in the metro environment that read these xnb files. You would have to write your own. It's not that hard though, that's similar to what I did. I now process an fbx file into xnb by building an Xna project, then my xna project writes the runtime model's data to my own binary file, which I read from my metro app. But I could've simply read the xnb also. I just would have had to study the contentManager's & Model class' type readers to see how the byte info was distributed.
After all is said and done, it just means I don't have to learn the FBXSDK which would be the standard way (and arguably preferred way) of bringing in model info.
EDIT - sorry, didn't clue into the use of the mono framework. I don't know anything about that... Maybe they do have a way of importing xnb files.

Are you on the develop3D branch? I think you need to add a dummy Content project and add it to that project, not your assets, build that project first, then you need to reference that project in your MonoGame project.
I didn't succeed on that yesterday as I'm using the current stable but one of the MonoGame guys told me to do just that yesterday. Here are some instructions:
https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing

In MonoGame content pipeline is not present, at least as off now.
Its very easy.
1)Create a xna project in VS2010
2)add all your assets over there.
3)Rebuild your project. Go to bin/x86/debug/content and copy all contents from there
Now go to your VS2012 Mono Project bin/x86/debug look for content folder, if its there copy all content there else create a content folder and copy all content there.
Now without changing even single line of code just run your project and you will find everything working great!!!
Let me know if you find any difficulty doing that.

Related

Developing Umbraco with Visual Studio - best practices

I have two environments that use Umbraco: Live and Dev.
As I have in research, Umbraco will be create a physical file when a user creates a new partial view, macro, etc. so, I have two questions:
1. What is the best way to know which files were created on Live and how to migrate them to Dev environment for the purpose of creating new features?
I have tried to Google and found "Hybrid Framework" but it is not up to date and I want to maintain code by myself.
2. I want to extend Umbraco with my own code. What is the best practice for this? (I do not want to change any code in the original Umbraco Source, just create my own new code)
As I know, I can create a package for extending code but I just want to know the other ways.
Partial Views, Macros , Templates are .cshtml files, these will not affect your source code. Same is case with css and js files; these will not harm any source code.
Just copy paste these files in respective folders and reload the nodes in backend. It will work properly.
Other way is you can create a package zip file from developer section where you can export datatypes, content and files, and install it in other environment.

Displaying a Scratch Project (.SB) file within a Delphi EXE FIle

I would like to Display a Scratch Project (.SB) file within my Delphi EXE file. I would like to know if it is possible to display and build the Scratch Project into your Delphi Project.
I wish to make a small game in Scratch and then use the game within my Delphi Application without the need of the Scratch IDE. Perhaps a 3rd party delphi tool or component or something that can help me achieve this would also be nice.
Is this possible?
How can this be done?
It's possible, like everything, but it's not been done AFAIK, which means it's going to be hard work.
You have a few choices:
Scratch is normally embedded within web sites as a Flash object. If
you can embed Flash media, that is a solution.
Some Scratch-inspired systems like BYOB export to exe. You could look into how they do that to use your project (Scratch and BYOB
are compatible enough to load your project and export it after
minor changes)
If you don't like these, then write your own Scratch interpreter for Delphi. Scratch sprites are objects, their behaviour is straightforward enough, the Scratch projects are easily parsed (it's XML), now - off you go!
I am assuming that you want to port a scratch program to .EXE.
If this is the case, then you can install BYOB.
After doing this, you can convert your scratch project to a BYOB project and load it into BYOB.
Then, go to Share->Compile this project, and it will generate a .EXE for you.

Delphi: How to generate the .resx from the .bdsproj

I am challenged with creating an automated release for a legacy Delphi (Delphi 2006) project.
I am a complete Delphi noob. So my question is maybe heading in a wrong direction ...
As far as I understood the release process of the given project it works like this:
A developer opens the project in Delphi Studio
Right-Click on the Project -> Properties -> Version Info
He sets the new version number of the next release in the Dialog.
He saves the project. This automatically generates the corresponding .resx file which contains the version number in binary form.
The .bsproj and the the .resx are checked in into source control
The automated build (Hudson) picks up the change and builds the release.
I would like to automate this process, since there are several projects that needs to get a new version number for each release.
I guess I could easily manipulate the .bsproj with a custom tool since it is xml.
However I am struggling with the generation of the .resx file which is currently done when saving the project in Delphi Studio.
Is there a way to automate the generation of the .resx? i.e. with a commandline-tool or something similar?
Or is there a smarter approach?
Any help is appreciated.
You can do it all in a batch file
Update the version numbers as specified in this SO question: change version number at build time
Use the DCC command-line compiler to build all the projects. There's plenty of documentation for that, basically you do just dcc32 <project>.dpr
DCC is e.g. documented here or here
I do wonder where your .resx files come from, but they can be converted as well. See this SO post.
Give it a go using these resources and for specific issues write a new SO question with your attempts so far.

Why does this project appear to have links to files in another project?

This is the TaskyPro solution, available here: https://github.com/xamarin/mobile-samples/tree/master/TaskyPro/
If you look at the solution structure on GitHub it doesn't have anything odd about it, but when I load the solution in Visual Studio it appears as follows:
The Tasky.Android project contains the same folders as the Tasky.Core project, and it appears to have links to the files in Tasky.Core. However, when I view the folders in Windows Explorer they are empty. If I view the properties of the links, the Full Path property points to the actual file stored in the Tasky.Core project.
Why are these links here? Can I remove them?
File linking is a way to share the same files across multiple projects without having to maintain multiple copies of each file by hand. In this case, it allows you to compile the same source files for both .NET and Android. Xamarin has a lot of documentation on this, including this article which describes how Tasky is architected and implemented. I also recommend reading this guide on Sharing Code Options.

XNA Content DLL

Where is the content DLL? When I try to build my game (using Primary Output from the Setup Wizard for both my game and content), it gives me this error:
Could not find file 'C:\Users\XXXX\Documents\XNA\PowerChampions\PowerChampions\PowerChampionsContent\obj\x86\Release\PowerChampionsContent.dll' 'The system cannot find the file specified.'
Anybody know how to solve that?
There is a list of things you need to check to solve this error. Let's start with cleaning and rebuilding the whole XNA solution, the one containing an XNA project and an XNA Content project (you have both in your project right?).

Resources