在 Delphi Prism 中进行 XNA

发布于 2024-07-09 16:04:01 字数 330 浏览 5 评论 0原文

我已经安装了Delphi Prism和XNA Game Studio 3.0。 我已成功翻译为 Delphi Prism XNA 教程 1“在屏幕上显示 3D 模型”(http://msdn.microsoft.com/en-us/library/bb197293.aspx)。 项目编译正常,但我无法加载模型。 看起来 XNA 中有一个新的“contentproj”类型,但 Delphi Prism 中没有...... 知道如何让它发挥作用吗?

I have installed Delphi Prism and XNA Game Studio 3.0. I have managed to translate to Delphi Prism XNA Tutorial 1 "Displaying a 3D Model on the Screen" (http://msdn.microsoft.com/en-us/library/bb197293.aspx).
Project compiles fine, but I cannot load a model. It looks like there is a new "contentproj" type in XNA that is not in Delphi Prism...
Any idea how to get it to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

青丝拂面 2024-07-16 16:04:02

我还没有做过任何 XNA 的东西,但这是我最好的猜测:-)

所以,内容项目类型是标准 XNA 项目的子项目,它只是将游戏内容(纹理、声音等)编译为嵌套的编译过程,对吗?

因此,我假设项目文件或解决方案文件中必须有对子项目的引用,也许最好的方法是在 C# 或 VB 中创建一个简单的 XMA 项目并查看生成的元文件( csproj、contentproj 等)

编辑:


哦,我建议您手动创建 contentproj 文件并插入引用,一旦您知道它们是什么样子,我假设 VS 会然后允许您添加、删除您的内容等


这样就留下了 XNA 内容管道编译过程如何被触发的问题,如果它没有“恰好发生”,这可能是 marc hoffman 等人的问题

希望这会有所帮助,这只是一个猜测。

顺便说一下,很高兴在 StackOverFlow 见到你。

Rgds 蒂姆·贾维斯。

I haven't done any XNA stuff yet, but here is my best guess :-)

So, the Content Project type is a sub-project for a standard XNA project that just compiles the game content (textures, sound etc) as a nested compile process, correct?

So I would assume that there must be some reference to the sub-project in either the project file or the solution file, perhaps the best way would be to create a simple XMA proj in C# or VB and look at the generated meta-files (csproj, contentproj etc)

Edit:


Oh, I'm suggesting here that you manually create the contentproj file and insert the reference, once you know what they look like, I assume that VS will then allow you to add, delete your content etc


That then just leaves the question of how is the XNA content pipeline compile process is fired, if it doesn't "just happen" that might be a question for marc hoffman et al

Hope this helps a little, its just a guess.

Good to see you in StackOverFlow by the way.

Rgds Tim Jarvis.

零度℉ 2024-07-16 16:04:02

据我所知,Prism只是宣布,并未发布。 因此,试用版并不是最终产品。 作为 RO 客户,我希望收到一封电子邮件,但不会在发布之前发布。 坦率地说,我不知道 XNA 支持是否已经完成,甚至是否已经发挥作用。 鉴于 Prism 正式发布最快还有一个月的时间,您尝试此操作可能为时过早。

我不知道该怎么告诉您如何解决 XNA 的问题,但等待 Prism 本身是明智的做法。 在 Prism 发布之前,我认为 XNA 支持“待定”。

According to my knowledge, Prism is only announced and not released. Hence the trial is not a final product. As a RO customer I expect an email come release, but not before except for the announcement of it. Frankly, I don't know that XNA support is finalized or even working yet. You might be premature in trying this, given that the official release of Prism is still almost a month away at the soonest.

I don't know what to tell you to do to fix your problems with XNA, but it would be wise to wait for Prism itself. Until Prism is released I would consider XNA support "pending".

等待我真够勒 2024-07-16 16:04:02

System.reflection 可用于访问 XNA 的内部运作以创建 xnb 文件

method Game1.LoadContent;
var
    importer : TextureImporter;
    texContent : Texture2DContent;
    cc : ContentCompiler;
    fullPath : String;
    fs : FileStream;
    args : array[1..7] of System.Object;
    begin
    spriteBatch := new SpriteBatch(GraphicsDevice);
    importer := new TextureImporter;
    texContent := importer.Import(’asset.png’, nil) as Texture2DContent;

    var compilerType := typeOf(ContentCompiler);

    cc := compilerType.GetConstructors(BindingFlags.NonPublic or BindingFlags.Instance)[0].Invoke(nil) as ContentCompiler;

    var compileMethod := compilerType.GetMethod("Compile", BindingFlags.NonPublic or BindingFlags.Instance);

    fullPath := ‘assestName.xnb’;

    fs := File.Create(fullPath);

    args[1] := fs;
    args[2] := texContent;
    args[3] := TargetPlatform.Windows;
    args[4] := GraphicsProfile.Reach;
    args[5] := true;
    args[6] := fullPath;
    args[7] := fullPath;

    compileMethod.Invoke
    (
        cc,
        args
    );

    //SpriteTexture := Content.Load(’assetName’);
end;

System.reflection can be used to gain access to inner workings of XNA to create xnb files

method Game1.LoadContent;
var
    importer : TextureImporter;
    texContent : Texture2DContent;
    cc : ContentCompiler;
    fullPath : String;
    fs : FileStream;
    args : array[1..7] of System.Object;
    begin
    spriteBatch := new SpriteBatch(GraphicsDevice);
    importer := new TextureImporter;
    texContent := importer.Import(’asset.png’, nil) as Texture2DContent;

    var compilerType := typeOf(ContentCompiler);

    cc := compilerType.GetConstructors(BindingFlags.NonPublic or BindingFlags.Instance)[0].Invoke(nil) as ContentCompiler;

    var compileMethod := compilerType.GetMethod("Compile", BindingFlags.NonPublic or BindingFlags.Instance);

    fullPath := ‘assestName.xnb’;

    fs := File.Create(fullPath);

    args[1] := fs;
    args[2] := texContent;
    args[3] := TargetPlatform.Windows;
    args[4] := GraphicsProfile.Reach;
    args[5] := true;
    args[6] := fullPath;
    args[7] := fullPath;

    compileMethod.Invoke
    (
        cc,
        args
    );

    //SpriteTexture := Content.Load(’assetName’);
end;
︶葆Ⅱㄣ 2024-07-16 16:04:01

您可以使用 msbuild 手动构建内容项目。 它可能不具有相同的集成,您可以在解决方案资源管理器中添加内容和更改设置...但它会起作用:-)

这里有关于此的更多信息:http://blogs.msdn.com/shawnhar/archive/2006/11 /07/build-it-ahead-of-time.aspx

You could just manually build the content project using msbuild. It might not have the same integration where you can just add content and change settings in solution explorer ... but it'll do the trick :-)

here is more info about this: http://blogs.msdn.com/shawnhar/archive/2006/11/07/build-it-ahead-of-time.aspx

天赋异禀 2024-07-16 16:04:01

我终于成功地通过以下方式使其工作:1)从命令行使用 MSBuild 构建“*.contentproj”,2)将生成的“Content”目录作为输出 Delphi Prism 可执行文件的子目录。

如果 Delphi Prism 自动识别 *.contentproj 并自动构建它,那就太好了。

I have finally managed to get it to work via 1) building "*.contentproj" with MSBuild from command line, 2) coping the resulting "Content" directory as a subdirectory where my Delphi Prism executable is outputted.

It would be nice to have Delphi Prism recognizing *.contentproj automatically and build it automatically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文