【发布时间】:2019-02-11 10:30:37
【问题描述】:
我想用 C# 编写游戏。
我使用以下代码。
using System;
using System.Runtime.InteropServices;
using SFML.Graphics;
using SFML.System;
using SFML.Window;
namespace opengl
{
static class Program
{
static void Main()
{
RenderWindow app = new RenderWindow(VideoMode.DesktopMode,"Game");
app.SetFramerateLimit(60);
while (app.IsOpen)
{
app.Clear();
drawQuad(app, Color.Green, 500, 500, 200, 500, 300, 100);
app.Display();
}
}
static void drawQuad(RenderWindow w ,Color c,int x1,int y1,int w1,int x2,int y2,int w2)
{
ConvexShape shape = new ConvexShape(4);
shape.FillColor = c;
shape.SetPoint(0, new Vector2f(x1 - w1, y1));
shape.SetPoint(1, new Vector2f(x2 - w2, y2));
shape.SetPoint(2, new Vector2f(x1 + w1, y1));
shape.SetPoint(3, new Vector2f(x2 + w2, y2));
w.Draw(shape);
}
}
}
但我面临以下错误。
System.BadImageFormatException: '无法加载文件或程序集 'sfmlnet-window-2, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null' 或其依赖项之一。试图加载格式不正确的程序。'
【问题讨论】:
-
您可能混合使用 32 位和 64 位程序集,请检查“sfmlnet-window-2”是否与调用它的应用程序架构相同
-
不,都是 64 位。
-
依赖程序集呢?不是你直接使用的,而是他们引用的。一定有某个地方引用了一些 32 位程序集。